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 / expr

expr
LineCoverageSource
22912(borrow_check_expr(
env,
assumptions,
state,
expr,
places_live_on_exit
) => (_init_ty, state))
──────── ("expr")
23715(borrow_check_statement(env, assumptions, state, Stmt::Expr { expr }, places_live_on_exit) => (env, state))

15 tests exercised this rule:


Source location: tests/borrowck.rs:113

fn foo() -> Datum {
    let x: Datum = Datum { value: 0 _ u32 };
    let y: Datum = x;
    x = Datum { value: 1 _ u32 };
    let z: Datum = x;
    return z;
}
Proof tree
… (200 of 1117 nodes shown)

Source location: tests/borrowck.rs:186

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

Source location: tests/borrowck.rs:2041

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 1234 nodes shown)

Source location: tests/borrowck.rs:2277

fn min_problem_case_4<'a>(list: &mut 'a Map, list2: &mut 'a Map) -> u32 {
    exists<'r0> {
        let num: &mut 'r0 u32 = &mut 'r0 (*list).value;
        list = &mut 'a *list2;
        num;
        return 0 _ u32;
    }
}
Proof tree
… (200 of 1262 nodes shown)

Source location: tests/borrowck.rs:2410

fn foo () -> u32 {
    exists<'l_p, 'l_q, 'loan_0, 'loan_1, 'loan_2, 'loan_3> {
        let a: u32 = 0 _ u32;
        let b: u32 = 0 _ u32;
        // In Rustc, the 1-tuple is needed for some reason
        // Niko does not 100% understand, else rustc is able to
        // see that this program is safe.
        let q: &mut 'l_q u32 = &mut 'loan_0 a;
        let p: &mut 'l_p u32 = &mut 'loan_1 a;
        if true {
            p = &mut 'loan_1 a;
            q = &mut 'loan_2 b;
        } else {
            p = &mut 'loan_3 b;
        }
        *q = 1 _ u32;
        return *p;
    }
}
Proof tree
… (200 of 1495 nodes shown)

Source location: tests/borrowck.rs:2922

fn bar() -> u32 {
    exists<'r0, 'r1> {
        let v: u32 = 1 _ u32;
        let p: &'r0 u32 = &'r1 v;
        foo(0 _ u32);
        return *p;
    }
}
Proof tree
… (200 of 1231 nodes shown)

Source location: tests/borrowck.rs:2976

fn foo() -> u32 {
    exists<'r0, 'r1, 'r2, 'r3> {
        let p: Point = Point { x: 0 _ u32, y: 0 _ u32 };
        let b1: &mut 'r0 u32 = &mut 'r1 p.x;
        let b2: &mut 'r2 u32 = &mut 'r3 p.y;
        *b1 = 1 _ u32;
        *b2 = 2 _ u32;
        return 0 _ u32;
    }
}
Proof tree
… (200 of 1318 nodes shown)

Source location: tests/borrowck.rs:3225

fn foo() -> u32 {
    exists<'r0, 'r1, 'r2> {
        let x: u32 = 22 _ u32;
        let p: &'r1 u32 = &'r0 x;
        let q: &'r2 u32 = p;
        x = 1 _ u32;
        return 0 _ u32;
    }
}
Proof tree
… (200 of 1126 nodes shown)

Source location: tests/codegen.rs:49

fn main() -> () {
    let x: i32 = 1 _ i32;
    x = 2 _ i32;
    println!(x);
}
Proof tree
… (200 of 1025 nodes shown)

Source location: tests/codegen.rs:238

fn main() -> () {
    a();
}
Proof tree
… (200 of 1152 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 trees omitted for the remaining 5 tests.


Source location: tests/codegen.rs:443

fn main() -> () {
    let x: i32 = 0 _ i32;
    'a: loop {
        x = 77 _ i32;
        break 'a;
    }
    println!(x);
}

Source location: tests/codegen.rs:461

fn main() -> () {
    let x: i32 = 0 _ i32;
    'a: loop {
        {
            x = 88 _ i32;
            break 'a;
        }
    }
    println!(x);
}

Source location: tests/mir_typeck.rs:105

fn foo() -> u32 {
    let v0: u32 = 0 _ u32;
    loop {
        v0 = v0;
    }
}

Source location: tests/mir_typeck.rs:234

fn foo (v1: u32) -> u32 {
    let v2: Dummy = Dummy { value: 1 _ u32, is_true: false };
    v2.value = 2 _ u32;
    return v1;
}