diff options
| author | Michael Goulet <michael@errs.io> | 2024-08-26 11:11:13 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-09-06 10:32:48 -0400 |
| commit | 9aaf873396186ea0c980cbea7d3449a355ccfeea (patch) | |
| tree | b2fac45d063823e935f66b6979f6ca21d82ba859 /compiler/rustc_parse | |
| parent | 59d4114b2d1aaac9a6dfe770997f2e79ccfd28ab (diff) | |
| download | rust-9aaf873396186ea0c980cbea7d3449a355ccfeea.tar.gz rust-9aaf873396186ea0c980cbea7d3449a355ccfeea.zip | |
Reserve prefix lifetimes too
Diffstat (limited to 'compiler/rustc_parse')
| -rw-r--r-- | compiler/rustc_parse/src/lexer/mod.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/lexer/mod.rs b/compiler/rustc_parse/src/lexer/mod.rs index f30939093c2..5d2d5a6010f 100644 --- a/compiler/rustc_parse/src/lexer/mod.rs +++ b/compiler/rustc_parse/src/lexer/mod.rs @@ -205,6 +205,16 @@ impl<'psess, 'src> StringReader<'psess, 'src> { self.report_unknown_prefix(start); self.ident(start) } + rustc_lexer::TokenKind::UnknownPrefixLifetime => { + self.report_unknown_prefix(start); + // Include the leading `'` in the real identifier, for macro + // expansion purposes. See #12512 for the gory details of why + // this is necessary. + let lifetime_name = self.str_from(start); + self.last_lifetime = Some(self.mk_sp(start, start + BytePos(1))); + let ident = Symbol::intern(lifetime_name); + token::Lifetime(ident, IdentIsRaw::No) + } rustc_lexer::TokenKind::InvalidIdent | rustc_lexer::TokenKind::InvalidPrefix // Do not recover an identifier with emoji if the codepoint is a confusable |
