Skip to content

Better error message for "error: break' outside of loop" inside of do' inside of `for' #3064

Closed
@bblum

Description

@bblum
fn main() {
    let vec = ~[some(())];
    for vec::each(vec) |slot| {
        do slot.iter |bucket| {
            break;
        }
    }
}

fails to compile, though I claim it should, and be the same as:

fn main() {
    let vec = ~[some(())];
    for vec::each(vec) |slot| {
        alt slot {
            some(bucket) { break; }
            none { }
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frontendArea: Compiler frontend (errors, parsing and HIR)E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions