Add Ident::is_non_reserved_ident

This commit is contained in:
Michael Goulet
2025-06-26 17:53:01 +00:00
parent 3b9d04c62f
commit 94e9973b92
7 changed files with 14 additions and 15 deletions

View File

@@ -2731,7 +2731,7 @@ impl<'a> Parser<'a> {
return first_pat;
}
if !matches!(first_pat.kind, PatKind::Ident(_, _, None) | PatKind::Path(..))
|| !self.look_ahead(1, |token| token.is_ident() && !token.is_reserved_ident())
|| !self.look_ahead(1, |token| token.is_non_reserved_ident())
{
let mut snapshot_type = self.create_snapshot_for_diagnostic();
snapshot_type.bump(); // `:`