Skip to content

Commit fe4d139

Browse files
committed
Removed RESERVED_RAW_IDENTIFIER and RESERVED_RAW_LIFETIME
I don't recall exactly why I added these, since the previous grammar didn't allow for them. Also `'r#_` is not reserved before edition 2021. Anyways, I don't think they are necessary because RAW_IDENTIFIER and RAW_LIFETIME now exclude `_` explicitly, and `_` is no different than the other excluded keywords like `crate`. It could be said it would be nice to document the rationale for the restrictions (#2042), but that is a bigger ask.
1 parent 3749e6d commit fe4d139

File tree

2 files changed

+0
-13
lines changed

2 files changed

+0
-13
lines changed

src/identifiers.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ RAW_IDENTIFIER -> `r#` IDENTIFIER_OR_KEYWORD _except `crate`, `self`, `super`, `
1414
NON_KEYWORD_IDENTIFIER -> IDENTIFIER_OR_KEYWORD _except a [strict][lex.keywords.strict] or [reserved][lex.keywords.reserved] keyword_
1515
1616
IDENTIFIER -> NON_KEYWORD_IDENTIFIER | RAW_IDENTIFIER
17-
18-
RESERVED_RAW_IDENTIFIER -> `r#_`
1917
```
2018

2119
<!-- When updating the version, update the UAX links, too. -->
@@ -71,9 +69,6 @@ r[ident.raw.allowed]
7169
Unlike a normal identifier, a raw identifier may be any strict or reserved
7270
keyword except the ones listed above for `RAW_IDENTIFIER`.
7371

74-
r[ident.raw.reserved]
75-
It is an error to use the [RESERVED_RAW_IDENTIFIER] token `r#_` in order to avoid confusion with the [WildcardPattern].
76-
7772
[`extern crate`]: items/extern-crates.md
7873
[`no_mangle`]: abi.md#the-no_mangle-attribute
7974
[`path` attribute]: items/modules.md#the-path-attribute

src/tokens.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -770,8 +770,6 @@ LIFETIME_OR_LABEL ->
770770
771771
RAW_LIFETIME ->
772772
`'r#` IDENTIFIER_OR_KEYWORD _except `crate`, `self`, `super`, `Self`, `_` and not immediately followed by `'`_
773-
774-
RESERVED_RAW_LIFETIME -> `'r#_` _not immediately followed by `'`_
775773
```
776774

777775
r[lex.token.life.intro]
@@ -785,9 +783,6 @@ A raw lifetime is like a normal lifetime, but its identifier is prefixed by `r#`
785783
r[lex.token.life.raw.allowed]
786784
Unlike a normal lifetime, a raw lifetime may be any strict or reserved keyword except the ones listed above for `RAW_LIFETIME`.
787785

788-
r[lex.token.life.raw.reserved]
789-
It is an error to use the RESERVED_RAW_LIFETIME token `'r#_` in order to avoid confusion with the [placeholder lifetime].
790-
791786
r[lex.token.life.raw.edition2021]
792787
> [!EDITION-2021]
793788
> Raw lifetimes are accepted in the 2021 edition or later. In earlier editions the token `'r#lt` is lexed as `'r # lt`.
@@ -930,8 +925,6 @@ RESERVED_TOKEN ->
930925
RESERVED_GUARDED_STRING_LITERAL
931926
| RESERVED_NUMBER
932927
| RESERVED_POUNDS
933-
| RESERVED_RAW_IDENTIFIER
934-
| RESERVED_RAW_LIFETIME
935928
| RESERVED_TOKEN_DOUBLE_QUOTE
936929
| RESERVED_TOKEN_LIFETIME
937930
| RESERVED_TOKEN_POUND
@@ -1058,7 +1051,6 @@ r[lex.token.reserved-guards.edition2024]
10581051
[numeric types]: types/numeric.md
10591052
[paths]: paths.md
10601053
[patterns]: patterns.md
1061-
[placeholder lifetime]: lifetime-elision.md
10621054
[question]: expressions/operator-expr.md#the-try-propagation-expression
10631055
[range]: expressions/range-expr.md
10641056
[rangepat]: patterns.md#range-patterns

0 commit comments

Comments
 (0)