Using the snap function in normal code does not always cause a compiler error like in the first function. The second function causes Prusti to crash:
use prusti_contracts::*;
// This function does not cause a verification failure:
fn _test_should_fail(v: &u64) -> u64 {
let s = snap(v);
let x = s + 1;
x
}
// This function causes an internal error:
fn _test_internal_error(v: &u64) {
let s = snap(v);
prusti_assert!(&s === v);
}
thread 'rustc' panicked at 'internal error: entered unreachable code', prusti-viper\src\encoder\foldunfold\requirements.rs:449:38
The panicking code is here
Using the
snapfunction in normal code does not always cause a compiler error like in the first function. The second function causes Prusti to crash:The panicking code is here