Skip to content

Commit

Permalink
do not attempt a recommends check if the primary query/ies timed out (f…
Browse files Browse the repository at this point in the history
…ixes #1412)

it is confusing to the user, and it may pollute the profiler information
  • Loading branch information
utaal committed Jan 27, 2025
1 parent a8a3ce3 commit 8d7ba77
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 32 deletions.
60 changes: 30 additions & 30 deletions source/rust_verify/example/playground.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,39 @@ use builtin_macros::*;

verus! {

#[derive(PartialEq, Eq, Structural)]
struct S<A> {
a: A,
b: bool,
}

fn add1(a: &mut u32)
requires
*old(a) < 10,
ensures
*a == *old(a) + 1,
{
*a = *a + 1;
}

fn foo(s: S<u32>) {
// let mut s = s;
let mut s = S { a: 5, b: false };
add1(&mut s.a);
assert(s.a == 6);
assert(s.b == false);
assert(s == S { a: 6u32, b: false });
}
// #[derive(PartialEq, Eq, Structural)]
// struct S<A> {
// a: A,
// b: bool,
// }
//
// fn add1(a: &mut u32)
// requires
// *old(a) < 10,
// ensures
// *a == *old(a) + 1,
// {
// *a = *a + 1;
// }
//
// fn foo(s: S<u32>) {
// // let mut s = s;
// let mut s = S { a: 5, b: false };
// add1(&mut s.a);
// assert(s.a == 6);
// assert(s.b == false);
// assert(s == S { a: 6u32, b: false });
// }

// The following causes a trigger loop (useful for testing rlimit-related features):
//
// spec fn f(x: nat, y: nat) -> bool;
//
// proof fn goodbye_z3()
// requires forall|x: nat, y: nat| f(x + 1, 2 * y) && f(2 * x, y + x) || f(y, x) ==> (#[trigger] f(x, y)),
// ensures forall|x: nat, y: nat| x > 2318 && y < 100 ==> f(x, y),
// {
// }
spec fn f(x: nat, y: nat) -> bool;

proof fn goodbye_z3()
requires forall|x: nat, y: nat| f(x + 1, 2 * y) && f(2 * x, y + x) || f(y, x) ==> (#[trigger] f(x, y)),
ensures forall|x: nat, y: nat| x > 2318 && y < 100 ==> f(x, y),
{
}
fn main() {
}

Expand Down
8 changes: 6 additions & 2 deletions source/rust_verify/src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1744,7 +1744,9 @@ impl Verifier {
}

if matches!(query_op, QueryOp::Body(Style::Normal)) {
if (any_invalid && !self.args.no_auto_recommends_check)
if (any_invalid
&& !self.args.no_auto_recommends_check
&& !any_timed_out)
|| function.x.attrs.check_recommends
{
function_opgen.retry_with_recommends(&op, any_invalid)?;
Expand Down Expand Up @@ -1772,7 +1774,9 @@ impl Verifier {
}

if matches!(query_op, QueryOp::SpecTermination) {
if (any_invalid && !self.args.no_auto_recommends_check)
if (any_invalid
&& !self.args.no_auto_recommends_check
&& !any_timed_out)
|| function.x.attrs.check_recommends
{
// Do recommends-checking for the body of the function.
Expand Down

0 comments on commit 8d7ba77

Please sign in to comment.