Skip to content

Label shadowing causes a warning that cannot be allowed #65269

@sugar700

Description

@sugar700
macro_rules! m {
    ($a:expr) => {
        'label: for _ in 0..1 {
            $a;
        }
    }
}

fn main() {
    m!(m!(1));
}

causes the following warning:

warning: label name `'label` shadows a label name that is already in scope
  --> src/main.rs:3:9
   |
3  |         'label: for _ in 0..1 {
   |         ^^^^^^
   |         |
   |         first declared here
   |         lifetime 'label already in scope
...
10 |     m!(m!(1));
   |        ----- in this macro invocation

There is no way to allow the warning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.T-compilerRelevant to the compiler 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