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 / remainder

remainder
LineCoverageSource
407N/A(let expr = Expr::bin_op(lhs, BinOpKind::Rem, rhs))
4082(borrow_check_expr(env, assumptions, state, expr, places_live_on_exit) => (ty, state))
──────── ("remainder")
41011(borrow_check_expr(env, assumptions, state, Expr::Rem { lhs, rhs }, places_live_on_exit) => (ty, state))

11 tests exercised this rule:


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

fn main() -> () {
    println!(7_i32 % 3_i32);
}
Proof tree
… (200 of 1301 nodes shown)

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

fn main() -> () {
    println!(-7_i32 % 3_i32);
    println!(7_i32 % -3_i32);
    println!(-7_i32 % -3_i32);
}
Proof tree
… (200 of 1327 nodes shown)

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

fn main() -> () {
    println!(13_u32 % 3_u32);
    println!(2_u32 % 7_u32);
}
Proof tree
… (200 of 1314 nodes shown)

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

fn main() -> () {
    println!(10_i32 + 7_i32 % 4_i32);
    println!(7_i32 % 4_i32 + 10_i32);
    println!(20_i32 - 7_i32 % 4_i32);
}
Proof tree
… (200 of 1354 nodes shown)

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

fn main() -> () {
    println!(10_i32 % 4_i32 % 3_i32);
}
Proof tree
… (200 of 1311 nodes shown)

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

fn main() -> () {
    println!(3_i32 * 7_i32 % 4_i32);
    println!(7_i32 % 4_i32 * 3_i32);
}
Proof tree
… (200 of 1334 nodes shown)

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

fn main() -> () {
    println!(10_i32 % (4_i32 % 3_i32));
    println!((10_i32 + 7_i32) % 4_i32);
}
Proof tree
… (200 of 1335 nodes shown)

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

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

panics on these; MiniRust reports them as undefined behavior.
 #543: assert a defined abort instead of accepting the MiniRust UB diagnostic.
#[test]
_panic(expected = "modulus of remainder is zero")]
er_remainder_by_zero() {
alityTest::new(crates![crate Foo {
fn main() -> () {
    println!(7_i32 % 0_i32);
}
Proof tree
… (200 of 1369 nodes shown)

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

fn main() -> () {
    println!(7_i32 % 0_i32);
}
Proof tree
… (200 of 1301 nodes shown)

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

fn main() -> () {
    println!(-2147483648_i32 % -1_i32);
}
Proof tree
… (200 of 1301 nodes shown)

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

fn main() -> () {
    println!(340282366920938463463374607431768211455_u128 % 2_u128);
    println!(-170141183460469231731687303715884105728_i128 % 3_i128);
    let x: u32 = 7_u32;
    exists<'a> {
        let r: &'a mut u32 = &'a mut x;
        println!(*r % x);
    }
}

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


How to read this page