about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-04-28 20:35:17 +0000
committerbors <bors@rust-lang.org>2021-04-28 20:35:17 +0000
commitca075d268d2ce315964e1dd195cfe837b8a53f4d (patch)
tree4129a237b61f9a4e21394269c0381274e5d1e216 /src
parentda43ee8d821999bf92d9ce8c81f8979ecea2c80d (diff)
parent2a9db919ffb30ca09a015877b6ab2ffab5633249 (diff)
downloadrust-ca075d268d2ce315964e1dd195cfe837b8a53f4d.tar.gz
rust-ca075d268d2ce315964e1dd195cfe837b8a53f4d.zip
Auto merge of #83386 - mark-i-m:stabilize-pat2015, r=nikomatsakis
Stabilize `:pat_param` and remove `:pat2021`

Blocked on #83384

cc `@rust-lang/lang` #79278

If I understand `@nikomatsakis` in  https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/or.20patterns/near/231133873, another FCP is not needed.

r? `@nikomatsakis`
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/feature-gates/feature-gate-edition_macro_pats.rs8
-rw-r--r--src/test/ui/feature-gates/feature-gate-edition_macro_pats.stderr21
-rw-r--r--src/test/ui/macros/edition-macro-pats.rs7
-rw-r--r--src/test/ui/macros/macro-or-patterns-back-compat.fixed13
-rw-r--r--src/test/ui/macros/macro-or-patterns-back-compat.rs7
-rw-r--r--src/test/ui/macros/macro-or-patterns-back-compat.stderr20
-rw-r--r--src/test/ui/macros/macro-pat2021-pattern-followed-by-or.rs13
-rw-r--r--src/test/ui/macros/macro-pat2021-pattern-followed-by-or.stderr24
8 files changed, 41 insertions, 72 deletions
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
deleted file mode 100644
index 430a9437cee..00000000000
--- a/src/test/ui/feature-gates/feature-gate-edition_macro_pats.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// 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
-}
-
-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
deleted file mode 100644
index d25bcaf929b..00000000000
--- a/src/test/ui/feature-gates/feature-gate-edition_macro_pats.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-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.
-  --> $DIR/feature-gate-edition_macro_pats.rs:5:9
-   |
-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
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/macros/edition-macro-pats.rs b/src/test/ui/macros/edition-macro-pats.rs
index 58f92710305..040894712a8 100644
--- a/src/test/ui/macros/edition-macro-pats.rs
+++ b/src/test/ui/macros/edition-macro-pats.rs
@@ -1,10 +1,9 @@
 // run-pass
