Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 26d84db

Browse files
committed
Revert "Macros: match const { ... } with expr nonterminal in edition 2024"
This reverts commit a55d063.
1 parent 56840d9 commit 26d84db

File tree

4 files changed

+1
-80
lines changed

4 files changed

+1
-80
lines changed

compiler/rustc_parse/src/parser/nonterminal.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use rustc_ast::HasTokens;
44
use rustc_ast_pretty::pprust;
55
use rustc_data_structures::sync::Lrc;
66
use rustc_errors::PResult;
7-
use rustc_span::edition::Edition;
87
use rustc_span::symbol::{kw, Ident};
98

109
use crate::errors::UnexpectedNonterminal;
@@ -37,19 +36,13 @@ impl<'a> Parser<'a> {
3736
}
3837

3938
match kind {
40-
NonterminalKind::Expr2021 => {
39+
NonterminalKind::Expr | NonterminalKind::Expr2021 => {
4140
token.can_begin_expr()
4241
// This exception is here for backwards compatibility.
4342
&& !token.is_keyword(kw::Let)
4443
// This exception is here for backwards compatibility.
4544
&& !token.is_keyword(kw::Const)
4645
}
47-
NonterminalKind::Expr => {
48-
token.can_begin_expr()
49-
// This exception is here for backwards compatibility.
50-
&& !token.is_keyword(kw::Let)
51-
&& (token.span.edition() >= Edition::Edition2024 || !token.is_keyword(kw::Const))
52-
}
5346
NonterminalKind::Ty => token.can_begin_type(),
5447
NonterminalKind::Ident => get_macro_ident(token).is_some(),
5548
NonterminalKind::Literal => token.can_begin_literal_maybe_minus(),

tests/ui/macros/expr_2021_inline_const.edi2021.stderr

Lines changed: 0 additions & 32 deletions
This file was deleted.

tests/ui/macros/expr_2021_inline_const.edi2024.stderr

Lines changed: 0 additions & 17 deletions
This file was deleted.

tests/ui/macros/expr_2021_inline_const.rs

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)