diff --git a/compiler/rustc_ast/src/token.rs b/compiler/rustc_ast/src/token.rs index 0b741c2cc40..bbab13221d3 100644 --- a/compiler/rustc_ast/src/token.rs +++ b/compiler/rustc_ast/src/token.rs @@ -909,7 +909,7 @@ pub fn from_symbol( }, sym::pat_param => NonterminalKind::PatParam { inferred: false }, sym::expr => NonterminalKind::Expr, - sym::expr_2021 if edition() >= Edition::Edition2024 => NonterminalKind::Expr2021, + sym::expr_2021 if edition() >= Edition::Edition2021 => NonterminalKind::Expr2021, sym::ty => NonterminalKind::Ty, sym::ident => NonterminalKind::Ident, sym::lifetime => NonterminalKind::Lifetime, diff --git a/tests/ui/macros/expr_2021_old_edition.rs b/tests/ui/macros/expr_2021_old_edition.rs index 329c5cdca33..ab7999ab373 100644 --- a/tests/ui/macros/expr_2021_old_edition.rs +++ b/tests/ui/macros/expr_2021_old_edition.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --edition=2021 +//@ compile-flags: --edition=2018 // This test ensures that expr_2021 is not allowed on pre-2024 editions