Open
Description
I tried this code:
#[ensures(|result| result.as_usize().is_power_of_two())]
pub const fn Align_of<T>() -> Self {
// This can't actually panic since type alignment is always a power of two.
const { Alignment::new(mem::align_of::<T>()).unwrap() }
}
#[kani::proof_for_contract(Alignment::of)]
pub fn check_of_i32() {
let _ = Align_of::<i32>();
}
and
#[kani::proof]
pub fn check_of_i32() {
let a = Align_of::<i32>();
assert!(a.as_usize().is_power_of_two());
}
using the following command line invocation:
kani src/main.rs -Z function-contracts
with Kani version: 0.59.0
I expected to see this happen: The same results for both harnesses.
Instead, this happened: The kani::proof_for_contract failed but the kani::proof succeed