Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warn -> deny duplicate match bindings #59394

Merged
merged 1 commit into from
Mar 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/librustc/lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ declare_lint! {

declare_lint! {
pub DUPLICATE_MATCHER_BINDING_NAME,
Warn,
Deny,
"duplicate macro matcher binding name"
}

Expand Down Expand Up @@ -464,6 +464,7 @@ impl LintPass for HardwiredLints {
DEPRECATED_IN_FUTURE,
AMBIGUOUS_ASSOCIATED_ITEMS,
NESTED_IMPL_TRAIT,
DUPLICATE_MATCHER_BINDING_NAME,
)
}
}
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/macros/macro-multiple-matcher-bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// compile-pass

#![allow(unused_macros)]
#![warn(duplicate_matcher_binding_name)]

macro_rules! foo1 {
($a:ident, $a:ident) => {}; //~WARNING duplicate matcher binding
Expand Down
14 changes: 9 additions & 5 deletions src/test/ui/macros/macro-multiple-matcher-bindings.stderr
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
warning: duplicate matcher binding
--> $DIR/macro-multiple-matcher-bindings.rs:11:6
--> $DIR/macro-multiple-matcher-bindings.rs:12:6
|
LL | ($a:ident, $a:ident) => {};
| ^^^^^^^^ ^^^^^^^^
|
= note: #[warn(duplicate_matcher_binding_name)] on by default
note: lint level defined here
--> $DIR/macro-multiple-matcher-bindings.rs:9:9
|
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>

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

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

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