Skip to content

Tracking issue for duplicate_matcher_binding_names compatibility lint #57742

Closed
@mark-i-m

Description

@mark-i-m

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-future-incompatibilityCategory: Future-incompatibility lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions