diff options
| author | trevyn <230691+trevyn@users.noreply.github.com> | 2024-07-11 12:12:00 +0400 |
|---|---|---|
| committer | trevyn <230691+trevyn@users.noreply.github.com> | 2024-07-11 12:12:00 +0400 |
| commit | a01f49e7f32b39b77f6a5804c1ed12aadaa89ec5 (patch) | |
| tree | 7d3ecfbca94228f9e6f19e14692cdf75a1e2ada5 /compiler/rustc_parse/src/parser | |
| parent | 8c39ac9eccdfaeff11bd3b6107817a81fe0a3a43 (diff) | |
| download | rust-a01f49e7f32b39b77f6a5804c1ed12aadaa89ec5.tar.gz rust-a01f49e7f32b39b77f6a5804c1ed12aadaa89ec5.zip | |
check is_ident before parse_ident
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/item.rs | 4 |
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, |
