Skip to content

Commit 2ada3dd

Browse files
committed
Replace annotations in some test cases with thrust_macros
1 parent 7d38373 commit 2ada3dd

9 files changed

Lines changed: 33 additions & 18 deletions

tests/ui/fail/annot_enum_simple.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ pub enum X {
55
B(bool),
66
}
77

8-
#[thrust::requires(x == X::A(1))]
9-
#[thrust::ensures(true)]
8+
impl thrust_models::Model for X {
9+
type Ty = X;
10+
}
11+
12+
#[thrust_macros::requires(x == X::A(1))]
13+
#[thrust_macros::ensures(true)]
1014
fn test(x: X) {
1115
if let X::A(i) = x {
1216
assert!(i == 2);

tests/ui/fail/annot_exists.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
//@compile-flags: -C debug-assertions=off
33
//@rustc-env: THRUST_SOLVER=tests/thrust-pcsat-wrapper
44

5+
use thrust_models::exists;
6+
57
#[thrust::trusted]
68
#[thrust::callable]
79
fn rand() -> i32 { unimplemented!() }
810

9-
#[thrust::requires(true)]
10-
#[thrust::ensures(exists x:int. result == 2 * x)]
11+
#[thrust_macros::requires(true)]
12+
#[thrust_macros::ensures(exists(|x: i32| result == 2 * x))]
1113
fn f() -> i32 {
1214
let x = rand();
1315
x + x + x

tests/ui/fail/annot_mut_term.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
//@error-in-other-file: Unsat
22

3-
#[thrust::requires(true)]
4-
#[thrust::ensures(x == <*x, y>)]
3+
use thrust_models::model::Mut;
4+
5+
#[thrust_macros::requires(true)]
6+
#[thrust_macros::ensures(x == Mut::new(*x, y))]
57
fn f(x: &mut i64, y: i64) {
68
*x = y;
79
}

tests/ui/fail/tuple_annot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//@error-in-other-file: Unsat
22
//@compile-flags: -C debug-assertions=off
33

4-
#[thrust::requires(true)]
5-
#[thrust::ensures(^x == ((*x).1, (*x).1))]
4+
#[thrust_macros::requires(true)]
5+
#[thrust_macros::ensures(!x == ((*x).1, (*x).1))]
66
fn swap_tuple(x: &mut (i32, i32)) {
77
let v = *x;
88
*x = (v.1, v.0);

tests/ui/pass/annot_enum_simple.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ pub enum X {
55
B(bool),
66
}
77

8-
#[thrust::requires(x == X::A(1))]
9-
#[thrust::ensures(true)]
8+
impl thrust_models::Model for X {
9+
type Ty = X;
10+
}
11+
12+
#[thrust_macros::requires(x == X::A(1))]
13+
#[thrust_macros::ensures(true)]
1014
fn test(x: X) {
1115
if let X::A(i) = x {
1216
assert!(i == 1);

tests/ui/pass/annot_exists.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
//@compile-flags: -C debug-assertions=off
33
//@rustc-env: THRUST_SOLVER=tests/thrust-pcsat-wrapper
44

5+
use thrust_models::exists;
6+
57
#[thrust::trusted]
68
#[thrust::callable]
79
fn rand() -> i32 { unimplemented!() }
810

9-
#[thrust::requires(true)]
10-
#[thrust::ensures(exists x:int. result == 2 * x)]
11+
#[thrust_macros::requires(true)]
12+
#[thrust_macros::ensures(exists(|x: i32| result == 2 * x))]
1113
fn f() -> i32 {
1214
let x = rand();
1315
x + x

tests/ui/pass/annot_mut_term.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
//@check-pass
22

3-
#[thrust::requires(true)]
4-
#[thrust::ensures(x == <*x, y>)]
3+
use thrust_models::model::Mut;
4+
5+
#[thrust_macros::requires(true)]
6+
#[thrust_macros::ensures(x == Mut::new(*x, y))]
57
fn f(x: &mut i64, y: i64) {
68
*x = y;
79
}

tests/ui/pass/take_max_annot.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//@check-pass
22
//@compile-flags: -C debug-assertions=off
33

4-
#[thrust::requires(true)]
5-
#[thrust::ensures(true)]
64
#[thrust::trusted]
5+
#[thrust::callable]
76
fn rand() -> i64 { unimplemented!() }
87

98
#[thrust::requires(true)]

tests/ui/pass/tuple_annot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//@check-pass
22
//@compile-flags: -C debug-assertions=off
33

4-
#[thrust::requires(true)]
5-
#[thrust::ensures(^x == ((*x).1, (*x).0))]
4+
#[thrust_macros::requires(true)]
5+
#[thrust_macros::ensures(^x == ((*x).1, (*x).0))]
66
fn swap_tuple(x: &mut (i32, i32)) {
77
let v = *x;
88
*x = (v.1, v.0);

0 commit comments

Comments
 (0)