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 / bitwise and

bitwise and
LineCoverageSource
428N/A(let expr = Expr::bin_op(lhs, BinOpKind::BitAnd, rhs))
4293(borrow_check_expr(env, assumptions, state, expr, places_live_on_exit) => (ty, state))
──────── ("bitwise and")
43114(borrow_check_expr(env, assumptions, state, Expr::BitAnd { lhs, rhs }, places_live_on_exit) => (ty, state))

14 tests exercised this rule:


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

fn main() -> () {
    let x: u32 = 6_u32;
    exists<'a> {
        let r: &'a mut u32 = &'a mut x;
        *r = 12_u32;
        println!(*r & x);
    }
}
Proof tree
… (200 of 1613 nodes shown)

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

fn main() -> () {
    println!(12_i32 & 10_i32);
}
Proof tree
… (200 of 1301 nodes shown)

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

fn main() -> () {
    println!(5_i32 ^ 6_i32 & 3_i32);
    println!(6_i32 & 3_i32 ^ 1_i32);
}
Proof tree
… (200 of 1334 nodes shown)

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

fn main() -> () {
    println!(5_i32 & 1_i32 + 2_i32);
    println!(3_i32 + 1_i32 & 6_i32);
    println!(9_i32 - 1_i32 & 12_i32);
    println!(6_i32 & 3_i32 * 2_i32);
}
Proof tree
… (200 of 1377 nodes shown)

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

fn main() -> () {
    println!(-1_i32 & 5_i32);
    println!(-6_i32 & -3_i32);
    println!(-16_i32 & 31_i32);
}
Proof tree
… (200 of 1327 nodes shown)

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

fn main() -> () {
    println!(240_u8 & 60_u8);
}
Proof tree
… (200 of 1301 nodes shown)

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

fn main() -> () { println!(left() & right()); }
}])
tc_ok()
ect_output("1\n2\n8\n")
);
}

#[test]
se_and_with_parentheses() {
alityTest::new(crates![crate Foo {
fn main() -> () {
    println!((5_i32 ^ 6_i32) & 3_i32);
    println!((6_i32 & 3_i32) * 2_i32);
}
Proof tree
… (200 of 1369 nodes shown)

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

fn main() -> () {
    println!((5_i32 ^ 6_i32) & 3_i32);
    println!((6_i32 & 3_i32) * 2_i32);
}
Proof tree
… (200 of 1336 nodes shown)

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

fn main() -> () {
    let x: i32 = 5_i32;
    x = x & 6_i32;
    println!(x);
}
Proof tree
… (200 of 1342 nodes shown)

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

fn main() -> () {
    println!(-128_i8 & -1_i8);
    println!(127_i8 & -128_i8);
    println!(-1_i8 & 127_i8);
}
Proof tree
… (200 of 1327 nodes shown)

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

fn main() -> () {
    println!(340282366920938463463374607431768211455_u128
        & 170141183460469231731687303715884105729_u128);
    println!(170141183460469231731687303715884105728_u128
        & 170141183460469231731687303715884105727_u128);
    println!(-170141183460469231731687303715884105728_i128 & -1_i128);
}

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


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

fn main() -> () {
    let x: u32 = 12_u32;
    exists<'a, 'b> {
        let r: &'a u32 = &'a x;
        println!(and_left::<'a>(r));
        let s: &'b u32 = &'b x;
        println!(and_right::<'b>(s));
    }
}

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

fn main() -> () {
    let x: u32 = 12_u32;
    exists<'a> {
        let r: &'a u32 = &'a x;
        println!(*r & *r);
        println!(*r & 6_u32);
    }
}

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

fn main() -> () {
    println!(identity(8_u32 | 6_u32 ^ 3_u32 & 1_u32));
    println!(identity((8_u32 | 6_u32 ^ 3_u32) & 1_u32));
    println!(identity(0_u32 & observed()));
}

How to read this page