-
Notifications
You must be signed in to change notification settings - Fork 209
Open
Description
Summary
Duplicate metavariables are allowed in macro definitions, as long as those macro definitions are unused. Also, we don't warn when a macro definition is unused. See #4405
Reproducer
I tried this code:
macro_rules! foo {
($a:ident, $a:ident) => {()}
}
pub fn foo() {
//foo!(a, b)
}Does the code make use of any (1.49) nightly feature ?
- Nightly
Godbolt link
https://godbolt.org/z/5G3ad4bTo
Actual behavior
No error
Expected behavior
error: duplicate matcher binding
--> <source>:2:16
|
2 | ($a:ident, $a:ident) => {()}
| -------- ^^^^^^^^ duplicate binding
| |
| previous binding
warning: unused macro definition
--> <source>:1:1
|
1 | / macro_rules! foo {
2 | | ($a:ident, $a:ident) => {()}
3 | | }
| |_^
|
= note: `#[warn(unused_macros)]` on by default
GCC Version
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels