Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Positive coverage: borrow_check_statement / break

break
LineCoverageSource
255(if state.scope_has_label(label))
256N/A(let locals_to_drop = state.locals_dropped_to_label(label))
2572(drop_places(env, assumptions, state, locals_to_drop, places_live_on_exit) => state)
258N/A(let state = state.with_break(label))
259N/A(let state = state.diverges())
──────── ("break")
26111(borrow_check_statement(env, assumptions, state, Stmt::Break { label }, places_live_on_exit) => (env, state))

11 tests exercised this rule:


Source location: tests/codegen.rs:110

fn main() -> () {
    let x: i32 = 0 _ i32;
    'a: loop {
        println!(x);
        break 'a;
    }
}
Proof tree
… (200 of 1037 nodes shown)

Source location: tests/codegen.rs:318

fn main() -> () {
    let x: i32 = 0 _ i32;
    'a: loop {
        if true {
            println!(x);
            break 'a;
        } else {
            continue 'a;
        }
    }
}
Proof tree
… (200 of 1073 nodes shown)

Source location: tests/codegen.rs:336

fn main() -> () {
    'outer: loop {
        println!(1 _ i32);
        'inner: loop {
            println!(2 _ i32);
            break 'outer;
        }
    }
    println!(3 _ i32);
}
Proof tree
… (200 of 1039 nodes shown)

Source location: tests/codegen.rs:356

fn main() -> () {
    'a: loop {
        if true {
            println!(1 _ i32);
            break 'a;
        } else {
            println!(2 _ i32);
            break 'a;
        }
    }
    println!(3 _ i32);
}
Proof tree
… (200 of 1053 nodes shown)

Source location: tests/codegen.rs:377

fn main() -> () {
    let x: i32 = 0 _ i32;
    'a: loop {
        if false {
            x = 1 _ i32;
            break 'a;
        } else {
            x = 2 _ i32;
            break 'a;
        }
    }
    println!(x);
}
Proof tree
… (200 of 1113 nodes shown)

Source location: tests/codegen.rs:443

fn main() -> () {
    let x: i32 = 0 _ i32;
    'a: loop {
        x = 77 _ i32;
        break 'a;
    }
    println!(x);
}
Proof tree
… (200 of 1053 nodes shown)

Source location: tests/codegen.rs:461

fn main() -> () {
    let x: i32 = 0 _ i32;
    'a: loop {
        {
            x = 88 _ i32;
            break 'a;
        }
    }
    println!(x);
}
Proof tree
… (200 of 1063 nodes shown)

Source location: tests/codegen.rs:477

fn main() -> () {
    'a: {
        println!(1 _ i32);
        break 'a;
        println!(2 _ i32);
    }
    println!(3 _ i32);
}
Proof tree
… (200 of 1003 nodes shown)

Source location: tests/mir_typeck.rs:755

fn foo() -> u32 {
    'a: loop {
        break 'a;
    }
    return 0 _ u32;
}
Proof tree
… (200 of 1010 nodes shown)

Source location: tests/mir_typeck.rs:882

fn foo() -> u32 {
    'a: {
        break 'a;
    }
    return 0 _ u32;
}
Proof tree
… (200 of 1002 nodes shown)

Source location: tests/return_validation.rs:111

fn foo() -> u32 {
    'a: loop {
        break 'a;
    }
    return 0 _ u32;
}

Proof trees omitted for the remaining 1 tests.