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-r

normalize-r
LineCoverageSource
355(prove_normalize(decls, env, assumptions, y) => Constrained(z, c))
36(prove_after(decls, c, assumptions, Relation::sub(x, &z)) => c)
──────── ("normalize-r")
382(prove_sub(decls, env, assumptions, x, y) => c)

2 tests exercised this rule:


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: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)