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_expr / assign-op

assign-op
LineCoverageSource
4711(borrow_check_expr(
env,
assumptions,
state,
rhs,
Seq(place, Assignment(place)).live_before(env, &state, places_live_on_exit),
) => (rhs_ty, state))
478N/A(let places_live_before_write = Assignment(place).live_before(env, &state, places_live_on_exit))
480✗(borrow_check_place_expr(env, assumptions, state, place) => (place, state))
481✗(prove_ty_is_rigid(env, assumptions, state, &place.ty) => (RigidTy { name: RigidName::ScalarId(scalar), parameters: _ }, state))
4821(if scalar.is_int())
4834(prove_assignable(env, assumptions, state, rhs_ty, &place.ty) => state)
4852(access_permitted(env, assumptions, state, Access::new(AccessKind::Read, place), places_live_before_write) => state)
4861(access_permitted(env, assumptions, state, Access::new(AccessKind::Write, place), places_live_on_exit) => state)
487N/A(let state = kill_loans(place, state))
──────── ("assign-op")
48919(borrow_check_expr(env, assumptions, state, Expr::AssignOp { place, op: _, rhs }, places_live_on_exit) => (Ty::unit(), state))

19 tests exercised this rule:


Source location: tests/borrowck.rs:5219 (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 1499 nodes shown)

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

fn bump<'a>(p: &'a mut u32) -> () {
    *p += 1_u32;
}
Proof tree
… (200 of 1424 nodes shown)

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

fn main() -> () {
    let x: u32 = 1_u32;
    exists<'a> {
        let r: &'a mut u32 = &'a mut x;
        x += update::<'a>(r);
    }
    println!(x);
}
Proof tree
… (200 of 1636 nodes shown)

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

fn main() -> () {
    let x: u32 = 1_u32;
    x += 2_u32 + 3_u32;
    println!(x);
}
Proof tree
… (200 of 1338 nodes shown)

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

fn main() -> () {
    let p: Pair = Pair { a: 1_u32, b: 10_u32 };
    p.b += p.a;
    println!(p.b);
}
Proof tree
… (200 of 1394 nodes shown)

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

fn main() -> () {
    let x: u32 = 20_u32;
    x -= 2_u32 + 3_u32;
    println!(x);
}
Proof tree
… (200 of 1338 nodes shown)

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);
}
Proof tree
… (200 of 1430 nodes shown)

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

fn main() -> () {
    let x: u32 = 12_u32;
    x ^= 3_u32 + 5_u32;
    println!(x);
}
Proof tree
… (200 of 1338 nodes shown)

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

fn main() -> () {
    let x: u32 = 1_u32;
    exists<'a> {
        let r: &'a mut u32 = &'a mut x;
        x ^= update::<'a>(r);
    }
    println!(x);
}
Proof tree
… (200 of 1636 nodes shown)

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

fn main() -> () {
    let x: u32 = 6_u32;
    x |= 1_u32 + 2_u32;
    println!(x);
}
Proof tree
… (200 of 1338 nodes shown)

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

fn main() -> () {
    let x: u32 = 2_u32;
    exists<'a> {
        let r: &'a mut u32 = &'a mut x;
        x |= update::<'a>(r);
    }
    println!(x);
}

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


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

fn main() -> () {
    let x: u32 = 14_u32;
    x &= 7_u32 + 5_u32;
    println!(x);
}

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

fn main() -> () {
    let x: u32 = 1_u32;
    exists<'a> {
        let r: &'a mut u32 = &'a mut x;
        x &= update::<'a>(r);
    }
    println!(x);
}

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

fn main() -> () {
    let p: Pair = Pair { left: 8_u32, right: 16_u32 };
    exists<'a> {
        let r: &'a mut Pair = &'a mut p;
        p.left %= update::<'a>(r);
    }
    println!(p.left);
    println!(p.right);
}

Source location: tests/division_abort.rs:60 (all coverage from this test)

#[test]
#[should_panic(expected = "expected a defined abort, got Ub(String(\"division by zero\"))")]
fn compound_division_by_zero_aborts() {
    assert_aborts(crates![crate Foo {
        fn divide(lhs: u32, rhs: u32) -> u32 {
            lhs /= rhs;
            return lhs;
        }
        fn main() -> () { println!(divide(12_u32, 0_u32)); }
    }]);
}

Source location: tests/division_abort.rs:73 (all coverage from this test)

#[test]
#[should_panic(expected = "expected a defined abort, got Ub(String(\"overflow in division\"))")]
fn signed_compound_division_overflow_aborts() {
    assert_aborts(crates![crate Foo {
        fn divide(lhs: i32, rhs: i32) -> i32 {
            lhs /= rhs;
            return lhs;
        }
        fn main() -> () { println!(divide(-2147483648_i32, -1_i32)); }
    }]);
}

Source location: tests/pr531_review_probes.rs:39 (all coverage from this test)

fn main() -> () {
    let p: Pair = Pair { left: 2_u32, right: 16_u32 };
    exists<'a> {
        let r: &'a mut Pair = &'a mut p;
        p.left |= update::<'a>(r);
    }
    println!(p.left);
    println!(p.right);
}

Source location: tests/pr531_review_probes.rs:55 (all coverage from this test)

fn main() -> () {
    let x: u128 = 170141183460469231731687303715884105728_u128;
    x |= identity(1_u128 | 2_u128 ^ 3_u128);
    println!(x);
    println!(identity((1_u128 | 2_u128) ^ 3_u128));
}

Source location: tests/pr539_review_probes.rs:39 (all coverage from this test)

fn main() -> () {
    let p: Pair = Pair { left: 1_u32, right: 16_u32 };
    exists<'a> {
        let r: &'a mut Pair = &'a mut p;
        p.left &= update::<'a>(r);
    }
    println!(p.left);
    println!(p.right);
}

How to read this page