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_ty_is_copy / trait

trait
LineCoverageSource
1032N/A(let goal = AtomicPredicate::is_implemented(TraitId::new("Copy").with(ty, Vec::<Parameter>::new())))
10333(env.prove_goal(assumptions, &state, goal) => state)
──────── ("trait")
103520(prove_ty_is_copy(env, assumptions, state, ty) => state)

20 tests exercised this rule:


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

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

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: &'l_q mut u32 = &'loan_0 mut a;
        let p: &'l_p mut u32 = &'loan_1 mut a;
        if true {
            p = &'loan_1 mut a;
            q = &'loan_2 mut b;
        } else {
            p = &'loan_3 mut b;
        }
        *q = 1_u32;
        return *p;
    }
}
Proof tree
… (200 of 3956 nodes shown)

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

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

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

fn bar() -> u32 {
    exists<'r1> {
        let v: u32 = 7_u32;
        let r: u32 = foo::<'r1>(&'r1 v);
        return r;
    }
}
Proof tree
… (200 of 3624 nodes shown)

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

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

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

fn f() -> u32 {
    exists<'r0> {
        let v: u32 = 0_u32;
        let w: Wrapper<'r0> = Wrapper::<'r0> { value: &'r0 v };
        return *w.value;
    }
}
Proof tree
… (200 of 3603 nodes shown)

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

fn foo() -> u32 {
    let a: u32 = 0_u32;
    a;
    a;
    return 0_u32;
}
Proof tree
… (200 of 3433 nodes shown)

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

fn foo() -> u32 {
    exists<'l0> {
        let a: u32 = 0_u32;
        let p: &'l0 u32 = &'l0 a;
        let q: &'l0 u32 = p;
        let r: &'l0 u32 = p;
        p;
        return 0_u32;
    }
}
Proof tree
… (200 of 3585 nodes shown)

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

fn foo() -> () {
    let x: u32 = 1_u32;
    exists<'r0> {
        let r: &'r0 mut u32 = &'r0 mut x;
        x += *r;
    }
}
Proof tree
… (200 of 3586 nodes shown)

Source location: tests/codegen.rs:251 (all coverage from this test)

fn main() -> () {
    let x: i32 = 42_i32;
    exists<'a> {
        let r: & 'a i32 = & 'a x;
        println!(*r);
    }
}
Proof tree
… (200 of 3666 nodes shown)

Source location: tests/codegen.rs:374 (all coverage from this test)

fn main() -> () {
    let p: Pair = Pair { x: 10_i32, y: 20_i32 };
    exists<'a> {
        let r: & 'a i32 = & 'a p.x;
        println!(*r);
    }
}

Proof trees omitted for the remaining 10 tests; each one is on its test’s page in Coverage by test.


Source location: tests/codegen.rs:391 (all coverage from this test)

fn main() -> () {
    let p: Pair = Pair { x: 10_i32, y: 20_i32 };
    exists<'a> {
        let r: & 'a Pair = & 'a p;
        println!((*r).x);
        println!((*r).y);
    }
}

Source location: tests/codegen.rs:485 (all coverage from this test)

fn main() -> () {
    let x: i32 = 1_i32;
    exists<'a> {
        let r: &'a mut i32 = &'a mut x;
        *r = 2_i32;
        println!(*r);
    }
}

Source location: tests/codegen.rs:501 (all coverage from this test)

fn main() -> () {
    let x: i32 = 42_i32;
    exists<'a> {
        let r1: & 'a i32 = & 'a x;
        let r2: & 'a i32 = & 'a *r1;
        println!(*r2);
    }
}

Source location: tests/codegen.rs:516 (all coverage from this test)

fn main() -> () {
    let x: i32 = 55_i32;
    exists<'a> {
        let r: & 'a i32 = & 'a x;
        println!(*r);
    }
}

Source location: tests/codegen.rs:1132 (all coverage from this test)

fn main() -> () {
    let p: Pair = Pair { a: 2_u32, b: 3_u32 };
    p.b *= p.a + 4_u32;
    println!(p.b);
    println!(p.a);
}

Source location: tests/field_projections.rs:17 (all coverage from this test)

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

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

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:987 (all coverage from this test)

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

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

fn foo<'a>(v1: &'a Pair) -> u32 {
    exists<'r0> {
        let v2: u32 = (*v1).value;
        return v2;
    }
}

How to read this page