Skip to content

Loop label hides variables with same name #12512

Closed
@sfackler

Description

@sfackler

This compiled as of yesterday, but no longer does:

fn main() {
    let mut foo = ~[];
    'foo: for i in [1, 2, 3].iter() {
        foo.push(i);
    }
}
test.rs:4:9: 4:12 error: unresolved name `foo`.
test.rs:4         foo.push(i);
                  ^~~
error: aborting due to previous error

Renaming either the label or the variable fixes the error.

rustc 0.10-pre (329fcd4 2014-02-23 15:37:05 -0800)
host: x86_64-unknown-linux-gnu]

cc @edwardw

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions