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: prove_sub / normalize-l

normalize-l
LineCoverageSource
285(prove_normalize(decls, env, assumptions, x) => Constrained(y, c))
29(prove_after(decls, c, assumptions, Relation::sub(y, z)) => c)
──────── ("normalize-l")
3116(prove_sub(decls, env, assumptions, x, z) => c)

16 tests exercised this rule:


Source location: tests/borrowck.rs:1968

fn min_problem_case_3<'a>(m: &mut 'a Map) -> &mut 'a Map {
    exists<'r0, 'r1> {
        let n: &mut 'r0 Map = &mut 'r0 *m;
        if true {
            return n;
        } else {
            let o: &mut 'r1 Map = &mut 'r1 *m;
            return o;
        }
    }
}
Proof tree
… (200 of 1324 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:2156

fn min_problem_case_3<'a>(m: &mut 'a Map) -> &mut 'a Map {
    exists<'r0, 'r1> {
        let n: &mut 'r0 Map = &mut 'r0 *m;
        if true {
        } else {
        }
        let o: &mut 'r1 Map = &mut 'r1 *m;
        return o;
    }
}
Proof tree
… (200 of 1295 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:2600

fn foo() -> u32 {
    exists<'r0, 'r1> {
        'a: loop {
            let x: i32 = 0 _ i32;
            let r: &'r0 i32 = &'r1 x;
            let _y: i32 = *r;
            continue 'a;
        }
    }
}
Proof tree
… (200 of 1443 nodes shown)

Source location: tests/borrowck.rs:2733

fn foo<'a>(m: &mut 'a Map) -> &mut 'a Map {
    exists<'r0, 'r1> {
        let n: &mut 'r0 Map = &mut 'r0 *m;
        if false {
            return n;
        } else {
            let o: &mut 'r1 Map = &mut 'r1 *m;
            return o;
        }
    }
}
Proof tree
… (200 of 1324 nodes shown)

Source location: tests/borrowck.rs:2828

fn bar() -> u32 {
    exists<'r1> {
        let v: u32 = 7 _ u32;
        let r: u32 = foo::<'r1>(&'r1 v);
        return r;
    }
}
Proof tree
… (200 of 1223 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:3095

fn reborrow<'a>(a: &mut 'a u8) -> &mut 'a u8 {
    exists<'r0, 'r1, 'r2, 'r3> {
        if true {
            let b: &mut 'r1 u8 = &mut 'r0 *a;
            return b;
        } else { }

        let c: &mut 'r3 u8 = &mut 'r2 *a;
        return c;
    }
}
Proof tree
… (200 of 1308 nodes shown)

Source location: tests/borrowck.rs:3120

fn reborrow<'a>(a: &mut 'a u8) -> &mut 'a u8 {
    exists<'r0, 'r1, 'r2, 'r3> {
        // This creates an outlives constraint
        let b: &mut 'r1 u8 = &mut 'r0 *a;
        if true {
            return b;
        } else {
            // this means the loan remains live
        }

        // If the outlives constraint propagated here,
        // we would get an error.
        let c: &mut 'r3 u8 = &mut 'r2 *a;
        return c;
    }
}

Proof trees omitted for the remaining 6 tests.


Source location: tests/borrowck.rs:3137

fn reborrow<'a>(a: &mut 'a u8) -> &mut 'a u8 {
    exists<'r0, 'r1, 'r2, 'r3> {
        let b: &mut 'r1 u8 = &mut 'r0 *a;
        return b;
        let c: &mut 'r3 u8 = &mut 'r2 *a;
        return c;
    }
}

Source location: tests/borrowck.rs:3157

fn reborrow<'a>(a: &mut 'a u8) -> &mut 'a u8 {
    exists<'r0, 'r1, 'r2, 'r3> {
        if true {
            let b: &mut 'r1 u8 = &mut 'r0 *a;
            return b;
        } else {
            let c: &mut 'r3 u8 = &mut 'r2 *a;
            return c;
        }
    }
}

Source location: tests/field_projections.rs:17

fn test(ptr: Ptr) -> () {
    let x: () = *ptr;
}

Source location: tests/mir_typeck.rs:710

fn foo () -> u32 {
    exists<'a> {
        let v0: u32 = 0 _ u32;
        let v1: &'a u32 = &'a v0;
        let v2: u32 = *v1;
        return v2;
    }
}

Source location: tests/mir_typeck.rs:729

fn foo<'a, T>(v1: &'a T) -> T
where
    T: Copy,
    T: 'a,
{
    exists<'r0> {
        let v2: T = *v1;
        return v2;
    }
}