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 / let-no-init

let-no-init
LineCoverageSource
2051(prove_ty_is_wf(env, assumptions, state, ty) => state)
206✗(let state = state.with_local_in_scope(&env.env, label, id, ty)?)
207N/A(let state = state.with_uninit(&PlaceExpr::var(id)))
──────── ("let-no-init")
2097(borrow_check_statement(env, assumptions, state, Stmt::Let { label, id, ty, init: None }, places_live_on_exit) => (env, state))

7 tests exercised this rule:


Source location: tests/borrowck.rs:290 (all coverage from this test)

fn foo() -> u32 {
    let x: u32;
    if true {
        x = 1_u32;
    } else {
        x = 2_u32;
    }
    return x;
}
Proof tree
… (200 of 1357 nodes shown)

Source location: tests/borrowck.rs:2575 (all coverage from this test)

fn foo() -> i32 {
    exists<'r0, 'r1> {
        let result: i32;
        {
            let v1: i32 = 22_i32;
            let v2: &'r0 i32 = &'r1 v1;
            result = *v2;
        }
        return result;
    }
}
Proof tree
… (200 of 1548 nodes shown)

Source location: tests/borrowck.rs:4664 (all coverage from this test)

fn to_refs<'a>(list: &'a mut List) -> &'a mut u32 {
    exists<'r0, 'r1> {
        let result: &'a mut u32;
        'l: loop {
            result = &'r0 mut (*list).value;
            if true {
                let n: &'r1 mut List = next_from_field::<'r1>(&'r1 mut (*list).next);
                list = n;
            } else {
                return result;
            }
        }
    }
}
Proof tree
… (200 of 2089 nodes shown)

Source location: tests/borrowck.rs:4699 (all coverage from this test)

fn to_refs2<'a>(list: &'a mut List) -> &'a mut u32 {
    exists<'r0, 'r1> {
        let result: &'a mut u32;
        'l: loop {
            result = &'r0 mut (*list).value;
            if true {
                let n: &'r1 mut List = next_from_field::<'r1>(&'r1 mut (*list).next);
                list = n;
            } else {
                break 'l;
            }
        }
        return result;
    }
}
Proof tree
… (200 of 2367 nodes shown)

Source location: tests/borrowck.rs:4746 (all coverage from this test)

fn to_refs3<'a>(list: &'a mut List) -> &'a mut u32 {
    exists<'r0, 'r1> {
        let result: &'a mut u32;
        let cursor: &'a mut List = &'a mut *list;
        'l: loop {
            result = &'r0 mut (*cursor).value;
            if true {
                let n: &'r1 mut List = next_from_field::<'r1>(&'r1 mut (*cursor).next);
                cursor = n;
            } else {
                return result;
            }
        }
    }
}
Proof tree
… (200 of 2267 nodes shown)

Source location: tests/borrowck.rs:5849 (all coverage from this test)

fn main() -> () {
    let v0: u32 = 0_u32;
    exists<'b> {
        let q: &'b u32;
        exists<'r> {
            let m: &'r u32 = &'r v0;
            q = m;
        }
        let z: u32 = *q;
        v0 = 1_u32;
    }
}
Proof tree
… (200 of 1574 nodes shown)

Source location: tests/mir_typeck.rs:276 (all coverage from this test)

fn foo() -> () {
    let s1: S1<u8>;
}
Proof tree
… (200 of 1326 nodes shown)

How to read this page