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

Negative coverage: borrow_check_statement / loop / premise borrow_check_loop(env, assumptions, state, body, places_live_on_exit) => state

Premise at line 246. Observed failure causes: failed_judgment.

loop
LineCoverageSource
244N/A(let continue_live = Stmt::loop_(label, body).live_before(&env, &state, places_live_on_exit))
245(let state = state.push_continue_scope(&env.env, label, places_live_on_exit, continue_live)?)
2466(borrow_check_loop(env, assumptions, state, body, places_live_on_exit) => state)
247N/A(let state = state.pop_scope(label))
──────── ("loop")
24913(borrow_check_statement(env, assumptions, state, Stmt::Loop { label, body }, places_live_on_exit) => (env, state))

6 tests failed proving this premise:


Source location: tests/borrowck.rs:2192

fn foo<'a, 'b>(v1: &'a u32, v2: &'b u32) -> () {
    let output: &'b u32 = v2;
    loop {
        output = v1;
    }
}
Failed proof tree

Source location: tests/borrowck.rs:2430

fn foo() -> i32 {
    exists<'r0, 'r1> {
        let r: &'r0 i32;
        'a: loop {
            let y: i32 = 0 _ i32;
            r = &'r1 y;
            continue 'a;
        }
        r; // only an error because of false edges, assumption that all loops terminate
    }
}
Failed proof tree

Source location: tests/borrowck.rs:2477

fn foo() -> i32 {
    exists<'r0, 'r1> {
        let x: i32 = 0 _ i32;
        let r: &'r0 i32;
        'a: loop {
            r; // this *may* read from `y` in a previous iteration
            let y: i32 = 0 _ i32;
            r = &'r1 y;
            continue 'a;
        }
    }
}
Failed proof tree

Source location: tests/borrowck.rs:2544

fn foo() -> i32 {
    exists<'r0, 'r1> {
        let r: &'r0 i32;
        'a: loop {
            let x: i32 = 0 _ i32;
            r = &'r1 x;
            break 'a;
        }
        return *r;
    }
}
Failed proof tree

Source location: tests/borrowck.rs:2671

fn foo() -> u32 {
    exists<'r0, 'r1> {
        let a: u32 = 22 _ u32;
        let p: &'r0 u32 = &'r1 a;
        'l: loop {
            if true {
                a = 23 _ u32;
                continue 'l;
            } else {
                break 'l;
            }
        }
        return *p;
    }
}
Failed proof tree

Source location: tests/mir_typeck.rs:776

fn foo() -> u32 {
    loop {
        break 'nonexistent;
    }
    return 0 _ u32;
}
Failed proof tree