Update compiler/rustc_parse/src/parser/nonterminal.rs

Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
This commit is contained in:
Eric Holk 2024-05-17 11:27:18 -07:00 committed by Eric Holk
parent f364011955
commit 3986ea0ea5
No known key found for this signature in database
GPG Key ID: 8EA6B43ED4CE0911

View File

@ -3,7 +3,6 @@
use rustc_ast::HasTokens;
use rustc_ast_pretty::pprust;
use rustc_errors::PResult;
use rustc_span::edition::Edition;
use rustc_span::symbol::{kw, Ident};
use crate::errors::UnexpectedNonterminal;
@ -49,7 +48,7 @@ fn may_be_ident(nt: &token::Nonterminal) -> bool {
token.can_begin_expr()
// This exception is here for backwards compatibility.
&& !token.is_keyword(kw::Let)
&& (token.span.edition() >= Edition::Edition2024 || !token.is_keyword(kw::Const))
&& (token.span.edition().at_least_rust_2024() || !token.is_keyword(kw::Const))
}
NonterminalKind::Ty => token.can_begin_type(),
NonterminalKind::Ident => get_macro_ident(token).is_some(),