about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-07-11 17:01:40 +0200
committerGitHub <noreply@github.com>2024-07-11 17:01:40 +0200
commitd433f176ef158f8955a8969c123ae20b614d6286 (patch)
tree2e4ed27e22c1b2d40f07c356f8ebd14388a436a2 /compiler/rustc_parse/src/parser
parent47ab86653e916041a3653118e44b716f23dfe3eb (diff)
parenta01f49e7f32b39b77f6a5804c1ed12aadaa89ec5 (diff)
downloadrust-d433f176ef158f8955a8969c123ae20b614d6286.tar.gz
rust-d433f176ef158f8955a8969c123ae20b614d6286.zip
Rollup merge of #127601 - trevyn:issue-127600, r=compiler-errors
check is_ident before parse_ident

Closes #127600
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/item.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs
index f31e634f55c..2c98feeece7 100644
--- a/compiler/rustc_parse/src/parser/item.rs
+++ b/compiler/rustc_parse/src/parser/item.rs
@@ -387,8 +387,8 @@ impl<'a> Parser<'a> {
         let span = if is_pub { self.prev_token.span.to(ident_span) } else { ident_span };
         let insert_span = ident_span.shrink_to_lo();
 
-        let ident = if (!is_const
-            || self.look_ahead(1, |t| *t == token::OpenDelim(Delimiter::Parenthesis)))
+        let ident = if self.token.is_ident()
+            && (!is_const || self.look_ahead(1, |t| *t == token::OpenDelim(Delimiter::Parenthesis)))
             && self.look_ahead(1, |t| {
                 [
                     token::Lt,