remove pat2021

This commit is contained in:
mark 2021-04-27 21:15:59 -05:00
parent 3f7b98ebe0
commit 2a9db919ff
14 changed files with 35 additions and 80 deletions

View file

@ -1,8 +0,0 @@
// Feature gate test for `edition_macro_pats` feature.
macro_rules! foo {
($x:pat_param) => {}; // ok
($x:pat2021) => {}; //~ERROR `pat2021` is unstable
}
fn main() {}

View file

@ -1,12 +0,0 @@
error[E0658]: `pat2021` is 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 previous error
For more information about this error, try `rustc --explain E0658`.

View file

@ -1,10 +1,9 @@
// run-pass
#![feature(edition_macro_pats)]
// edition:2021
macro_rules! foo {
(a $x:pat_param) => {};
(b $x:pat2021) => {};
(b $x:pat) => {};
}
fn main() {

View file

@ -1,6 +1,5 @@
// run-rustfix
#![feature(edition_macro_pats)]
#![deny(or_patterns_back_compat)]
#![allow(unused_macros)]
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

View file

@ -1,6 +1,5 @@
// 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

View file

@ -1,29 +1,29 @@
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 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 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: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 pat_param to preserve semantics: `$pat:pat_param`

View file

@ -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! 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:pat2021) => {} } // should be ok
macro_rules! ogg { ($x:pat2021 | $y:pat_param) => {} } //~ ERROR `$x:pat2021` is followed by `|`, which is not allowed for `pat2021` fragments
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, )+

View file

@ -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:pat_param) => {} }
| ^ 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`