Label shadowing by himself warning


#1

Hello.

I got a strange warning I can’t understand why.

src/main.rs:183:33: 210:22 warning: label name `'ecto_loop` shadows a label name that is already in scope
src/main.rs:183                     'ecto_loop: loop {
                ...
src/main.rs:183:33: 210:22 note: shadowed label `'ecto_loop` declared here
src/main.rs:183                     'ecto_loop: loop {
            ...

But I’m pretty sure there is only one 'ecto_loop label. And how It’s possible to shadow itself? Can someone please explain what does compiler mean?

gist of this code


#2

Could you post the whole function that contains this code?


#3

new gist


#4

This looks like a bug in rustc.


#5

By the way, even renaming does not affect anything but the error message (which then prints the new label name).


#6

Smaller reproduction:

fn main() {
    let _ = || {
        'foo: loop {}
    };
}

Looks to be a problem with closures, which has already been filed as #25343.