Skip to content

Commit 9f14e14

Browse files
committed
deny duplicate matcher bindings by default
1 parent 237bf32 commit 9f14e14

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/librustc/lint/builtin.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ declare_lint! {
354354

355355
declare_lint! {
356356
pub DUPLICATE_MATCHER_BINDING_NAME,
357-
Warn,
357+
Deny,
358358
"duplicate macro matcher binding name"
359359
}
360360

@@ -464,6 +464,7 @@ impl LintPass for HardwiredLints {
464464
DEPRECATED_IN_FUTURE,
465465
AMBIGUOUS_ASSOCIATED_ITEMS,
466466
NESTED_IMPL_TRAIT,
467+
DUPLICATE_MATCHER_BINDING_NAME,
467468
)
468469
}
469470
}

src/test/ui/macros/macro-multiple-matcher-bindings.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// compile-pass
77

88
#![allow(unused_macros)]
9+
#![warn(duplicate_matcher_binding_name)]
910

1011
macro_rules! foo1 {
1112
($a:ident, $a:ident) => {}; //~WARNING duplicate matcher binding

src/test/ui/macros/macro-multiple-matcher-bindings.stderr

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
warning: duplicate matcher binding
2-
--> $DIR/macro-multiple-matcher-bindings.rs:11:6
2+
--> $DIR/macro-multiple-matcher-bindings.rs:12:6
33
|
44
LL | ($a:ident, $a:ident) => {};
55
| ^^^^^^^^ ^^^^^^^^
66
|
7-
= note: #[warn(duplicate_matcher_binding_name)] on by default
7+
note: lint level defined here
8+
--> $DIR/macro-multiple-matcher-bindings.rs:9:9
9+
|
10+
LL | #![warn(duplicate_matcher_binding_name)]
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
812
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
913
= note: for more information, see issue #57593 <https://github.com/rust-lang/rust/issues/57593>
1014

1115
warning: duplicate matcher binding
12-
--> $DIR/macro-multiple-matcher-bindings.rs:12:6
16+
--> $DIR/macro-multiple-matcher-bindings.rs:13:6
1317
|
1418
LL | ($a:ident, $a:path) => {};
1519
| ^^^^^^^^ ^^^^^^^
@@ -18,7 +22,7 @@ LL | ($a:ident, $a:path) => {};
1822
= note: for more information, see issue #57593 <https://github.com/rust-lang/rust/issues/57593>
1923

2024
warning: duplicate matcher binding
21-
--> $DIR/macro-multiple-matcher-bindings.rs:21:6
25+
--> $DIR/macro-multiple-matcher-bindings.rs:22:6
2226
|
2327
LL | ($a:ident, $($a:ident),*) => {};
2428
| ^^^^^^^^ ^^^^^^^^
@@ -27,7 +31,7 @@ LL | ($a:ident, $($a:ident),*) => {};
2731
= note: for more information, see issue #57593 <https://github.com/rust-lang/rust/issues/57593>
2832

2933
warning: duplicate matcher binding
30-
--> $DIR/macro-multiple-matcher-bindings.rs:22:8
34+
--> $DIR/macro-multiple-matcher-bindings.rs:23:8
3135
|
3236
LL | ($($a:ident)+ # $($($a:path),+);*) => {};
3337
| ^^^^^^^^ ^^^^^^^

0 commit comments

Comments
 (0)