diff options
| author | Mark Mansi <markm@cs.wisc.edu> | 2019-03-28 12:36:13 -0500 |
|---|---|---|
| committer | Mark Mansi <markm@cs.wisc.edu> | 2019-04-10 21:29:17 -0500 |
| commit | d7f5c50a335204e00565c978f5eb7fac40468f96 (patch) | |
| tree | 15d27ac1f1f231c95a2af63e82bd82fca50a4953 /src/test | |
| parent | 96d700f1b7bc9c53fa0d11567adb1ed2c1c27e79 (diff) | |
| download | rust-d7f5c50a335204e00565c978f5eb7fac40468f96.tar.gz rust-d7f5c50a335204e00565c978f5eb7fac40468f96.zip | |
make duplicate matcher bindings a hard error
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/macros/macro-multiple-matcher-bindings.rs | 12 | ||||
| -rw-r--r-- | src/test/ui/macros/macro-multiple-matcher-bindings.stderr | 57 |
2 files changed, 37 insertions, 32 deletions
diff --git a/src/test/ui/macros/macro-multiple-matcher-bindings.rs b/src/test/ui/macros/macro-multiple-matcher-bindings.rs index 23d566780c8..f31af2365ff 100644 --- a/src/test/ui/macros/macro-multiple-matcher-bindings.rs +++ b/src/test/ui/macros/macro-multiple-matcher-bindings.rs @@ -1,16 +1,12 @@ // Test that duplicate matcher binding names are caught at declaration time, rather than at macro // invocation time. -// -// FIXME(mark-i-m): Update this when it becomes a hard error. - -// compile-pass #![allow(unused_macros)] #![warn(duplicate_matcher_binding_name)] macro_rules! foo1 { - ($a:ident, $a:ident) => {}; //~WARNING duplicate matcher binding - ($a:ident, $a:path) => {}; //~WARNING duplicate matcher binding + ($a:ident, $a:ident) => {}; //~ERROR duplicate matcher binding + ($a:ident, $a:path) => {}; //~ERROR duplicate matcher binding } macro_rules! foo2 { @@ -19,8 +15,8 @@ macro_rules! foo2 { } macro_rules! foo3 { - ($a:ident, $($a:ident),*) => {}; //~WARNING duplicate matcher binding - ($($a:ident)+ # $($($a:path),+);*) => {}; //~WARNING duplicate matcher binding + ($a:ident, $($a:ident),*) => {}; //~ERROR duplicate matcher binding + ($($a:ident)+ # $($($a:path),+);*) => {}; //~ERROR duplicate matcher binding } fn main() {} diff --git a/src/test/ui/macros/macro-multiple-matcher-bindings.stderr b/src/test/ui/macros/macro-multiple-matcher-bindings.stderr index f7970dbd2eb..65362388d7d 100644 --- a/src/test/ui/macros/macro-multiple-matcher-bindings.stderr +++ b/src/test/ui/macros/macro-multiple-matcher-bindings.stderr @@ -1,41 +1,50 @@ -warning: duplicate matcher binding - --> $DIR/macro-multiple-matcher-bindings.rs:12:6 +error: duplicate matcher binding + --> $DIR/macro-multiple-matcher-bindings.rs:7:16 | LL | ($a:ident, $a:ident) => {}; - | ^^^^^^^^ ^^^^^^^^ + | ^^^^^^^^ | -note: lint level defined here - --> $DIR/macro-multiple-matcher-bindings.rs:9:9 +note: previous declaration was here + --> $DIR/macro-multiple-matcher-bindings.rs:7:6 | -LL | #![warn(duplicate_matcher_binding_name)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #57593 <https://github.com/rust-lang/rust/issues/57593> +LL | ($a:ident, $a:ident) => {}; + | ^^^^^^^^ -warning: duplicate matcher binding - --> $DIR/macro-multiple-matcher-bindings.rs:13:6 +error: duplicate matcher binding + --> $DIR/macro-multiple-matcher-bindings.rs:8:16 | LL | ($a:ident, $a:path) => {}; - | ^^^^^^^^ ^^^^^^^ + | ^^^^^^^ + | +note: previous declaration was here + --> $DIR/macro-multiple-matcher-bindings.rs:8:6 | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #57593 <https://github.com/rust-lang/rust/issues/57593> +LL | ($a:ident, $a:path) => {}; + | ^^^^^^^^ -warning: duplicate matcher binding - --> $DIR/macro-multiple-matcher-bindings.rs:22:6 +error: duplicate matcher binding + --> $DIR/macro-multiple-matcher-bindings.rs:17:18 | LL | ($a:ident, $($a:ident),*) => {}; - | ^^^^^^^^ ^^^^^^^^ + | ^^^^^^^^ + | +note: previous declaration was here + --> $DIR/macro-multiple-matcher-bindings.rs:17:6 | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #57593 <https://github.com/rust-lang/rust/issues/57593> +LL | ($a:ident, $($a:ident),*) => {}; + | ^^^^^^^^ -warning: duplicate matcher binding - --> $DIR/macro-multiple-matcher-bindings.rs:23:8 +error: duplicate matcher binding + --> $DIR/macro-multiple-matcher-bindings.rs:18:25 | LL | ($($a:ident)+ # $($($a:path),+);*) => {}; - | ^^^^^^^^ ^^^^^^^ + | ^^^^^^^ + | +note: previous declaration was here + --> $DIR/macro-multiple-matcher-bindings.rs:18:8 | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #57593 <https://github.com/rust-lang/rust/issues/57593> +LL | ($($a:ident)+ # $($($a:path),+);*) => {}; + | ^^^^^^^^ + +error: aborting due to 4 previous errors |
