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
775
775
LIFETIME_TOKEN will be accepted by the lexer, and for example, can be used in
776
776
macros.
777
777
778
+
r[lex.token.life.raw.intro]
779
+
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.)
780
+
781
+
r[lex.token.life.raw.allowed]
782
+
Unlike a normal lifetime, a raw lifetime may be any strict or reserved keyword.
783
+
784
+
> **Edition differences**: Raw lifetimes are accepted in the 2021
785
+
> 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.
@@ -869,6 +879,9 @@ Note that raw identifiers, raw string literals, and raw byte string literals may
869
879
r[lex.token.reserved-prefix.strings]
870
880
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.
871
881
882
+
r[lex.token.reserved-prefix.life]
883
+
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.
884
+
872
885
r[lex.token.reserved-prefix.edition2021]
873
886
> **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