diff options
Diffstat (limited to 'tests/fstar/misc')
-rw-r--r-- | tests/fstar/misc/Bitwise.fst | 10 | ||||
-rw-r--r-- | tests/fstar/misc/Constants.fst | 62 | ||||
-rw-r--r-- | tests/fstar/misc/External.Funs.fst | 4 | ||||
-rw-r--r-- | tests/fstar/misc/InfiniteLoop.fst | 24 | ||||
-rw-r--r-- | tests/fstar/misc/Issue194RecursiveStructProjector.fst | 24 | ||||
-rw-r--r-- | tests/fstar/misc/Loops.Clauses.Template.fst | 46 | ||||
-rw-r--r-- | tests/fstar/misc/Loops.Funs.fst | 96 | ||||
-rw-r--r-- | tests/fstar/misc/Loops.Types.fst | 2 | ||||
-rw-r--r-- | tests/fstar/misc/Matches.fst | 12 | ||||
-rw-r--r-- | tests/fstar/misc/NoNestedBorrows.fst | 128 | ||||
-rw-r--r-- | tests/fstar/misc/Paper.fst | 18 | ||||
-rw-r--r-- | tests/fstar/misc/PoloniusList.fst | 4 |
12 files changed, 245 insertions, 185 deletions
diff --git a/tests/fstar/misc/Bitwise.fst b/tests/fstar/misc/Bitwise.fst index b17c9233..7945e142 100644 --- a/tests/fstar/misc/Bitwise.fst +++ b/tests/fstar/misc/Bitwise.fst @@ -6,27 +6,27 @@ open Primitives #set-options "--z3rlimit 50 --fuel 1 --ifuel 1" (** [bitwise::shift_u32]: - Source: 'tests/src/bitwise.rs', lines 3:0-3:31 *) + Source: 'tests/src/bitwise.rs', lines 5:0-5:31 *) let shift_u32 (a : u32) : result u32 = let* t = u32_shr #Usize a 16 in u32_shl #Usize t 16 (** [bitwise::shift_i32]: - Source: 'tests/src/bitwise.rs', lines 10:0-10:31 *) + Source: 'tests/src/bitwise.rs', lines 12:0-12:31 *) let shift_i32 (a : i32) : result i32 = let* t = i32_shr #Isize a 16 in i32_shl #Isize t 16 (** [bitwise::xor_u32]: - Source: 'tests/src/bitwise.rs', lines 17:0-17:37 *) + Source: 'tests/src/bitwise.rs', lines 19:0-19:37 *) let xor_u32 (a : u32) (b : u32) : result u32 = Ok (u32_xor a b) (** [bitwise::or_u32]: - Source: 'tests/src/bitwise.rs', lines 21:0-21:36 *) + Source: 'tests/src/bitwise.rs', lines 23:0-23:36 *) let or_u32 (a : u32) (b : u32) : result u32 = Ok (u32_or a b) (** [bitwise::and_u32]: - Source: 'tests/src/bitwise.rs', lines 25:0-25:37 *) + Source: 'tests/src/bitwise.rs', lines 27:0-27:37 *) let and_u32 (a : u32) (b : u32) : result u32 = Ok (u32_and a b) diff --git a/tests/fstar/misc/Constants.fst b/tests/fstar/misc/Constants.fst index 78562ae1..1d72f5ff 100644 --- a/tests/fstar/misc/Constants.fst +++ b/tests/fstar/misc/Constants.fst @@ -6,154 +6,154 @@ open Primitives #set-options "--z3rlimit 50 --fuel 1 --ifuel 1" (** [constants::X0] - Source: 'tests/src/constants.rs', lines 5:0-5:17 *) + Source: 'tests/src/constants.rs', lines 8:0-8:17 *) let x0_body : result u32 = Ok 0 let x0 : u32 = eval_global x0_body (** [constants::X1] - Source: 'tests/src/constants.rs', lines 7:0-7:17 *) + Source: 'tests/src/constants.rs', lines 10:0-10:17 *) let x1_body : result u32 = Ok core_u32_max let x1 : u32 = eval_global x1_body (** [constants::X2] - Source: 'tests/src/constants.rs', lines 10:0-10:17 *) + Source: 'tests/src/constants.rs', lines 13:0-13:17 *) let x2_body : result u32 = Ok 3 let x2 : u32 = eval_global x2_body (** [constants::incr]: - Source: 'tests/src/constants.rs', lines 17:0-17:32 *) + Source: 'tests/src/constants.rs', lines 20:0-20:32 *) let incr (n : u32) : result u32 = u32_add n 1 (** [constants::X3] - Source: 'tests/src/constants.rs', lines 15:0-15:17 *) + Source: 'tests/src/constants.rs', lines 18:0-18:17 *) let x3_body : result u32 = incr 32 let x3 : u32 = eval_global x3_body (** [constants::mk_pair0]: - Source: 'tests/src/constants.rs', lines 23:0-23:51 *) + Source: 'tests/src/constants.rs', lines 26:0-26:51 *) let mk_pair0 (x : u32) (y1 : u32) : result (u32 & u32) = Ok (x, y1) (** [constants::Pair] - Source: 'tests/src/constants.rs', lines 36:0-36:23 *) + Source: 'tests/src/constants.rs', lines 39:0-39:23 *) type pair_t (t1 t2 : Type0) = { x : t1; y : t2; } (** [constants::mk_pair1]: - Source: 'tests/src/constants.rs', lines 27:0-27:55 *) + Source: 'tests/src/constants.rs', lines 30:0-30:55 *) let mk_pair1 (x : u32) (y1 : u32) : result (pair_t u32 u32) = Ok { x = x; y = y1 } (** [constants::P0] - Source: 'tests/src/constants.rs', lines 31:0-31:24 *) + Source: 'tests/src/constants.rs', lines 34:0-34:24 *) let p0_body : result (u32 & u32) = mk_pair0 0 1 let p0 : (u32 & u32) = eval_global p0_body (** [constants::P1] - Source: 'tests/src/constants.rs', lines 32:0-32:28 *) + Source: 'tests/src/constants.rs', lines 35:0-35:28 *) let p1_body : result (pair_t u32 u32) = mk_pair1 0 1 let p1 : pair_t u32 u32 = eval_global p1_body (** [constants::P2] - Source: 'tests/src/constants.rs', lines 33:0-33:24 *) + Source: 'tests/src/constants.rs', lines 36:0-36:24 *) let p2_body : result (u32 & u32) = Ok (0, 1) let p2 : (u32 & u32) = eval_global p2_body (** [constants::P3] - Source: 'tests/src/constants.rs', lines 34:0-34:28 *) + Source: 'tests/src/constants.rs', lines 37:0-37:28 *) let p3_body : result (pair_t u32 u32) = Ok { x = 0; y = 1 } let p3 : pair_t u32 u32 = eval_global p3_body (** [constants::Wrap] - Source: 'tests/src/constants.rs', lines 49:0-49:18 *) + Source: 'tests/src/constants.rs', lines 52:0-52:18 *) type wrap_t (t : Type0) = { value : t; } (** [constants::{constants::Wrap<T>}::new]: - Source: 'tests/src/constants.rs', lines 54:4-54:41 *) + Source: 'tests/src/constants.rs', lines 57:4-57:41 *) let wrap_new (t : Type0) (value : t) : result (wrap_t t) = Ok { value = value } (** [constants::Y] - Source: 'tests/src/constants.rs', lines 41:0-41:22 *) + Source: 'tests/src/constants.rs', lines 44:0-44:22 *) let y_body : result (wrap_t i32) = wrap_new i32 2 let y : wrap_t i32 = eval_global y_body (** [constants::unwrap_y]: - Source: 'tests/src/constants.rs', lines 43:0-43:30 *) + Source: 'tests/src/constants.rs', lines 46:0-46:30 *) let unwrap_y : result i32 = Ok y.value (** [constants::YVAL] - Source: 'tests/src/constants.rs', lines 47:0-47:19 *) + Source: 'tests/src/constants.rs', lines 50:0-50:19 *) let yval_body : result i32 = unwrap_y let yval : i32 = eval_global yval_body (** [constants::get_z1::Z1] - Source: 'tests/src/constants.rs', lines 62:4-62:17 *) + Source: 'tests/src/constants.rs', lines 65:4-65:17 *) let get_z1_z1_body : result i32 = Ok 3 let get_z1_z1 : i32 = eval_global get_z1_z1_body (** [constants::get_z1]: - Source: 'tests/src/constants.rs', lines 61:0-61:28 *) + Source: 'tests/src/constants.rs', lines 64:0-64:28 *) let get_z1 : result i32 = Ok get_z1_z1 (** [constants::add]: - Source: 'tests/src/constants.rs', lines 66:0-66:39 *) + Source: 'tests/src/constants.rs', lines 69:0-69:39 *) let add (a : i32) (b : i32) : result i32 = i32_add a b (** [constants::Q1] - Source: 'tests/src/constants.rs', lines 74:0-74:17 *) + Source: 'tests/src/constants.rs', lines 77:0-77:17 *) let q1_body : result i32 = Ok 5 let q1 : i32 = eval_global q1_body (** [constants::Q2] - Source: 'tests/src/constants.rs', lines 75:0-75:17 *) + Source: 'tests/src/constants.rs', lines 78:0-78:17 *) let q2_body : result i32 = Ok q1 let q2 : i32 = eval_global q2_body (** [constants::Q3] - Source: 'tests/src/constants.rs', lines 76:0-76:17 *) + Source: 'tests/src/constants.rs', lines 79:0-79:17 *) let q3_body : result i32 = add q2 3 let q3 : i32 = eval_global q3_body (** [constants::get_z2]: - Source: 'tests/src/constants.rs', lines 70:0-70:28 *) + Source: 'tests/src/constants.rs', lines 73:0-73:28 *) let get_z2 : result i32 = let* i = get_z1 in let* i1 = add i q3 in add q1 i1 (** [constants::S1] - Source: 'tests/src/constants.rs', lines 80:0-80:18 *) + Source: 'tests/src/constants.rs', lines 83:0-83:18 *) let s1_body : result u32 = Ok 6 let s1 : u32 = eval_global s1_body (** [constants::S2] - Source: 'tests/src/constants.rs', lines 81:0-81:18 *) + Source: 'tests/src/constants.rs', lines 84:0-84:18 *) let s2_body : result u32 = incr s1 let s2 : u32 = eval_global s2_body (** [constants::S3] - Source: 'tests/src/constants.rs', lines 82:0-82:29 *) + Source: 'tests/src/constants.rs', lines 85:0-85:29 *) let s3_body : result (pair_t u32 u32) = Ok p3 let s3 : pair_t u32 u32 = eval_global s3_body (** [constants::S4] - Source: 'tests/src/constants.rs', lines 83:0-83:29 *) + Source: 'tests/src/constants.rs', lines 86:0-86:29 *) let s4_body : result (pair_t u32 u32) = mk_pair1 7 8 let s4 : pair_t u32 u32 = eval_global s4_body (** [constants::V] - Source: 'tests/src/constants.rs', lines 86:0-86:31 *) + Source: 'tests/src/constants.rs', lines 89:0-89:31 *) type v_t (t : Type0) (n : usize) = { x : array t n; } (** [constants::{constants::V<T, N>#1}::LEN] - Source: 'tests/src/constants.rs', lines 91:4-91:24 *) + Source: 'tests/src/constants.rs', lines 94:4-94:24 *) let v_len_body (t : Type0) (n : usize) : result usize = Ok n let v_len (t : Type0) (n : usize) : usize = eval_global (v_len_body t n) (** [constants::use_v]: - Source: 'tests/src/constants.rs', lines 94:0-94:42 *) + Source: 'tests/src/constants.rs', lines 97:0-97:42 *) let use_v (t : Type0) (n : usize) : result usize = Ok (v_len t n) diff --git a/tests/fstar/misc/External.Funs.fst b/tests/fstar/misc/External.Funs.fst index 5a7a9f32..f5e8d4b7 100644 --- a/tests/fstar/misc/External.Funs.fst +++ b/tests/fstar/misc/External.Funs.fst @@ -15,12 +15,12 @@ let core_marker_CopyU32 : core_marker_Copy_t u32 = { } (** [external::use_get]: - Source: 'tests/src/external.rs', lines 5:0-5:37 *) + Source: 'tests/src/external.rs', lines 9:0-9:37 *) let use_get (rc : core_cell_Cell_t u32) (st : state) : result (state & u32) = core_cell_Cell_get u32 core_marker_CopyU32 rc st (** [external::incr]: - Source: 'tests/src/external.rs', lines 9:0-9:31 *) + Source: 'tests/src/external.rs', lines 13:0-13:31 *) let incr (rc : core_cell_Cell_t u32) (st : state) : result (state & (core_cell_Cell_t u32)) diff --git a/tests/fstar/misc/InfiniteLoop.fst b/tests/fstar/misc/InfiniteLoop.fst new file mode 100644 index 00000000..4e7c8c06 --- /dev/null +++ b/tests/fstar/misc/InfiniteLoop.fst @@ -0,0 +1,24 @@ +(** THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS *) +(** [infinite_loop] *) +module InfiniteLoop +open Primitives + +#set-options "--z3rlimit 50 --fuel 1 --ifuel 1" + +(** [infinite_loop::bar]: + Source: 'tests/src/infinite-loop.rs', lines 4:0-4:8 *) +let bar : result unit = + Ok () + +(** [infinite_loop::foo]: loop 0: + Source: 'tests/src/infinite-loop.rs', lines 6:0-10:1 *) +let rec foo_loop (n : nat) : result unit = + if is_zero n + then Fail OutOfFuel + else let n1 = decrease n in let* _ = bar in foo_loop n1 + +(** [infinite_loop::foo]: + Source: 'tests/src/infinite-loop.rs', lines 6:0-6:8 *) +let foo (n : nat) : result unit = + foo_loop n + diff --git a/tests/fstar/misc/Issue194RecursiveStructProjector.fst b/tests/fstar/misc/Issue194RecursiveStructProjector.fst new file mode 100644 index 00000000..76368f04 --- /dev/null +++ b/tests/fstar/misc/Issue194RecursiveStructProjector.fst @@ -0,0 +1,24 @@ +(** THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS *) +(** [issue_194_recursive_struct_projector] *) +module Issue194RecursiveStructProjector +open Primitives + +#set-options "--z3rlimit 50 --fuel 1 --ifuel 1" + +(** [issue_194_recursive_struct_projector::AVLNode] + Source: 'tests/src/issue-194-recursive-struct-projector.rs', lines 2:0-2:17 *) +type aVLNode_t (t : Type0) = +{ + value : t; left : option (aVLNode_t t); right : option (aVLNode_t t); +} + +(** [issue_194_recursive_struct_projector::get_val]: + Source: 'tests/src/issue-194-recursive-struct-projector.rs', lines 10:0-10:33 *) +let get_val (t : Type0) (x : aVLNode_t t) : result t = + Ok x.value + +(** [issue_194_recursive_struct_projector::get_left]: + Source: 'tests/src/issue-194-recursive-struct-projector.rs', lines 14:0-14:43 *) +let get_left (t : Type0) (x : aVLNode_t t) : result (option (aVLNode_t t)) = + Ok x.left + diff --git a/tests/fstar/misc/Loops.Clauses.Template.fst b/tests/fstar/misc/Loops.Clauses.Template.fst index 77f9c3e4..5d450275 100644 --- a/tests/fstar/misc/Loops.Clauses.Template.fst +++ b/tests/fstar/misc/Loops.Clauses.Template.fst @@ -7,144 +7,144 @@ open Loops.Types #set-options "--z3rlimit 50 --fuel 1 --ifuel 1" (** [loops::sum]: decreases clause - Source: 'tests/src/loops.rs', lines 4:0-14:1 *) + Source: 'tests/src/loops.rs', lines 8:0-18:1 *) unfold let sum_loop_decreases (max : u32) (i : u32) (s : u32) : nat = admit () (** [loops::sum_with_mut_borrows]: decreases clause - Source: 'tests/src/loops.rs', lines 19:0-31:1 *) + Source: 'tests/src/loops.rs', lines 23:0-35:1 *) unfold let sum_with_mut_borrows_loop_decreases (max : u32) (i : u32) (s : u32) : nat = admit () (** [loops::sum_with_shared_borrows]: decreases clause - Source: 'tests/src/loops.rs', lines 34:0-48:1 *) + Source: 'tests/src/loops.rs', lines 38:0-52:1 *) unfold let sum_with_shared_borrows_loop_decreases (max : u32) (i : u32) (s : u32) : nat = admit () (** [loops::sum_array]: decreases clause - Source: 'tests/src/loops.rs', lines 50:0-58:1 *) + Source: 'tests/src/loops.rs', lines 54:0-62:1 *) unfold let sum_array_loop_decreases (n : usize) (a : array u32 n) (i : usize) (s : u32) : nat = admit () (** [loops::clear]: decreases clause - Source: 'tests/src/loops.rs', lines 62:0-68:1 *) + Source: 'tests/src/loops.rs', lines 66:0-72:1 *) unfold let clear_loop_decreases (v : alloc_vec_Vec u32) (i : usize) : nat = admit () (** [loops::list_mem]: decreases clause - Source: 'tests/src/loops.rs', lines 76:0-85:1 *) + Source: 'tests/src/loops.rs', lines 80:0-89:1 *) unfold let list_mem_loop_decreases (x : u32) (ls : list_t u32) : nat = admit () (** [loops::list_nth_mut_loop]: decreases clause - Source: 'tests/src/loops.rs', lines 88:0-98:1 *) + Source: 'tests/src/loops.rs', lines 92:0-102:1 *) unfold let list_nth_mut_loop_loop_decreases (t : Type0) (ls : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_shared_loop]: decreases clause - Source: 'tests/src/loops.rs', lines 101:0-111:1 *) + Source: 'tests/src/loops.rs', lines 105:0-115:1 *) unfold let list_nth_shared_loop_loop_decreases (t : Type0) (ls : list_t t) (i : u32) : nat = admit () (** [loops::get_elem_mut]: decreases clause - Source: 'tests/src/loops.rs', lines 113:0-127:1 *) + Source: 'tests/src/loops.rs', lines 117:0-131:1 *) unfold let get_elem_mut_loop_decreases (x : usize) (ls : list_t usize) : nat = admit () (** [loops::get_elem_shared]: decreases clause - Source: 'tests/src/loops.rs', lines 129:0-143:1 *) + Source: 'tests/src/loops.rs', lines 133:0-147:1 *) unfold let get_elem_shared_loop_decreases (x : usize) (ls : list_t usize) : nat = admit () (** [loops::list_nth_mut_loop_with_id]: decreases clause - Source: 'tests/src/loops.rs', lines 154:0-165:1 *) + Source: 'tests/src/loops.rs', lines 158:0-169:1 *) unfold let list_nth_mut_loop_with_id_loop_decreases (t : Type0) (i : u32) (ls : list_t t) : nat = admit () (** [loops::list_nth_shared_loop_with_id]: decreases clause - Source: 'tests/src/loops.rs', lines 168:0-179:1 *) + Source: 'tests/src/loops.rs', lines 172:0-183:1 *) unfold let list_nth_shared_loop_with_id_loop_decreases (t : Type0) (i : u32) (ls : list_t t) : nat = admit () (** [loops::list_nth_mut_loop_pair]: decreases clause - Source: 'tests/src/loops.rs', lines 184:0-205:1 *) + Source: 'tests/src/loops.rs', lines 188:0-209:1 *) unfold let list_nth_mut_loop_pair_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_shared_loop_pair]: decreases clause - Source: 'tests/src/loops.rs', lines 208:0-229:1 *) + Source: 'tests/src/loops.rs', lines 212:0-233:1 *) unfold let list_nth_shared_loop_pair_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_mut_loop_pair_merge]: decreases clause - Source: 'tests/src/loops.rs', lines 233:0-248:1 *) + Source: 'tests/src/loops.rs', lines 237:0-252:1 *) unfold let list_nth_mut_loop_pair_merge_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_shared_loop_pair_merge]: decreases clause - Source: 'tests/src/loops.rs', lines 251:0-266:1 *) + Source: 'tests/src/loops.rs', lines 255:0-270:1 *) unfold let list_nth_shared_loop_pair_merge_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_mut_shared_loop_pair]: decreases clause - Source: 'tests/src/loops.rs', lines 269:0-284:1 *) + Source: 'tests/src/loops.rs', lines 273:0-288:1 *) unfold let list_nth_mut_shared_loop_pair_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_mut_shared_loop_pair_merge]: decreases clause - Source: 'tests/src/loops.rs', lines 288:0-303:1 *) + Source: 'tests/src/loops.rs', lines 292:0-307:1 *) unfold let list_nth_mut_shared_loop_pair_merge_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_shared_mut_loop_pair]: decreases clause - Source: 'tests/src/loops.rs', lines 307:0-322:1 *) + Source: 'tests/src/loops.rs', lines 311:0-326:1 *) unfold let list_nth_shared_mut_loop_pair_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = admit () (** [loops::list_nth_shared_mut_loop_pair_merge]: decreases clause - Source: 'tests/src/loops.rs', lines 326:0-341:1 *) + Source: 'tests/src/loops.rs', lines 330:0-345:1 *) unfold let list_nth_shared_mut_loop_pair_merge_loop_decreases (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : nat = admit () (** [loops::ignore_input_mut_borrow]: decreases clause - Source: 'tests/src/loops.rs', lines 345:0-349:1 *) + Source: 'tests/src/loops.rs', lines 349:0-353:1 *) unfold let ignore_input_mut_borrow_loop_decreases (i : u32) : nat = admit () (** [loops::incr_ignore_input_mut_borrow]: decreases clause - Source: 'tests/src/loops.rs', lines 353:0-358:1 *) + Source: 'tests/src/loops.rs', lines 357:0-362:1 *) unfold let incr_ignore_input_mut_borrow_loop_decreases (i : u32) : nat = admit () (** [loops::ignore_input_shared_borrow]: decreases clause - Source: 'tests/src/loops.rs', lines 362:0-366:1 *) + Source: 'tests/src/loops.rs', lines 366:0-370:1 *) unfold let ignore_input_shared_borrow_loop_decreases (i : u32) : nat = admit () diff --git a/tests/fstar/misc/Loops.Funs.fst b/tests/fstar/misc/Loops.Funs.fst index 0eafeebb..05e77046 100644 --- a/tests/fstar/misc/Loops.Funs.fst +++ b/tests/fstar/misc/Loops.Funs.fst @@ -8,7 +8,7 @@ include Loops.Clauses #set-options "--z3rlimit 50 --fuel 1 --ifuel 1" (** [loops::sum]: loop 0: - Source: 'tests/src/loops.rs', lines 4:0-14:1 *) + Source: 'tests/src/loops.rs', lines 8:0-18:1 *) let rec sum_loop (max : u32) (i : u32) (s : u32) : Tot (result u32) (decreases (sum_loop_decreases max i s)) @@ -18,12 +18,12 @@ let rec sum_loop else u32_mul s 2 (** [loops::sum]: - Source: 'tests/src/loops.rs', lines 4:0-4:27 *) + Source: 'tests/src/loops.rs', lines 8:0-8:27 *) let sum (max : u32) : result u32 = sum_loop max 0 0 (** [loops::sum_with_mut_borrows]: loop 0: - Source: 'tests/src/loops.rs', lines 19:0-31:1 *) + Source: 'tests/src/loops.rs', lines 23:0-35:1 *) let rec sum_with_mut_borrows_loop (max : u32) (i : u32) (s : u32) : Tot (result u32) (decreases (sum_with_mut_borrows_loop_decreases max i s)) @@ -36,12 +36,12 @@ let rec sum_with_mut_borrows_loop else u32_mul s 2 (** [loops::sum_with_mut_borrows]: - Source: 'tests/src/loops.rs', lines 19:0-19:44 *) + Source: 'tests/src/loops.rs', lines 23:0-23:44 *) let sum_with_mut_borrows (max : u32) : result u32 = sum_with_mut_borrows_loop max 0 0 (** [loops::sum_with_shared_borrows]: loop 0: - Source: 'tests/src/loops.rs', lines 34:0-48:1 *) + Source: 'tests/src/loops.rs', lines 38:0-52:1 *) let rec sum_with_shared_borrows_loop (max : u32) (i : u32) (s : u32) : Tot (result u32) (decreases (sum_with_shared_borrows_loop_decreases max i s)) @@ -54,12 +54,12 @@ let rec sum_with_shared_borrows_loop else u32_mul s 2 (** [loops::sum_with_shared_borrows]: - Source: 'tests/src/loops.rs', lines 34:0-34:47 *) + Source: 'tests/src/loops.rs', lines 38:0-38:47 *) let sum_with_shared_borrows (max : u32) : result u32 = sum_with_shared_borrows_loop max 0 0 (** [loops::sum_array]: loop 0: - Source: 'tests/src/loops.rs', lines 50:0-58:1 *) + Source: 'tests/src/loops.rs', lines 54:0-62:1 *) let rec sum_array_loop (n : usize) (a : array u32 n) (i : usize) (s : u32) : Tot (result u32) (decreases (sum_array_loop_decreases n a i s)) @@ -73,12 +73,12 @@ let rec sum_array_loop else Ok s (** [loops::sum_array]: - Source: 'tests/src/loops.rs', lines 50:0-50:52 *) + Source: 'tests/src/loops.rs', lines 54:0-54:52 *) let sum_array (n : usize) (a : array u32 n) : result u32 = sum_array_loop n a 0 0 (** [loops::clear]: loop 0: - Source: 'tests/src/loops.rs', lines 62:0-68:1 *) + Source: 'tests/src/loops.rs', lines 66:0-72:1 *) let rec clear_loop (v : alloc_vec_Vec u32) (i : usize) : Tot (result (alloc_vec_Vec u32)) (decreases (clear_loop_decreases v i)) @@ -95,12 +95,12 @@ let rec clear_loop else Ok v (** [loops::clear]: - Source: 'tests/src/loops.rs', lines 62:0-62:30 *) + Source: 'tests/src/loops.rs', lines 66:0-66:30 *) let clear (v : alloc_vec_Vec u32) : result (alloc_vec_Vec u32) = clear_loop v 0 (** [loops::list_mem]: loop 0: - Source: 'tests/src/loops.rs', lines 76:0-85:1 *) + Source: 'tests/src/loops.rs', lines 80:0-89:1 *) let rec list_mem_loop (x : u32) (ls : list_t u32) : Tot (result bool) (decreases (list_mem_loop_decreases x ls)) @@ -111,12 +111,12 @@ let rec list_mem_loop end (** [loops::list_mem]: - Source: 'tests/src/loops.rs', lines 76:0-76:52 *) + Source: 'tests/src/loops.rs', lines 80:0-80:52 *) let list_mem (x : u32) (ls : list_t u32) : result bool = list_mem_loop x ls (** [loops::list_nth_mut_loop]: loop 0: - Source: 'tests/src/loops.rs', lines 88:0-98:1 *) + Source: 'tests/src/loops.rs', lines 92:0-102:1 *) let rec list_nth_mut_loop_loop (t : Type0) (ls : list_t t) (i : u32) : Tot (result (t & (t -> result (list_t t)))) @@ -135,7 +135,7 @@ let rec list_nth_mut_loop_loop end (** [loops::list_nth_mut_loop]: - Source: 'tests/src/loops.rs', lines 88:0-88:71 *) + Source: 'tests/src/loops.rs', lines 92:0-92:71 *) let list_nth_mut_loop (t : Type0) (ls : list_t t) (i : u32) : result (t & (t -> result (list_t t))) @@ -143,7 +143,7 @@ let list_nth_mut_loop list_nth_mut_loop_loop t ls i (** [loops::list_nth_shared_loop]: loop 0: - Source: 'tests/src/loops.rs', lines 101:0-111:1 *) + Source: 'tests/src/loops.rs', lines 105:0-115:1 *) let rec list_nth_shared_loop_loop (t : Type0) (ls : list_t t) (i : u32) : Tot (result t) (decreases (list_nth_shared_loop_loop_decreases t ls i)) @@ -157,12 +157,12 @@ let rec list_nth_shared_loop_loop end (** [loops::list_nth_shared_loop]: - Source: 'tests/src/loops.rs', lines 101:0-101:66 *) + Source: 'tests/src/loops.rs', lines 105:0-105:66 *) let list_nth_shared_loop (t : Type0) (ls : list_t t) (i : u32) : result t = list_nth_shared_loop_loop t ls i (** [loops::get_elem_mut]: loop 0: - Source: 'tests/src/loops.rs', lines 113:0-127:1 *) + Source: 'tests/src/loops.rs', lines 117:0-131:1 *) let rec get_elem_mut_loop (x : usize) (ls : list_t usize) : Tot (result (usize & (usize -> result (list_t usize)))) @@ -180,7 +180,7 @@ let rec get_elem_mut_loop end (** [loops::get_elem_mut]: - Source: 'tests/src/loops.rs', lines 113:0-113:73 *) + Source: 'tests/src/loops.rs', lines 117:0-117:73 *) let get_elem_mut (slots : alloc_vec_Vec (list_t usize)) (x : usize) : result (usize & (usize -> result (alloc_vec_Vec (list_t usize)))) @@ -193,7 +193,7 @@ let get_elem_mut Ok (i, back1) (** [loops::get_elem_shared]: loop 0: - Source: 'tests/src/loops.rs', lines 129:0-143:1 *) + Source: 'tests/src/loops.rs', lines 133:0-147:1 *) let rec get_elem_shared_loop (x : usize) (ls : list_t usize) : Tot (result usize) (decreases (get_elem_shared_loop_decreases x ls)) @@ -204,7 +204,7 @@ let rec get_elem_shared_loop end (** [loops::get_elem_shared]: - Source: 'tests/src/loops.rs', lines 129:0-129:68 *) + Source: 'tests/src/loops.rs', lines 133:0-133:68 *) let get_elem_shared (slots : alloc_vec_Vec (list_t usize)) (x : usize) : result usize = let* ls = @@ -213,7 +213,7 @@ let get_elem_shared get_elem_shared_loop x ls (** [loops::id_mut]: - Source: 'tests/src/loops.rs', lines 145:0-145:50 *) + Source: 'tests/src/loops.rs', lines 149:0-149:50 *) let id_mut (t : Type0) (ls : list_t t) : result ((list_t t) & (list_t t -> result (list_t t))) @@ -221,12 +221,12 @@ let id_mut Ok (ls, Ok) (** [loops::id_shared]: - Source: 'tests/src/loops.rs', lines 149:0-149:45 *) + Source: 'tests/src/loops.rs', lines 153:0-153:45 *) let id_shared (t : Type0) (ls : list_t t) : result (list_t t) = Ok ls (** [loops::list_nth_mut_loop_with_id]: loop 0: - Source: 'tests/src/loops.rs', lines 154:0-165:1 *) + Source: 'tests/src/loops.rs', lines 158:0-169:1 *) let rec list_nth_mut_loop_with_id_loop (t : Type0) (i : u32) (ls : list_t t) : Tot (result (t & (t -> result (list_t t)))) @@ -245,7 +245,7 @@ let rec list_nth_mut_loop_with_id_loop end (** [loops::list_nth_mut_loop_with_id]: - Source: 'tests/src/loops.rs', lines 154:0-154:75 *) + Source: 'tests/src/loops.rs', lines 158:0-158:75 *) let list_nth_mut_loop_with_id (t : Type0) (ls : list_t t) (i : u32) : result (t & (t -> result (list_t t))) @@ -256,7 +256,7 @@ let list_nth_mut_loop_with_id Ok (x, back1) (** [loops::list_nth_shared_loop_with_id]: loop 0: - Source: 'tests/src/loops.rs', lines 168:0-179:1 *) + Source: 'tests/src/loops.rs', lines 172:0-183:1 *) let rec list_nth_shared_loop_with_id_loop (t : Type0) (i : u32) (ls : list_t t) : Tot (result t) @@ -271,13 +271,13 @@ let rec list_nth_shared_loop_with_id_loop end (** [loops::list_nth_shared_loop_with_id]: - Source: 'tests/src/loops.rs', lines 168:0-168:70 *) + Source: 'tests/src/loops.rs', lines 172:0-172:70 *) let list_nth_shared_loop_with_id (t : Type0) (ls : list_t t) (i : u32) : result t = let* ls1 = id_shared t ls in list_nth_shared_loop_with_id_loop t i ls1 (** [loops::list_nth_mut_loop_pair]: loop 0: - Source: 'tests/src/loops.rs', lines 184:0-205:1 *) + Source: 'tests/src/loops.rs', lines 188:0-209:1 *) let rec list_nth_mut_loop_pair_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result ((t & t) & (t -> result (list_t t)) & (t -> result (list_t t)))) @@ -306,7 +306,7 @@ let rec list_nth_mut_loop_pair_loop end (** [loops::list_nth_mut_loop_pair]: - Source: 'tests/src/loops.rs', lines 184:0-188:27 *) + Source: 'tests/src/loops.rs', lines 188:0-192:27 *) let list_nth_mut_loop_pair (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result ((t & t) & (t -> result (list_t t)) & (t -> result (list_t t))) @@ -314,7 +314,7 @@ let list_nth_mut_loop_pair list_nth_mut_loop_pair_loop t ls0 ls1 i (** [loops::list_nth_shared_loop_pair]: loop 0: - Source: 'tests/src/loops.rs', lines 208:0-229:1 *) + Source: 'tests/src/loops.rs', lines 212:0-233:1 *) let rec list_nth_shared_loop_pair_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result (t & t)) @@ -333,13 +333,13 @@ let rec list_nth_shared_loop_pair_loop end (** [loops::list_nth_shared_loop_pair]: - Source: 'tests/src/loops.rs', lines 208:0-212:19 *) + Source: 'tests/src/loops.rs', lines 212:0-216:19 *) let list_nth_shared_loop_pair (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result (t & t) = list_nth_shared_loop_pair_loop t ls0 ls1 i (** [loops::list_nth_mut_loop_pair_merge]: loop 0: - Source: 'tests/src/loops.rs', lines 233:0-248:1 *) + Source: 'tests/src/loops.rs', lines 237:0-252:1 *) let rec list_nth_mut_loop_pair_merge_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result ((t & t) & ((t & t) -> result ((list_t t) & (list_t t))))) @@ -369,7 +369,7 @@ let rec list_nth_mut_loop_pair_merge_loop end (** [loops::list_nth_mut_loop_pair_merge]: - Source: 'tests/src/loops.rs', lines 233:0-237:27 *) + Source: 'tests/src/loops.rs', lines 237:0-241:27 *) let list_nth_mut_loop_pair_merge (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result ((t & t) & ((t & t) -> result ((list_t t) & (list_t t)))) @@ -377,7 +377,7 @@ let list_nth_mut_loop_pair_merge list_nth_mut_loop_pair_merge_loop t ls0 ls1 i (** [loops::list_nth_shared_loop_pair_merge]: loop 0: - Source: 'tests/src/loops.rs', lines 251:0-266:1 *) + Source: 'tests/src/loops.rs', lines 255:0-270:1 *) let rec list_nth_shared_loop_pair_merge_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result (t & t)) @@ -398,13 +398,13 @@ let rec list_nth_shared_loop_pair_merge_loop end (** [loops::list_nth_shared_loop_pair_merge]: - Source: 'tests/src/loops.rs', lines 251:0-255:19 *) + Source: 'tests/src/loops.rs', lines 255:0-259:19 *) let list_nth_shared_loop_pair_merge (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result (t & t) = list_nth_shared_loop_pair_merge_loop t ls0 ls1 i (** [loops::list_nth_mut_shared_loop_pair]: loop 0: - Source: 'tests/src/loops.rs', lines 269:0-284:1 *) + Source: 'tests/src/loops.rs', lines 273:0-288:1 *) let rec list_nth_mut_shared_loop_pair_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result ((t & t) & (t -> result (list_t t)))) @@ -428,7 +428,7 @@ let rec list_nth_mut_shared_loop_pair_loop end (** [loops::list_nth_mut_shared_loop_pair]: - Source: 'tests/src/loops.rs', lines 269:0-273:23 *) + Source: 'tests/src/loops.rs', lines 273:0-277:23 *) let list_nth_mut_shared_loop_pair (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result ((t & t) & (t -> result (list_t t))) @@ -436,7 +436,7 @@ let list_nth_mut_shared_loop_pair list_nth_mut_shared_loop_pair_loop t ls0 ls1 i (** [loops::list_nth_mut_shared_loop_pair_merge]: loop 0: - Source: 'tests/src/loops.rs', lines 288:0-303:1 *) + Source: 'tests/src/loops.rs', lines 292:0-307:1 *) let rec list_nth_mut_shared_loop_pair_merge_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result ((t & t) & (t -> result (list_t t)))) @@ -461,7 +461,7 @@ let rec list_nth_mut_shared_loop_pair_merge_loop end (** [loops::list_nth_mut_shared_loop_pair_merge]: - Source: 'tests/src/loops.rs', lines 288:0-292:23 *) + Source: 'tests/src/loops.rs', lines 292:0-296:23 *) let list_nth_mut_shared_loop_pair_merge (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result ((t & t) & (t -> result (list_t t))) @@ -469,7 +469,7 @@ let list_nth_mut_shared_loop_pair_merge list_nth_mut_shared_loop_pair_merge_loop t ls0 ls1 i (** [loops::list_nth_shared_mut_loop_pair]: loop 0: - Source: 'tests/src/loops.rs', lines 307:0-322:1 *) + Source: 'tests/src/loops.rs', lines 311:0-326:1 *) let rec list_nth_shared_mut_loop_pair_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result ((t & t) & (t -> result (list_t t)))) @@ -493,7 +493,7 @@ let rec list_nth_shared_mut_loop_pair_loop end (** [loops::list_nth_shared_mut_loop_pair]: - Source: 'tests/src/loops.rs', lines 307:0-311:23 *) + Source: 'tests/src/loops.rs', lines 311:0-315:23 *) let list_nth_shared_mut_loop_pair (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result ((t & t) & (t -> result (list_t t))) @@ -501,7 +501,7 @@ let list_nth_shared_mut_loop_pair list_nth_shared_mut_loop_pair_loop t ls0 ls1 i (** [loops::list_nth_shared_mut_loop_pair_merge]: loop 0: - Source: 'tests/src/loops.rs', lines 326:0-341:1 *) + Source: 'tests/src/loops.rs', lines 330:0-345:1 *) let rec list_nth_shared_mut_loop_pair_merge_loop (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : Tot (result ((t & t) & (t -> result (list_t t)))) @@ -526,7 +526,7 @@ let rec list_nth_shared_mut_loop_pair_merge_loop end (** [loops::list_nth_shared_mut_loop_pair_merge]: - Source: 'tests/src/loops.rs', lines 326:0-330:23 *) + Source: 'tests/src/loops.rs', lines 330:0-334:23 *) let list_nth_shared_mut_loop_pair_merge (t : Type0) (ls0 : list_t t) (ls1 : list_t t) (i : u32) : result ((t & t) & (t -> result (list_t t))) @@ -534,7 +534,7 @@ let list_nth_shared_mut_loop_pair_merge list_nth_shared_mut_loop_pair_merge_loop t ls0 ls1 i (** [loops::ignore_input_mut_borrow]: loop 0: - Source: 'tests/src/loops.rs', lines 345:0-349:1 *) + Source: 'tests/src/loops.rs', lines 349:0-353:1 *) let rec ignore_input_mut_borrow_loop (i : u32) : Tot (result unit) (decreases (ignore_input_mut_borrow_loop_decreases i)) @@ -544,12 +544,12 @@ let rec ignore_input_mut_borrow_loop else Ok () (** [loops::ignore_input_mut_borrow]: - Source: 'tests/src/loops.rs', lines 345:0-345:56 *) + Source: 'tests/src/loops.rs', lines 349:0-349:56 *) let ignore_input_mut_borrow (_a : u32) (i : u32) : result u32 = let* _ = ignore_input_mut_borrow_loop i in Ok _a (** [loops::incr_ignore_input_mut_borrow]: loop 0: - Source: 'tests/src/loops.rs', lines 353:0-358:1 *) + Source: 'tests/src/loops.rs', lines 357:0-362:1 *) let rec incr_ignore_input_mut_borrow_loop (i : u32) : Tot (result unit) (decreases (incr_ignore_input_mut_borrow_loop_decreases i)) @@ -559,14 +559,14 @@ let rec incr_ignore_input_mut_borrow_loop else Ok () (** [loops::incr_ignore_input_mut_borrow]: - Source: 'tests/src/loops.rs', lines 353:0-353:60 *) + Source: 'tests/src/loops.rs', lines 357:0-357:60 *) let incr_ignore_input_mut_borrow (a : u32) (i : u32) : result u32 = let* a1 = u32_add a 1 in let* _ = incr_ignore_input_mut_borrow_loop i in Ok a1 (** [loops::ignore_input_shared_borrow]: loop 0: - Source: 'tests/src/loops.rs', lines 362:0-366:1 *) + Source: 'tests/src/loops.rs', lines 366:0-370:1 *) let rec ignore_input_shared_borrow_loop (i : u32) : Tot (result unit) (decreases (ignore_input_shared_borrow_loop_decreases i)) @@ -576,7 +576,7 @@ let rec ignore_input_shared_borrow_loop else Ok () (** [loops::ignore_input_shared_borrow]: - Source: 'tests/src/loops.rs', lines 362:0-362:59 *) + Source: 'tests/src/loops.rs', lines 366:0-366:59 *) let ignore_input_shared_borrow (_a : u32) (i : u32) : result u32 = let* _ = ignore_input_shared_borrow_loop i in Ok _a diff --git a/tests/fstar/misc/Loops.Types.fst b/tests/fstar/misc/Loops.Types.fst index 534f5df7..c9e2f1cf 100644 --- a/tests/fstar/misc/Loops.Types.fst +++ b/tests/fstar/misc/Loops.Types.fst @@ -6,7 +6,7 @@ open Primitives #set-options "--z3rlimit 50 --fuel 1 --ifuel 1" (** [loops::List] - Source: 'tests/src/loops.rs', lines 70:0-70:16 *) + Source: 'tests/src/loops.rs', lines 74:0-74:16 *) type list_t (t : Type0) = | List_Cons : t -> list_t t -> list_t t | List_Nil : list_t t diff --git a/tests/fstar/misc/Matches.fst b/tests/fstar/misc/Matches.fst new file mode 100644 index 00000000..06a9b6df --- /dev/null +++ b/tests/fstar/misc/Matches.fst @@ -0,0 +1,12 @@ +(** THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS *) +(** [matches] *) +module Matches +open Primitives + +#set-options "--z3rlimit 50 --fuel 1 --ifuel 1" + +(** [matches::match_u32]: + Source: 'tests/src/matches.rs', lines 4:0-4:27 *) +let match_u32 (x : u32) : result u32 = + begin match x with | 0 -> Ok 0 | 1 -> Ok 1 | _ -> Ok 2 end + diff --git a/tests/fstar/misc/NoNestedBorrows.fst b/tests/fstar/misc/NoNestedBorrows.fst index 5fd775cb..7506a13b 100644 --- a/tests/fstar/misc/NoNestedBorrows.fst +++ b/tests/fstar/misc/NoNestedBorrows.fst @@ -6,54 +6,54 @@ open Primitives #set-options "--z3rlimit 50 --fuel 1 --ifuel 1" (** [no_nested_borrows::Pair] - Source: 'tests/src/no_nested_borrows.rs', lines 4:0-4:23 *) + Source: 'tests/src/no_nested_borrows.rs', lines 7:0-7:23 *) type pair_t (t1 t2 : Type0) = { x : t1; y : t2; } (** [no_nested_borrows::List] - Source: 'tests/src/no_nested_borrows.rs', lines 9:0-9:16 *) + Source: 'tests/src/no_nested_borrows.rs', lines 12:0-12:16 *) type list_t (t : Type0) = | List_Cons : t -> list_t t -> list_t t | List_Nil : list_t t (** [no_nested_borrows::One] - Source: 'tests/src/no_nested_borrows.rs', lines 20:0-20:16 *) + Source: 'tests/src/no_nested_borrows.rs', lines 23:0-23:16 *) type one_t (t1 : Type0) = | One_One : t1 -> one_t t1 (** [no_nested_borrows::EmptyEnum] - Source: 'tests/src/no_nested_borrows.rs', lines 26:0-26:18 *) + Source: 'tests/src/no_nested_borrows.rs', lines 29:0-29:18 *) type emptyEnum_t = | EmptyEnum_Empty : emptyEnum_t (** [no_nested_borrows::Enum] - Source: 'tests/src/no_nested_borrows.rs', lines 32:0-32:13 *) + Source: 'tests/src/no_nested_borrows.rs', lines 35:0-35:13 *) type enum_t = | Enum_Variant1 : enum_t | Enum_Variant2 : enum_t (** [no_nested_borrows::EmptyStruct] - Source: 'tests/src/no_nested_borrows.rs', lines 39:0-39:22 *) + Source: 'tests/src/no_nested_borrows.rs', lines 42:0-42:22 *) type emptyStruct_t = unit (** [no_nested_borrows::Sum] - Source: 'tests/src/no_nested_borrows.rs', lines 41:0-41:20 *) + Source: 'tests/src/no_nested_borrows.rs', lines 44:0-44:20 *) type sum_t (t1 t2 : Type0) = | Sum_Left : t1 -> sum_t t1 t2 | Sum_Right : t2 -> sum_t t1 t2 (** [no_nested_borrows::cast_u32_to_i32]: - Source: 'tests/src/no_nested_borrows.rs', lines 46:0-46:37 *) + Source: 'tests/src/no_nested_borrows.rs', lines 49:0-49:37 *) let cast_u32_to_i32 (x : u32) : result i32 = scalar_cast U32 I32 x (** [no_nested_borrows::cast_bool_to_i32]: - Source: 'tests/src/no_nested_borrows.rs', lines 50:0-50:39 *) + Source: 'tests/src/no_nested_borrows.rs', lines 53:0-53:39 *) let cast_bool_to_i32 (x : bool) : result i32 = scalar_cast_bool I32 x (** [no_nested_borrows::cast_bool_to_bool]: - Source: 'tests/src/no_nested_borrows.rs', lines 55:0-55:41 *) + Source: 'tests/src/no_nested_borrows.rs', lines 58:0-58:41 *) let cast_bool_to_bool (x : bool) : result bool = Ok x (** [no_nested_borrows::test2]: - Source: 'tests/src/no_nested_borrows.rs', lines 60:0-60:14 *) + Source: 'tests/src/no_nested_borrows.rs', lines 63:0-63:14 *) let test2 : result unit = let* _ = u32_add 23 44 in Ok () @@ -61,12 +61,12 @@ let test2 : result unit = let _ = assert_norm (test2 = Ok ()) (** [no_nested_borrows::get_max]: - Source: 'tests/src/no_nested_borrows.rs', lines 72:0-72:37 *) + Source: 'tests/src/no_nested_borrows.rs', lines 75:0-75:37 *) let get_max (x : u32) (y : u32) : result u32 = if x >= y then Ok x else Ok y (** [no_nested_borrows::test3]: - Source: 'tests/src/no_nested_borrows.rs', lines 80:0-80:14 *) + Source: 'tests/src/no_nested_borrows.rs', lines 83:0-83:14 *) let test3 : result unit = let* x = get_max 4 3 in let* y = get_max 10 11 in @@ -77,7 +77,7 @@ let test3 : result unit = let _ = assert_norm (test3 = Ok ()) (** [no_nested_borrows::test_neg1]: - Source: 'tests/src/no_nested_borrows.rs', lines 87:0-87:18 *) + Source: 'tests/src/no_nested_borrows.rs', lines 90:0-90:18 *) let test_neg1 : result unit = let* y = i32_neg 3 in if not (y = -3) then Fail Failure else Ok () @@ -85,7 +85,7 @@ let test_neg1 : result unit = let _ = assert_norm (test_neg1 = Ok ()) (** [no_nested_borrows::refs_test1]: - Source: 'tests/src/no_nested_borrows.rs', lines 94:0-94:19 *) + Source: 'tests/src/no_nested_borrows.rs', lines 97:0-97:19 *) let refs_test1 : result unit = if not (1 = 1) then Fail Failure else Ok () @@ -93,7 +93,7 @@ let refs_test1 : result unit = let _ = assert_norm (refs_test1 = Ok ()) (** [no_nested_borrows::refs_test2]: - Source: 'tests/src/no_nested_borrows.rs', lines 105:0-105:19 *) + Source: 'tests/src/no_nested_borrows.rs', lines 108:0-108:19 *) let refs_test2 : result unit = if not (2 = 2) then Fail Failure @@ -109,7 +109,7 @@ let refs_test2 : result unit = let _ = assert_norm (refs_test2 = Ok ()) (** [no_nested_borrows::test_list1]: - Source: 'tests/src/no_nested_borrows.rs', lines 121:0-121:19 *) + Source: 'tests/src/no_nested_borrows.rs', lines 124:0-124:19 *) let test_list1 : result unit = Ok () @@ -117,7 +117,7 @@ let test_list1 : result unit = let _ = assert_norm (test_list1 = Ok ()) (** [no_nested_borrows::test_box1]: - Source: 'tests/src/no_nested_borrows.rs', lines 126:0-126:18 *) + Source: 'tests/src/no_nested_borrows.rs', lines 129:0-129:18 *) let test_box1 : result unit = let* (_, deref_mut_back) = alloc_boxed_Box_deref_mut i32 0 in let* b = deref_mut_back 1 in @@ -128,22 +128,22 @@ let test_box1 : result unit = let _ = assert_norm (test_box1 = Ok ()) (** [no_nested_borrows::copy_int]: - Source: 'tests/src/no_nested_borrows.rs', lines 136:0-136:30 *) + Source: 'tests/src/no_nested_borrows.rs', lines 139:0-139:30 *) let copy_int (x : i32) : result i32 = Ok x (** [no_nested_borrows::test_unreachable]: - Source: 'tests/src/no_nested_borrows.rs', lines 142:0-142:32 *) + Source: 'tests/src/no_nested_borrows.rs', lines 145:0-145:32 *) let test_unreachable (b : bool) : result unit = if b then Fail Failure else Ok () (** [no_nested_borrows::test_panic]: - Source: 'tests/src/no_nested_borrows.rs', lines 150:0-150:26 *) + Source: 'tests/src/no_nested_borrows.rs', lines 153:0-153:26 *) let test_panic (b : bool) : result unit = if b then Fail Failure else Ok () (** [no_nested_borrows::test_copy_int]: - Source: 'tests/src/no_nested_borrows.rs', lines 157:0-157:22 *) + Source: 'tests/src/no_nested_borrows.rs', lines 160:0-160:22 *) let test_copy_int : result unit = let* y = copy_int 0 in if not (0 = y) then Fail Failure else Ok () @@ -151,12 +151,12 @@ let test_copy_int : result unit = let _ = assert_norm (test_copy_int = Ok ()) (** [no_nested_borrows::is_cons]: - Source: 'tests/src/no_nested_borrows.rs', lines 164:0-164:38 *) + Source: 'tests/src/no_nested_borrows.rs', lines 167:0-167:38 *) let is_cons (t : Type0) (l : list_t t) : result bool = begin match l with | List_Cons _ _ -> Ok true | List_Nil -> Ok false end (** [no_nested_borrows::test_is_cons]: - Source: 'tests/src/no_nested_borrows.rs', lines 171:0-171:21 *) + Source: 'tests/src/no_nested_borrows.rs', lines 174:0-174:21 *) let test_is_cons : result unit = let* b = is_cons i32 (List_Cons 0 List_Nil) in if not b then Fail Failure else Ok () @@ -165,7 +165,7 @@ let test_is_cons : result unit = let _ = assert_norm (test_is_cons = Ok ()) (** [no_nested_borrows::split_list]: - Source: 'tests/src/no_nested_borrows.rs', lines 177:0-177:48 *) + Source: 'tests/src/no_nested_borrows.rs', lines 180:0-180:48 *) let split_list (t : Type0) (l : list_t t) : result (t & (list_t t)) = begin match l with | List_Cons hd tl -> Ok (hd, tl) @@ -173,7 +173,7 @@ let split_list (t : Type0) (l : list_t t) : result (t & (list_t t)) = end (** [no_nested_borrows::test_split_list]: - Source: 'tests/src/no_nested_borrows.rs', lines 185:0-185:24 *) + Source: 'tests/src/no_nested_borrows.rs', lines 188:0-188:24 *) let test_split_list : result unit = let* p = split_list i32 (List_Cons 0 List_Nil) in let (hd, _) = p in @@ -183,7 +183,7 @@ let test_split_list : result unit = let _ = assert_norm (test_split_list = Ok ()) (** [no_nested_borrows::choose]: - Source: 'tests/src/no_nested_borrows.rs', lines 192:0-192:70 *) + Source: 'tests/src/no_nested_borrows.rs', lines 195:0-195:70 *) let choose (t : Type0) (b : bool) (x : t) (y : t) : result (t & (t -> result (t & t))) = if b @@ -191,7 +191,7 @@ let choose else let back = fun ret -> Ok (x, ret) in Ok (y, back) (** [no_nested_borrows::choose_test]: - Source: 'tests/src/no_nested_borrows.rs', lines 200:0-200:20 *) + Source: 'tests/src/no_nested_borrows.rs', lines 203:0-203:20 *) let choose_test : result unit = let* (z, choose_back) = choose i32 true 0 0 in let* z1 = i32_add z 1 in @@ -207,29 +207,29 @@ let choose_test : result unit = let _ = assert_norm (choose_test = Ok ()) (** [no_nested_borrows::test_char]: - Source: 'tests/src/no_nested_borrows.rs', lines 212:0-212:26 *) + Source: 'tests/src/no_nested_borrows.rs', lines 215:0-215:26 *) let test_char : result char = Ok 'a' (** [no_nested_borrows::panic_mut_borrow]: - Source: 'tests/src/no_nested_borrows.rs', lines 217:0-217:36 *) + Source: 'tests/src/no_nested_borrows.rs', lines 220:0-220:36 *) let panic_mut_borrow (i : u32) : result u32 = Fail Failure (** [no_nested_borrows::Tree] - Source: 'tests/src/no_nested_borrows.rs', lines 222:0-222:16 *) + Source: 'tests/src/no_nested_borrows.rs', lines 225:0-225:16 *) type tree_t (t : Type0) = | Tree_Leaf : t -> tree_t t | Tree_Node : t -> nodeElem_t t -> tree_t t -> tree_t t (** [no_nested_borrows::NodeElem] - Source: 'tests/src/no_nested_borrows.rs', lines 227:0-227:20 *) + Source: 'tests/src/no_nested_borrows.rs', lines 230:0-230:20 *) and nodeElem_t (t : Type0) = | NodeElem_Cons : tree_t t -> nodeElem_t t -> nodeElem_t t | NodeElem_Nil : nodeElem_t t (** [no_nested_borrows::list_length]: - Source: 'tests/src/no_nested_borrows.rs', lines 262:0-262:48 *) + Source: 'tests/src/no_nested_borrows.rs', lines 265:0-265:48 *) let rec list_length (t : Type0) (l : list_t t) : result u32 = begin match l with | List_Cons _ l1 -> let* i = list_length t l1 in u32_add 1 i @@ -237,7 +237,7 @@ let rec list_length (t : Type0) (l : list_t t) : result u32 = end (** [no_nested_borrows::list_nth_shared]: - Source: 'tests/src/no_nested_borrows.rs', lines 270:0-270:62 *) + Source: 'tests/src/no_nested_borrows.rs', lines 273:0-273:62 *) let rec list_nth_shared (t : Type0) (l : list_t t) (i : u32) : result t = begin match l with | List_Cons x tl -> @@ -246,7 +246,7 @@ let rec list_nth_shared (t : Type0) (l : list_t t) (i : u32) : result t = end (** [no_nested_borrows::list_nth_mut]: - Source: 'tests/src/no_nested_borrows.rs', lines 286:0-286:67 *) + Source: 'tests/src/no_nested_borrows.rs', lines 289:0-289:67 *) let rec list_nth_mut (t : Type0) (l : list_t t) (i : u32) : result (t & (t -> result (list_t t))) @@ -265,7 +265,7 @@ let rec list_nth_mut end (** [no_nested_borrows::list_rev_aux]: - Source: 'tests/src/no_nested_borrows.rs', lines 302:0-302:63 *) + Source: 'tests/src/no_nested_borrows.rs', lines 305:0-305:63 *) let rec list_rev_aux (t : Type0) (li : list_t t) (lo : list_t t) : result (list_t t) = begin match li with @@ -274,13 +274,13 @@ let rec list_rev_aux end (** [no_nested_borrows::list_rev]: - Source: 'tests/src/no_nested_borrows.rs', lines 316:0-316:42 *) + Source: 'tests/src/no_nested_borrows.rs', lines 319:0-319:42 *) let list_rev (t : Type0) (l : list_t t) : result (list_t t) = let (li, _) = core_mem_replace (list_t t) l List_Nil in list_rev_aux t li List_Nil (** [no_nested_borrows::test_list_functions]: - Source: 'tests/src/no_nested_borrows.rs', lines 321:0-321:28 *) + Source: 'tests/src/no_nested_borrows.rs', lines 324:0-324:28 *) let test_list_functions : result unit = let l = List_Cons 2 List_Nil in let l1 = List_Cons 1 l in @@ -317,7 +317,7 @@ let test_list_functions : result unit = let _ = assert_norm (test_list_functions = Ok ()) (** [no_nested_borrows::id_mut_pair1]: - Source: 'tests/src/no_nested_borrows.rs', lines 337:0-337:89 *) + Source: 'tests/src/no_nested_borrows.rs', lines 340:0-340:89 *) let id_mut_pair1 (t1 t2 : Type0) (x : t1) (y : t2) : result ((t1 & t2) & ((t1 & t2) -> result (t1 & t2))) @@ -325,7 +325,7 @@ let id_mut_pair1 Ok ((x, y), Ok) (** [no_nested_borrows::id_mut_pair2]: - Source: 'tests/src/no_nested_borrows.rs', lines 341:0-341:88 *) + Source: 'tests/src/no_nested_borrows.rs', lines 344:0-344:88 *) let id_mut_pair2 (t1 t2 : Type0) (p : (t1 & t2)) : result ((t1 & t2) & ((t1 & t2) -> result (t1 & t2))) @@ -333,7 +333,7 @@ let id_mut_pair2 let (x, x1) = p in Ok ((x, x1), Ok) (** [no_nested_borrows::id_mut_pair3]: - Source: 'tests/src/no_nested_borrows.rs', lines 345:0-345:93 *) + Source: 'tests/src/no_nested_borrows.rs', lines 348:0-348:93 *) let id_mut_pair3 (t1 t2 : Type0) (x : t1) (y : t2) : result ((t1 & t2) & (t1 -> result t1) & (t2 -> result t2)) @@ -341,7 +341,7 @@ let id_mut_pair3 Ok ((x, y), Ok, Ok) (** [no_nested_borrows::id_mut_pair4]: - Source: 'tests/src/no_nested_borrows.rs', lines 349:0-349:92 *) + Source: 'tests/src/no_nested_borrows.rs', lines 352:0-352:92 *) let id_mut_pair4 (t1 t2 : Type0) (p : (t1 & t2)) : result ((t1 & t2) & (t1 -> result t1) & (t2 -> result t2)) @@ -349,35 +349,35 @@ let id_mut_pair4 let (x, x1) = p in Ok ((x, x1), Ok, Ok) (** [no_nested_borrows::StructWithTuple] - Source: 'tests/src/no_nested_borrows.rs', lines 356:0-356:34 *) + Source: 'tests/src/no_nested_borrows.rs', lines 359:0-359:34 *) type structWithTuple_t (t1 t2 : Type0) = { p : (t1 & t2); } (** [no_nested_borrows::new_tuple1]: - Source: 'tests/src/no_nested_borrows.rs', lines 360:0-360:48 *) + Source: 'tests/src/no_nested_borrows.rs', lines 363:0-363:48 *) let new_tuple1 : result (structWithTuple_t u32 u32) = Ok { p = (1, 2) } (** [no_nested_borrows::new_tuple2]: - Source: 'tests/src/no_nested_borrows.rs', lines 364:0-364:48 *) + Source: 'tests/src/no_nested_borrows.rs', lines 367:0-367:48 *) let new_tuple2 : result (structWithTuple_t i16 i16) = Ok { p = (1, 2) } (** [no_nested_borrows::new_tuple3]: - Source: 'tests/src/no_nested_borrows.rs', lines 368:0-368:48 *) + Source: 'tests/src/no_nested_borrows.rs', lines 371:0-371:48 *) let new_tuple3 : result (structWithTuple_t u64 i64) = Ok { p = (1, 2) } (** [no_nested_borrows::StructWithPair] - Source: 'tests/src/no_nested_borrows.rs', lines 373:0-373:33 *) + Source: 'tests/src/no_nested_borrows.rs', lines 376:0-376:33 *) type structWithPair_t (t1 t2 : Type0) = { p : pair_t t1 t2; } (** [no_nested_borrows::new_pair1]: - Source: 'tests/src/no_nested_borrows.rs', lines 377:0-377:46 *) + Source: 'tests/src/no_nested_borrows.rs', lines 380:0-380:46 *) let new_pair1 : result (structWithPair_t u32 u32) = Ok { p = { x = 1; y = 2 } } (** [no_nested_borrows::test_constants]: - Source: 'tests/src/no_nested_borrows.rs', lines 385:0-385:23 *) + Source: 'tests/src/no_nested_borrows.rs', lines 388:0-388:23 *) let test_constants : result unit = let* swt = new_tuple1 in let (i, _) = swt.p in @@ -401,7 +401,7 @@ let test_constants : result unit = let _ = assert_norm (test_constants = Ok ()) (** [no_nested_borrows::test_weird_borrows1]: - Source: 'tests/src/no_nested_borrows.rs', lines 394:0-394:28 *) + Source: 'tests/src/no_nested_borrows.rs', lines 397:0-397:28 *) let test_weird_borrows1 : result unit = Ok () @@ -409,71 +409,71 @@ let test_weird_borrows1 : result unit = let _ = assert_norm (test_weird_borrows1 = Ok ()) (** [no_nested_borrows::test_mem_replace]: - Source: 'tests/src/no_nested_borrows.rs', lines 404:0-404:37 *) + Source: 'tests/src/no_nested_borrows.rs', lines 407:0-407:37 *) let test_mem_replace (px : u32) : result u32 = let (y, _) = core_mem_replace u32 px 1 in if not (y = 0) then Fail Failure else Ok 2 (** [no_nested_borrows::test_shared_borrow_bool1]: - Source: 'tests/src/no_nested_borrows.rs', lines 411:0-411:47 *) + Source: 'tests/src/no_nested_borrows.rs', lines 414:0-414:47 *) let test_shared_borrow_bool1 (b : bool) : result u32 = if b then Ok 0 else Ok 1 (** [no_nested_borrows::test_shared_borrow_bool2]: - Source: 'tests/src/no_nested_borrows.rs', lines 424:0-424:40 *) + Source: 'tests/src/no_nested_borrows.rs', lines 427:0-427:40 *) let test_shared_borrow_bool2 : result u32 = Ok 0 (** [no_nested_borrows::test_shared_borrow_enum1]: - Source: 'tests/src/no_nested_borrows.rs', lines 439:0-439:52 *) + Source: 'tests/src/no_nested_borrows.rs', lines 442:0-442:52 *) let test_shared_borrow_enum1 (l : list_t u32) : result u32 = begin match l with | List_Cons _ _ -> Ok 1 | List_Nil -> Ok 0 end (** [no_nested_borrows::test_shared_borrow_enum2]: - Source: 'tests/src/no_nested_borrows.rs', lines 451:0-451:40 *) + Source: 'tests/src/no_nested_borrows.rs', lines 454:0-454:40 *) let test_shared_borrow_enum2 : result u32 = Ok 0 (** [no_nested_borrows::incr]: - Source: 'tests/src/no_nested_borrows.rs', lines 462:0-462:24 *) + Source: 'tests/src/no_nested_borrows.rs', lines 465:0-465:24 *) let incr (x : u32) : result u32 = u32_add x 1 (** [no_nested_borrows::call_incr]: - Source: 'tests/src/no_nested_borrows.rs', lines 466:0-466:35 *) + Source: 'tests/src/no_nested_borrows.rs', lines 469:0-469:35 *) let call_incr (x : u32) : result u32 = incr x (** [no_nested_borrows::read_then_incr]: - Source: 'tests/src/no_nested_borrows.rs', lines 471:0-471:41 *) + Source: 'tests/src/no_nested_borrows.rs', lines 474:0-474:41 *) let read_then_incr (x : u32) : result (u32 & u32) = let* x1 = u32_add x 1 in Ok (x, x1) (** [no_nested_borrows::Tuple] - Source: 'tests/src/no_nested_borrows.rs', lines 477:0-477:24 *) + Source: 'tests/src/no_nested_borrows.rs', lines 480:0-480:24 *) type tuple_t (t1 t2 : Type0) = t1 * t2 (** [no_nested_borrows::use_tuple_struct]: - Source: 'tests/src/no_nested_borrows.rs', lines 479:0-479:48 *) + Source: 'tests/src/no_nested_borrows.rs', lines 482:0-482:48 *) let use_tuple_struct (x : tuple_t u32 u32) : result (tuple_t u32 u32) = let (_, i) = x in Ok (1, i) (** [no_nested_borrows::create_tuple_struct]: - Source: 'tests/src/no_nested_borrows.rs', lines 483:0-483:61 *) + Source: 'tests/src/no_nested_borrows.rs', lines 486:0-486:61 *) let create_tuple_struct (x : u32) (y : u64) : result (tuple_t u32 u64) = Ok (x, y) (** [no_nested_borrows::IdType] - Source: 'tests/src/no_nested_borrows.rs', lines 488:0-488:20 *) + Source: 'tests/src/no_nested_borrows.rs', lines 491:0-491:20 *) type idType_t (t : Type0) = t (** [no_nested_borrows::use_id_type]: - Source: 'tests/src/no_nested_borrows.rs', lines 490:0-490:40 *) + Source: 'tests/src/no_nested_borrows.rs', lines 493:0-493:40 *) let use_id_type (t : Type0) (x : idType_t t) : result t = Ok x (** [no_nested_borrows::create_id_type]: - Source: 'tests/src/no_nested_borrows.rs', lines 494:0-494:43 *) + Source: 'tests/src/no_nested_borrows.rs', lines 497:0-497:43 *) let create_id_type (t : Type0) (x : t) : result (idType_t t) = Ok x diff --git a/tests/fstar/misc/Paper.fst b/tests/fstar/misc/Paper.fst index 2e74e21a..e2412076 100644 --- a/tests/fstar/misc/Paper.fst +++ b/tests/fstar/misc/Paper.fst @@ -6,12 +6,12 @@ open Primitives #set-options "--z3rlimit 50 --fuel 1 --ifuel 1" (** [paper::ref_incr]: - Source: 'tests/src/paper.rs', lines 4:0-4:28 *) + Source: 'tests/src/paper.rs', lines 7:0-7:28 *) let ref_incr (x : i32) : result i32 = i32_add x 1 (** [paper::test_incr]: - Source: 'tests/src/paper.rs', lines 8:0-8:18 *) + Source: 'tests/src/paper.rs', lines 11:0-11:18 *) let test_incr : result unit = let* x = ref_incr 0 in if not (x = 1) then Fail Failure else Ok () @@ -19,7 +19,7 @@ let test_incr : result unit = let _ = assert_norm (test_incr = Ok ()) (** [paper::choose]: - Source: 'tests/src/paper.rs', lines 15:0-15:70 *) + Source: 'tests/src/paper.rs', lines 18:0-18:70 *) let choose (t : Type0) (b : bool) (x : t) (y : t) : result (t & (t -> result (t & t))) = if b @@ -27,7 +27,7 @@ let choose else let back = fun ret -> Ok (x, ret) in Ok (y, back) (** [paper::test_choose]: - Source: 'tests/src/paper.rs', lines 23:0-23:20 *) + Source: 'tests/src/paper.rs', lines 26:0-26:20 *) let test_choose : result unit = let* (z, choose_back) = choose i32 true 0 0 in let* z1 = i32_add z 1 in @@ -43,13 +43,13 @@ let test_choose : result unit = let _ = assert_norm (test_choose = Ok ()) (** [paper::List] - Source: 'tests/src/paper.rs', lines 35:0-35:16 *) + Source: 'tests/src/paper.rs', lines 38:0-38:16 *) type list_t (t : Type0) = | List_Cons : t -> list_t t -> list_t t | List_Nil : list_t t (** [paper::list_nth_mut]: - Source: 'tests/src/paper.rs', lines 42:0-42:67 *) + Source: 'tests/src/paper.rs', lines 45:0-45:67 *) let rec list_nth_mut (t : Type0) (l : list_t t) (i : u32) : result (t & (t -> result (list_t t))) @@ -68,7 +68,7 @@ let rec list_nth_mut end (** [paper::sum]: - Source: 'tests/src/paper.rs', lines 57:0-57:32 *) + Source: 'tests/src/paper.rs', lines 60:0-60:32 *) let rec sum (l : list_t i32) : result i32 = begin match l with | List_Cons x tl -> let* i = sum tl in i32_add x i @@ -76,7 +76,7 @@ let rec sum (l : list_t i32) : result i32 = end (** [paper::test_nth]: - Source: 'tests/src/paper.rs', lines 68:0-68:17 *) + Source: 'tests/src/paper.rs', lines 71:0-71:17 *) let test_nth : result unit = let l = List_Cons 3 List_Nil in let l1 = List_Cons 2 l in @@ -90,7 +90,7 @@ let test_nth : result unit = let _ = assert_norm (test_nth = Ok ()) (** [paper::call_choose]: - Source: 'tests/src/paper.rs', lines 76:0-76:44 *) + Source: 'tests/src/paper.rs', lines 79:0-79:44 *) let call_choose (p : (u32 & u32)) : result u32 = let (px, py) = p in let* (pz, choose_back) = choose u32 true px py in diff --git a/tests/fstar/misc/PoloniusList.fst b/tests/fstar/misc/PoloniusList.fst index 071fd3ef..810388db 100644 --- a/tests/fstar/misc/PoloniusList.fst +++ b/tests/fstar/misc/PoloniusList.fst @@ -6,13 +6,13 @@ open Primitives #set-options "--z3rlimit 50 --fuel 1 --ifuel 1" (** [polonius_list::List] - Source: 'tests/src/polonius_list.rs', lines 3:0-3:16 *) + Source: 'tests/src/polonius_list.rs', lines 6:0-6:16 *) type list_t (t : Type0) = | List_Cons : t -> list_t t -> list_t t | List_Nil : list_t t (** [polonius_list::get_list_at_x]: - Source: 'tests/src/polonius_list.rs', lines 13:0-13:76 *) + Source: 'tests/src/polonius_list.rs', lines 16:0-16:76 *) let rec get_list_at_x (ls : list_t u32) (x : u32) : result ((list_t u32) & (list_t u32 -> result (list_t u32))) |