Don't try to recover keyword as non-keyword identifier

There's no sensible recovery scheme here, giving up the recovery is the
right thing to do.
This commit is contained in:
Jieyou Xu 2026-01-02 17:27:35 +08:00
parent 31531b3665
commit 79c47278f1
No known key found for this signature in database
GPG key ID: 045B995028EA6AFC

View file

@ -408,6 +408,7 @@ impl<'a> Parser<'a> {
let insert_span = ident_span.shrink_to_lo();
let ident = if self.token.is_ident()
&& self.token.is_non_reserved_ident()
&& (!is_const || self.look_ahead(1, |t| *t == token::OpenParen))
&& self.look_ahead(1, |t| {
matches!(t.kind, token::Lt | token::OpenBrace | token::OpenParen)