Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Rustin170506 committed Apr 2, 2021
1 parent 2c66e15 commit aa987c2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_expand/src/mbe/macro_rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ fn check_matcher_core(
&OR_PATTERNS_BACK_COMPAT,
span,
ast::CRATE_NODE_ID,
&*format!("the meaning of the pat fragment specific is changing in Rust 2021, which may affect this macro",),
&*format!("the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro",),
BuiltinLintDiagnostics::OrPatternsBackCompat(
span, suggestion,
),
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/macros/macro-or-patterns-back-compat.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
#![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 specific is changing in Rust 2021, which may affect this macro
macro_rules! bar { ($($x:pat2015)+ | $($y:pat)+) => {} } //~ ERROR the meaning of the pat fragment specific is changing in Rust 2021, which may affect this macro
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 specific is changing in Rust 2021, which may affect this macro
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! match_any {
( $expr:expr , $( $( $pat:pat2015 )|+ => $expr_arm:expr ),+ ) => { //~ ERROR the meaning of the pat fragment specific is changing in Rust 2021, which may affect this macro
( $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
match $expr {
$(
$( $pat => $expr_arm, )+
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/macros/macro-or-patterns-back-compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
#![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 specific is changing in Rust 2021, which may affect this macro
macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} } //~ ERROR the meaning of the pat fragment specific 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
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 specific is changing in Rust 2021, which may affect this macro
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! match_any {
( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => { //~ ERROR the meaning of the pat fragment specific 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
match $expr {
$(
$( $pat => $expr_arm, )+
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/macros/macro-or-patterns-back-compat.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: the meaning of the pat fragment specific is changing in Rust 2021, which may affect this macro
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:21
|
LL | macro_rules! foo { ($x:pat | $y:pat) => {} }
Expand All @@ -10,19 +10,19 @@ note: the lint level is defined here
LL | #![deny(or_patterns_back_compat)]
| ^^^^^^^^^^^^^^^^^^^^^^^

error: the meaning of the pat fragment specific is changing in Rust 2021, which may affect this macro
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:8:23
|
LL | macro_rules! bar { ($($x:pat)+ | $($y:pat)+) => {} }
| ^^^^^^ help: use pat2015 to preserve semantics: `$x:pat2015`

error: the meaning of the pat fragment specific is changing in Rust 2021, which may affect this macro
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:21
|
LL | macro_rules! ogg { ($x:pat | $y:pat2015) => {} }
| ^^^^^^ help: use pat2015 to preserve semantics: `$x:pat2015`

error: the meaning of the pat fragment specific is changing in Rust 2021, which may affect this macro
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:13:26
|
LL | ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => {
Expand Down

0 comments on commit aa987c2

Please sign in to comment.