You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/rust-2024/reserved-syntax.md
+7-4Lines changed: 7 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,11 +10,14 @@ More information may be found in the tracking issue at <https://github.com/rust-
10
10
11
11
## Details
12
12
13
-
[RFC 3593] reserved syntax in the 2024 Edition for guarded string literals that do not have a prefix to future-proof against future language changes. The 2021 Edition [reserved syntax][2021] for guarded strings with a prefix, such as `ident##"foo"##`. The 2024 Edition extends that to also reserve strings without the `ident` prefix.
13
+
[RFC 3593] reserved syntax in the 2024 Edition for guarded string literals that do not have a prefix to make room for possible future language changes. The 2021 Edition [reserved syntax][2021] for guarded strings with a prefix, such as `ident##"foo"##`. The 2024 Edition extends that to also reserve strings without the `ident` prefix.
14
14
15
-
There are two reserved syntaxes: One or more `#` immediately followed by a [string literal], and two or more `#` characters in a row.
15
+
There are two reserved syntaxes:
16
16
17
-
This reservation is done across an edition boundary because of interactions with tokenization and macros. For example, with the following macro:
17
+
- One or more `#` characters immediately followed by a [string literal].
18
+
- Two or more `#` characters in a row (not separated by whitespace).
19
+
20
+
This reservation is done across an edition boundary because of interactions with tokenization and macros. For example, consider this macro:
18
21
19
22
```rust
20
23
macro_rules!demo {
@@ -45,7 +48,7 @@ Starting in the 2024 Edition, the `#"foo"#` line and the `###` line now generate
45
48
46
49
## Migration
47
50
48
-
The [`rust_2024_guarded_string_incompatible_syntax`] lint will identify any tokens that match the reserved syntax, and will suggest a modification to insert spaces where necessary to ensure it continues to be parsed as separate tokens.
51
+
The [`rust_2024_guarded_string_incompatible_syntax`] lint will identify any tokens that match the reserved syntax, and will suggest a modification to insert spaces where necessary to ensure the tokens continue to be parsed separately.
49
52
50
53
The lint is part of the `rust-2024-compatibility` lint group which is included in the automatic edition migration. In order to migrate your code to be Rust 2024 Edition compatible, run:
0 commit comments