about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authormark <markm@cs.wisc.edu>2021-04-27 21:15:59 -0500
committermark <markm@cs.wisc.edu>2021-04-27 21:15:59 -0500
commit2a9db919ffb30ca09a015877b6ab2ffab5633249 (patch)
tree334b473a1325e11035e265d9145baaa66e96f3fe /compiler
parent3f7b98ebe0238e3bacbeedc57c76d825eabc689c (diff)
downloadrust-2a9db919ffb30ca09a015877b6ab2ffab5633249.tar.gz
rust-2a9db919ffb30ca09a015877b6ab2ffab5633249.zip
remove pat2021
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_ast/src/token.rs13
-rw-r--r--compiler/rustc_expand/src/mbe/macro_rules.rs2
-rw-r--r--compiler/rustc_expand/src/mbe/quoted.rs16
-rw-r--r--compiler/rustc_feature/src/active.rs3
-rw-r--r--compiler/rustc_parse/src/parser/nonterminal.rs8
-rw-r--r--compiler/rustc_span/src/symbol.rs1
6 files changed, 10 insertions, 33 deletions
diff --git a/compiler/rustc_ast/src/token.rs b/compiler/rustc_ast/src/token.rs
index 3bd2d0fa324..15f46ef5d7f 100644
--- a/compiler/rustc_ast/src/token.rs
+++ b/compiler/rustc_ast/src/token.rs
@@ -693,11 +693,7 @@ pub enum NonterminalKind {
         /// edition of the span. This is used for diagnostics.
         inferred: bool,
     },
-    Pat2021 {
-        /// Keep track of whether the user used `:pat_param` or `:pat` and we inferred it from the
-        /// edition of the span. This is used for diagnostics.
-        inferred: bool,
-    },
+    PatWithOr,
     Expr,
     Ty,
     Ident,
@@ -724,10 +720,9 @@ impl NonterminalKind {
                 Edition::Edition2015 | Edition::Edition2018 => {
                     NonterminalKind::PatParam { inferred: true }
                 }
-                Edition::Edition2021 => NonterminalKind::Pat2021 { inferred: true },
+                Edition::Edition2021 => NonterminalKind::PatWithOr,
             },
             sym::pat_param => NonterminalKind::PatParam { inferred: false },
-            sym::pat2021 => NonterminalKind::Pat2021 { inferred: false },
             sym::expr => NonterminalKind::Expr,
             sym::ty => NonterminalKind::Ty,
             sym::ident => NonterminalKind::Ident,
@@ -746,9 +741,7 @@ impl NonterminalKind {
             NonterminalKind::Block => sym::block,
             NonterminalKind::Stmt => sym::stmt,
             NonterminalKind::PatParam { inferred: false } => sym::pat_param,
-            NonterminalKind::Pat2021 { inferred: false } => sym::pat2021,
-            NonterminalKind::PatParam { inferred: true }
-            | NonterminalKind::Pat2021 { inferred: true } => sym::pat,
+            NonterminalKind::PatParam { inferred: true } | NonterminalKind::PatWithOr => sym::pat,
             NonterminalKind::Expr => sym::expr,
             NonterminalKind::Ty => sym::ty,
             NonterminalKind::Ident => sym::ident,
diff --git a/compiler/rustc_expand/src/mbe/macro_rules.rs b/compiler/rustc_expand/src/mbe/macro_rules.rs
index 7a2fa3d2475..91d4a0f0d65 100644
--- a/compiler/rustc_expand/src/mbe/macro_rules.rs
+++ b/compiler/rustc_expand/src/mbe/macro_rules.rs
@@ -1116,7 +1116,7 @@ fn is_in_follow(tok: &mbe::TokenTree, kind: NonterminalKind) -> IsInFollow {
                     _ => IsInFollow::No(TOKENS),
                 }
             }
