Closed
Description
What is this lint about
In #57593, it was observed that duplicate macro matcher bindings are allowed in declarations, but unusable in invocations:
macro_rules! foo {
($a:expr, $a:expr) => {}
}
This is macro compiles fine on its own, but any attempt to use it will result in an error because $a
is bound twice. This is likely an oversight in the original implementation, but it really feels like a bug, so we want to make this a hard error.
This compatibility lint warns on such a declaration. The end goal is to make this a hard error in a few releases.
How to fix this warning/error
Change the binding names to be different.
Current status
- PR Error on duplicate matcher bindings #57617 introduces the
duplicate_matcher_binding_names
lint as warn-by-default - PR warn -> deny duplicate match bindings #59394 makes the
duplicate_matcher_binding_names
lint as deny-by-default - PR Make duplicate matcher bindings a hard error #59858 makes the
duplicate_matcher_binding_names
a hard error