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.

(cherry picked from commit 79c47278f1)
This commit is contained in:
Jieyou Xu 2026-01-02 17:27:35 +08:00 committed by Josh Stone
parent f691f9a0ec
commit feb759bb79

View file

@ -393,6 +393,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)