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
Lifetime parameters and [loop labels] use LIFETIME_OR_LABEL tokens. Any
777
777
LIFETIME_TOKEN will be accepted by the lexer, and for example, can be used in
778
778
macros.
779
779
780
+
r[lex.token.life.raw.intro]
781
+
A raw lifetime is like a normal lifetime, but its identifier is prefixed by `r#`. (Note that the `r#` prefix is not included as part of the actual lifetime.)
782
+
783
+
r[lex.token.life.raw.allowed]
784
+
Unlike a normal lifetime, a raw lifetime may be any strict or reserved keyword.
785
+
786
+
> **Edition differences**: Raw lifetimes are accepted in the 2021
787
+
> edition or later. In earlier additions the token `'r#lt` is lexed as `'r # lt`.
Some lexical forms known as _reserved prefixes_ are reserved for future use.
@@ -871,6 +881,9 @@ Note that raw identifiers, raw string literals, and raw byte string literals may
871
881
r[lex.token.reserved-prefix.strings]
872
882
Similarly the `r`, `b`, `br`, `c`, and `cr` prefixes used in raw string literals, byte literals, byte string literals, raw byte string literals, C string literals, and raw C string literals are not interpreted as reserved prefixes.
873
883
884
+
r[lex.token.reserved-prefix.life]
885
+
Source input which would otherwise be lexically interpreted as a non-raw lifetime (or a keyword or `_`) which is immediately followed by a `#` character (without intervening whitespace) is identified as a reserved lifetime prefix.
886
+
874
887
r[lex.token.reserved-prefix.edition2021]
875
888
> **Edition differences**: Starting with the 2021 edition, reserved prefixes are reported as an error by the lexer (in particular, they cannot be passed to macros).
0 commit comments