prusti-dev
prusti-dev copied to clipboard
Overflow checks for division and remainder even when disabled
Even when the overflow checks are disabled (check_overflows = false is set),
#[requires(b != 0)]
fn do_div(a: i32, b: i32) -> i32 {
a / b
}
and
#[requires(b != 0)]
fn do_rem(a: i32, b: i32) -> i32 {
a % b
}
fail to verify with
error: [Prusti: verification error] assertion might fail with "attempt to divide with overflow"
and
error: [Prusti: verification error] assertion might fail with "attempt to calculate the remainder with overflow"
respectively.