about summary refs log tree commit diff
diff options
context:
space:
mode:
authormark <markm@cs.wisc.edu>2021-03-22 13:53:16 -0500
committermark <markm@cs.wisc.edu>2021-04-15 13:52:09 -0500
commitebc4acee91dc9871d1c90f0d7a38aff0580dd18a (patch)
tree4dbf786f7459fca087a6834714b0fe2c406c36d2
parent2962e7c0089d5c136f4e9600b7abccfbbde4973d (diff)
downloadrust-ebc4acee91dc9871d1c90f0d7a38aff0580dd18a.tar.gz
rust-ebc4acee91dc9871d1c90f0d7a38aff0580dd18a.zip
stabilize :pat2015, leave :pat2021 gated
-rw-r--r--compiler/rustc_expand/src/mbe/quoted.rs23
-rw-r--r--compiler/rustc_feature/src/active.rs2
-rw-r--r--src/test/ui/feature-gates/feature-gate-edition_macro_pats.rs4
-rw-r--r--src/test/ui/feature-gates/feature-gate-edition_macro_pats.stderr13
4 files changed, 15 insertions, 27 deletions
diff --git a/compiler/rustc_expand/src/mbe/quoted.rs b/compiler/rustc_expand/src/mbe/quoted.rs
index e205cb65d02..c3e7448b630 100644
--- a/compiler/rustc_expand/src/mbe/quoted.rs
+++ b/compiler/rustc_expand/src/mbe/quoted.rs
@@ -62,19 +62,16 @@ pub(super) fn parse(
                                 Some((frag, _)) => {
                                     let span = token.span.with_lo(start_sp.lo());
 
-                                    match frag.name {
-                                        sym::pat2015 | sym::pat2021 => {
-                                            if !features.edition_macro_pats {
-                                                feature_err(
-                                                    sess,
-                                                    sym::edition_macro_pats,
-                                                    frag.span,
-                                                    "`pat2015` and `pat2021` are unstable.",
-                                                )
-                                                .emit();
-                                            }
-                                        }
-                                        _ => {}
+                                    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 =
diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs
index 1a91eb600a9..774f21b2dd8 100644
--- a/compiler/rustc_feature/src/active.rs
+++ b/compiler/rustc_feature/src/active.rs
@@ -609,7 +609,7 @@ declare_features! (
     /// Allows arbitrary expressions in key-value attributes at parse time.
     (active, extended_key_value_attributes, "1.50.0", Some(78835), None),
 
-    /// `:pat2015` and `:pat2021` macro matchers.
+    /// `: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>(...);`).
diff --git a/src/test/ui/feature-gates/feature-gate-edition_macro_pats.rs b/src/test/ui/feature-gates/feature-gate-edition_macro_pats.rs
index 430a9437cee..e9f813f83ae 100644
--- a/src/test/ui/feature-gates/feature-gate-edition_macro_pats.rs
+++ b/src/test/ui/feature-gates/feature-gate-edition_macro_pats.rs
@@ -1,8 +1,8 @@
 // Feature gate test for `edition_macro_pats` feature.
 
 macro_rules! foo {
-    ($x:pat2015) => {}; //~ERROR `pat2015` and `pat2021` are unstable
-    ($x:pat2021) => {}; //~ERROR `pat2015` and `pat2021` are unstable
+    ($x:pat2015) => {}; // ok
+    ($x:pat2021) => {}; //~ERROR `pat2021` is unstable
 }
 
 fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-edition_macro_pats.stderr b/src/test/ui/feature-gates/feature-gate-edition_macro_pats.stderr
index d25bcaf929b..dc1f52d87a8 100644
--- a/src/test/ui/feature-gates/feature-gate-edition_macro_pats.stderr
+++ b/src/test/ui/feature-gates/feature-gate-edition_macro_pats.stderr
@@ -1,13 +1,4 @@
-error[E0658]: `pat2015` and `pat2021` are unstable.
-  --> $DIR/feature-gate-edition_macro_pats.rs:4:9
-   |
-LL |     ($x:pat2015) => {};
-   |         ^^^^^^^
-   |
-   = note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
-   = help: add `#![feature(edition_macro_pats)]` to the crate attributes to enable
-
-error[E0658]: `pat2015` and `pat2021` are unstable.
+error[E0658]: `pat2021` is unstable.
   --> $DIR/feature-gate-edition_macro_pats.rs:5:9
    |
 LL |     ($x:pat2021) => {};
@@ -16,6 +7,6 @@ LL |     ($x:pat2021) => {};
    = note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
    = help: add `#![feature(edition_macro_pats)]` to the crate attributes to enable
 
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0658`.