Skip to content

Commit

Permalink
Rollup merge of #130489 - compiler-errors:raw-lt-lint, r=jieyouxu
Browse files Browse the repository at this point in the history
Ensure that `keyword_ident` lint doesn't trigger on `'r#kw` lifetime

Fixes #130486
  • Loading branch information
matthiaskrgr authored Sep 18, 2024
2 parents 09b255d + 5de89bb commit 32c4d41
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 32c4d41

Please sign in to comment.