Skip to content

Commit e8d39b6

Browse files
committed
Revert "Add expr_2021 nonterminal and feature flag"
This reverts commit ef6478b.
1 parent e814d8b commit e8d39b6

File tree

9 files changed

+3
-41
lines changed

9 files changed

+3
-41
lines changed

compiler/rustc_ast/src/token.rs

-4
Original file line numberDiff line numberDiff line change
@@ -881,8 +881,6 @@ pub enum NonterminalKind {
881881
},
882882
PatWithOr,
883883
Expr,
884-
/// Matches an expression using the rules from edition 2021 and earlier.
885-
Expr2021,
886884
Ty,
887885
Ident,
888886
Lifetime,
@@ -912,7 +910,6 @@ impl NonterminalKind {
912910
},
913911
sym::pat_param => NonterminalKind::PatParam { inferred: false },
914912
sym::expr => NonterminalKind::Expr,
915-
sym::expr_2021 if edition() >= Edition::Edition2024 => NonterminalKind::Expr2021,
916913
sym::ty => NonterminalKind::Ty,
917914
sym::ident => NonterminalKind::Ident,
918915
sym::lifetime => NonterminalKind::Lifetime,
@@ -932,7 +929,6 @@ impl NonterminalKind {
932929
NonterminalKind::PatParam { inferred: false } => sym::pat_param,
933930
NonterminalKind::PatParam { inferred: true } | NonterminalKind::PatWithOr => sym::pat,
934931
NonterminalKind::Expr => sym::expr,
935-
NonterminalKind::Expr2021 => sym::expr_2021,
936932
NonterminalKind::Ty => sym::ty,
937933
NonterminalKind::Ident => sym::ident,
938934
NonterminalKind::Lifetime => sym::lifetime,

compiler/rustc_expand/messages.ftl

-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ expand_explain_doc_comment_inner =
4747
expand_explain_doc_comment_outer =
4848
outer doc comments expand to `#[doc = "..."]`, which is what this macro attempted to match
4949
50-
expand_expr_2021_is_experimental =
51-
expr_2021 is experimental
52-
5350
expand_expr_repeat_no_syntax_vars =
5451
attempted to repeat an expression containing no syntax variables matched as repeating at this depth
5552

compiler/rustc_expand/src/mbe/macro_rules.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ fn is_in_follow(tok: &mbe::TokenTree, kind: NonterminalKind) -> IsInFollow {
12931293
// maintain
12941294
IsInFollow::Yes
12951295
}
1296-
NonterminalKind::Stmt | NonterminalKind::Expr | NonterminalKind::Expr2021 => {
1296+
NonterminalKind::Stmt | NonterminalKind::Expr => {
12971297
const TOKENS: &[&str] = &["`=>`", "`,`", "`;`"];
12981298
match tok {
12991299
TokenTree::Token(token) => match token.kind {

compiler/rustc_expand/src/mbe/quoted.rs

-6
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,6 @@ pub(super) fn parse(
9292
token::NonterminalKind::Ident
9393
},
9494
);
95-
if kind == token::NonterminalKind::Expr2021
96-
&& !features.expr_fragment_specifier_2024
97-
{
98-
sess.dcx()
99-
.emit_err(errors::Expr2021IsExperimental { span });
100-
}
10195
result.push(TokenTree::MetaVarDecl(span, ident, Some(kind)));
10296
continue;
10397
}

compiler/rustc_feature/src/unstable.rs

-2
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,6 @@ declare_features! (
458458
(unstable, exhaustive_patterns, "1.13.0", Some(51085)),
459459
/// Allows explicit tail calls via `become` expression.
460460
(incomplete, explicit_tail_calls, "1.72.0", Some(112788)),
461-
/// Uses 2024 rules for matching `expr` fragments in macros. Also enables `expr_2021` fragment.
462-
(incomplete, expr_fragment_specifier_2024, "CURRENT_RUSTC_VERSION", Some(123742)),
463461
/// Allows using `efiapi`, `sysv64` and `win64` as calling convention
464462
/// for functions with varargs.
465463
(unstable, extended_varargs_abi_support, "1.65.0", Some(100189)),

compiler/rustc_parse/src/parser/nonterminal.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl<'a> Parser<'a> {
3636
}
3737

3838
match kind {
39-
NonterminalKind::Expr | NonterminalKind::Expr2021 => {
39+
NonterminalKind::Expr => {
4040
token.can_begin_expr()
4141
// This exception is here for backwards compatibility.
4242
&& !token.is_keyword(kw::Let)
@@ -143,9 +143,7 @@ impl<'a> Parser<'a> {
143143
})?)
144144
}
145145

146-
NonterminalKind::Expr | NonterminalKind::Expr2021 => {
147-
NtExpr(self.parse_expr_force_collect()?)
148-
}
146+
NonterminalKind::Expr => NtExpr(self.parse_expr_force_collect()?),
149147
NonterminalKind::Literal => {
150148
// The `:literal` matcher does not support attributes
151149
NtLiteral(self.collect_tokens_no_attrs(|this| this.parse_literal_maybe_minus())?)

compiler/rustc_span/src/symbol.rs

-2
Original file line numberDiff line numberDiff line change
@@ -782,8 +782,6 @@ symbols! {
782782
explicit_tail_calls,
783783
export_name,
784784
expr,
785-
expr_2021,
786-
expr_fragment_specifier_2024,
787785
extended_key_value_attributes,
788786
extended_varargs_abi_support,
789787
extern_absolute_paths,

tests/ui/macros/feature-gate-expr_fragment_specifier_2024.rs

-11
This file was deleted.

tests/ui/macros/feature-gate-expr_fragment_specifier_2024.stderr

-8
This file was deleted.

0 commit comments

Comments
 (0)