We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f164624 commit 45a5f09Copy full SHA for 45a5f09
1 file changed
tests/ui/pass/annot_preds_raw_define_multi.rs
@@ -0,0 +1,36 @@
1
+//@check-pass
2
+//@compile-flags: -Adead_code -C debug-assertions=off
3
+
4
+#![feature(custom_inner_attributes)]
5
+#![thrust::raw_define("(define-fun is_double ((x Int) (doubled_x Int)) Bool
6
+ (=
7
+ (* x 2)
8
+ doubled_x
9
+ )
10
+)")]
11
12
+#![thrust::raw_define("(define-fun is_triple ((x Int) (tripled_x Int)) Bool
13
14
+ (* x 3)
15
+ tripled_x
16
17
18
19
+#[thrust::requires(true)]
20
+#[thrust::ensures(is_double(x, result))]
21
+fn double(x: i64) -> i64 {
22
+ x + x
23
+}
24
25
+#[thrust::require(is_double(x, doubled_x))]
26
+#[thrust::ensures(is_triple(x, result))]
27
+fn triple(x: i64, doubled_x: i64) -> i64 {
28
+ x + doubled_x
29
30
31
+fn main() {
32
+ let a = 3;
33
+ let double_a = double(a);
34
+ assert!(double_a == 6);
35
+ assert!(triple(a, double_a) == 9);
36
0 commit comments