Allow naming expr_2021 in all editions

This commit is contained in:
Michael Goulet 2024-06-19 12:21:09 -04:00
parent 50d1efa3e2
commit 3e8898a4e1
8 changed files with 23 additions and 59 deletions

View file

@ -36,7 +36,7 @@ impl<'a> Parser<'a> {
}
match kind {
NonterminalKind::Expr2021 => {
NonterminalKind::Expr2021 { inferred: _ } => {
token.can_begin_expr()
// This exception is here for backwards compatibility.
&& !token.is_keyword(kw::Let)
@ -47,7 +47,6 @@ impl<'a> Parser<'a> {
token.can_begin_expr()
// This exception is here for backwards compatibility.
&& !token.is_keyword(kw::Let)
&& (!token.is_keyword(kw::Const) || token.span.edition().at_least_rust_2024())
}
NonterminalKind::Ty => token.can_begin_type(),
NonterminalKind::Ident => get_macro_ident(token).is_some(),
@ -149,7 +148,7 @@ impl<'a> Parser<'a> {
})?)
}
NonterminalKind::Expr | NonterminalKind::Expr2021 => {
NonterminalKind::Expr | NonterminalKind::Expr2021 { inferred: _ } => {
NtExpr(self.parse_expr_force_collect()?)
}
NonterminalKind::Literal => {