-            NonterminalKind::Pat2021 { .. } => {
+            NonterminalKind::PatWithOr { .. } => {
                 const TOKENS: &[&str] = &["`=>`", "`,`", "`=`", "`if`", "`in`"];
                 match tok {
                     TokenTree::Token(token) => match token.kind {
diff --git a/compiler/rustc_expand/src/mbe/quoted.rs b/compiler/rustc_expand/src/mbe/quoted.rs
index c3e7448b630..aca02ef93f8 100644
--- a/compiler/rustc_expand/src/mbe/quoted.rs
+++ b/compiler/rustc_expand/src/mbe/quoted.rs
@@ -6,8 +6,8 @@ use rustc_ast::tokenstream;
 use rustc_ast::{NodeId, DUMMY_NODE_ID};
 use rustc_ast_pretty::pprust;
 use rustc_feature::Features;
-use rustc_session::parse::{feature_err, ParseSess};
-use rustc_span::symbol::{kw, sym, Ident};
+use rustc_session::parse::ParseSess;
+use rustc_span::symbol::{kw, Ident};
 
 use rustc_span::Span;
 
@@ -62,18 +62,6 @@ pub(super) fn parse(
                                 Some((frag, _)) => {
                                     let span = token.span.with_lo(start_sp.lo());
 
-                                    if matches!(frag.name, sym::pat2021)
-                                        && !features.edition_macro_pats
-                                    {
-                                        feature_err(
-                                            sess,
-                                            sym::edition_macro_pats,
-                                            frag.span,
-                                            "`pat2021` is unstable.",
-                                        )
-                                        .emit();
-                                    }
-
                                     let kind =
                                         token::NonterminalKind::from_symbol(frag.name, || {
                                             span.edition()
diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs
index 774f21b2dd8..3151aa349d6 100644
--- a/compiler/rustc_feature/src/active.rs
+++ b/compiler/rustc_feature/src/active.rs
@@ -609,9 +609,6 @@ declare_features! (
     /// Allows arbitrary expressions in key-value attributes at parse time.
     (active, extended_key_value_attributes, "1.50.0", Some(78835), None),
 
-    /// `:pat2021` macro matcher.
-    (active, edition_macro_pats, "1.51.0", Some(54883), None),
-
     /// Allows const generics to have default values (e.g. `struct Foo<const N: usize = 3>(...);`).
     (active, const_generics_defaults, "1.51.0", Some(44580), None),
 
diff --git a/compiler/rustc_parse/src/parser/nonterminal.rs b/compiler/rustc_parse/src/parser/nonterminal.rs
index 5635fbbb978..0c43e304f1e 100644
--- a/compiler/rustc_parse/src/parser/nonterminal.rs
+++ b/compiler/rustc_parse/src/parser/nonterminal.rs
@@ -61,7 +61,7 @@ impl<'a> Parser<'a> {
                 },
                 _ => false,
             },
-            NonterminalKind::PatParam { .. } | NonterminalKind::Pat2021 { .. } => {
+            NonterminalKind::PatParam { .. } | NonterminalKind::PatWithOr { .. } => {
                 match token.kind {
                 token::Ident(..) |                  // box, ref, mut, and other identifiers (can stricten)
                 token::OpenDelim(token::Paren) |    // tuple pattern
@@ -76,7 +76,7 @@ impl<'a> Parser<'a> {
                 token::Lt |                         // path (UFCS constant)
                 token::BinOp(token::Shl) => true,   // path (double UFCS)
                 // leading vert `|` or-pattern
-                token::BinOp(token::Or) =>  matches!(kind, NonterminalKind::Pat2021 {..}),
+                token::BinOp(token::Or) =>  matches!(kind, NonterminalKind::PatWithOr {..}),
                 token::Interpolated(ref nt) => may_be_ident(nt),
                 _ => false,
             }
@@ -120,10 +120,10 @@ impl<'a> Parser<'a> {
                     return Err(self.struct_span_err(self.token.span, "expected a statement"));
                 }
             },
-            NonterminalKind::PatParam { .. } | NonterminalKind::Pat2021 { .. } => {
+            NonterminalKind::PatParam { .. } | NonterminalKind::PatWithOr { .. } => {
                 token::NtPat(self.collect_tokens_no_attrs(|this| match kind {
                     NonterminalKind::PatParam { .. } => this.parse_pat_no_top_alt(None),
-                    NonterminalKind::Pat2021 { .. } => {
+                    NonterminalKind::PatWithOr { .. } => {
                         this.parse_pat_allow_top_alt(None, RecoverComma::No)
                     }
                     _ => unreachable!(),
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index db0d0b9966c..a7f493569d3 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -849,7 +849,6 @@ symbols! {
         partial_ord,
         passes,
         pat,
-        pat2021,
         pat_param,
         path,
         pattern_parentheses,