forked from verus-lang/verus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecommends.rs
More file actions
67 lines (55 loc) · 1.55 KB
/
recommends.rs
File metadata and controls
67 lines (55 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#![feature(rustc_private)]
#[macro_use]
mod common;
use common::*;
test_verify_one_file! {
#[test] ensures_forall_recommends_failure verus_code! {
spec fn foo(i: int) -> bool
recommends 0 <= i < 5,
{
i + 3 == 20
}
proof fn some_proof()
ensures forall |i: int| 0 <= i < 20 ==> foo(i), // FAILS
{
}
} => Err(e) => assert_one_fails(e)
}
test_verify_one_file! {
#[test] ensures_type_substitutes_issue1566 verus_code! {
use vstd::*;
use vstd::seq::*;
struct W { }
spec fn bar(w: W) -> bool
recommends false
{ true }
struct X { }
trait Tr<Key> {
spec fn trait_fn(s: Seq<u8>) -> Option<Key>;
}
struct Implementor<T> { t: T }
impl<S> Tr<S> for Implementor<S> {
uninterp spec fn trait_fn(s: Seq<u8>) -> Option<S>;
}
trait SecondTrait<R, Kv: Tr<R>> {
proof fn proof_trait_fn()
ensures
forall|s: Seq<u8>|
#![trigger Kv::trait_fn(s)]
{
&&& Kv::trait_fn(s) matches Some(x)
&&& {
exists |w| bar(w)
}
};
}
struct Y<Z> { z: Z }
impl<K> SecondTrait<K, Implementor<K>> for Y<K> {
proof fn proof_trait_fn() {
return; // FAILS
}
}
} => Err(e) => {
assert_one_fails(e);
}
}