Skip to content

Commit

Permalink
Revert "Add expr_2021 nonterminal and feature flag"
Browse files Browse the repository at this point in the history
This reverts commit ef6478b.
  • Loading branch information
fmease committed May 21, 2024
1 parent e814d8b commit e8d39b6
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 41 deletions.
4 changes: 0 additions & 4 deletions compiler/rustc_ast/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -881,8 +881,6 @@ pub enum NonterminalKind {
},
PatWithOr,
Expr,
/// Matches an expression using the rules from edition 2021 and earlier.
Expr2021,
Ty,
Ident,
Lifetime,
Expand Down Expand Up @@ -912,7 +910,6 @@ impl NonterminalKind {
},
sym::pat_param => NonterminalKind::PatParam { inferred: false },
sym::expr => NonterminalKind::Expr,
sym::expr_2021 if edition() >= Edition::Edition2024 => NonterminalKind::Expr2021,
sym::ty => NonterminalKind::Ty,
sym::ident => NonterminalKind::Ident,
sym::lifetime => NonterminalKind::Lifetime,
Expand All @@ -932,7 +929,6 @@ impl NonterminalKind {
NonterminalKind::PatParam { inferred: false } => sym::pat_param,
NonterminalKind::PatParam { inferred: true } | NonterminalKind::PatWithOr => sym::pat,
NonterminalKind::Expr => sym::expr,
NonterminalKind::Expr2021 => sym::expr_2021,
NonterminalKind::Ty => sym::ty,
NonterminalKind::Ident => sym::ident,
NonterminalKind::Lifetime => sym::lifetime,
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_expand/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ expand_explain_doc_comment_inner =
expand_explain_doc_comment_outer =
outer doc comments expand to `#[doc = "..."]`, which is what this macro attempted to match
expand_expr_2021_is_experimental =
expr_2021 is experimental
expand_expr_repeat_no_syntax_vars =
attempted to repeat an expression containing no syntax variables matched as repeating at this depth
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_expand/src/mbe/macro_rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,7 @@ fn is_in_follow(tok: &mbe::TokenTree, kind: NonterminalKind) -> IsInFollow {
// maintain
IsInFollow::Yes
}
NonterminalKind::Stmt | NonterminalKind::Expr | NonterminalKind::Expr2021 => {
NonterminalKind::Stmt | NonterminalKind::Expr => {
const TOKENS: &[&str] = &["`=>`", "`,`", "`;`"];
match tok {
TokenTree::Token(token) => match token.kind {
Expand Down
6 changes: 0 additions & 6 deletions compiler/rustc_expand/src/mbe/quoted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,6 @@ pub(super) fn parse(
token::NonterminalKind::Ident
},
);
if kind == token::NonterminalKind::Expr2021
&& !features.expr_fragment_specifier_2024
{
sess.dcx()
.emit_err(errors::Expr2021IsExperimental { span });
}
result.push(TokenTree::MetaVarDecl(span, ident, Some(kind)));
continue;
}
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,6 @@ declare_features! (
(unstable, exhaustive_patterns, "1.13.0", Some(51085)),
/// Allows explicit tail calls via `become` expression.
(incomplete, explicit_tail_calls, "1.72.0", Some(112788)),
/// Uses 2024 rules for matching `expr` fragments in macros. Also enables `expr_2021` fragment.
(incomplete, expr_fragment_specifier_2024, "CURRENT_RUSTC_VERSION", Some(123742)),
/// Allows using `efiapi`, `sysv64` and `win64` as calling convention
/// for functions with varargs.
(unstable, extended_varargs_abi_support, "1.65.0", Some(100189)),
Expand Down
6 changes: 2 additions & 4 deletions compiler/rustc_parse/src/parser/nonterminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl<'a> Parser<'a> {
}

match kind {
NonterminalKind::Expr | NonterminalKind::Expr2021 => {
NonterminalKind::Expr => {
token.can_begin_expr()
// This exception is here for backwards compatibility.
&& !token.is_keyword(kw::Let)
Expand Down Expand Up @@ -143,9 +143,7 @@ impl<'a> Parser<'a> {
})?)
}

NonterminalKind::Expr | NonterminalKind::Expr2021 => {
NtExpr(self.parse_expr_force_collect()?)
}
NonterminalKind::Expr => NtExpr(self.parse_expr_force_collect()?),
NonterminalKind::Literal => {
// The `:literal` matcher does not support attributes
NtLiteral(self.collect_tokens_no_attrs(|this| this.parse_literal_maybe_minus())?)
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -782,8 +782,6 @@ symbols! {
explicit_tail_calls,
export_name,
expr,
expr_2021,
expr_fragment_specifier_2024,
extended_key_value_attributes,
extended_varargs_abi_support,
extern_absolute_paths,
Expand Down
11 changes: 0 additions & 11 deletions tests/ui/macros/feature-gate-expr_fragment_specifier_2024.rs

This file was deleted.

This file was deleted.

0 comments on commit e8d39b6

Please sign in to comment.