summaryrefslogtreecommitdiff
path: root/tests/lean/NoNestedBorrows.lean
diff options
context:
space:
mode:
authorSon HO2023-12-07 15:02:44 +0100
committerGitHub2023-12-07 15:02:44 +0100
commitd4ebd6c1f0ba150e5e52d812d361189c89e43695 (patch)
tree4b3fa3d48c86ba379c78d01fca88d2084c2678c2 /tests/lean/NoNestedBorrows.lean
parent9eb117dc9e94d1b04d24c87d278d014f456b2d89 (diff)
parent613496f6c76b3f8c7211ef5bc98e3cc170e45ed1 (diff)
Merge pull request #49 from AeneasVerif/son_merge_back
Allow the extraction of structures as tuples
Diffstat (limited to '')
-rw-r--r--tests/lean/NoNestedBorrows.lean31
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/lean/NoNestedBorrows.lean b/tests/lean/NoNestedBorrows.lean
index 0c7dff8e..8ee8ad9e 100644
--- a/tests/lean/NoNestedBorrows.lean
+++ b/tests/lean/NoNestedBorrows.lean
@@ -35,7 +35,7 @@ inductive Enum :=
/- [no_nested_borrows::EmptyStruct]
Source: 'src/no_nested_borrows.rs', lines 39:0-39:22 -/
-structure EmptyStruct where
+@[reducible] def EmptyStruct := Unit
/- [no_nested_borrows::Sum]
Source: 'src/no_nested_borrows.rs', lines 41:0-41:20 -/
@@ -643,4 +643,33 @@ def test_shared_borrow_enum1 (l : List U32) : Result U32 :=
def test_shared_borrow_enum2 : Result U32 :=
Result.ret 0#u32
+/- [no_nested_borrows::Tuple]
+ Source: 'src/no_nested_borrows.rs', lines 530:0-530:24 -/
+def Tuple (T1 T2 : Type) := T1 × T2
+
+/- [no_nested_borrows::use_tuple_struct]: merged forward/backward function
+ (there is a single backward function, and the forward function returns ())
+ Source: 'src/no_nested_borrows.rs', lines 532:0-532:48 -/
+def use_tuple_struct (x : Tuple U32 U32) : Result (Tuple U32 U32) :=
+ Result.ret (1#u32, x.1)
+
+/- [no_nested_borrows::create_tuple_struct]: forward function
+ Source: 'src/no_nested_borrows.rs', lines 536:0-536:61 -/
+def create_tuple_struct (x : U32) (y : U64) : Result (Tuple U32 U64) :=
+ Result.ret (x, y)
+
+/- [no_nested_borrows::IdType]
+ Source: 'src/no_nested_borrows.rs', lines 541:0-541:20 -/
+@[reducible] def IdType (T : Type) := T
+
+/- [no_nested_borrows::use_id_type]: forward function
+ Source: 'src/no_nested_borrows.rs', lines 543:0-543:40 -/
+def use_id_type (T : Type) (x : IdType T) : Result T :=
+ Result.ret x
+
+/- [no_nested_borrows::create_id_type]: forward function
+ Source: 'src/no_nested_borrows.rs', lines 547:0-547:43 -/
+def create_id_type (T : Type) (x : T) : Result (IdType T) :=
+ Result.ret x
+
end no_nested_borrows