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

Label shadowing causes a warning that cannot be allowed #65269

xfix opened this issue Oct 10, 2019 · 1 comment


Copy link

@xfix xfix commented Oct 10, 2019

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

fn main() {

causes the following warning:

warning: label name `'label` shadows a label name that is already in scope
  --> src/
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.

@xfix xfix changed the title Label shadowing causes a warning that cannot be avoided Label shadowing causes a warning that cannot be allowed Oct 10, 2019

This comment has been minimized.

Copy link

@Mark-Simulacrum Mark-Simulacrum commented Oct 12, 2019


// shadowing involving a label is only a warning, due to issues with
// labels and lifetimes not being macro-hygienic.
"{} name `{}` shadows a \
{} name that is already in scope",
piece of code should be converted to emitting a lint versus a warning, I think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.