Rollup merge of #86192 - hi-rustin:rustin-patch-lint, r=nikomatsakis
Make OR_PATTERNS_BACK_COMPAT be a 2021 future-incompatible lint close https://github.com/rust-lang/rust/issues/84869 r? `@nikomatsakis`
This commit is contained in:
commit
3ee78b38fe
4 changed files with 45 additions and 12 deletions
|
@ -3239,4 +3239,8 @@ declare_lint! {
|
|||
pub OR_PATTERNS_BACK_COMPAT,
|
||||
Allow,
|
||||
"detects usage of old versions of or-patterns",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #84869 <https://github.com/rust-lang/rust/issues/84869>",
|
||||
edition: Some(Edition::Edition2021),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,13 +2,22 @@
|
|||
|
||||
#![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
|
||||
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! foo { ($x:pat_param | $y:pat) => {} }
|
||||
//~^ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
|
||||
//~| WARN this was previously accepted
|
||||
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
|
||||
//~| WARN this was previously accepted
|
||||
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! 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
|
||||
//~| WARN this was previously accepted
|
||||
macro_rules! match_any {
|
||||
( $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
|
||||
( $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
|
||||
//~| WARN this was previously accepted
|
||||
match $expr {
|
||||
$(
|
||||
$( $pat => $expr_arm, )+
|
||||
|
|
|
@ -2,13 +2,22 @@
|
|||
|
||||
#![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! foo { ($x:pat | $y:pat) => {} }
|
||||
//~^ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
|
||||
//~| WARN this was previously accepted
|
||||
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
|
||||
//~| WARN this was previously accepted
|
||||
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! ogg { ($x:pat | $y:pat_param) => {} }
|
||||
//~^ ERROR the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
|
||||
//~| WARN this was previously accepted
|
||||
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
|
||||
( $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
|
||||
//~| WARN this was previously accepted
|
||||
match $expr {
|
||||
$(
|
||||
$( $pat => $expr_arm, )+
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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:5:21
|
||||
--> $DIR/macro-or-patterns-back-compat.rs:6:21
|
||||
|
|
||||
LL | macro_rules! foo { ($x:pat | $y:pat) => {} }
|
||||
| ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param`
|
||||
|
@ -9,24 +9,35 @@ note: the lint level is defined here
|
|||
|
|
||||
LL | #![deny(or_patterns_back_compat)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
|
||||
= note: for more information, see issue #84869 <https://github.com/rust-lang/rust/issues/84869>
|
||||
|
||||
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:23
|
||||
--> $DIR/macro-or-patterns-back-compat.rs:9:23
|
||||
|
|
||||
LL | macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} }
|
||||
| ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param`
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
|
||||
= note: for more information, see issue #84869 <https://github.com/rust-lang/rust/issues/84869>
|
||||
|
||||
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:9:21
|
||||
--> $DIR/macro-or-patterns-back-compat.rs:14:21
|
||||
|
|
||||
LL | macro_rules! ogg { ($x:pat | $y:pat_param) => {} }
|
||||
| ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param`
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
|
||||
= note: for more information, see issue #84869 <https://github.com/rust-lang/rust/issues/84869>
|
||||
|
||||
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:11:26
|
||||
--> $DIR/macro-or-patterns-back-compat.rs:18:26
|
||||
|
|
||||
LL | ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => {
|
||||
| ^^^^^^^^ help: use pat_param to preserve semantics: `$pat:pat_param`
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
|
||||
= note: for more information, see issue #84869 <https://github.com/rust-lang/rust/issues/84869>
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue