diff options
| author | Michael Goulet <michael@errs.io> | 2024-09-17 16:43:18 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-09-17 16:43:18 -0400 |
| commit | 5de89bb011fdaaf9d300cf63f97a3cf4c86d367a (patch) | |
| tree | c0969a436b6c65a77873c685fb81422eeff25ef6 | |
| parent | f609b7e0586f81fefb3523e3e17adf779ac416be (diff) | |
| download | rust-5de89bb011fdaaf9d300cf63f97a3cf4c86d367a.tar.gz rust-5de89bb011fdaaf9d300cf63f97a3cf4c86d367a.zip | |
Store raw ident span for raw lifetime
| -rw-r--r-- | compiler/rustc_parse/src/lexer/mod.rs | 3 | ||||
| -rw-r--r-- | tests/ui/rust-2024/raw-gen-lt.rs | 8 |
2 files changed, 11 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/lexer/mod.rs b/compiler/rustc_parse/src/lexer/mod.rs index b7232ff21ca..898c4779b08 100644 --- a/compiler/rustc_parse/src/lexer/mod.rs +++ b/compiler/rustc_parse/src/lexer/mod.rs @@ -299,6 +299,9 @@ impl<'psess, 'src> StringReader<'psess, 'src> { lifetime_name += lifetime_name_without_tick; let sym = Symbol::intern(&lifetime_name); + // Make sure we mark this as a raw identifier. + self.psess.raw_identifier_spans.push(self.mk_sp(start, self.pos)); + token::Lifetime(sym, IdentIsRaw::Yes) } else { // Otherwise, this should be parsed like `'r`. Warn about it though. diff --git a/tests/ui/rust-2024/raw-gen-lt.rs b/tests/ui/rust-2024/raw-gen-lt.rs new file mode 100644 index 00000000000..b2df217d1a1 --- /dev/null +++ b/tests/ui/rust-2024/raw-gen-lt.rs @@ -0,0 +1,8 @@ +//@ edition: 2021 +//@ check-pass + +#![deny(keyword_idents_2024)] + +fn foo<'r#gen>() {} + +fn main() {} |