-
-#![feature(edition_macro_pats)]
+// edition:2021
 
 macro_rules! foo {
-    (a $x:pat2015) => {};
-    (b $x:pat2021) => {};
+    (a $x:pat_param) => {};
+    (b $x:pat) => {};
 }
 
 fn main() {
diff --git a/src/test/ui/macros/macro-or-patterns-back-compat.fixed b/src/test/ui/macros/macro-or-patterns-back-compat.fixed
index f089f0fda4e..f829129d516 100644
--- a/src/test/ui/macros/macro-or-patterns-back-compat.fixed
+++ b/src/test/ui/macros/macro-or-patterns-back-compat.fixed
@@ -1,15 +1,14 @@
 // run-rustfix
 
-#![feature(edition_macro_pats)]
 #![deny(or_patterns_back_compat)]
 #![allow(unused_macros)]
-macro_rules! foo { ($x:pat2015 | $y:pat) => {} } //~ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
-macro_rules! bar { ($($x:pat2015)+ | $($y:pat)+) => {} } //~ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
-macro_rules! baz { ($x:pat2015 | $y:pat2015) => {} } // should be ok
-macro_rules! qux { ($x:pat2015 | $y:pat) => {} } // should be ok
-macro_rules! ogg { ($x:pat2015 | $y:pat2015) => {} } //~ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
+macro_rules! foo { ($x:pat_param | $y:pat) => {} } //~ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
+macro_rules! bar { ($($x:pat_param)+ | $($y:pat)+) => {} } //~ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
+macro_rules! baz { ($x:pat_param | $y:pat_param) => {} } // should be ok
+macro_rules! qux { ($x:pat_param | $y:pat) => {} } // should be ok
+macro_rules! ogg { ($x:pat_param | $y:pat_param) => {} } //~ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
 macro_rules! match_any {
-    ( $expr:expr , $( $( $pat:pat2015 )|+ => $expr_arm:expr ),+ ) => { //~ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
+    ( $expr:expr , $( $( $pat:pat_param )|+ => $expr_arm:expr ),+ ) => { //~ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
         match $expr {
             $(
                 $( $pat => $expr_arm, )+
diff --git a/src/test/ui/macros/macro-or-patterns-back-compat.rs b/src/test/ui/macros/macro-or-patterns-back-compat.rs
index 0252581d5f1..1cdaa1cd631 100644
--- a/src/test/ui/macros/macro-or-patterns-back-compat.rs
+++ b/src/test/ui/macros/macro-or-patterns-back-compat.rs
@@ -1,13 +1,12 @@
 // run-rustfix
 
-#![feature(edition_macro_pats)]
 #![deny(or_patterns_back_compat)]
 #![allow(unused_macros)]
 macro_rules! foo { ($x:pat | $y:pat) => {} } //~ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
 macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} } //~ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
-macro_rules! baz { ($x:pat2015 | $y:pat2015) => {} } // should be ok
-macro_rules! qux { ($x:pat2015 | $y:pat) => {} } // should be ok
-macro_rules! ogg { ($x:pat | $y:pat2015) => {} } //~ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
+macro_rules! baz { ($x:pat_param | $y:pat_param) => {} } // should be ok
+macro_rules! qux { ($x:pat_param | $y:pat) => {} } // should be ok
+macro_rules! ogg { ($x:pat | $y:pat_param) => {} } //~ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
 macro_rules! match_any {
     ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => { //~ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
         match $expr {
diff --git a/src/test/ui/macros/macro-or-patterns-back-compat.stderr b/src/test/ui/macros/macro-or-patterns-back-compat.stderr
index d8f19fa5807..01d220dd0b1 100644
--- a/src/test/ui/macros/macro-or-patterns-back-compat.stderr
+++ b/src/test/ui/macros/macro-or-patterns-back-compat.stderr
@@ -1,32 +1,32 @@
 error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
-  --> $DIR/macro-or-patterns-back-compat.rs:6:21
+  --> $DIR/macro-or-patterns-back-compat.rs:5:21
    |
 LL | macro_rules! foo { ($x:pat | $y:pat) => {} }
-   |                     ^^^^^^ help: use pat2015 to preserve semantics: `$x:pat2015`
+   |                     ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param`
    |
 note: the lint level is defined here
-  --> $DIR/macro-or-patterns-back-compat.rs:4:9
+  --> $DIR/macro-or-patterns-back-compat.rs:3:9
    |
 LL | #![deny(or_patterns_back_compat)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^
 
 error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
-  --> $DIR/macro-or-patterns-back-compat.rs:7:23
+  --> $DIR/macro-or-patterns-back-compat.rs:6:23
    |
 LL | macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} }
-   |                       ^^^^^^ help: use pat2015 to preserve semantics: `$x:pat2015`
+   |                       ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param`
 
 error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
-  --> $DIR/macro-or-patterns-back-compat.rs:10:21
+  --> $DIR/macro-or-patterns-back-compat.rs:9:21
    |
-LL | macro_rules! ogg { ($x:pat | $y:pat2015) => {} }
-   |                     ^^^^^^ help: use pat2015 to preserve semantics: `$x:pat2015`
+LL | macro_rules! ogg { ($x:pat | $y:pat_param) => {} }
+   |                     ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param`
 
 error: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
-  --> $DIR/macro-or-patterns-back-compat.rs:12:26
+  --> $DIR/macro-or-patterns-back-compat.rs:11:26
    |
 LL |     ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => {
-   |                          ^^^^^^^^ help: use pat2015 to preserve semantics: `$pat:pat2015`
+   |                          ^^^^^^^^ help: use pat_param to preserve semantics: `$pat:pat_param`
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/macros/macro-pat2021-pattern-followed-by-or.rs b/src/test/ui/macros/macro-pat2021-pattern-followed-by-or.rs
index edd3f3e7646..b4be03aaddd 100644
--- a/src/test/ui/macros/macro-pat2021-pattern-followed-by-or.rs
+++ b/src/test/ui/macros/macro-pat2021-pattern-followed-by-or.rs
@@ -1,11 +1,12 @@
-#![feature(edition_macro_pats)]
+// edition:2021
+
 #![allow(unused_macros)]
-macro_rules! foo { ($x:pat2021 | $y:pat2021) => {} } //~ ERROR `$x:pat2021` is followed by `|`, which is not allowed for `pat2021` fragments
-macro_rules! baz { ($x:pat2015 | $y:pat2015) => {} } // should be ok
-macro_rules! qux { ($x:pat2015 | $y:pat2021) => {} } // should be ok
-macro_rules! ogg { ($x:pat2021 | $y:pat2015) => {} } //~ ERROR `$x:pat2021` is followed by `|`, which is not allowed for `pat2021` fragments
+macro_rules! foo { ($x:pat | $y:pat) => {} } //~ ERROR `$x:pat` is followed by `|`, which is not allowed for `pat` fragments
+macro_rules! baz { ($x:pat_param | $y:pat_param) => {} } // should be ok
+macro_rules! qux { ($x:pat_param | $y:pat) => {} } // should be ok
+macro_rules! ogg { ($x:pat | $y:pat_param) => {} } //~ ERROR `$x:pat` is followed by `|`, which is not allowed for `pat` fragments
 macro_rules! match_any {
-    ( $expr:expr , $( $( $pat:pat2021 )|+ => $expr_arm:pat2021 ),+ ) => { //~ ERROR  `$pat:pat2021` may be followed by `|`, which is not allowed for `pat2021` fragments
+    ( $expr:expr , $( $( $pat:pat)|+ => $expr_arm:pat),+ ) => { //~ ERROR  `$pat:pat` may be followed by `|`, which is not allowed for `pat` fragments
         match $expr {
             $(
                 $( $pat => $expr_arm, )+
diff --git a/src/test/ui/macros/macro-pat2021-pattern-followed-by-or.stderr b/src/test/ui/macros/macro-pat2021-pattern-followed-by-or.stderr
index fe0b40cd86e..8aebe98515f 100644
--- a/src/test/ui/macros/macro-pat2021-pattern-followed-by-or.stderr
+++ b/src/test/ui/macros/macro-pat2021-pattern-followed-by-or.stderr
@@ -1,24 +1,24 @@
-error: `$x:pat2021` is followed by `|`, which is not allowed for `pat2021` fragments
-  --> $DIR/macro-pat2021-pattern-followed-by-or.rs:3:32
+error: `$x:pat` is followed by `|`, which is not allowed for `pat` fragments
+  --> $DIR/macro-pat2021-pattern-followed-by-or.rs:4:28
    |
-LL | macro_rules! foo { ($x:pat2021 | $y:pat2021) => {} }
-   |                                ^ not allowed after `pat2021` fragments
+LL | macro_rules! foo { ($x:pat | $y:pat) => {} }
+   |                            ^ not allowed after `pat` fragments
    |
    = note: allowed there are: `=>`, `,`, `=`, `if` or `in`
 
-error: `$x:pat2021` is followed by `|`, which is not allowed for `pat2021` fragments
-  --> $DIR/macro-pat2021-pattern-followed-by-or.rs:6:32
+error: `$x:pat` is followed by `|`, which is not allowed for `pat` fragments
+  --> $DIR/macro-pat2021-pattern-followed-by-or.rs:7:28
    |
-LL | macro_rules! ogg { ($x:pat2021 | $y:pat2015) => {} }
-   |                                ^ not allowed after `pat2021` fragments
+LL | macro_rules! ogg { ($x:pat | $y:pat_param) => {} }
+   |                            ^ not allowed after `pat` fragments
    |
    = note: allowed there are: `=>`, `,`, `=`, `if` or `in`
 
-error: `$pat:pat2021` may be followed by `|`, which is not allowed for `pat2021` fragments
-  --> $DIR/macro-pat2021-pattern-followed-by-or.rs:8:40
+error: `$pat:pat` may be followed by `|`, which is not allowed for `pat` fragments
+  --> $DIR/macro-pat2021-pattern-followed-by-or.rs:9:35
    |
-LL |     ( $expr:expr , $( $( $pat:pat2021 )|+ => $expr_arm:pat2021 ),+ ) => {
-   |                                        ^ not allowed after `pat2021` fragments
+LL |     ( $expr:expr , $( $( $pat:pat)|+ => $expr_arm:pat),+ ) => {
+   |                                   ^ not allowed after `pat` fragments
    |
    = note: allowed there are: `=>`, `,`, `=`, `if` or `in`