|
2 | 2 |
|
3 | 3 | ## Summary
|
4 | 4 |
|
5 |
| -- `any_identifier#`, `any_identifier"..."`, and `any_identifier'...'` are now reserved |
6 |
| - syntax, and no longer tokenize. |
| 5 | +- `any_identifier#`, `any_identifier"..."`, `any_identifier'...'`, and `'any_identifier#` are now reserved syntax, and no longer tokenize. |
7 | 6 | - This is mostly relevant to macros. E.g. `quote!{ #a#b }` is no longer accepted.
|
8 | 7 | - It doesn't treat keywords specially, so e.g. `match"..." {}` is no longer accepted.
|
9 | 8 | - Insert whitespace between the identifier and the subsequent `#`, `"`, or `'`
|
|
13 | 12 | ## Details
|
14 | 13 |
|
15 | 14 | To make space for new syntax in the future,
|
16 |
| -we've decided to reserve syntax for prefixed identifiers and literals: |
17 |
| -`prefix#identifier`, `prefix"string"`, `prefix'c'`, and `prefix#123`, |
| 15 | +we've decided to reserve syntax for prefixed identifiers, literals, and lifetimes: |
| 16 | +`prefix#identifier`, `prefix"string"`, `prefix'c'`, `prefix#123`, and `'prefix#`, |
18 | 17 | where `prefix` can be any identifier.
|
19 | 18 | (Except those prefixes that already have a meaning, such as `b'...'` (byte
|
20 | 19 | chars) and `r"..."` (raw strings).)
|
@@ -52,7 +51,7 @@ committed to any of them yet):
|
52 | 51 |
|
53 | 52 | ## Migration
|
54 | 53 |
|
55 |
| -As a part of the 2021 edition a migration lint, `rust_2021_prefixes_incompatible_syntax`, has been added in order to aid in automatic migration of Rust 2018 codebases to Rust 2021. |
| 54 | +As a part of the 2021 edition a migration lint, [`rust_2021_prefixes_incompatible_syntax`], has been added in order to aid in automatic migration of Rust 2018 codebases to Rust 2021. |
56 | 55 |
|
57 | 56 | In order to migrate your code to be Rust 2021 Edition compatible, run:
|
58 | 57 |
|
@@ -81,3 +80,5 @@ This `z` prefix is no longer allowed in Rust 2021, so in order to call this macr
|
81 | 80 | ```rust,ignore
|
82 | 81 | my_macro!(z "hey");
|
83 | 82 | ```
|
| 83 | + |
| 84 | +[`rust_2021_prefixes_incompatible_syntax`]: ../../rustc/lints/listing/allowed-by-default.html#rust-2021-prefixes-incompatible-syntax |
0 commit comments