Skip to content

Commit

Permalink
Store raw ident span for raw lifetime
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Sep 17, 2024
1 parent f609b7e commit 5de89bb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions compiler/rustc_parse/src/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 8 additions & 0 deletions tests/ui/rust-2024/raw-gen-lt.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//@ edition: 2021
//@ check-pass

#![deny(keyword_idents_2024)]

fn foo<'r#gen>() {}

fn main() {}

0 comments on commit 5de89bb

Please sign in to comment.