From 0632d7c935bf1e3a637f083d561c08fd7d20fbf3 Mon Sep 17 00:00:00 2001 From: Guillaume Claret Date: Thu, 25 Apr 2024 11:45:42 +0200 Subject: [PATCH 1/7] wip --- CoqOfRust/MT.v | 760 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 760 insertions(+) create mode 100644 CoqOfRust/MT.v diff --git a/CoqOfRust/MT.v b/CoqOfRust/MT.v new file mode 100644 index 000000000..d1090db17 --- /dev/null +++ b/CoqOfRust/MT.v @@ -0,0 +1,760 @@ +(** * The definition of a Rust monad with high-level types, for the simulations. *) +Require Import CoqOfRust.CoqOfRust. + +Module Value. + Inductive t : Set := + | Bool : bool -> t + | Integer : Integer.t -> Z -> t + (** For now we do not know how to represent floats so we use a string *) + | Float : string -> t + | UnicodeChar : Z -> t + | String : string -> t + | Tuple : list t -> t + | Array : list t -> t + | StructRecord : string -> list (string * t) -> t + | StructTuple : string -> list t -> t + | Pointer : Pointer.t t -> t + (** The two existential types of the closure must be [Value.t] and [M]. We + cannot enforce this constraint there yet, but we will do when defining the + semantics. *) + | Closure : {'(t, M) : Set * Set @ list t -> M} -> t + (** A special value that does not appear in the translation, but that we use + to implement primitive functions over values that are not total. We + statically know, from the fact that the source Rust code is well-typed, + that these error values are impossible. In these values appear in a proof, + this might indicate invalid pre-conditions or mistakes in the translation + to Coq. *) + | Error (message : string) + (** To implement the ability to declare a variable but not give it a value + yet. *) + | DeclaredButUndefined. + + (** Read the part of the value that is at a given pointer path, starting from + the main value. It might return [None] if the path does not have a shape + compatible with the value. *) + Fixpoint read_path (value : Value.t) (path : Pointer.Path.t) : + option Value.t := + match path with + | [] => Some value + | Pointer.Index.Tuple index :: path => + match value with + | Tuple fields => + match List.nth_error fields (Z.to_nat index) with + | Some value => read_path value path + | None => None + end + | _ => None + end + | Pointer.Index.Array index :: path => + match value with + | Array fields => + match List.nth_error fields (Z.to_nat index) with + | Some value => read_path value path + | None => None + end + | _ => None + end + | Pointer.Index.StructRecord constructor field :: path => + match value with + | StructRecord c fields => + if String.eqb c constructor then + match List.assoc fields field with + | Some value => read_path value path + | None => None + end + else + None + | _ => None + end + | Pointer.Index.StructTuple constructor index :: path => + match value with + | StructTuple c fields => + if String.eqb c constructor then + match List.nth_error fields (Z.to_nat index) with + | Some value => read_path value path + | None => None + end + else + None + | _ => None + end + end. + + (** Update the part of a value at a certain [path], and return [None] if the + path is of invalid shape. *) + Fixpoint write_value + (value : Value.t) (path : Pointer.Path.t) (update : Value.t) : + option Value.t := + match path with + | [] => Some update + | Pointer.Index.Tuple index :: path => + match value with + | Tuple fields => + match List.nth_error fields (Z.to_nat index) with + | Some value => + match write_value value path update with + | Some value => + Some (Tuple (List.replace_at fields (Z.to_nat index) value)) + | None => None + end + | None => None + end + | _ => None + end + | Pointer.Index.Array index :: path => + match value with + | Array fields => + match List.nth_error fields (Z.to_nat index) with + | Some value => + match write_value value path update with + | Some value => + Some (Array (List.replace_at fields (Z.to_nat index) value)) + | None => None + end + | None => None + end + | _ => None + end + | Pointer.Index.StructRecord constructor field :: path => + match value with + | StructRecord c fields => + if String.eqb c constructor then + match List.assoc fields field with + | Some value => + match write_value value path update with + | Some value => + Some (StructRecord c (List.assoc_replace fields field value)) + | None => None + end + | None => None + end + else + None + | _ => None + end + | Pointer.Index.StructTuple constructor index :: path => + match value with + | StructTuple c fields => + if String.eqb c constructor then + match List.nth_error fields (Z.to_nat index) with + | Some value => + match write_value value path update with + | Some value => + Some (StructTuple c (List.replace_at fields (Z.to_nat index) value)) + | None => None + end + | None => None + end + else + None + | _ => None + end + end. + + (** Equality between values. Defined only for basic types. *) + Definition eqb (v1 v2 : Value.t) : bool := + match v1, v2 with + | Value.Bool b1, Value.Bool b2 => Bool.eqb b1 b2 + | Value.Integer _ i1, Value.Integer _ i2 => Z.eqb i1 i2 + | Value.Float f1, Value.Float f2 => String.eqb f1 f2 + | Value.UnicodeChar c1, Value.UnicodeChar c2 => Z.eqb c1 c2 + | Value.String s1, Value.String s2 => String.eqb s1 s2 + | Value.Tuple _, Value.Tuple _ + | Value.Array _, Value.Array _ + | Value.StructRecord _ _, Value.StructRecord _ _ + | Value.StructTuple _ _, Value.StructTuple _ _ + | Value.Pointer _, Value.Pointer _ + | Value.Closure _, Value.Closure _ + | Value.Error _, Value.Error _ + | Value.DeclaredButUndefined, Value.DeclaredButUndefined => + true + | _, _ => false + end. + + Lemma eqb_is_reflexive (v : Value.t) : eqb v v = true. + Proof. + destruct v; simpl; + try reflexivity; + try apply Z.eqb_refl; + try apply String.eqb_refl. + now destruct_all bool. + Qed. +End Value. + +Module Primitive. + Inductive t : Set := + | StateAlloc (value : Value.t) + | StateRead {Address : Set} (address : Address) + | StateWrite {Address : Set} (address : Address) (value : Value.t) + | EnvRead + | GetFunction (path : string) (generic_tys : list Ty.t) + | GetAssociatedFunction (ty : Ty.t) (name : string) (generic_tys : list Ty.t) + | GetTraitMethod + (trait : string) + (self_ty : Ty.t) + (trait_tys : list Ty.t) + (method : string) + (generic_tys : list Ty.t). +End Primitive. + +Module LowM. + Inductive t (A : Set) : Set := + | Pure (value : A) + | CallPrimitive (primitive : Primitive.t) (k : Value.t -> t A) + | CallClosure (closure : Value.t) (args : list Value.t) (k : A -> t A) + | Loop (body : t A) (k : A -> t A) + | Impossible. + Arguments Pure {_}. + Arguments CallPrimitive {_}. + Arguments CallClosure {_}. + Arguments Loop {_}. + Arguments Impossible {_}. + + Fixpoint let_ {A : Set} (e1 : t A) (e2 : A -> t A) : t A := + match e1 with + | Pure v => e2 v + | CallPrimitive primitive k => + CallPrimitive primitive (fun v => let_ (k v) e2) + | CallClosure f args k => + CallClosure f args (fun v => let_ (k v) e2) + | Loop body k => + Loop body (fun v => let_ (k v) e2) + | Impossible => Impossible + end. +End LowM. + +Module Exception. + Inductive t : Set := + (** exceptions for Rust's `return` *) + | Return : Value.t -> t + (** exceptions for Rust's `continue` *) + | Continue : t + (** exceptions for Rust's `break` *) + | Break : t + (** escape from a match branch once we know that it is not valid *) + | BreakMatch : t + | Panic : string -> t. +End Exception. + +Definition M : Set := + LowM.t (Value.t + Exception.t). + +Definition pure (v : Value.t) : M := + LowM.Pure (inl v). + +Definition let_ (e1 : M) (e2 : Value.t -> M) : M := + LowM.let_ e1 (fun v1 => + match v1 with + | inl v1 => e2 v1 + | inr error => LowM.Pure (inr error) + end). + +Module InstanceField. + Inductive t : Set := + | Constant (constant : Value.t) + | Method (method : list Ty.t -> list Value.t -> M) + | Ty (ty : Ty.t). +End InstanceField. + +Module Instance. + Definition t : Set := list (string * InstanceField.t). +End Instance. + +Parameter IsTraitInstance : + forall + (trait_name : string) + (Self : Ty.t) + (generic_tys : list Ty.t) + (instance : Instance.t), + Prop. + +Parameter IsAssociatedFunction : + forall + (Self : Ty.t) + (function_name : string) + (function : list Ty.t -> list Value.t -> M), + Prop. + +Parameter IsAssociatedConstant : + forall + (Self : Ty.t) + (constant_name : string) + (constant : Value.t), + Prop. + +Parameter IsProvidedMethod : + forall + (trait_name : string) + (method_name : string) + (method : Ty.t -> list Ty.t -> list Value.t -> M), + Prop. + +Module Option. + Definition bind {A B : Set} (x : option A) (f : A -> option B) : option B := + match x with + | Some x => f x + | None => None + end. +End Option. + +(** This parameter is used as a marker to allow a monadic notation + without naming all intermediate results. Computation represented using + this markers can be translated to a regular monadic computation using + [M.monadic] tactic. Additionally, this parameter is used for the + definitions of "const".*) +Parameter run : M -> Value.t. + +Module Notations. + Notation "'let-' a := b 'in' c" := + (LowM.let_ b (fun a => c)) + (at level 200, b at level 100, a name). + + Notation "'let*' a := b 'in' c" := + (let_ b (fun a => c)) + (at level 200, b at level 100, a name). + + Notation "'let*' ' a ':=' b 'in' c" := + (let_ b (fun a => c)) + (at level 200, a pattern, b at level 100, c at level 200). + + Notation "e (| e1 , .. , en |)" := + (run ((.. (e e1) ..) en)) + (at level 100). + + Notation "e (||)" := + (run e) + (at level 100). +End Notations. +Import Notations. + +(** A tactic that replaces all [M.run] markers with a bind operation. + This allows to represent Rust programs without introducing + explicit names for all intermediate computation results. *) +Ltac monadic e := + lazymatch e with + | context ctxt [let v : _ := ?x in @?f v] => + refine (let_ _ _); + [ monadic x + | let v' := fresh v in + intro v'; + let y := (eval cbn beta in (f v')) in + lazymatch context ctxt [let v := x in y] with + | let _ := x in y => monadic y + | _ => + refine (let_ _ _); + [ monadic y + | let w := fresh "v" in + intro w; + let z := context ctxt [w] in + monadic z + ] + end + ] + | context ctxt [run ?x] => + lazymatch context ctxt [run x] with + | run x => monadic x + | _ => + refine (let_ _ _); + [ monadic x + | let v := fresh "v" in + intro v; + let y := context ctxt [v] in + monadic y + ] + end + | _ => + lazymatch type of e with + | M => exact e + | _ => exact (pure e) + end + end. + +Definition raise (exception : Exception.t) : M := + LowM.Pure (inr exception). + +Definition return_ (r : Value.t) : M := + raise (Exception.Return r). + +Definition continue : M := + raise Exception.Continue. + +Definition break : M := + raise Exception.Break. + +Definition break_match : M := + raise Exception.BreakMatch. + +Definition panic (message : string) : M := + raise (Exception.Panic message). + +Definition call_closure (f : Value.t) (args : list Value.t) : M := + LowM.CallClosure f args LowM.Pure. + +Definition call_primitive (primitive : Primitive.t) : M := + LowM.CallPrimitive primitive (fun result => + LowM.Pure (inl result)). + +Definition alloc (v : Value.t) : M := + call_primitive (Primitive.StateAlloc v). + +Definition read (r : Value.t) : M := + match r with + | Value.Pointer (Pointer.Immediate v) => LowM.Pure (inl v) + | Value.Pointer (Pointer.Mutable address path) => + let* v := call_primitive (Primitive.StateRead address) in + match Value.read_path v path with + | Some v => LowM.Pure (inl v) + | None => LowM.Impossible + end + | _ => LowM.Impossible + end. + +Definition write (r : Value.t) (update : Value.t) : M := + match r with + | Value.Pointer (Pointer.Immediate _) => LowM.Impossible + | Value.Pointer (Pointer.Mutable address path) => + let* value := call_primitive (Primitive.StateRead address) in + match Value.write_value value path update with + | Some value => call_primitive (Primitive.StateWrite address value) + | None => LowM.Impossible + end + | _ => LowM.Impossible + end. + +Definition copy (r : Value.t) : M := + let* v := read r in + alloc v. + +Definition read_env : M := + call_primitive Primitive.EnvRead. + +Definition impossible : M := + LowM.Impossible. + +Parameter get_constant : string -> M. + +Definition get_function (path : string) (generic_tys : list Ty.t) : M := + call_primitive (Primitive.GetFunction path generic_tys). + +Definition get_associated_function + (ty : Ty.t) + (name : string) + (generic_tys : list Ty.t) : + M := + call_primitive (Primitive.GetAssociatedFunction ty name generic_tys). + +Definition get_trait_method + (trait : string) + (self_ty : Ty.t) + (trait_tys : list Ty.t) + (method : string) + (generic_tys : list Ty.t) : + M := + call_primitive (Primitive.GetTraitMethod + trait self_ty trait_tys method generic_tys + ). + +Definition catch (body : M) (handler : Exception.t -> M) : M := + let- result := body in + match result with + | inl v => LowM.Pure (inl v) + | inr exception => handler exception + end. + +Definition catch_return (body : M) : M := + catch + body + (fun exception => + match exception with + | Exception.Return r => pure r + | _ => raise exception + end + ). + +Definition catch_continue (body : M) : M := + catch + body + (fun exception => + match exception with + | Exception.Continue => alloc (Value.Tuple []) + | _ => raise exception + end + ). + +Definition catch_break (body : M) : M := + catch + body + (fun exception => + match exception with + | Exception.Break => alloc (Value.Tuple []) + | _ => raise exception + end + ). + +Definition loop (body : M) : M := + LowM.Loop + (catch_continue body) + (fun result => + catch_break (LowM.Pure result)). + +Fixpoint match_operator + (scrutinee : Value.t) + (arms : list (Value.t -> M)) : + M := + match arms with + | nil => impossible + | arm :: arms => + catch + (arm scrutinee) + (fun exception => + match exception with + | Exception.BreakMatch => match_operator scrutinee arms + | _ => raise exception + end + ) + end. + +(** Each arm must return a tuple of the free variables found in the pattern. If + no arms are valid, we raise an [Exception.BreakMatch]. *) +Fixpoint find_or_pattern_aux + (scrutinee : Value.t) + (arms : list (Value.t -> M)) : + M := + match arms with + | nil => break_match + | arm :: arms => + catch + (arm scrutinee) + (fun exception => + match exception with + | Exception.BreakMatch => find_or_pattern_aux scrutinee arms + | _ => raise exception + end + ) + end. + +(** The [body] must be a closure. *) +Definition find_or_pattern + (scrutinee : Value.t) + (arms : list (Value.t -> M)) + (body : Value.t) : + M := + let* free_vars := find_or_pattern_aux scrutinee arms in + match free_vars with + | Value.Tuple free_vars => call_closure body free_vars + | _ => impossible + end. + +Definition never_to_any (x : Value.t) : M := + M.impossible. + +Definition use (x : Value.t) : Value.t := + x. + +(** An error should not occur as we statically know the number of fields in a + tuple, but the code for the error branch is still there for typing and + debugging reasons. *) +Definition get_tuple_field (value : Value.t) (index : Z) : Value.t := + match value with + | Value.Pointer pointer => + match pointer with + | Pointer.Immediate value => + match value with + | Value.Tuple fields => + match List.nth_error fields (Z.to_nat index) with + | Some field => Value.Pointer (Pointer.Immediate field) + | None => Value.Error "invalid tuple index" + end + | _ => Value.Error "expected a tuple" + end + | Pointer.Mutable address path => + let new_path := path ++ [Pointer.Index.Tuple index] in + Value.Pointer (Pointer.Mutable address new_path) + end + | _ => Value.Error "expected an address" + end. + +(** This function might fail, in case the [index] is out of range. *) +Definition get_array_field (value : Value.t) (index : Value.t) : M := + let* index := read index in + match index with + | Value.Integer Integer.Usize index => + match value with + | Value.Pointer pointer => + match pointer with + | Pointer.Immediate value => + match value with + | Value.Array fields => + (* As this is in `usize`, the index is necessarily positive. *) + match List.nth_error fields (Z.to_nat index) with + | Some field => pure (Value.Pointer (Pointer.Immediate field)) + | None => panic "invalid array index" + end + | _ => pure (Value.Error "expected an array") + end + | Pointer.Mutable address path => + let new_path := path ++ [Pointer.Index.Array index] in + pure (Value.Pointer (Pointer.Mutable address new_path)) + end + | _ => pure (Value.Error "expected an address") + end + | _ => pure (Value.Error "Expected a usize as an array index") + end. + +(** Same as for [get_tuple_field], an error should not occur. *) +Definition get_struct_tuple_field + (value : Value.t) (constructor : string) (index : Z) : + Value.t := + match value with + | Value.Pointer pointer => + match pointer with + | Pointer.Immediate value => + match value with + | Value.StructTuple current_constructor fields => + if String.eqb current_constructor constructor then + match List.nth_error fields (Z.to_nat index) with + | Some value => Value.Pointer (Pointer.Immediate value) + | None => Value.Error "field not found" + end + else + Value.Error "different values of constructor" + | _ => Value.Error "not a struct tuple" + end + | Pointer.Mutable address path => + let new_path := path ++ [Pointer.Index.StructTuple constructor index] in + Value.Pointer (Pointer.Mutable address new_path) + end + | _ => Value.Error "expected an address" + end. + +(** Same as for [get_tuple_field], an error should not occur. *) +Definition get_struct_record_field + (value : Value.t) (constructor field : string) : + Value.t := + match value with + | Value.Pointer (Pointer.Immediate value) => + match value with + | Value.StructRecord current_constructor fields => + if String.eqb current_constructor constructor then + match List.assoc fields field with + | Some value => Value.Pointer (Pointer.Immediate value) + | None => Value.Error "field not found" + end + else + Value.Error "different values of constructor" + | _ => Value.Error "not a struct record" + end + | Value.Pointer (Pointer.Mutable address path) => + let new_path := path ++ [Pointer.Index.StructRecord constructor field] in + Value.Pointer (Pointer.Mutable address new_path) + | _ => Value.Error "expected an address" + end. + +Parameter pointer_coercion : Value.t -> Value.t. + +Definition get_struct_tuple_field_or_break_match + (value : Value.t) (constructor : string) (index : Z) : + M := + match value with + | Value.Pointer pointer => + match pointer with + | Pointer.Immediate value => + match value with + | Value.StructTuple current_constructor fields => + if String.eqb current_constructor constructor then + match List.nth_error fields (Z.to_nat index) with + | Some value => pure (Value.Pointer (Pointer.Immediate value)) + | None => M.impossible + end + else + break_match + | _ => M.impossible + end + | Pointer.Mutable address path => + match Value.read_path value path with + | None => M.impossible + | Some value => + match value with + | Value.StructTuple current_constructor fields => + if String.eqb current_constructor constructor then + let new_path := + path ++ [Pointer.Index.StructTuple constructor index] in + pure (Value.Pointer (Pointer.Mutable address new_path)) + else + break_match + | _ => M.impossible + end + end + end + | _ => M.impossible + end. + +Definition get_struct_record_field_or_break_match + (value : Value.t) (constructor field : string) : + M := + match value with + | Value.Pointer pointer => + match pointer with + | Pointer.Immediate value => + match value with + | Value.StructRecord current_constructor fields => + if String.eqb current_constructor constructor then + match List.assoc fields field with + | Some value => pure (Value.Pointer (Pointer.Immediate value)) + | None => M.impossible + end + else + break_match + | _ => M.impossible + end + | Pointer.Mutable address path => + match Value.read_path value path with + | None => M.impossible + | Some value => + match value with + | Value.StructRecord current_constructor fields => + if String.eqb current_constructor constructor then + let new_path := + path ++ [Pointer.Index.StructRecord constructor field] in + pure (Value.Pointer (Pointer.Mutable address new_path)) + else + break_match + | _ => M.impossible + end + end + end + | _ => M.impossible + end. + +Definition is_constant_or_break_match (value expected_value : Value.t) : M := + if Value.eqb value expected_value then + pure (Value.Tuple []) + else + break_match. + +(** Get an element of a slice by index. *) +Parameter get_slice_index_or_break_match : + Value.t -> Z -> M. + +(** Get an element of a slice by index counting from the end. *) +Parameter get_slice_rev_index_or_break_match : + Value.t -> Z -> M. + +(** For two indices n and k, get all elements of a slice without + the first n elements and without the last k elements. *) +Parameter get_slice_rest_or_break_match : + Value.t -> Z -> Z -> M. + +(** This function is explicitely called in the Rust AST, and should take two + types that are actually different but convertible, like different kinds of + integers. *) +Parameter rust_cast : Value.t -> Value.t. + +Definition closure (f : list Value.t -> M) : Value.t := + Value.Closure (existS (Value.t, M) f). + +Definition constructor_as_closure (constructor : string) : Value.t := + closure (fun args => + pure (Value.StructTuple constructor args)). + +Parameter struct_record_update : Value.t -> list (string * Value.t) -> Value.t. From 8cc0e97f9b07f6a3ff88906f7fc536123e0fbf0b Mon Sep 17 00:00:00 2001 From: Guillaume Claret Date: Fri, 26 Apr 2024 18:34:48 +0200 Subject: [PATCH 2/7] proof: definition of a typed effectful monad --- CoqOfRust/MT.v | 760 -------------------------------------------- CoqOfRust/typed/M.v | 300 +++++++++++++++++ 2 files changed, 300 insertions(+), 760 deletions(-) delete mode 100644 CoqOfRust/MT.v create mode 100644 CoqOfRust/typed/M.v diff --git a/CoqOfRust/MT.v b/CoqOfRust/MT.v deleted file mode 100644 index d1090db17..000000000 --- a/CoqOfRust/MT.v +++ /dev/null @@ -1,760 +0,0 @@ -(** * The definition of a Rust monad with high-level types, for the simulations. *) -Require Import CoqOfRust.CoqOfRust. - -Module Value. - Inductive t : Set := - | Bool : bool -> t - | Integer : Integer.t -> Z -> t - (** For now we do not know how to represent floats so we use a string *) - | Float : string -> t - | UnicodeChar : Z -> t - | String : string -> t - | Tuple : list t -> t - | Array : list t -> t - | StructRecord : string -> list (string * t) -> t - | StructTuple : string -> list t -> t - | Pointer : Pointer.t t -> t - (** The two existential types of the closure must be [Value.t] and [M]. We - cannot enforce this constraint there yet, but we will do when defining the - semantics. *) - | Closure : {'(t, M) : Set * Set @ list t -> M} -> t - (** A special value that does not appear in the translation, but that we use - to implement primitive functions over values that are not total. We - statically know, from the fact that the source Rust code is well-typed, - that these error values are impossible. In these values appear in a proof, - this might indicate invalid pre-conditions or mistakes in the translation - to Coq. *) - | Error (message : string) - (** To implement the ability to declare a variable but not give it a value - yet. *) - | DeclaredButUndefined. - - (** Read the part of the value that is at a given pointer path, starting from - the main value. It might return [None] if the path does not have a shape - compatible with the value. *) - Fixpoint read_path (value : Value.t) (path : Pointer.Path.t) : - option Value.t := - match path with - | [] => Some value - | Pointer.Index.Tuple index :: path => - match value with - | Tuple fields => - match List.nth_error fields (Z.to_nat index) with - | Some value => read_path value path - | None => None - end - | _ => None - end - | Pointer.Index.Array index :: path => - match value with - | Array fields => - match List.nth_error fields (Z.to_nat index) with - | Some value => read_path value path - | None => None - end - | _ => None - end - | Pointer.Index.StructRecord constructor field :: path => - match value with - | StructRecord c fields => - if String.eqb c constructor then - match List.assoc fields field with - | Some value => read_path value path - | None => None - end - else - None - | _ => None - end - | Pointer.Index.StructTuple constructor index :: path => - match value with - | StructTuple c fields => - if String.eqb c constructor then - match List.nth_error fields (Z.to_nat index) with - | Some value => read_path value path - | None => None - end - else - None - | _ => None - end - end. - - (** Update the part of a value at a certain [path], and return [None] if the - path is of invalid shape. *) - Fixpoint write_value - (value : Value.t) (path : Pointer.Path.t) (update : Value.t) : - option Value.t := - match path with - | [] => Some update - | Pointer.Index.Tuple index :: path => - match value with - | Tuple fields => - match List.nth_error fields (Z.to_nat index) with - | Some value => - match write_value value path update with - | Some value => - Some (Tuple (List.replace_at fields (Z.to_nat index) value)) - | None => None - end - | None => None - end - | _ => None - end - | Pointer.Index.Array index :: path => - match value with - | Array fields => - match List.nth_error fields (Z.to_nat index) with - | Some value => - match write_value value path update with - | Some value => - Some (Array (List.replace_at fields (Z.to_nat index) value)) - | None => None - end - | None => None - end - | _ => None - end - | Pointer.Index.StructRecord constructor field :: path => - match value with - | StructRecord c fields => - if String.eqb c constructor then - match List.assoc fields field with - | Some value => - match write_value value path update with - | Some value => - Some (StructRecord c (List.assoc_replace fields field value)) - | None => None - end - | None => None - end - else - None - | _ => None - end - | Pointer.Index.StructTuple constructor index :: path => - match value with - | StructTuple c fields => - if String.eqb c constructor then - match List.nth_error fields (Z.to_nat index) with - | Some value => - match write_value value path update with - | Some value => - Some (StructTuple c (List.replace_at fields (Z.to_nat index) value)) - | None => None - end - | None => None - end - else - None - | _ => None - end - end. - - (** Equality between values. Defined only for basic types. *) - Definition eqb (v1 v2 : Value.t) : bool := - match v1, v2 with - | Value.Bool b1, Value.Bool b2 => Bool.eqb b1 b2 - | Value.Integer _ i1, Value.Integer _ i2 => Z.eqb i1 i2 - | Value.Float f1, Value.Float f2 => String.eqb f1 f2 - | Value.UnicodeChar c1, Value.UnicodeChar c2 => Z.eqb c1 c2 - | Value.String s1, Value.String s2 => String.eqb s1 s2 - | Value.Tuple _, Value.Tuple _ - | Value.Array _, Value.Array _ - | Value.StructRecord _ _, Value.StructRecord _ _ - | Value.StructTuple _ _, Value.StructTuple _ _ - | Value.Pointer _, Value.Pointer _ - | Value.Closure _, Value.Closure _ - | Value.Error _, Value.Error _ - | Value.DeclaredButUndefined, Value.DeclaredButUndefined => - true - | _, _ => false - end. - - Lemma eqb_is_reflexive (v : Value.t) : eqb v v = true. - Proof. - destruct v; simpl; - try reflexivity; - try apply Z.eqb_refl; - try apply String.eqb_refl. - now destruct_all bool. - Qed. -End Value. - -Module Primitive. - Inductive t : Set := - | StateAlloc (value : Value.t) - | StateRead {Address : Set} (address : Address) - | StateWrite {Address : Set} (address : Address) (value : Value.t) - | EnvRead - | GetFunction (path : string) (generic_tys : list Ty.t) - | GetAssociatedFunction (ty : Ty.t) (name : string) (generic_tys : list Ty.t) - | GetTraitMethod - (trait : string) - (self_ty : Ty.t) - (trait_tys : list Ty.t) - (method : string) - (generic_tys : list Ty.t). -End Primitive. - -Module LowM. - Inductive t (A : Set) : Set := - | Pure (value : A) - | CallPrimitive (primitive : Primitive.t) (k : Value.t -> t A) - | CallClosure (closure : Value.t) (args : list Value.t) (k : A -> t A) - | Loop (body : t A) (k : A -> t A) - | Impossible. - Arguments Pure {_}. - Arguments CallPrimitive {_}. - Arguments CallClosure {_}. - Arguments Loop {_}. - Arguments Impossible {_}. - - Fixpoint let_ {A : Set} (e1 : t A) (e2 : A -> t A) : t A := - match e1 with - | Pure v => e2 v - | CallPrimitive primitive k => - CallPrimitive primitive (fun v => let_ (k v) e2) - | CallClosure f args k => - CallClosure f args (fun v => let_ (k v) e2) - | Loop body k => - Loop body (fun v => let_ (k v) e2) - | Impossible => Impossible - end. -End LowM. - -Module Exception. - Inductive t : Set := - (** exceptions for Rust's `return` *) - | Return : Value.t -> t - (** exceptions for Rust's `continue` *) - | Continue : t - (** exceptions for Rust's `break` *) - | Break : t - (** escape from a match branch once we know that it is not valid *) - | BreakMatch : t - | Panic : string -> t. -End Exception. - -Definition M : Set := - LowM.t (Value.t + Exception.t). - -Definition pure (v : Value.t) : M := - LowM.Pure (inl v). - -Definition let_ (e1 : M) (e2 : Value.t -> M) : M := - LowM.let_ e1 (fun v1 => - match v1 with - | inl v1 => e2 v1 - | inr error => LowM.Pure (inr error) - end). - -Module InstanceField. - Inductive t : Set := - | Constant (constant : Value.t) - | Method (method : list Ty.t -> list Value.t -> M) - | Ty (ty : Ty.t). -End InstanceField. - -Module Instance. - Definition t : Set := list (string * InstanceField.t). -End Instance. - -Parameter IsTraitInstance : - forall - (trait_name : string) - (Self : Ty.t) - (generic_tys : list Ty.t) - (instance : Instance.t), - Prop. - -Parameter IsAssociatedFunction : - forall - (Self : Ty.t) - (function_name : string) - (function : list Ty.t -> list Value.t -> M), - Prop. - -Parameter IsAssociatedConstant : - forall - (Self : Ty.t) - (constant_name : string) - (constant : Value.t), - Prop. - -Parameter IsProvidedMethod : - forall - (trait_name : string) - (method_name : string) - (method : Ty.t -> list Ty.t -> list Value.t -> M), - Prop. - -Module Option. - Definition bind {A B : Set} (x : option A) (f : A -> option B) : option B := - match x with - | Some x => f x - | None => None - end. -End Option. - -(** This parameter is used as a marker to allow a monadic notation - without naming all intermediate results. Computation represented using - this markers can be translated to a regular monadic computation using - [M.monadic] tactic. Additionally, this parameter is used for the - definitions of "const".*) -Parameter run : M -> Value.t. - -Module Notations. - Notation "'let-' a := b 'in' c" := - (LowM.let_ b (fun a => c)) - (at level 200, b at level 100, a name). - - Notation "'let*' a := b 'in' c" := - (let_ b (fun a => c)) - (at level 200, b at level 100, a name). - - Notation "'let*' ' a ':=' b 'in' c" := - (let_ b (fun a => c)) - (at level 200, a pattern, b at level 100, c at level 200). - - Notation "e (| e1 , .. , en |)" := - (run ((.. (e e1) ..) en)) - (at level 100). - - Notation "e (||)" := - (run e) - (at level 100). -End Notations. -Import Notations. - -(** A tactic that replaces all [M.run] markers with a bind operation. - This allows to represent Rust programs without introducing - explicit names for all intermediate computation results. *) -Ltac monadic e := - lazymatch e with - | context ctxt [let v : _ := ?x in @?f v] => - refine (let_ _ _); - [ monadic x - | let v' := fresh v in - intro v'; - let y := (eval cbn beta in (f v')) in - lazymatch context ctxt [let v := x in y] with - | let _ := x in y => monadic y - | _ => - refine (let_ _ _); - [ monadic y - | let w := fresh "v" in - intro w; - let z := context ctxt [w] in - monadic z - ] - end - ] - | context ctxt [run ?x] => - lazymatch context ctxt [run x] with - | run x => monadic x - | _ => - refine (let_ _ _); - [ monadic x - | let v := fresh "v" in - intro v; - let y := context ctxt [v] in - monadic y - ] - end - | _ => - lazymatch type of e with - | M => exact e - | _ => exact (pure e) - end - end. - -Definition raise (exception : Exception.t) : M := - LowM.Pure (inr exception). - -Definition return_ (r : Value.t) : M := - raise (Exception.Return r). - -Definition continue : M := - raise Exception.Continue. - -Definition break : M := - raise Exception.Break. - -Definition break_match : M := - raise Exception.BreakMatch. - -Definition panic (message : string) : M := - raise (Exception.Panic message). - -Definition call_closure (f : Value.t) (args : list Value.t) : M := - LowM.CallClosure f args LowM.Pure. - -Definition call_primitive (primitive : Primitive.t) : M := - LowM.CallPrimitive primitive (fun result => - LowM.Pure (inl result)). - -Definition alloc (v : Value.t) : M := - call_primitive (Primitive.StateAlloc v). - -Definition read (r : Value.t) : M := - match r with - | Value.Pointer (Pointer.Immediate v) => LowM.Pure (inl v) - | Value.Pointer (Pointer.Mutable address path) => - let* v := call_primitive (Primitive.StateRead address) in - match Value.read_path v path with - | Some v => LowM.Pure (inl v) - | None => LowM.Impossible - end - | _ => LowM.Impossible - end. - -Definition write (r : Value.t) (update : Value.t) : M := - match r with - | Value.Pointer (Pointer.Immediate _) => LowM.Impossible - | Value.Pointer (Pointer.Mutable address path) => - let* value := call_primitive (Primitive.StateRead address) in - match Value.write_value value path update with - | Some value => call_primitive (Primitive.StateWrite address value) - | None => LowM.Impossible - end - | _ => LowM.Impossible - end. - -Definition copy (r : Value.t) : M := - let* v := read r in - alloc v. - -Definition read_env : M := - call_primitive Primitive.EnvRead. - -Definition impossible : M := - LowM.Impossible. - -Parameter get_constant : string -> M. - -Definition get_function (path : string) (generic_tys : list Ty.t) : M := - call_primitive (Primitive.GetFunction path generic_tys). - -Definition get_associated_function - (ty : Ty.t) - (name : string) - (generic_tys : list Ty.t) : - M := - call_primitive (Primitive.GetAssociatedFunction ty name generic_tys). - -Definition get_trait_method - (trait : string) - (self_ty : Ty.t) - (trait_tys : list Ty.t) - (method : string) - (generic_tys : list Ty.t) : - M := - call_primitive (Primitive.GetTraitMethod - trait self_ty trait_tys method generic_tys - ). - -Definition catch (body : M) (handler : Exception.t -> M) : M := - let- result := body in - match result with - | inl v => LowM.Pure (inl v) - | inr exception => handler exception - end. - -Definition catch_return (body : M) : M := - catch - body - (fun exception => - match exception with - | Exception.Return r => pure r - | _ => raise exception - end - ). - -Definition catch_continue (body : M) : M := - catch - body - (fun exception => - match exception with - | Exception.Continue => alloc (Value.Tuple []) - | _ => raise exception - end - ). - -Definition catch_break (body : M) : M := - catch - body - (fun exception => - match exception with - | Exception.Break => alloc (Value.Tuple []) - | _ => raise exception - end - ). - -Definition loop (body : M) : M := - LowM.Loop - (catch_continue body) - (fun result => - catch_break (LowM.Pure result)). - -Fixpoint match_operator - (scrutinee : Value.t) - (arms : list (Value.t -> M)) : - M := - match arms with - | nil => impossible - | arm :: arms => - catch - (arm scrutinee) - (fun exception => - match exception with - | Exception.BreakMatch => match_operator scrutinee arms - | _ => raise exception - end - ) - end. - -(** Each arm must return a tuple of the free variables found in the pattern. If - no arms are valid, we raise an [Exception.BreakMatch]. *) -Fixpoint find_or_pattern_aux - (scrutinee : Value.t) - (arms : list (Value.t -> M)) : - M := - match arms with - | nil => break_match - | arm :: arms => - catch - (arm scrutinee) - (fun exception => - match exception with - | Exception.BreakMatch => find_or_pattern_aux scrutinee arms - | _ => raise exception - end - ) - end. - -(** The [body] must be a closure. *) -Definition find_or_pattern - (scrutinee : Value.t) - (arms : list (Value.t -> M)) - (body : Value.t) : - M := - let* free_vars := find_or_pattern_aux scrutinee arms in - match free_vars with - | Value.Tuple free_vars => call_closure body free_vars - | _ => impossible - end. - -Definition never_to_any (x : Value.t) : M := - M.impossible. - -Definition use (x : Value.t) : Value.t := - x. - -(** An error should not occur as we statically know the number of fields in a - tuple, but the code for the error branch is still there for typing and - debugging reasons. *) -Definition get_tuple_field (value : Value.t) (index : Z) : Value.t := - match value with - | Value.Pointer pointer => - match pointer with - | Pointer.Immediate value => - match value with - | Value.Tuple fields => - match List.nth_error fields (Z.to_nat index) with - | Some field => Value.Pointer (Pointer.Immediate field) - | None => Value.Error "invalid tuple index" - end - | _ => Value.Error "expected a tuple" - end - | Pointer.Mutable address path => - let new_path := path ++ [Pointer.Index.Tuple index] in - Value.Pointer (Pointer.Mutable address new_path) - end - | _ => Value.Error "expected an address" - end. - -(** This function might fail, in case the [index] is out of range. *) -Definition get_array_field (value : Value.t) (index : Value.t) : M := - let* index := read index in - match index with - | Value.Integer Integer.Usize index => - match value with - | Value.Pointer pointer => - match pointer with - | Pointer.Immediate value => - match value with - | Value.Array fields => - (* As this is in `usize`, the index is necessarily positive. *) - match List.nth_error fields (Z.to_nat index) with - | Some field => pure (Value.Pointer (Pointer.Immediate field)) - | None => panic "invalid array index" - end - | _ => pure (Value.Error "expected an array") - end - | Pointer.Mutable address path => - let new_path := path ++ [Pointer.Index.Array index] in - pure (Value.Pointer (Pointer.Mutable address new_path)) - end - | _ => pure (Value.Error "expected an address") - end - | _ => pure (Value.Error "Expected a usize as an array index") - end. - -(** Same as for [get_tuple_field], an error should not occur. *) -Definition get_struct_tuple_field - (value : Value.t) (constructor : string) (index : Z) : - Value.t := - match value with - | Value.Pointer pointer => - match pointer with - | Pointer.Immediate value => - match value with - | Value.StructTuple current_constructor fields => - if String.eqb current_constructor constructor then - match List.nth_error fields (Z.to_nat index) with - | Some value => Value.Pointer (Pointer.Immediate value) - | None => Value.Error "field not found" - end - else - Value.Error "different values of constructor" - | _ => Value.Error "not a struct tuple" - end - | Pointer.Mutable address path => - let new_path := path ++ [Pointer.Index.StructTuple constructor index] in - Value.Pointer (Pointer.Mutable address new_path) - end - | _ => Value.Error "expected an address" - end. - -(** Same as for [get_tuple_field], an error should not occur. *) -Definition get_struct_record_field - (value : Value.t) (constructor field : string) : - Value.t := - match value with - | Value.Pointer (Pointer.Immediate value) => - match value with - | Value.StructRecord current_constructor fields => - if String.eqb current_constructor constructor then - match List.assoc fields field with - | Some value => Value.Pointer (Pointer.Immediate value) - | None => Value.Error "field not found" - end - else - Value.Error "different values of constructor" - | _ => Value.Error "not a struct record" - end - | Value.Pointer (Pointer.Mutable address path) => - let new_path := path ++ [Pointer.Index.StructRecord constructor field] in - Value.Pointer (Pointer.Mutable address new_path) - | _ => Value.Error "expected an address" - end. - -Parameter pointer_coercion : Value.t -> Value.t. - -Definition get_struct_tuple_field_or_break_match - (value : Value.t) (constructor : string) (index : Z) : - M := - match value with - | Value.Pointer pointer => - match pointer with - | Pointer.Immediate value => - match value with - | Value.StructTuple current_constructor fields => - if String.eqb current_constructor constructor then - match List.nth_error fields (Z.to_nat index) with - | Some value => pure (Value.Pointer (Pointer.Immediate value)) - | None => M.impossible - end - else - break_match - | _ => M.impossible - end - | Pointer.Mutable address path => - match Value.read_path value path with - | None => M.impossible - | Some value => - match value with - | Value.StructTuple current_constructor fields => - if String.eqb current_constructor constructor then - let new_path := - path ++ [Pointer.Index.StructTuple constructor index] in - pure (Value.Pointer (Pointer.Mutable address new_path)) - else - break_match - | _ => M.impossible - end - end - end - | _ => M.impossible - end. - -Definition get_struct_record_field_or_break_match - (value : Value.t) (constructor field : string) : - M := - match value with - | Value.Pointer pointer => - match pointer with - | Pointer.Immediate value => - match value with - | Value.StructRecord current_constructor fields => - if String.eqb current_constructor constructor then - match List.assoc fields field with - | Some value => pure (Value.Pointer (Pointer.Immediate value)) - | None => M.impossible - end - else - break_match - | _ => M.impossible - end - | Pointer.Mutable address path => - match Value.read_path value path with - | None => M.impossible - | Some value => - match value with - | Value.StructRecord current_constructor fields => - if String.eqb current_constructor constructor then - let new_path := - path ++ [Pointer.Index.StructRecord constructor field] in - pure (Value.Pointer (Pointer.Mutable address new_path)) - else - break_match - | _ => M.impossible - end - end - end - | _ => M.impossible - end. - -Definition is_constant_or_break_match (value expected_value : Value.t) : M := - if Value.eqb value expected_value then - pure (Value.Tuple []) - else - break_match. - -(** Get an element of a slice by index. *) -Parameter get_slice_index_or_break_match : - Value.t -> Z -> M. - -(** Get an element of a slice by index counting from the end. *) -Parameter get_slice_rev_index_or_break_match : - Value.t -> Z -> M. - -(** For two indices n and k, get all elements of a slice without - the first n elements and without the last k elements. *) -Parameter get_slice_rest_or_break_match : - Value.t -> Z -> Z -> M. - -(** This function is explicitely called in the Rust AST, and should take two - types that are actually different but convertible, like different kinds of - integers. *) -Parameter rust_cast : Value.t -> Value.t. - -Definition closure (f : list Value.t -> M) : Value.t := - Value.Closure (existS (Value.t, M) f). - -Definition constructor_as_closure (constructor : string) : Value.t := - closure (fun args => - pure (Value.StructTuple constructor args)). - -Parameter struct_record_update : Value.t -> list (string * Value.t) -> Value.t. diff --git a/CoqOfRust/typed/M.v b/CoqOfRust/typed/M.v new file mode 100644 index 000000000..3aef5af36 --- /dev/null +++ b/CoqOfRust/typed/M.v @@ -0,0 +1,300 @@ +(** * The definition of a Rust monad with high-level types, for the simulations. *) +Require Import CoqOfRust.CoqOfRust. + +Module Pointer. + Inductive t (A : Set) : Set := + | Immediate (value : A) + | Mutable {Address Big_A : Set} + (address : Address) + (projection : Big_A -> option A) + (injection : A -> Big_A -> option Big_A). + Arguments Immediate {_}. + Arguments Mutable {_ _ _}. +End Pointer. + +Module Primitive. + Inductive t : Set -> Set := + | StateAlloc {A : Set} (value : A) : t (Pointer.t A) + | StateRead {Address A : Set} (address : Address) : t A + | StateWrite {Address A : Set} (address : Address) (value : A) : t unit + | EnvRead {A : Set} : t A. +End Primitive. + +Module LowM. + Inductive t (A : Set) : Set := + | Pure (value : A) + | CallPrimitive {B : Set} (primitive : Primitive.t B) (k : B -> t A) + | CallClosure {B : Set} (body : t B) (k : B -> t A) + | Impossible. + Arguments Pure {_}. + Arguments CallPrimitive {_ _}. + Arguments CallClosure {_ _}. + Arguments Impossible {_}. + + Fixpoint let_ {A B : Set} (e1 : t A) (e2 : A -> t B) : t B := + match e1 with + | Pure v => e2 v + | CallPrimitive primitive k => + CallPrimitive primitive (fun v => let_ (k v) e2) + | CallClosure body k => + CallClosure body (fun v => let_ (k v) e2) + | Impossible => Impossible + end. +End LowM. + +Module Exception. + Inductive t (R : Set) : Set := + (** exceptions for Rust's `return` *) + | Return (value : R) + (** exceptions for Rust's `continue` *) + | Continue + (** exceptions for Rust's `break` *) + | Break + (** escape from a match branch once we know that it is not valid *) + | BreakMatch + | Panic (message : string). + Arguments Return {_}. + Arguments Continue {_}. + Arguments Break {_}. + Arguments BreakMatch {_}. + Arguments Panic {_}. +End Exception. + +(** In the body of a function we can have a type for the parameter of the `return` keyword. *) +Definition MBody (A R : Set) : Set := + LowM.t (A + Exception.t R). + +(** For the whole type of a function, the potential `return` that appear in the body are already + handled. *) +Definition M (A : Set) : Set := + MBody A Empty_set. + +Definition pure {A R : Set} (v : A) : MBody A R := + LowM.Pure (inl v). + +Definition let_ {A B R : Set} (e1 : MBody A R) (e2 : A -> MBody B R) : MBody B R := + LowM.let_ e1 (fun v1 => + match v1 with + | inl v1 => e2 v1 + | inr error => LowM.Pure (inr error) + end). + +(** This parameter is used as a marker to allow a monadic notation + without naming all intermediate results. Computation represented using + this markers can be translated to a regular monadic computation using + [M.monadic] tactic. *) +Parameter run : forall {A R : Set}, MBody A R -> A. + +Module Notations. + Notation "'let-' a := b 'in' c" := + (LowM.let_ b (fun a => c)) + (at level 200, b at level 100, a name). + + Notation "'let*' a := b 'in' c" := + (let_ b (fun a => c)) + (at level 200, b at level 100, a name). + + Notation "'let*' ' a ':=' b 'in' c" := + (let_ b (fun a => c)) + (at level 200, a pattern, b at level 100, c at level 200). + + Notation "e (| e1 , .. , en |)" := + (run ((.. (e e1) ..) en)) + (at level 100). + + Notation "e (||)" := + (run e) + (at level 100). +End Notations. +Import Notations. + +(** A tactic that replaces all [M.run] markers with a bind operation. + This allows to represent Rust programs without introducing + explicit names for all intermediate computation results. *) +Ltac monadic e := + lazymatch e with + | context ctxt [let v : _ := ?x in @?f v] => + refine (let_ _ _); + [ monadic x + | let v' := fresh v in + intro v'; + let y := (eval cbn beta in (f v')) in + lazymatch context ctxt [let v := x in y] with + | let _ := x in y => monadic y + | _ => + refine (let_ _ _); + [ monadic y + | let w := fresh "v" in + intro w; + let z := context ctxt [w] in + monadic z + ] + end + ] + | context ctxt [run ?x] => + lazymatch context ctxt [run x] with + | run x => monadic x + | _ => + refine (let_ _ _); + [ monadic x + | let v := fresh "v" in + intro v; + let y := context ctxt [v] in + monadic y + ] + end + | _ => + lazymatch type of e with + | MBody _ _ => exact e + | _ => exact (pure e) + end + end. + +Definition raise {A R : Set} (exception : Exception.t R) : MBody A R := + LowM.Pure (inr exception). + +Definition return_ {R : Set} (value : R) : MBody R R := + raise (Exception.Return value). + +Definition continue {R : Set} : MBody unit R := + raise Exception.Continue. + +Definition break {R : Set} : MBody unit R := + raise Exception.Break. + +Definition break_match {R : Set} : MBody unit R := + raise Exception.BreakMatch. + +Definition panic {A R : Set} (message : string) : MBody A R := + raise (Exception.Panic message). + +Definition call_primitive {A R : Set} (primitive : Primitive.t A) : MBody A R := + LowM.CallPrimitive primitive (fun result => + LowM.Pure (inl result)). + +Definition alloc {A R : Set} (value : A) : MBody (Pointer.t A) R := + call_primitive (Primitive.StateAlloc value). + +Definition read {A R : Set} (p : Pointer.t A) : MBody A R := + match p with + | Pointer.Immediate v => LowM.Pure (inl v) + | Pointer.Mutable address projection injection => + let* v := call_primitive (Primitive.StateRead address) in + match projection v with + | Some v => LowM.Pure (inl v) + | None => LowM.Impossible + end + end. + +Definition write {A R : Set} (p : Pointer.t A) (update : A) : MBody unit R := + match p with + | Pointer.Immediate _ => LowM.Impossible + | Pointer.Mutable address projection injection => + let* value := call_primitive (Primitive.StateRead address) in + match injection update value with + | Some value => call_primitive (Primitive.StateWrite address value) + | None => LowM.Impossible + end + end. + +Definition copy {A R : Set} (p : Pointer.t A) : MBody (Pointer.t A) R := + let* v := read p in + alloc v. + +Definition catch {A R R' : Set} (body : MBody A R) (handler : Exception.t R -> MBody A R') : + MBody A R' := + let- result := body in + match result with + | inl v => LowM.Pure (inl v) + | inr exception => handler exception + end. + +Definition catch_return {R : Set} (body : MBody R R) : M R := + catch (R' := Empty_set) + body + (fun exception => + match exception with + | Exception.Return r => pure r + | Exception.Continue => raise Exception.Continue + | Exception.Break => raise Exception.Break + | Exception.BreakMatch => raise Exception.BreakMatch + | Exception.Panic message => raise (Exception.Panic message) + end + ). + +Definition catch_continue {R : Set} (body : MBody (Pointer.t unit) R) : MBody (Pointer.t unit) R := + catch + body + (fun exception => + match exception with + | Exception.Continue => alloc tt + | _ => raise exception + end + ). + +Definition catch_break {R : Set} (body : MBody (Pointer.t unit) R) : MBody (Pointer.t unit) R := + catch + body + (fun exception => + match exception with + | Exception.Break => alloc tt + | _ => raise exception + end + ). + +Definition call_closure {A R : Set} (body : M A) : MBody A R := + catch (LowM.CallClosure body LowM.Pure) (fun exception => + match exception with + | Exception.Return r => match r with end + | Exception.Continue => raise Exception.Continue + | Exception.Break => raise Exception.Break + | Exception.BreakMatch => raise Exception.BreakMatch + | Exception.Panic message => raise (Exception.Panic message) + end + ). + +Definition read_env {A R : Set} : MBody A R := + call_primitive Primitive.EnvRead. + +Definition impossible {A R : Set} : MBody A R := + LowM.Impossible. + +(* Definition loop (body : M) : M := + LowM.Loop + (catch_continue body) + (fun result => + catch_break (LowM.Pure result)). *) + +Module State. + Class Trait (State Address : Set) : Type := { + get_Set : Address -> Set; + read (a : Address) : State -> option (get_Set a); + alloc_write (a : Address) : State -> get_Set a -> option State; + }. + + Module Valid. + (** A valid state should behave as map from address to optional values + of the type given by the address. A value is [None] while not + allocated, and [Some] once allocated. It is impossible to free + allocated values. *) + Record t `(Trait) : Prop := { + (* [alloc_write] can only fail on new cells *) + not_allocated (a : Address) (s : State) (v : get_Set a) : + match alloc_write a s v with + | Some _ => True + | None => read a s = None + end; + same (a : Address) (s : State) (v : get_Set a) : + match alloc_write a s v with + | Some s => read a s = Some v + | None => True + end; + different (a1 a2 : Address) (s : State) (v2 : get_Set a2) : + a1 <> a2 -> + match alloc_write a2 s v2 with + | Some s' => read a1 s' = read a1 s + | None => True + end; + }. + End Valid. +End State. From fc7b68d7ed69432806659a83392f2f04d51545c2 Mon Sep 17 00:00:00 2001 From: Guillaume Claret Date: Mon, 29 Apr 2024 15:12:44 +0200 Subject: [PATCH 3/7] wip --- CoqOfRust/M.v | 74 +++-- .../examples/ink_contracts/typed/erc20.v | 11 + CoqOfRust/lib/lib.v | 9 +- CoqOfRust/simulations/M.v | 14 + CoqOfRust/typed/M.v | 310 ++++++++++++------ 5 files changed, 292 insertions(+), 126 deletions(-) create mode 100644 CoqOfRust/examples/default/examples/ink_contracts/typed/erc20.v diff --git a/CoqOfRust/M.v b/CoqOfRust/M.v index 568073908..b92ec9574 100644 --- a/CoqOfRust/M.v +++ b/CoqOfRust/M.v @@ -134,7 +134,13 @@ Module Value. | Array : list t -> t | StructRecord : string -> list (string * t) -> t | StructTuple : string -> list t -> t - | Pointer : Pointer.t t -> t + (** The field [to_value] does not change the runtime semantics, but is here for instrumentation to + relate the semantics of the untyped mode to the semantics of the type mode. This is the + function to go from the typed space to the untyped [Value.t] space. + + It is set once and for all at the creation of the pointer (allocation). When creating a + pointer to a sub-field (extending the [path]) we keep the same [to_value] function. *) + | Pointer {A : Set} (to_value : A -> t) : Pointer.t t -> t (** The two existential types of the closure must be [Value.t] and [M]. We cannot enforce this constraint there yet, but we will do when defining the semantics. *) @@ -284,7 +290,7 @@ Module Value. | Value.Array _, Value.Array _ | Value.StructRecord _ _, Value.StructRecord _ _ | Value.StructTuple _ _, Value.StructTuple _ _ - | Value.Pointer _, Value.Pointer _ + | Value.Pointer _ _, Value.Pointer _ _ | Value.Closure _, Value.Closure _ | Value.Error _, Value.Error _ | Value.DeclaredButUndefined, Value.DeclaredButUndefined => @@ -305,8 +311,8 @@ End Value. Module Primitive. Inductive t : Set := | StateAlloc (value : Value.t) - | StateRead {Address : Set} (address : Address) - | StateWrite {Address : Set} (address : Address) (value : Value.t) + | StateRead {A : Set} (to_value : A -> Value.t) (pointer : Pointer.t Value.t) + | StateWrite {A : Set} (to_value : A -> Value.t) (pointer : Pointer.t Value.t) (update : Value.t) | EnvRead | GetFunction (path : string) (generic_tys : list Ty.t) | GetAssociatedFunction (ty : Ty.t) (name : string) (generic_tys : list Ty.t) @@ -518,10 +524,10 @@ Definition call_primitive (primitive : Primitive.t) : M := Definition alloc (v : Value.t) : M := call_primitive (Primitive.StateAlloc v). -Definition read (r : Value.t) : M := +(* Definition read (r : Value.t) : M := match r with - | Value.Pointer (Pointer.Immediate v) => LowM.Pure (inl v) - | Value.Pointer (Pointer.Mutable address path) => + | Value.Pointer _ (Pointer.Immediate v) => LowM.Pure (inl v) + | Value.Pointer _ (Pointer.Mutable address path) => let* v := call_primitive (Primitive.StateRead address) in match Value.read_path v path with | Some v => LowM.Pure (inl v) @@ -532,14 +538,26 @@ Definition read (r : Value.t) : M := Definition write (r : Value.t) (update : Value.t) : M := match r with - | Value.Pointer (Pointer.Immediate _) => LowM.Impossible - | Value.Pointer (Pointer.Mutable address path) => + | Value.Pointer _ (Pointer.Immediate _) => LowM.Impossible + | Value.Pointer _ (Pointer.Mutable address path) => let* value := call_primitive (Primitive.StateRead address) in match Value.write_value value path update with | Some value => call_primitive (Primitive.StateWrite address value) | None => LowM.Impossible end | _ => LowM.Impossible + end. *) + +Definition read (r : Value.t) : M := + match r with + | Value.Pointer to_value pointer => call_primitive (Primitive.StateRead to_value pointer) + | _ => LowM.Impossible + end. + +Definition write (r : Value.t) (update : Value.t) : M := + match r with + | Value.Pointer to_value pointer => call_primitive (Primitive.StateWrite to_value pointer update) + | _ => LowM.Impossible end. Definition copy (r : Value.t) : M := @@ -677,20 +695,20 @@ Definition use (x : Value.t) : Value.t := debugging reasons. *) Definition get_tuple_field (value : Value.t) (index : Z) : Value.t := match value with - | Value.Pointer pointer => + | Value.Pointer to_value pointer => match pointer with | Pointer.Immediate value => match value with | Value.Tuple fields => match List.nth_error fields (Z.to_nat index) with - | Some field => Value.Pointer (Pointer.Immediate field) + | Some field => Value.Pointer to_value (Pointer.Immediate field) | None => Value.Error "invalid tuple index" end | _ => Value.Error "expected a tuple" end | Pointer.Mutable address path => let new_path := path ++ [Pointer.Index.Tuple index] in - Value.Pointer (Pointer.Mutable address new_path) + Value.Pointer to_value (Pointer.Mutable address new_path) end | _ => Value.Error "expected an address" end. @@ -701,21 +719,21 @@ Definition get_array_field (value : Value.t) (index : Value.t) : M := match index with | Value.Integer Integer.Usize index => match value with - | Value.Pointer pointer => + | Value.Pointer to_value pointer => match pointer with | Pointer.Immediate value => match value with | Value.Array fields => (* As this is in `usize`, the index is necessarily positive. *) match List.nth_error fields (Z.to_nat index) with - | Some field => pure (Value.Pointer (Pointer.Immediate field)) + | Some field => pure (Value.Pointer to_value (Pointer.Immediate field)) | None => panic "invalid array index" end | _ => pure (Value.Error "expected an array") end | Pointer.Mutable address path => let new_path := path ++ [Pointer.Index.Array index] in - pure (Value.Pointer (Pointer.Mutable address new_path)) + pure (Value.Pointer to_value (Pointer.Mutable address new_path)) end | _ => pure (Value.Error "expected an address") end @@ -727,14 +745,14 @@ Definition get_struct_tuple_field (value : Value.t) (constructor : string) (index : Z) : Value.t := match value with - | Value.Pointer pointer => + | Value.Pointer to_value pointer => match pointer with | Pointer.Immediate value => match value with | Value.StructTuple current_constructor fields => if String.eqb current_constructor constructor then match List.nth_error fields (Z.to_nat index) with - | Some value => Value.Pointer (Pointer.Immediate value) + | Some value => Value.Pointer to_value (Pointer.Immediate value) | None => Value.Error "field not found" end else @@ -743,7 +761,7 @@ Definition get_struct_tuple_field end | Pointer.Mutable address path => let new_path := path ++ [Pointer.Index.StructTuple constructor index] in - Value.Pointer (Pointer.Mutable address new_path) + Value.Pointer to_value (Pointer.Mutable address new_path) end | _ => Value.Error "expected an address" end. @@ -753,21 +771,21 @@ Definition get_struct_record_field (value : Value.t) (constructor field : string) : Value.t := match value with - | Value.Pointer (Pointer.Immediate value) => + | Value.Pointer to_value (Pointer.Immediate value) => match value with | Value.StructRecord current_constructor fields => if String.eqb current_constructor constructor then match List.assoc fields field with - | Some value => Value.Pointer (Pointer.Immediate value) + | Some value => Value.Pointer to_value (Pointer.Immediate value) | None => Value.Error "field not found" end else Value.Error "different values of constructor" | _ => Value.Error "not a struct record" end - | Value.Pointer (Pointer.Mutable address path) => + | Value.Pointer to_value (Pointer.Mutable address path) => let new_path := path ++ [Pointer.Index.StructRecord constructor field] in - Value.Pointer (Pointer.Mutable address new_path) + Value.Pointer to_value (Pointer.Mutable address new_path) | _ => Value.Error "expected an address" end. @@ -777,14 +795,14 @@ Definition get_struct_tuple_field_or_break_match (value : Value.t) (constructor : string) (index : Z) : M := match value with - | Value.Pointer pointer => + | Value.Pointer to_value pointer => match pointer with | Pointer.Immediate value => match value with | Value.StructTuple current_constructor fields => if String.eqb current_constructor constructor then match List.nth_error fields (Z.to_nat index) with - | Some value => pure (Value.Pointer (Pointer.Immediate value)) + | Some value => pure (Value.Pointer to_value (Pointer.Immediate value)) | None => M.impossible end else @@ -800,7 +818,7 @@ Definition get_struct_tuple_field_or_break_match if String.eqb current_constructor constructor then let new_path := path ++ [Pointer.Index.StructTuple constructor index] in - pure (Value.Pointer (Pointer.Mutable address new_path)) + pure (Value.Pointer to_value (Pointer.Mutable address new_path)) else break_match | _ => M.impossible @@ -814,14 +832,14 @@ Definition get_struct_record_field_or_break_match (value : Value.t) (constructor field : string) : M := match value with - | Value.Pointer pointer => + | Value.Pointer to_value pointer => match pointer with | Pointer.Immediate value => match value with | Value.StructRecord current_constructor fields => if String.eqb current_constructor constructor then match List.assoc fields field with - | Some value => pure (Value.Pointer (Pointer.Immediate value)) + | Some value => pure (Value.Pointer to_value (Pointer.Immediate value)) | None => M.impossible end else @@ -837,7 +855,7 @@ Definition get_struct_record_field_or_break_match if String.eqb current_constructor constructor then let new_path := path ++ [Pointer.Index.StructRecord constructor field] in - pure (Value.Pointer (Pointer.Mutable address new_path)) + pure (Value.Pointer to_value (Pointer.Mutable address new_path)) else break_match | _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/ink_contracts/typed/erc20.v b/CoqOfRust/examples/default/examples/ink_contracts/typed/erc20.v new file mode 100644 index 000000000..1292aaa7a --- /dev/null +++ b/CoqOfRust/examples/default/examples/ink_contracts/typed/erc20.v @@ -0,0 +1,11 @@ +Require Import CoqOfRust.CoqOfRust. +Require Import CoqOfRust.typed.M. +Require CoqOfRust.examples.default.examples.ink_contracts.erc20. + +Module Impl_erc20_Mapping_K_V. + Parameter t : Set -> Set -> Set. + + Parameter get : forall {K V : Set}, Pointer.t (t K V) -> Pointer.t K -> M (option V). + + Parameter insert : forall {K V : Set}, Pointer.t (t K V) -> K -> V -> M unit. +End Impl_erc20_Mapping_K_V. diff --git a/CoqOfRust/lib/lib.v b/CoqOfRust/lib/lib.v index 65abab2cf..6a002ff03 100644 --- a/CoqOfRust/lib/lib.v +++ b/CoqOfRust/lib/lib.v @@ -33,12 +33,9 @@ Definition assign (target : Value.t) (source : Value.t) : M := (** ** Integer types *) (** A value with an address of type `ref str`. *) -Definition mk_str (s : string) : Value.t := - Value.Pointer (Pointer.Immediate ( - Value.Pointer (Pointer.Immediate ( - Value.String s - )) - )). +Definition mk_str (s : string) : M := + let* p := M.alloc (Value.String s) in + alloc p. Module IntegerDescription. Class C (Self : M.Integer.t) : Set := { diff --git a/CoqOfRust/simulations/M.v b/CoqOfRust/simulations/M.v index 9db88bab9..59d1cc790 100644 --- a/CoqOfRust/simulations/M.v +++ b/CoqOfRust/simulations/M.v @@ -6,6 +6,20 @@ Class ToValue (A : Set) : Set := { }. Arguments Φ _ {_}. +Module Empty_setIsToValue. + Global Instance I : ToValue Empty_set := { + Φ := Ty.path "never"; + φ v := match v with end; + }. +End Empty_setIsToValue. + +Module StringIsToValue. + Global Instance I : ToValue string := { + Φ := Ty.path "str"; + φ v := Value.String v; + }. +End StringIsToValue. + (** For tuples we provide a canonical way to convert to values. *) Module TupleIsToValue. Global Instance I0 : ToValue unit := { diff --git a/CoqOfRust/typed/M.v b/CoqOfRust/typed/M.v index 3aef5af36..dceb896c3 100644 --- a/CoqOfRust/typed/M.v +++ b/CoqOfRust/typed/M.v @@ -1,30 +1,80 @@ (** * The definition of a Rust monad with high-level types, for the simulations. *) Require Import CoqOfRust.CoqOfRust. +Require Import CoqOfRust.simulations.M. Module Pointer. Inductive t (A : Set) : Set := | Immediate (value : A) - | Mutable {Address Big_A : Set} - (address : Address) - (projection : Big_A -> option A) - (injection : A -> Big_A -> option Big_A). + | Mutable {Address : Set} (address : Address) (path : Pointer.Path.t). Arguments Immediate {_}. - Arguments Mutable {_ _ _}. + Arguments Mutable {_ _}. + + Definition to_value_pointer {A : Set} (to_value : A -> Value.t) (pointer : t A) : + CoqOfRust.M.Pointer.t Value.t := + match pointer with + | Immediate v => CoqOfRust.M.Pointer.Immediate (to_value v) + | Mutable address path => CoqOfRust.M.Pointer.Mutable address path + end. End Pointer. Module Primitive. Inductive t : Set -> Set := - | StateAlloc {A : Set} (value : A) : t (Pointer.t A) - | StateRead {Address A : Set} (address : Address) : t A - | StateWrite {Address A : Set} (address : Address) (value : A) : t unit + | StateAlloc {A : Set} (to_value : A -> Value.t) (value : A) : t (Pointer.t A) + | StateRead {A : Set} (pointer : Pointer.t A) : t A + | StateWrite {A : Set} (pointer : Pointer.t A) (update : A) : t unit | EnvRead {A : Set} : t A. End Primitive. +Module Exception. + Inductive t (R : Set) : Set := + (** exceptions for Rust's `return` *) + | Return (value : R) + (** exceptions for Rust's `continue` *) + | Continue + (** exceptions for Rust's `break` *) + | Break + (** escape from a match branch once we know that it is not valid *) + | BreakMatch + | Panic (message : string). + Arguments Return {_}. + Arguments Continue {_}. + Arguments Break {_}. + Arguments BreakMatch {_}. + Arguments Panic {_}. +End Exception. + +Module ClosureParams. + Inductive t : Set := + | Empty + | Cons {A : Set} `{ToValue A} (param : A) (params : t). + + Notation "<[ ]>" := Empty. + Notation "<[ x ; .. ; y ]>" := (Cons x .. (Cons y Empty) ..). + + Fixpoint to_value (params : t) : list Value.t := + match params with + | <[]> => [] + | Cons param params => φ param :: to_value params + end. + + Module HasSetValue. + Inductive t : ClosureParams.t -> forall {A : Set}, A -> Prop := + | Empty : t ClosureParams.Empty tt + | Cons {A As : Set} `{ToValue A} (value : A) (params : ClosureParams.t) (values : As) : + t params values -> + t (ClosureParams.Cons value params) (value, values). + End HasSetValue. +End ClosureParams. + Module LowM. Inductive t (A : Set) : Set := | Pure (value : A) | CallPrimitive {B : Set} (primitive : Primitive.t B) (k : B -> t A) - | CallClosure {B : Set} (body : t B) (k : B -> t A) + | CallClosure {B : Set} + (to_value : B -> Value.t) + (params : ClosureParams.t) + (body : t (B + Exception.t Empty_set)) + (k : (B + Exception.t Empty_set) -> t A) | Impossible. Arguments Pure {_}. Arguments CallPrimitive {_ _}. @@ -36,30 +86,12 @@ Module LowM. | Pure v => e2 v | CallPrimitive primitive k => CallPrimitive primitive (fun v => let_ (k v) e2) - | CallClosure body k => - CallClosure body (fun v => let_ (k v) e2) + | CallClosure to_value params body k => + CallClosure to_value params body (fun v => let_ (k v) e2) | Impossible => Impossible end. End LowM. -Module Exception. - Inductive t (R : Set) : Set := - (** exceptions for Rust's `return` *) - | Return (value : R) - (** exceptions for Rust's `continue` *) - | Continue - (** exceptions for Rust's `break` *) - | Break - (** escape from a match branch once we know that it is not valid *) - | BreakMatch - | Panic (message : string). - Arguments Return {_}. - Arguments Continue {_}. - Arguments Break {_}. - Arguments BreakMatch {_}. - Arguments Panic {_}. -End Exception. - (** In the body of a function we can have a type for the parameter of the `return` keyword. *) Definition MBody (A R : Set) : Set := LowM.t (A + Exception.t R). @@ -79,6 +111,20 @@ Definition let_ {A B R : Set} (e1 : MBody A R) (e2 : A -> MBody B R) : MBody B R | inr error => LowM.Pure (inr error) end). +Definition result_to_value {A R : Set} `{ToValue A} `{ToValue R} (result : A + Exception.t R) : + Value.t + CoqOfRust.M.Exception.t := + match result with + | inl v => inl (φ v) + | inr exception => + inr match exception with + | Exception.Return r => CoqOfRust.M.Exception.Return (φ r) + | Exception.Continue => CoqOfRust.M.Exception.Continue + | Exception.Break => CoqOfRust.M.Exception.Break + | Exception.BreakMatch => CoqOfRust.M.Exception.BreakMatch + | Exception.Panic message => CoqOfRust.M.Exception.Panic message + end + end. + (** This parameter is used as a marker to allow a monadic notation without naming all intermediate results. Computation represented using this markers can be translated to a regular monadic computation using @@ -172,32 +218,16 @@ Definition call_primitive {A R : Set} (primitive : Primitive.t A) : MBody A R := LowM.CallPrimitive primitive (fun result => LowM.Pure (inl result)). -Definition alloc {A R : Set} (value : A) : MBody (Pointer.t A) R := - call_primitive (Primitive.StateAlloc value). - -Definition read {A R : Set} (p : Pointer.t A) : MBody A R := - match p with - | Pointer.Immediate v => LowM.Pure (inl v) - | Pointer.Mutable address projection injection => - let* v := call_primitive (Primitive.StateRead address) in - match projection v with - | Some v => LowM.Pure (inl v) - | None => LowM.Impossible - end - end. +Definition alloc {A R : Set} `{ToValue A} (value : A) : MBody (Pointer.t A) R := + call_primitive (Primitive.StateAlloc φ value). -Definition write {A R : Set} (p : Pointer.t A) (update : A) : MBody unit R := - match p with - | Pointer.Immediate _ => LowM.Impossible - | Pointer.Mutable address projection injection => - let* value := call_primitive (Primitive.StateRead address) in - match injection update value with - | Some value => call_primitive (Primitive.StateWrite address value) - | None => LowM.Impossible - end - end. +Definition read {A R : Set} (pointer : Pointer.t A) : MBody A R := + call_primitive (Primitive.StateRead pointer). -Definition copy {A R : Set} (p : Pointer.t A) : MBody (Pointer.t A) R := +Definition write {A R : Set} (pointer : Pointer.t A) (update : A) : MBody unit R := + call_primitive (Primitive.StateWrite pointer update). + +Definition copy {A R : Set} `{ToValue A} (p : Pointer.t A) : MBody (Pointer.t A) R := let* v := read p in alloc v. @@ -242,8 +272,8 @@ Definition catch_break {R : Set} (body : MBody (Pointer.t unit) R) : MBody (Poin end ). -Definition call_closure {A R : Set} (body : M A) : MBody A R := - catch (LowM.CallClosure body LowM.Pure) (fun exception => +Definition call_closure {A R : Set} {H : ToValue A} (body : M A) : MBody A R := + catch (LowM.CallClosure φ body LowM.Pure) (fun exception => match exception with | Exception.Return r => match r with end | Exception.Continue => raise Exception.Continue @@ -259,42 +289,138 @@ Definition read_env {A R : Set} : MBody A R := Definition impossible {A R : Set} : MBody A R := LowM.Impossible. -(* Definition loop (body : M) : M := - LowM.Loop - (catch_continue body) - (fun result => - catch_break (LowM.Pure result)). *) - -Module State. - Class Trait (State Address : Set) : Type := { - get_Set : Address -> Set; - read (a : Address) : State -> option (get_Set a); - alloc_write (a : Address) : State -> get_Set a -> option State; +(* Module EnvStateToValue. + Record t (Env Address : Set) (get_Set : Address -> Set) : Set := { + env_to_value : Env -> Value.t; + cell_to_value : forall (address : Address), get_Set address -> Value.t; }. +End EnvStateToValue. *) + +Module Run. + Reserved Notation "{{ Address , env_to_value | e ~ result }}". + + Inductive t (Address : Set) {Env : Set} (env_to_value : Env -> Value.t) + {A R : Set} `{ToValue A} `{ToValue R} : + CoqOfRust.M.M -> MBody A R -> Prop := + | Pure (result : A + Exception.t R) : + {{ Address, env_to_value | + CoqOfRust.M.LowM.Pure (result_to_value result) ~ + LowM.Pure result + }} + | CallPrimitiveStateAlloc {B : Set} `{ToValue B} + (value : B) + (k' : Value.t -> CoqOfRust.M.M) + (k : Pointer.t B -> MBody A R) : + (forall (pointer : Pointer.t B), + {{ Address, env_to_value | + k' (Value.Pointer φ (Pointer.to_value_pointer φ pointer)) ~ + k pointer + }} + ) -> + {{ Address, env_to_value | + CoqOfRust.M.LowM.CallPrimitive (CoqOfRust.M.Primitive.StateAlloc (φ value)) k' ~ + LowM.CallPrimitive (Primitive.StateAlloc φ value) k + }} + | CallPrimitiveStateRead {B : Set} + (to_value : B -> Value.t) + (pointer : Pointer.t B) + (k' : Value.t -> CoqOfRust.M.M) + (k : B -> MBody A R) : + (forall (value : B), + {{ Address, env_to_value | + k' (to_value value) ~ + k value + }} + ) -> + {{ Address, env_to_value | + CoqOfRust.M.LowM.CallPrimitive + (CoqOfRust.M.Primitive.StateRead to_value (Pointer.to_value_pointer to_value pointer)) + k' ~ + LowM.CallPrimitive (Primitive.StateRead pointer) k + }} + | CallPrimitiveStateWrite {B : Set} + (to_value : B -> Value.t) + (pointer : Pointer.t B) + (update : B) + (k' : Value.t -> CoqOfRust.M.M) + (k : unit -> MBody A R) : + {{ Address, env_to_value | + k' (Value.Tuple []) ~ + k tt + }} -> + {{ Address, env_to_value | + CoqOfRust.M.LowM.CallPrimitive + (CoqOfRust.M.Primitive.StateWrite + to_value + (Pointer.to_value_pointer to_value pointer) + (to_value update) + ) + k' ~ + LowM.CallPrimitive (Primitive.StateWrite pointer update) k + }} + | CallPrimitiveEnvRead + (k' : Value.t -> CoqOfRust.M.M) + (k : Env -> MBody A R) : + (forall (env : Env), + {{ Address, env_to_value | + k' (env_to_value env) ~ + k env + }} + ) -> + {{ Address, env_to_value | + CoqOfRust.M.LowM.CallPrimitive CoqOfRust.M.Primitive.EnvRead k' ~ + LowM.CallPrimitive Primitive.EnvRead k + }} + | CallClosure {B : Set} + (to_value : B -> Value.t) + (body : M B) + (k : B + Exception.t Empty_set -> MBody A R) : + {{ Address, env_to_value | + LowM.CallClosure e k ~ + LowM.CallClosure to_value body k + }} + + where "{{ Address , env_to_value | untyped ~ typed }}" := + (t Address env_to_value untyped typed). +End Run. + + +Ltac run_symbolic_state_read := + match goal with + | |- Run.t _ _ _ (LowM.CallPrimitive (Primitive.StateRead ?address) _) _ => + let H := fresh "H" in + epose proof (H := Run.CallPrimitiveStateRead _ _ _ address); + eapply H; [reflexivity|]; + clear H + end. + +Ltac run_symbolic_state_write := + match goal with + | |- Run.t ?env ?result ?state' + (LowM.CallPrimitive (Primitive.StateWrite ?address ?value) ?k) + ?state => + let H := fresh "H" in + epose proof (H := + Run.CallPrimitiveStateWrite + env result state' address value state _ k); + apply H; [reflexivity|]; + clear H + end. - Module Valid. - (** A valid state should behave as map from address to optional values - of the type given by the address. A value is [None] while not - allocated, and [Some] once allocated. It is impossible to free - allocated values. *) - Record t `(Trait) : Prop := { - (* [alloc_write] can only fail on new cells *) - not_allocated (a : Address) (s : State) (v : get_Set a) : - match alloc_write a s v with - | Some _ => True - | None => read a s = None - end; - same (a : Address) (s : State) (v : get_Set a) : - match alloc_write a s v with - | Some s => read a s = Some v - | None => True - end; - different (a1 a2 : Address) (s : State) (v2 : get_Set a2) : - a1 <> a2 -> - match alloc_write a2 s v2 with - | Some s' => read a1 s' = read a1 s - | None => True - end; - }. - End Valid. -End State. +Ltac run_symbolic_one_step := + match goal with + | |- Run.t _ _ _ _ _ => + (* We do not use [Run.CallClosure] and intentionally let the user use existing lemma for this + case. *) + apply Run.Pure || + apply Run.CallPrimitiveStateAllocNone || + apply Run.CallPrimitiveEnvRead || + run_symbolic_state_read || + run_symbolic_state_write + end. + +Ltac run_symbolic := + repeat ( + cbn || + run_symbolic_one_step + ). From e5f5cc469847b043dc81ec4c9d890316698df901 Mon Sep 17 00:00:00 2001 From: Guillaume Claret Date: Tue, 30 Apr 2024 13:57:05 +0200 Subject: [PATCH 4/7] more wip --- CoqOfRust/CoqOfRust.v | 1 - CoqOfRust/M.v | 171 ++++++----- .../default/examples/ink_contracts/erc20.v | 1 + .../examples/ink_contracts/typed/erc20.v | 147 +++++++++- CoqOfRust/lib/lib.v | 10 +- CoqOfRust/lib/{simulations => typed}/lib.v | 4 +- CoqOfRust/simulations/M.v | 111 ------- CoqOfRust/typed/M.v | 270 +++++++++++++++--- 8 files changed, 460 insertions(+), 255 deletions(-) rename CoqOfRust/lib/{simulations => typed}/lib.v (97%) diff --git a/CoqOfRust/CoqOfRust.v b/CoqOfRust/CoqOfRust.v index b3bfca405..2d596902a 100644 --- a/CoqOfRust/CoqOfRust.v +++ b/CoqOfRust/CoqOfRust.v @@ -32,7 +32,6 @@ Require Export CoqOfRust.lib.lib. Export List.ListNotations. Require Export CoqOfRust.M. -Export M.Notations. Parameter pointer_coercion : string -> Value.t -> Value.t. diff --git a/CoqOfRust/M.v b/CoqOfRust/M.v index b92ec9574..116636e6b 100644 --- a/CoqOfRust/M.v +++ b/CoqOfRust/M.v @@ -97,6 +97,15 @@ Module Integer. End Integer. Module Pointer. + Module Address. + (** The type [Value] is know just after as [Value.t], but not defined here yet. *) + Inductive t (Value : Set) : Set := + | Immediate (value : Value) + | Mutable {Address : Set} (address : Address). + Arguments Immediate {_}. + Arguments Mutable {_ _}. + End Address. + Module Index. (** We are very explicit for the indexes, so that if the target is mutated and the index does not make any sense anymore we can detect it. This @@ -116,10 +125,20 @@ Module Pointer. End Path. Inductive t (Value : Set) : Set := - | Immediate (value : Value) - | Mutable {Address : Set} (address : Address) (path : Path.t). - Arguments Immediate {_}. - Arguments Mutable {_ _}. + (** The field [to_value] does not change the runtime semantics, but is here for instrumentation to + relate the semantics of the untyped mode to the semantics of the type mode. This is the + function to go from the typed space to the untyped [Value.t] space. + + It is set once and for all at the creation of the pointer (allocation). When creating a + pointer to a sub-field (extending the [path]) we keep the same [to_value] function. *) + | Make {Big_A A : Set} + (big_to_value : Big_A -> Value) + (to_value : A -> Value) + (projection : Big_A -> option A) + (injection : Big_A -> A -> option Big_A) + (address : Address.t Value) + (path : Path.t). + Arguments Make {_ _ _}. End Pointer. Module Value. @@ -134,13 +153,7 @@ Module Value. | Array : list t -> t | StructRecord : string -> list (string * t) -> t | StructTuple : string -> list t -> t - (** The field [to_value] does not change the runtime semantics, but is here for instrumentation to - relate the semantics of the untyped mode to the semantics of the type mode. This is the - function to go from the typed space to the untyped [Value.t] space. - - It is set once and for all at the creation of the pointer (allocation). When creating a - pointer to a sub-field (extending the [path]) we keep the same [to_value] function. *) - | Pointer {A : Set} (to_value : A -> t) : Pointer.t t -> t + | Pointer : Pointer.t t -> t (** The two existential types of the closure must be [Value.t] and [M]. We cannot enforce this constraint there yet, but we will do when defining the semantics. *) @@ -207,6 +220,15 @@ Module Value. end end. + Lemma read_path_suffix_eq + (value : Value.t) (path1 path2 : Pointer.Path.t) : + read_path value (path1 ++ path2) = + match read_path value path1 with + | Some value => read_path value path2 + | None => None + end. + Admitted. + (** Update the part of a value at a certain [path], and return [None] if the path is of invalid shape. *) Fixpoint write_value @@ -290,7 +312,7 @@ Module Value. | Value.Array _, Value.Array _ | Value.StructRecord _ _, Value.StructRecord _ _ | Value.StructTuple _ _, Value.StructTuple _ _ - | Value.Pointer _ _, Value.Pointer _ _ + | Value.Pointer _, Value.Pointer _ | Value.Closure _, Value.Closure _ | Value.Error _, Value.Error _ | Value.DeclaredButUndefined, Value.DeclaredButUndefined => @@ -311,8 +333,9 @@ End Value. Module Primitive. Inductive t : Set := | StateAlloc (value : Value.t) - | StateRead {A : Set} (to_value : A -> Value.t) (pointer : Pointer.t Value.t) - | StateWrite {A : Set} (to_value : A -> Value.t) (pointer : Pointer.t Value.t) (update : Value.t) + | StateRead {A : Set} (to_value : A -> Value.t) (address : Pointer.Address.t Value.t) + | StateWrite {A : Set} + (to_value : A -> Value.t) (address : Pointer.Address.t Value.t) (update : Value.t) | EnvRead | GetFunction (path : string) (generic_tys : list Ty.t) | GetAssociatedFunction (ty : Ty.t) (name : string) (generic_tys : list Ty.t) @@ -422,6 +445,12 @@ Module Option. | Some x => f x | None => None end. + + Definition map {A B : Set} (x : option A) (f : A -> B) : option B := + match x with + | Some x => Some (f x) + | None => None + end. End Option. (** This parameter is used as a marker to allow a monadic notation @@ -514,6 +543,9 @@ Definition break_match : M := Definition panic (message : string) : M := raise (Exception.Panic message). +Definition impossible : M := + LowM.Impossible. + Definition call_closure (f : Value.t) (args : list Value.t) : M := LowM.CallClosure f args LowM.Pure. @@ -524,40 +556,27 @@ Definition call_primitive (primitive : Primitive.t) : M := Definition alloc (v : Value.t) : M := call_primitive (Primitive.StateAlloc v). -(* Definition read (r : Value.t) : M := +Definition read (r : Value.t) : M := match r with - | Value.Pointer _ (Pointer.Immediate v) => LowM.Pure (inl v) - | Value.Pointer _ (Pointer.Mutable address path) => - let* v := call_primitive (Primitive.StateRead address) in - match Value.read_path v path with - | Some v => LowM.Pure (inl v) - | None => LowM.Impossible + | Value.Pointer (Pointer.Make to_value address path) => + let* value := call_primitive (Primitive.StateRead to_value address) in + match Value.read_path value path with + | Some sub_value => pure sub_value + | None => impossible end - | _ => LowM.Impossible + | _ => impossible end. Definition write (r : Value.t) (update : Value.t) : M := match r with - | Value.Pointer _ (Pointer.Immediate _) => LowM.Impossible - | Value.Pointer _ (Pointer.Mutable address path) => - let* value := call_primitive (Primitive.StateRead address) in - match Value.write_value value path update with - | Some value => call_primitive (Primitive.StateWrite address value) - | None => LowM.Impossible + | Value.Pointer (Pointer.Make to_value address path) => + let* current_value := call_primitive (Primitive.StateRead to_value address) in + match Value.write_value current_value path update with + | Some updated_value => + call_primitive (Primitive.StateWrite to_value address updated_value) + | None => impossible end - | _ => LowM.Impossible - end. *) - -Definition read (r : Value.t) : M := - match r with - | Value.Pointer to_value pointer => call_primitive (Primitive.StateRead to_value pointer) - | _ => LowM.Impossible - end. - -Definition write (r : Value.t) (update : Value.t) : M := - match r with - | Value.Pointer to_value pointer => call_primitive (Primitive.StateWrite to_value pointer update) - | _ => LowM.Impossible + | _ => impossible end. Definition copy (r : Value.t) : M := @@ -567,9 +586,6 @@ Definition copy (r : Value.t) : M := Definition read_env : M := call_primitive Primitive.EnvRead. -Definition impossible : M := - LowM.Impossible. - Parameter get_constant : string -> M. Definition get_function (path : string) (generic_tys : list Ty.t) : M := @@ -693,28 +709,18 @@ Definition use (x : Value.t) : Value.t := (** An error should not occur as we statically know the number of fields in a tuple, but the code for the error branch is still there for typing and debugging reasons. *) -Definition get_tuple_field (value : Value.t) (index : Z) : Value.t := - match value with - | Value.Pointer to_value pointer => - match pointer with - | Pointer.Immediate value => - match value with - | Value.Tuple fields => - match List.nth_error fields (Z.to_nat index) with - | Some field => Value.Pointer to_value (Pointer.Immediate field) - | None => Value.Error "invalid tuple index" - end - | _ => Value.Error "expected a tuple" - end - | Pointer.Mutable address path => - let new_path := path ++ [Pointer.Index.Tuple index] in - Value.Pointer to_value (Pointer.Mutable address new_path) - end +Definition get_tuple_field (value : Value.t) (index : Z) : Value.t. +Admitted. + (* match value with + | Value.Pointer to_value {| Pointer.address := address; Pointer.path := path |} => + let new_path := path ++ [Pointer.Index.Tuple index] in + Value.Pointer to_value {| Pointer.address := address; Pointer.path := new_path |} | _ => Value.Error "expected an address" - end. + end. *) (** This function might fail, in case the [index] is out of range. *) -Definition get_array_field (value : Value.t) (index : Value.t) : M := +Parameter get_array_field : forall (value : Value.t) (index : Value.t), M. +(* Definition get_array_field (value : Value.t) (index : Value.t) : M := let* index := read index in match index with | Value.Integer Integer.Usize index => @@ -738,10 +744,13 @@ Definition get_array_field (value : Value.t) (index : Value.t) : M := | _ => pure (Value.Error "expected an address") end | _ => pure (Value.Error "Expected a usize as an array index") - end. + end. *) (** Same as for [get_tuple_field], an error should not occur. *) -Definition get_struct_tuple_field +Parameter get_struct_tuple_field : forall + (value : Value.t) (constructor : string) (index : Z), + Value.t. +(* Definition get_struct_tuple_field (value : Value.t) (constructor : string) (index : Z) : Value.t := match value with @@ -764,28 +773,16 @@ Definition get_struct_tuple_field Value.Pointer to_value (Pointer.Mutable address new_path) end | _ => Value.Error "expected an address" - end. + end. *) (** Same as for [get_tuple_field], an error should not occur. *) Definition get_struct_record_field (value : Value.t) (constructor field : string) : Value.t := match value with - | Value.Pointer to_value (Pointer.Immediate value) => - match value with - | Value.StructRecord current_constructor fields => - if String.eqb current_constructor constructor then - match List.assoc fields field with - | Some value => Value.Pointer to_value (Pointer.Immediate value) - | None => Value.Error "field not found" - end - else - Value.Error "different values of constructor" - | _ => Value.Error "not a struct record" - end - | Value.Pointer to_value (Pointer.Mutable address path) => + | Value.Pointer (Pointer.Make to_value address path) => let new_path := path ++ [Pointer.Index.StructRecord constructor field] in - Value.Pointer to_value (Pointer.Mutable address new_path) + Value.Pointer (Pointer.Make to_value address new_path) | _ => Value.Error "expected an address" end. @@ -793,8 +790,9 @@ Parameter pointer_coercion : Value.t -> Value.t. Definition get_struct_tuple_field_or_break_match (value : Value.t) (constructor : string) (index : Z) : - M := - match value with + M. +Admitted. + (* match value with | Value.Pointer to_value pointer => match pointer with | Pointer.Immediate value => @@ -826,12 +824,13 @@ Definition get_struct_tuple_field_or_break_match end end | _ => M.impossible - end. + end. *) Definition get_struct_record_field_or_break_match (value : Value.t) (constructor field : string) : - M := - match value with + M. +Admitted. + (* match value with | Value.Pointer to_value pointer => match pointer with | Pointer.Immediate value => @@ -863,7 +862,7 @@ Definition get_struct_record_field_or_break_match end end | _ => M.impossible - end. + end. *) Definition is_constant_or_break_match (value expected_value : Value.t) : M := if Value.eqb value expected_value then diff --git a/CoqOfRust/examples/default/examples/ink_contracts/erc20.v b/CoqOfRust/examples/default/examples/ink_contracts/erc20.v index f4b69df47..49c658fa2 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/erc20.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/erc20.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/default/examples/ink_contracts/typed/erc20.v b/CoqOfRust/examples/default/examples/ink_contracts/typed/erc20.v index 1292aaa7a..6617459f6 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/typed/erc20.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/typed/erc20.v @@ -1,11 +1,152 @@ Require Import CoqOfRust.CoqOfRust. Require Import CoqOfRust.typed.M. +Require Import CoqOfRust.lib.typed.lib. Require CoqOfRust.examples.default.examples.ink_contracts.erc20. -Module Impl_erc20_Mapping_K_V. +Import M.Notations. +Import Run. + +Module Mapping. Parameter t : Set -> Set -> Set. - Parameter get : forall {K V : Set}, Pointer.t (t K V) -> Pointer.t K -> M (option V). + Parameter to_value : forall {K V : Set} `{ToValue K} `{ToValue V}, t K V -> Value.t. + + Global Instance IsToValue (K V : Set) `{ToValue K} `{ToValue V} : ToValue (t K V) := { + Φ := Ty.apply (Ty.path "erc20::Mapping") [Φ K; Φ V]; + φ := to_value; + }. +End Mapping. - Parameter insert : forall {K V : Set}, Pointer.t (t K V) -> K -> V -> M unit. +Module Impl_erc20_Mapping_K_V. + Parameter get : forall {K V : Set}, Pointer.t (Mapping.t K V) -> Pointer.t K -> M (option V). + + Parameter insert : forall {K V : Set}, Pointer.t (Mapping.t K V) -> K -> V -> M unit. End Impl_erc20_Mapping_K_V. + +Module Balance. + Definition t : Set := u128.t. +End Balance. + +Module AccountId. + Inductive t : Set := + | Make (account_id : u128.t). + + Global Instance IsToValue : ToValue t := { + Φ := Ty.path "erc20::AccountId"; + φ '(Make x) := Value.StructTuple "erc20::AccountId" [φ x]; + }. +End AccountId. + +(* TODO: move to the right place *) +Module Pointer. + Global Instance IsToValue {T : Set} `{ToValue T} : ToValue (Pointer.t T) := { + Φ := Ty.path "erc20::Pointer"; + φ x := + let '(Pointer.Make to_value address path _ _) := x in + Value.Pointer (CoqOfRust.M.Pointer.Make + to_value + (Pointer.Address.to_address to_value address) + path + ); + }. + + Module Valid. + Inductive t {A : Set} `{ToValue A} : Pointer.t A -> Prop := + | Intro {Big_A : Set} + (to_value : Big_A -> Value.t) + (address : Pointer.Address.t Big_A) + (path : Pointer.Path.t) + (projection : Big_A -> option A) + (injection : Big_A -> A -> option Big_A) : + (forall (value : Big_A), + Value.read_path (to_value value) path = + Option.map (projection value) φ + ) -> + t (Pointer.Make to_value address path projection injection). + End Valid. +End Pointer. + +Module Erc20. + Record t : Set := { + total_supply : Balance.t; + balances : Mapping.t AccountId.t Balance.t; + allowances : Mapping.t (AccountId.t * AccountId.t) Balance.t; + }. + + Global Instance IsToValue : ToValue t := { + Φ := Ty.path "erc20::Erc20"; + φ x := + Value.StructRecord "erc20::Erc20" [ + ("total_supply", φ x.(total_supply)); + ("balances", φ x.(balances)); + ("allowances", φ x.(allowances)) + ]; + }. + + Definition get_total_supply (self : Pointer.t t) : Pointer.t Balance.t := + Pointer.map self (Pointer.Index.StructRecord "erc20::Erc20" "total_supply") + (fun x => Some x.(total_supply)) + (fun x v => Some (x <| total_supply := v |>)). + + Lemma get_total_supply_is_valid (self : Pointer.t t) + (H_self : Pointer.Valid.t self) : + Pointer.Valid.t (get_total_supply self). + Proof. + destruct H_self. + constructor. + intros. + rewrite Value.read_path_suffix_eq. + rewrite H. + now destruct (projection value). + Qed. +End Erc20. + +Module Impl_erc20_Erc20. + Definition Self : Set := Erc20.t. + + Definition total_supply (self : Pointer.t Self) : M Balance.t := + let* self := M.alloc self in + let* self := M.read self in + M.read (Erc20.get_total_supply self). + + Lemma total_supply_run {Address Env : Set} (env_to_value : Env -> Value.t) + (self : Pointer.t Self) + (H_self : Pointer.Valid.t self) : + {{ Address, env_to_value | + ink_contracts.erc20.Impl_erc20_Erc20.total_supply [] [φ self] ~ + total_supply self + }}. + Proof. + Opaque φ. + cbn. + (* destruct self. *) + apply Run.CallPrimitiveStateAlloc. + intros; cbn. + apply Run.CallPrimitiveStateRead. + intros. + unfold M.get_struct_record_field. + unfold M.read. + assert (H_total_supply := Erc20.get_total_supply_is_valid self H_self). + unfold Erc20.get_total_supply in *. + cbn. + unfold Pointer.map. + Transparent φ. + cbn. + destruct H_self. + (* destruct value. *) + apply Run.CallPrimitiveStateRead. + intros. + rewrite Value.read_path_suffix_eq. + destruct H_self. + rewrite H. + + inversion H_total_supply. + Qed. + + + (* Definition balance_of_impl (self : Pointer.t Erc20.t) (owner : Pointer.t AccountId) : + M (option Balance.t) := + let* self := M.read self in *) + + Impl_erc20_Mapping_K_V.get mapping owner. +End Impl_erc20_Erc20. diff --git a/CoqOfRust/lib/lib.v b/CoqOfRust/lib/lib.v index 6a002ff03..33de9a1de 100644 --- a/CoqOfRust/lib/lib.v +++ b/CoqOfRust/lib/lib.v @@ -14,7 +14,7 @@ Global Open Scope type_scope. Export List.ListNotations. Require Export CoqOfRust.M. -Export M.Notations. +Import M.Notations. Module List. (** Check the equality of two lists. *) @@ -26,17 +26,13 @@ Module List. end. End List. -Definition assign (target : Value.t) (source : Value.t) : M := - let* _ := M.write target source in - M.alloc (Value.Tuple []). - -(** ** Integer types *) - (** A value with an address of type `ref str`. *) Definition mk_str (s : string) : M := let* p := M.alloc (Value.String s) in alloc p. +(** ** Integer types *) + Module IntegerDescription. Class C (Self : M.Integer.t) : Set := { (** Apply the modulo operation in case of overflows. *) diff --git a/CoqOfRust/lib/simulations/lib.v b/CoqOfRust/lib/typed/lib.v similarity index 97% rename from CoqOfRust/lib/simulations/lib.v rename to CoqOfRust/lib/typed/lib.v index 79bbbc209..a6bfd141d 100644 --- a/CoqOfRust/lib/simulations/lib.v +++ b/CoqOfRust/lib/typed/lib.v @@ -1,7 +1,5 @@ Require Import CoqOfRust.CoqOfRust. -Require Import CoqOfRust.simulations.M. - -Import simulations.M.Notations. +Require Import CoqOfRust.typed.M. Module u8. Inductive t : Set := diff --git a/CoqOfRust/simulations/M.v b/CoqOfRust/simulations/M.v index 59d1cc790..70ff3f857 100644 --- a/CoqOfRust/simulations/M.v +++ b/CoqOfRust/simulations/M.v @@ -1,116 +1,5 @@ Require Import CoqOfRust.CoqOfRust. -Class ToValue (A : Set) : Set := { - Φ : Ty.t; - φ : A -> Value.t; -}. -Arguments Φ _ {_}. - -Module Empty_setIsToValue. - Global Instance I : ToValue Empty_set := { - Φ := Ty.path "never"; - φ v := match v with end; - }. -End Empty_setIsToValue. - -Module StringIsToValue. - Global Instance I : ToValue string := { - Φ := Ty.path "str"; - φ v := Value.String v; - }. -End StringIsToValue. - -(** For tuples we provide a canonical way to convert to values. *) -Module TupleIsToValue. - Global Instance I0 : ToValue unit := { - Φ := Ty.tuple []; - φ 'tt := Value.Tuple []; - }. - - Global Instance I2 (A1 A2 : Set) - (_ : ToValue A1) - (_ : ToValue A2) : - ToValue (A1 * A2) := { - Φ := Ty.tuple [Φ A1; Φ A2]; - φ '(x1, x2) := Value.Tuple [φ x1; φ x2]; - }. - - Global Instance I3 (A1 A2 A3 : Set) - (_ : ToValue A1) - (_ : ToValue A2) - (_ : ToValue A3) : - ToValue (A1 * A2 * A3) := { - Φ := Ty.tuple [Φ A1; Φ A2; Φ A3]; - φ '(x1, x2, x3) := - Value.Tuple [φ x1; φ x2; φ x3]; - }. - - Global Instance I4 (A1 A2 A3 A4 : Set) - (_ : ToValue A1) - (_ : ToValue A2) - (_ : ToValue A3) - (_ : ToValue A4) : - ToValue (A1 * A2 * A3 * A4) := { - Φ := Ty.tuple [Φ A1; Φ A2; Φ A3; Φ A4]; - φ '(x1, x2, x3, x4) := - Value.Tuple [φ x1; φ x2; φ x3; φ x4]; - }. - - Global Instance I5 (A1 A2 A3 A4 A5 : Set) - (_ : ToValue A1) - (_ : ToValue A2) - (_ : ToValue A3) - (_ : ToValue A4) - (_ : ToValue A5) : - ToValue (A1 * A2 * A3 * A4 * A5) := { - Φ := Ty.tuple [Φ A1; Φ A2; Φ A3; Φ A4; Φ A5]; - φ '(x1, x2, x3, x4, x5) := - Value.Tuple [φ x1; φ x2; φ x3; φ x4; φ x5]; - }. - - Global Instance I6 (A1 A2 A3 A4 A5 A6 : Set) - (_ : ToValue A1) - (_ : ToValue A2) - (_ : ToValue A3) - (_ : ToValue A4) - (_ : ToValue A5) - (_ : ToValue A6) : - ToValue (A1 * A2 * A3 * A4 * A5 * A6) := { - Φ := Ty.tuple [Φ A1; Φ A2; Φ A3; Φ A4; Φ A5; Φ A6]; - φ '(x1, x2, x3, x4, x5, x6) := - Value.Tuple [φ x1; φ x2; φ x3; φ x4; φ x5; φ x6]; - }. - - Global Instance I7 (A1 A2 A3 A4 A5 A6 A7 : Set) - (_ : ToValue A1) - (_ : ToValue A2) - (_ : ToValue A3) - (_ : ToValue A4) - (_ : ToValue A5) - (_ : ToValue A6) - (_ : ToValue A7) : - ToValue (A1 * A2 * A3 * A4 * A5 * A6 * A7) := { - Φ := Ty.tuple [Φ A1; Φ A2; Φ A3; Φ A4; Φ A5; Φ A6; Φ A7]; - φ '(x1, x2, x3, x4, x5, x6, x7) := - Value.Tuple [φ x1; φ x2; φ x3; φ x4; φ x5; φ x6; φ x7]; - }. - - Global Instance I8 (A1 A2 A3 A4 A5 A6 A7 A8 : Set) - (_ : ToValue A1) - (_ : ToValue A2) - (_ : ToValue A3) - (_ : ToValue A4) - (_ : ToValue A5) - (_ : ToValue A6) - (_ : ToValue A7) - (_ : ToValue A8) : - ToValue (A1 * A2 * A3 * A4 * A5 * A6 * A7 * A8) := { - Φ := Ty.tuple [Φ A1; Φ A2; Φ A3; Φ A4; Φ A5; Φ A6; Φ A7; Φ A8]; - φ '(x1, x2, x3, x4, x5, x6, x7, x8) := - Value.Tuple [φ x1; φ x2; φ x3; φ x4; φ x5; φ x6; φ x7; φ x8]; - }. -End TupleIsToValue. - (** ** Monads that are useful for the definition of simulations. *) Module Error. diff --git a/CoqOfRust/typed/M.v b/CoqOfRust/typed/M.v index dceb896c3..5c31c272e 100644 --- a/CoqOfRust/typed/M.v +++ b/CoqOfRust/typed/M.v @@ -2,26 +2,194 @@ Require Import CoqOfRust.CoqOfRust. Require Import CoqOfRust.simulations.M. +Import List.ListNotations. + +Local Open Scope list. + +(** ** Translation from a high-level type to a value. *) + +Class ToValue (A : Set) : Set := { + Φ : Ty.t; + φ : A -> Value.t; +}. +Arguments Φ _ {_}. + +Module Empty_setIsToValue. + Global Instance I : ToValue Empty_set := { + Φ := Ty.path "never"; + φ v := match v with end; + }. +End Empty_setIsToValue. + +Module StringIsToValue. + Global Instance I : ToValue string := { + Φ := Ty.path "str"; + φ v := Value.String v; + }. +End StringIsToValue. + +(** For tuples we provide a canonical way to convert to values. *) +Module TupleIsToValue. + Global Instance I0 : ToValue unit := { + Φ := Ty.tuple []; + φ 'tt := Value.Tuple []; + }. + + Global Instance I2 (A1 A2 : Set) + (_ : ToValue A1) + (_ : ToValue A2) : + ToValue (A1 * A2) := { + Φ := Ty.tuple [Φ A1; Φ A2]; + φ '(x1, x2) := Value.Tuple [φ x1; φ x2]; + }. + + Global Instance I3 (A1 A2 A3 : Set) + (_ : ToValue A1) + (_ : ToValue A2) + (_ : ToValue A3) : + ToValue (A1 * A2 * A3) := { + Φ := Ty.tuple [Φ A1; Φ A2; Φ A3]; + φ '(x1, x2, x3) := + Value.Tuple [φ x1; φ x2; φ x3]; + }. + + Global Instance I4 (A1 A2 A3 A4 : Set) + (_ : ToValue A1) + (_ : ToValue A2) + (_ : ToValue A3) + (_ : ToValue A4) : + ToValue (A1 * A2 * A3 * A4) := { + Φ := Ty.tuple [Φ A1; Φ A2; Φ A3; Φ A4]; + φ '(x1, x2, x3, x4) := + Value.Tuple [φ x1; φ x2; φ x3; φ x4]; + }. + + Global Instance I5 (A1 A2 A3 A4 A5 : Set) + (_ : ToValue A1) + (_ : ToValue A2) + (_ : ToValue A3) + (_ : ToValue A4) + (_ : ToValue A5) : + ToValue (A1 * A2 * A3 * A4 * A5) := { + Φ := Ty.tuple [Φ A1; Φ A2; Φ A3; Φ A4; Φ A5]; + φ '(x1, x2, x3, x4, x5) := + Value.Tuple [φ x1; φ x2; φ x3; φ x4; φ x5]; + }. + + Global Instance I6 (A1 A2 A3 A4 A5 A6 : Set) + (_ : ToValue A1) + (_ : ToValue A2) + (_ : ToValue A3) + (_ : ToValue A4) + (_ : ToValue A5) + (_ : ToValue A6) : + ToValue (A1 * A2 * A3 * A4 * A5 * A6) := { + Φ := Ty.tuple [Φ A1; Φ A2; Φ A3; Φ A4; Φ A5; Φ A6]; + φ '(x1, x2, x3, x4, x5, x6) := + Value.Tuple [φ x1; φ x2; φ x3; φ x4; φ x5; φ x6]; + }. + + Global Instance I7 (A1 A2 A3 A4 A5 A6 A7 : Set) + (_ : ToValue A1) + (_ : ToValue A2) + (_ : ToValue A3) + (_ : ToValue A4) + (_ : ToValue A5) + (_ : ToValue A6) + (_ : ToValue A7) : + ToValue (A1 * A2 * A3 * A4 * A5 * A6 * A7) := { + Φ := Ty.tuple [Φ A1; Φ A2; Φ A3; Φ A4; Φ A5; Φ A6; Φ A7]; + φ '(x1, x2, x3, x4, x5, x6, x7) := + Value.Tuple [φ x1; φ x2; φ x3; φ x4; φ x5; φ x6; φ x7]; + }. + + Global Instance I8 (A1 A2 A3 A4 A5 A6 A7 A8 : Set) + (_ : ToValue A1) + (_ : ToValue A2) + (_ : ToValue A3) + (_ : ToValue A4) + (_ : ToValue A5) + (_ : ToValue A6) + (_ : ToValue A7) + (_ : ToValue A8) : + ToValue (A1 * A2 * A3 * A4 * A5 * A6 * A7 * A8) := { + Φ := Ty.tuple [Φ A1; Φ A2; Φ A3; Φ A4; Φ A5; Φ A6; Φ A7; Φ A8]; + φ '(x1, x2, x3, x4, x5, x6, x7, x8) := + Value.Tuple [φ x1; φ x2; φ x3; φ x4; φ x5; φ x6; φ x7; φ x8]; + }. +End TupleIsToValue. + Module Pointer. + Module Address. + Inductive t (A : Set) : Set := + | Immediate (value : A) + | Mutable {Address : Set} (address : Address). + Arguments Immediate {_}. + Arguments Mutable {_ _}. + + Definition to_address {A : Set} (to_value : A -> Value.t) (address : t A) : + CoqOfRust.M.Pointer.Address.t Value.t := + match address with + | Immediate v => CoqOfRust.M.Pointer.Address.Immediate (to_value v) + | Mutable address => CoqOfRust.M.Pointer.Address.Mutable address + end. + End Address. + Inductive t (A : Set) : Set := - | Immediate (value : A) - | Mutable {Address : Set} (address : Address) (path : Pointer.Path.t). - Arguments Immediate {_}. - Arguments Mutable {_ _}. - - Definition to_value_pointer {A : Set} (to_value : A -> Value.t) (pointer : t A) : - CoqOfRust.M.Pointer.t Value.t := - match pointer with - | Immediate v => CoqOfRust.M.Pointer.Immediate (to_value v) - | Mutable address path => CoqOfRust.M.Pointer.Mutable address path - end. + | Make {Big_A : Set} + (to_value : Big_A -> Value.t) + (address : Address.t Big_A) + (path : Pointer.Path.t) + (projection : Big_A -> option A) + (injection : Big_A -> A -> option Big_A). + Arguments Make {_ _}. + + Definition map {Big Small : Set} + (pointer : t Big) + (index : Pointer.Index.t) + (projection : Big -> option Small) + (injection : Big -> Small -> option Big) : + t Small := + let 'Make to_value address path projection' injection' := pointer in + Make + to_value + address + (path ++ [index]) + (fun big_big => + match projection' big_big with + | Some big => projection big + | None => None + end + ) + (fun big_big small => + match projection' big_big with + | Some big => + match injection big small with + | Some big' => injection' big_big big' + | None => None + end + | None => None + end + ). + + (* Definition to_value_pointer {A : Set} (pointer : t A) : CoqOfRust.M.Pointer.t Value.t := + let 'Make address projection injection := pointer in + let address := + match address with + | Address.Immediate v => CoqOfRust.M.Pointer.Address.Immediate (to_value v) + | Address.Mutable address => CoqOfRust.M.Pointer.Address.Mutable address + end in + {| + CoqOfRust.M.Pointer.address := address; + CoqOfRust.M.Pointer.path := path; + |}. *) End Pointer. Module Primitive. Inductive t : Set -> Set := | StateAlloc {A : Set} (to_value : A -> Value.t) (value : A) : t (Pointer.t A) - | StateRead {A : Set} (pointer : Pointer.t A) : t A - | StateWrite {A : Set} (pointer : Pointer.t A) (update : A) : t unit + | StateRead {A : Set} (address : Pointer.Address.t A) : t A + | StateWrite {A : Set} (address : Pointer.Address.t A) (update : A) : t unit | EnvRead {A : Set} : t A. End Primitive. @@ -72,8 +240,8 @@ Module LowM. | CallPrimitive {B : Set} (primitive : Primitive.t B) (k : B -> t A) | CallClosure {B : Set} (to_value : B -> Value.t) - (params : ClosureParams.t) (body : t (B + Exception.t Empty_set)) + (params : ClosureParams.t) (k : (B + Exception.t Empty_set) -> t A) | Impossible. Arguments Pure {_}. @@ -111,10 +279,11 @@ Definition let_ {A B R : Set} (e1 : MBody A R) (e2 : A -> MBody B R) : MBody B R | inr error => LowM.Pure (inr error) end). -Definition result_to_value {A R : Set} `{ToValue A} `{ToValue R} (result : A + Exception.t R) : +Definition result_to_value {A R : Set} `{ToValue R} + (to_value : A -> Value.t) (result : A + Exception.t R) : Value.t + CoqOfRust.M.Exception.t := match result with - | inl v => inl (φ v) + | inl v => inl (to_value v) | inr exception => inr match exception with | Exception.Return r => CoqOfRust.M.Exception.Return (φ r) @@ -214,6 +383,9 @@ Definition break_match {R : Set} : MBody unit R := Definition panic {A R : Set} (message : string) : MBody A R := raise (Exception.Panic message). +Definition impossible {A R : Set} : MBody A R := + LowM.Impossible. + Definition call_primitive {A R : Set} (primitive : Primitive.t A) : MBody A R := LowM.CallPrimitive primitive (fun result => LowM.Pure (inl result)). @@ -222,10 +394,20 @@ Definition alloc {A R : Set} `{ToValue A} (value : A) : MBody (Pointer.t A) R := call_primitive (Primitive.StateAlloc φ value). Definition read {A R : Set} (pointer : Pointer.t A) : MBody A R := - call_primitive (Primitive.StateRead pointer). + let 'Pointer.Make _ address _ injection _ := pointer in + let* value := call_primitive (Primitive.StateRead address) in + match injection value with + | Some sub_value => pure sub_value + | None => impossible + end. Definition write {A R : Set} (pointer : Pointer.t A) (update : A) : MBody unit R := - call_primitive (Primitive.StateWrite pointer update). + let 'Pointer.Make _ address _ _ projection := pointer in + let* current_value := call_primitive (Primitive.StateRead address) in + match projection current_value update with + | Some updated_value => call_primitive (Primitive.StateWrite address updated_value) + | None => impossible + end. Definition copy {A R : Set} `{ToValue A} (p : Pointer.t A) : MBody (Pointer.t A) R := let* v := read p in @@ -272,8 +454,9 @@ Definition catch_break {R : Set} (body : MBody (Pointer.t unit) R) : MBody (Poin end ). -Definition call_closure {A R : Set} {H : ToValue A} (body : M A) : MBody A R := - catch (LowM.CallClosure φ body LowM.Pure) (fun exception => +Definition call_closure {A R : Set} {H : ToValue A} (body : M A) (params : ClosureParams.t) : + MBody A R := + catch (LowM.CallClosure φ body params LowM.Pure) (fun exception => match exception with | Exception.Return r => match r with end | Exception.Continue => raise Exception.Continue @@ -286,16 +469,6 @@ Definition call_closure {A R : Set} {H : ToValue A} (body : M A) : MBody A R := Definition read_env {A R : Set} : MBody A R := call_primitive Primitive.EnvRead. -Definition impossible {A R : Set} : MBody A R := - LowM.Impossible. - -(* Module EnvStateToValue. - Record t (Env Address : Set) (get_Set : Address -> Set) : Set := { - env_to_value : Env -> Value.t; - cell_to_value : forall (address : Address), get_Set address -> Value.t; - }. -End EnvStateToValue. *) - Module Run. Reserved Notation "{{ Address , env_to_value | e ~ result }}". @@ -304,17 +477,17 @@ Module Run. CoqOfRust.M.M -> MBody A R -> Prop := | Pure (result : A + Exception.t R) : {{ Address, env_to_value | - CoqOfRust.M.LowM.Pure (result_to_value result) ~ + CoqOfRust.M.LowM.Pure (result_to_value φ result) ~ LowM.Pure result }} | CallPrimitiveStateAlloc {B : Set} `{ToValue B} (value : B) (k' : Value.t -> CoqOfRust.M.M) (k : Pointer.t B -> MBody A R) : - (forall (pointer : Pointer.t B), + (forall (address : Pointer.Address.t B), {{ Address, env_to_value | - k' (Value.Pointer φ (Pointer.to_value_pointer φ pointer)) ~ - k pointer + k' (Value.Pointer (CoqOfRust.M.Pointer.Make φ (Pointer.Address.to_address φ address) [])) ~ + k (Pointer.Make φ address [] (fun x => Some x) (fun _ x => Some x)) }} ) -> {{ Address, env_to_value | @@ -323,7 +496,7 @@ Module Run. }} | CallPrimitiveStateRead {B : Set} (to_value : B -> Value.t) - (pointer : Pointer.t B) + (address : Pointer.Address.t B) (k' : Value.t -> CoqOfRust.M.M) (k : B -> MBody A R) : (forall (value : B), @@ -334,13 +507,13 @@ Module Run. ) -> {{ Address, env_to_value | CoqOfRust.M.LowM.CallPrimitive - (CoqOfRust.M.Primitive.StateRead to_value (Pointer.to_value_pointer to_value pointer)) + (CoqOfRust.M.Primitive.StateRead to_value (Pointer.Address.to_address to_value address)) k' ~ - LowM.CallPrimitive (Primitive.StateRead pointer) k + LowM.CallPrimitive (Primitive.StateRead address) k }} | CallPrimitiveStateWrite {B : Set} (to_value : B -> Value.t) - (pointer : Pointer.t B) + (address : Pointer.Address.t B) (update : B) (k' : Value.t -> CoqOfRust.M.M) (k : unit -> MBody A R) : @@ -352,11 +525,11 @@ Module Run. CoqOfRust.M.LowM.CallPrimitive (CoqOfRust.M.Primitive.StateWrite to_value - (Pointer.to_value_pointer to_value pointer) + (Pointer.Address.to_address to_value address) (to_value update) ) k' ~ - LowM.CallPrimitive (Primitive.StateWrite pointer update) k + LowM.CallPrimitive (Primitive.StateWrite address update) k }} | CallPrimitiveEnvRead (k' : Value.t -> CoqOfRust.M.M) @@ -374,10 +547,19 @@ Module Run. | CallClosure {B : Set} (to_value : B -> Value.t) (body : M B) + (params : ClosureParams.t) + (body' : Value.t) + (k' : Value.t + CoqOfRust.M.Exception.t -> CoqOfRust.M.M) (k : B + Exception.t Empty_set -> MBody A R) : + (forall (result : B + Exception.t Empty_set), + {{ Address, env_to_value | + k' (result_to_value to_value result) ~ + k result + }} + ) -> {{ Address, env_to_value | - LowM.CallClosure e k ~ - LowM.CallClosure to_value body k + CoqOfRust.M.LowM.CallClosure body' (ClosureParams.to_value params) k' ~ + LowM.CallClosure to_value body params k }} where "{{ Address , env_to_value | untyped ~ typed }}" := @@ -385,7 +567,7 @@ Module Run. End Run. -Ltac run_symbolic_state_read := +(* Ltac run_symbolic_state_read := match goal with | |- Run.t _ _ _ (LowM.CallPrimitive (Primitive.StateRead ?address) _) _ => let H := fresh "H" in @@ -423,4 +605,4 @@ Ltac run_symbolic := repeat ( cbn || run_symbolic_one_step - ). + ). *) From d7e07e2f622d553d3a21e7271e622e505b26fbfb Mon Sep 17 00:00:00 2001 From: Guillaume Claret Date: Tue, 30 Apr 2024 17:17:00 +0200 Subject: [PATCH 5/7] more wip --- CoqOfRust/M.v | 38 +- .../axiomatized/examples/custom/add_one.v | 1 + .../examples/custom/constructor_as_function.v | 1 + .../axiomatized/examples/custom/hello_world.v | 1 + .../axiomatized/examples/custom/if_let.v | 1 + .../axiomatized/examples/custom/impl_param.v | 1 + .../examples/custom/module_duplicate.v | 1 + .../axiomatized/examples/custom/mutual_loop.v | 1 + .../custom/pattern_in_function_parameters.v | 1 + .../custom/polymorphic_associated_function.v | 1 + .../examples/custom/provided_method.v | 1 + .../ink_contracts/basic_contract_caller.v | 1 + .../examples/ink_contracts/call_runtime.v | 1 + .../ink_contracts/conditional_compilation.v | 1 + .../ink_contracts/contract_terminate.v | 1 + .../ink_contracts/contract_transfer.v | 1 + .../examples/ink_contracts/custom_allocator.v | 1 + .../ink_contracts/custom_environment.v | 1 + .../axiomatized/examples/ink_contracts/dns.v | 1 + .../examples/ink_contracts/e2e_call_runtime.v | 1 + .../examples/ink_contracts/erc1155.v | 1 + .../examples/ink_contracts/erc20.v | 1 + .../examples/ink_contracts/erc721.v | 1 + .../examples/ink_contracts/flipper.v | 1 + .../examples/ink_contracts/incrementer.v | 1 + .../lang_err_integration_tests/call_builder.v | 1 + .../call_builder_delegate.v | 1 + .../constructors_return_value.v | 1 + .../lang_err_integration_tests/contract_ref.v | 1 + .../integration_flipper.v | 1 + .../ink_contracts/mapping_integration_tests.v | 1 + .../examples/ink_contracts/mother.v | 1 + .../examples/ink_contracts/multisig.v | 1 + .../examples/ink_contracts/payment_channel.v | 1 + .../examples/ink_contracts/set_code_hash.v | 1 + .../set_code_hash/updated_incrementer.v | 1 + .../examples/ink_contracts/trait_erc20.v | 1 + .../examples/ink_contracts/trait_flipper.v | 1 + .../ink_contracts/trait_incrementer.v | 1 + .../ink_contracts/wildcard_selector.v | 1 + .../monadic_transformation/example01.v | 1 + .../monadic_transformation/example02.v | 1 + .../monadic_transformation/example03.v | 1 + .../monadic_transformation/example04.v | 1 + .../monadic_transformation/example05.v | 1 + .../examples/rust_book/attributes/dead_code.v | 1 + .../rust_book/cargo/concurrent_tests.v | 1 + .../conversion/converting_to_string.v | 1 + .../examples/rust_book/conversion/from.v | 1 + .../examples/rust_book/conversion/into.v | 1 + .../rust_book/conversion/parsing_a_string.v | 1 + .../conversion/try_from_and_try_into.v | 1 + .../rust_book/custom_types/constants.v | 1 + .../examples/rust_book/custom_types/enums.v | 1 + .../rust_book/custom_types/enums_c_like.v | 1 + .../custom_types/enums_testcase_linked_list.v | 1 + .../custom_types/enums_type_aliases_v1.v | 1 + .../custom_types/enums_type_aliases_v2.v | 1 + .../rust_book/custom_types/enums_use.v | 1 + .../rust_book/custom_types/structures.v | 1 + .../error_handling/aliases_for_result.v | 1 + .../rust_book/error_handling/boxing_errors.v | 1 + .../error_handling/combinators_and_then.v | 1 + .../error_handling/combinators_map.v | 1 + .../error_handling/defining_an_error_type.v | 1 + .../rust_book/error_handling/early_returns.v | 1 + .../introducing_question_mark.v | 1 + ...ark_is_an_replacement_for_deprecated_try.v | 1 + ..._valid_values_and_failures_via_partition.v | 1 + ...ues_and_failures_via_partition_unwrapped.v | 1 + ...sults_collect_via_map_err_and_filter_map.v | 1 + ...esults_fail_entire_operation_via_collect.v | 1 + .../iterating_over_results_failed.v | 1 + ...ating_over_results_handle_via_filter_map.v | 1 + .../map_in_result_via_combinators.v | 1 + .../error_handling/map_in_result_via_match.v | 1 + .../error_handling/multiple_error_types.v | 1 + .../error_handling/option_and_unwrap.v | 1 + .../other_uses_of_question_mark.v | 1 + .../examples/rust_book/error_handling/panic.v | 1 + .../pulling_results_out_of_options.v | 1 + ...ut_of_options_with_stop_error_processing.v | 1 + .../error_handling/result_use_in_main.v | 1 + ...g_options_and_defaults_via_get_or_insert.v | 1 + ...ions_and_defaults_via_get_or_insert_with.v | 1 + .../unpacking_options_and_defaults_via_or.v | 1 + ...packing_options_and_defaults_via_or_else.v | 1 + .../unpacking_options_via_question_mark.v | 1 + .../error_handling/wrapping_errors.v | 1 + .../examples/rust_book/expressions/blocks.v | 1 + .../expressions/const_underscore_expression.v | 1 + .../rust_book/expressions/statement.v | 1 + .../variable_binding_and_expression.v | 1 + .../for_and_iterators_into_iter.v | 1 + .../flow_of_control/for_and_iterators_iter.v | 1 + .../for_and_iterators_iter_mut.v | 1 + .../for_and_range_completely_inclusive.v | 1 + .../for_and_range_inclusive_to_exclusive.v | 1 + .../rust_book/flow_of_control/if_else.v | 1 + .../rust_book/flow_of_control/if_let.v | 1 + .../flow_of_control/if_let_challenge.v | 1 + .../flow_of_control/if_let_dont_use_match.v | 1 + .../if_let_match_enum_values.v | 1 + .../rust_book/flow_of_control/infinite_loop.v | 1 + .../flow_of_control/loop_nesting_and_labels.v | 1 + .../loop_returning_from_loops.v | 1 + .../rust_book/flow_of_control/match.v | 1 + .../rust_book/flow_of_control/match_binding.v | 1 + .../match_binding_destructure_enum_variants.v | 1 + .../match_destructuring_arrays_slices.v | 1 + .../match_destructuring_enums.v | 1 + .../match_destructuring_pointers_ref.v | 1 + .../match_destructuring_structs.v | 1 + .../match_destructuring_tuples.v | 1 + .../match_destructuring_tuples_fixed.v | 1 + .../rust_book/flow_of_control/match_guards.v | 1 + .../match_guards_unreachable.v | 1 + .../rust_book/flow_of_control/while.v | 1 + .../rust_book/flow_of_control/while_let.v | 1 + .../while_let_match_is_weird.v | 1 + .../associated_functions_and_methods.v | 1 + .../rust_book/functions/diverging_functions.v | 1 + ...erging_functions_example_sum_odd_numbers.v | 1 + ...verging_functions_no_info_in_return_type.v | 1 + .../examples/rust_book/functions/functions.v | 1 + .../rust_book/functions/functions_closures.v | 1 + .../functions_closures_as_input_parameters.v | 1 + .../functions_closures_as_output_parameters.v | 1 + .../functions/functions_closures_capturing.v | 1 + .../functions_closures_example_Iterator_any.v | 1 + ...earching_through_iterators_Iterator_find.v | 1 + ...hing_through_iterators_Iterator_position.v | 1 + ...ions_closures_forced_capturing_with_move.v | 1 + .../functions_closures_input_functions.v | 1 + ...functions_closures_type_anonymity_define.v | 1 + ...s_closures_type_anonymity_define_and_use.v | 1 + .../rust_book/functions/functions_order.v | 1 + .../functions/higher_order_functions.v | 1 + .../examples/rust_book/generics/generics.v | 1 + .../generics_associated_types_problem.v | 1 + .../generics_associated_types_solution.v | 1 + .../rust_book/generics/generics_bounds.v | 1 + .../generics_bounds_test_case_empty_bounds.v | 1 + .../rust_book/generics/generics_functions.v | 1 + .../generics/generics_implementation.v | 1 + .../generics/generics_multiple_bounds.v | 1 + .../generics/generics_new_type_idiom.v | 1 + .../generics_new_type_idiom_as_base_type.v | 1 + .../generics/generics_phantom_type.v | 1 + ...hantom_type_test_case_unit_clarification.v | 1 + .../rust_book/generics/generics_traits.v | 1 + .../generics/generics_where_clauses.v | 1 + .../rust_book/guessing_game/guessing_game.v | 1 + .../rust_book/hello_world/formatted_print.v | 1 + .../rust_book/hello_world/hello_world.v | 1 + .../rust_book/macro_rules/macro_example.v | 1 + .../macro_rules/macro_rules_designators.v | 1 + .../rust_book/macro_rules/macro_rules_dsl.v | 1 + .../macro_rules/macro_rules_overload.v | 1 + .../macro_rules/macro_rules_repeat.v | 1 + .../macro_rules_variadic_interfaces.v | 1 + .../rust_book/modules/struct_visibility.v | 1 + .../rust_book/modules/super_and_self.v | 1 + .../modules/the_use_as_declaration.v | 1 + .../examples/rust_book/modules/visibility.v | 1 + .../rust_book/primitives/arrays_and_slices.v | 1 + .../rust_book/primitives/compound_types.v | 1 + .../rust_book/primitives/literals_operators.v | 1 + .../examples/rust_book/primitives/tuples.v | 1 + .../scoping_rules/scoping_rules_borrowing.v | 1 + .../scoping_rules_borrowing_aliasing.v | 1 + .../scoping_rules_borrowing_mutablity.v | 1 + .../scoping_rules_borrowing_the_ref_pattern.v | 1 + .../scoping_rules/scoping_rules_lifetimes.v | 1 + .../scoping_rules_lifetimes_bounds.v | 1 + .../scoping_rules_lifetimes_coercion.v | 1 + .../scoping_rules_lifetimes_elision.v | 1 + .../scoping_rules_lifetimes_functions.v | 1 + .../scoping_rules_lifetimes_methods.v | 1 + ...ules_lifetimes_reference_lifetime_static.v | 1 + .../scoping_rules_lifetimes_structs.v | 1 + .../scoping_rules_lifetimes_traits.v | 1 + .../scoping_rules_ownership_and_rules.v | 1 + ...ping_rules_ownership_and_rules_mutablity.v | 1 + ..._rules_ownership_and_rules_partial_moves.v | 1 + .../scoping_rules/scoping_rules_raii.v | 1 + .../scoping_rules_raii_desctructor.v | 1 + .../rust_book/std_library_types/arc.v | 1 + .../std_library_types/box_stack_heap.v | 1 + .../rust_book/std_library_types/hash_map.v | 1 + .../hash_map_alternate_or_custom_key_types.v | 1 + .../std_library_types/hash_map_hash_set.v | 1 + .../rust_book/std_library_types/option.v | 1 + .../rust_book/std_library_types/panic.v | 1 + .../examples/rust_book/std_library_types/rc.v | 1 + .../rust_book/std_library_types/result.v | 1 + .../result_chaining_with_question_mark.v | 1 + .../rust_book/std_library_types/strings.v | 1 + .../strings_byte_strings_as_non_utf8.v | 1 + .../strings_literals_and_escapes.v | 1 + .../strings_raw_string_literals.v | 1 + .../rust_book/std_library_types/vectors.v | 1 + .../examples/rust_book/std_misc/channels.v | 1 + .../rust_book/std_misc/child_processes.v | 1 + .../std_misc/child_processes_pipes.v | 1 + .../rust_book/std_misc/child_processes_wait.v | 1 + .../rust_book/std_misc/file_io_create.v | 1 + .../rust_book/std_misc/file_io_open.v | 1 + .../rust_book/std_misc/file_io_read_lines.v | 1 + .../file_io_read_lines_efficient_method.v | 1 + .../std_misc/filesystem_operations.v | 1 + .../std_misc/foreign_function_interface.v | 1 + .../examples/rust_book/std_misc/path.v | 1 + .../rust_book/std_misc/program_arguments.v | 1 + .../std_misc/program_arguments_parsing.v | 1 + .../examples/rust_book/std_misc/threads.v | 1 + .../std_misc/threads_test_case_map_reduce.v | 1 + .../rust_book/testing/documentation_testing.v | 1 + .../examples/rust_book/testing/unit_testing.v | 1 + .../examples/rust_book/traits/clone.v | 1 + .../examples/rust_book/traits/derive.v | 1 + .../disambiguating_overlapping_traits.v | 1 + .../examples/rust_book/traits/drop.v | 1 + .../examples/rust_book/traits/hash.v | 1 + .../traits/impl_trait_as_return_type.v | 1 + .../examples/rust_book/traits/iterators.v | 1 + .../rust_book/traits/operator_overloading.v | 1 + .../traits/returning_traits_with_dyn.v | 1 + .../examples/rust_book/traits/supertraits.v | 1 + .../examples/rust_book/traits/traits.v | 1 + .../examples/rust_book/traits/traits_parms.v | 1 + .../examples/rust_book/types/aliasing.v | 1 + .../examples/rust_book/types/casting.v | 1 + .../examples/rust_book/types/inference.v | 1 + .../examples/rust_book/types/literals.v | 1 + .../calling_unsafe_functions.v | 1 + .../unsafe_operations/inline_assembly.v | 1 + .../inline_assembly_clobbered_registers.v | 1 + ...line_assembly_explicit_register_operands.v | 1 + ...line_assembly_inlateout_case_implemented.v | 1 + .../inline_assembly_inlateout_case_non_used.v | 1 + .../inline_assembly_inlateout_mul.v | 1 + .../unsafe_operations/inline_assembly_inout.v | 1 + .../inline_assembly_inputs_and_outputs.v | 1 + ...embly_inputs_and_outputs_another_example.v | 1 + ..._and_outputs_another_example_without_mov.v | 1 + .../inline_assembly_labels.v | 1 + .../inline_assembly_memory_address_operands.v | 1 + .../inline_assembly_options.v | 1 + ...ine_assembly_register_template_modifiers.v | 1 + .../inline_assembly_scratch_register.v | 1 + ...ssembly_symbol_operands_and_abi_clobbers.v | 1 + .../unsafe_operations/raw_pointers.v | 1 + .../variable_bindings/declare_first.v | 1 + .../rust_book/variable_bindings/freezing.v | 1 + .../rust_book/variable_bindings/mutability.v | 1 + .../rust_book/variable_bindings/scope.v | 1 + .../variable_bindings/variable_bindings.v | 1 + .../variable_bindings/variable_shadowing.v | 1 + .../examples/axiomatized/examples/subtle.v | 1 + .../default/examples/custom/add_one.v | 1 + .../examples/custom/constructor_as_function.v | 8 +- .../default/examples/custom/hello_world.v | 1 + .../examples/default/examples/custom/if_let.v | 1 + .../default/examples/custom/impl_param.v | 1 + .../examples/custom/module_duplicate.v | 1 + .../default/examples/custom/mutual_loop.v | 1 + .../custom/pattern_in_function_parameters.v | 1 + .../custom/polymorphic_associated_function.v | 13 +- .../default/examples/custom/provided_method.v | 1 + .../ink_contracts/basic_contract_caller.v | 38 +- .../examples/ink_contracts/call_runtime.v | 1 + .../ink_contracts/conditional_compilation.v | 85 ++-- .../ink_contracts/contract_terminate.v | 3 +- .../ink_contracts/contract_transfer.v | 3 +- .../examples/ink_contracts/custom_allocator.v | 28 +- .../ink_contracts/custom_environment.v | 3 +- .../default/examples/ink_contracts/dns.v | 93 ++-- .../examples/ink_contracts/e2e_call_runtime.v | 1 + .../default/examples/ink_contracts/erc1155.v | 96 ++-- .../default/examples/ink_contracts/erc20.v | 22 +- .../default/examples/ink_contracts/erc721.v | 79 ++-- .../default/examples/ink_contracts/flipper.v | 9 +- .../examples/ink_contracts/incrementer.v | 9 +- .../lang_err_integration_tests/call_builder.v | 1 + .../call_builder_delegate.v | 1 + .../constructors_return_value.v | 8 +- .../lang_err_integration_tests/contract_ref.v | 30 +- .../integration_flipper.v | 16 +- .../ink_contracts/mapping_integration_tests.v | 61 ++- .../default/examples/ink_contracts/mother.v | 80 ++-- .../default/examples/ink_contracts/multisig.v | 427 +++++++++++------- .../examples/ink_contracts/payment_channel.v | 172 ++++--- .../examples/ink_contracts/set_code_hash.v | 16 +- .../set_code_hash/updated_incrementer.v | 23 +- .../examples/ink_contracts/trait_erc20.v | 42 +- .../examples/ink_contracts/trait_flipper.v | 11 +- .../ink_contracts/trait_incrementer.v | 25 +- .../ink_contracts/wildcard_selector.v | 1 + .../monadic_transformation/example01.v | 1 + .../monadic_transformation/example02.v | 1 + .../monadic_transformation/example03.v | 1 + .../monadic_transformation/example04.v | 1 + .../monadic_transformation/example05.v | 3 +- .../examples/rust_book/attributes/dead_code.v | 1 + .../rust_book/cargo/concurrent_tests.v | 1 + .../conversion/converting_to_string.v | 8 +- .../examples/rust_book/conversion/from.v | 1 + .../examples/rust_book/conversion/into.v | 1 + .../rust_book/conversion/parsing_a_string.v | 1 + .../conversion/try_from_and_try_into.v | 15 +- .../rust_book/custom_types/constants.v | 1 + .../examples/rust_book/custom_types/enums.v | 1 + .../rust_book/custom_types/enums_c_like.v | 1 + .../custom_types/enums_testcase_linked_list.v | 1 + .../custom_types/enums_type_aliases_v1.v | 1 + .../custom_types/enums_type_aliases_v2.v | 1 + .../rust_book/custom_types/enums_use.v | 1 + .../rust_book/custom_types/structures.v | 41 +- .../error_handling/aliases_for_result.v | 1 + .../rust_book/error_handling/boxing_errors.v | 1 + .../error_handling/combinators_and_then.v | 1 + .../error_handling/combinators_map.v | 7 +- .../error_handling/defining_an_error_type.v | 1 + .../rust_book/error_handling/early_returns.v | 1 + .../introducing_question_mark.v | 1 + ...ark_is_an_replacement_for_deprecated_try.v | 1 + ..._valid_values_and_failures_via_partition.v | 1 + ...ues_and_failures_via_partition_unwrapped.v | 1 + ...sults_collect_via_map_err_and_filter_map.v | 1 + ...esults_fail_entire_operation_via_collect.v | 1 + .../iterating_over_results_failed.v | 1 + ...ating_over_results_handle_via_filter_map.v | 1 + .../map_in_result_via_combinators.v | 1 + .../error_handling/map_in_result_via_match.v | 1 + .../error_handling/multiple_error_types.v | 1 + .../error_handling/option_and_unwrap.v | 1 + .../other_uses_of_question_mark.v | 1 + .../examples/rust_book/error_handling/panic.v | 1 + .../pulling_results_out_of_options.v | 1 + ...ut_of_options_with_stop_error_processing.v | 1 + .../error_handling/result_use_in_main.v | 1 + ...g_options_and_defaults_via_get_or_insert.v | 1 + ...ions_and_defaults_via_get_or_insert_with.v | 1 + .../unpacking_options_and_defaults_via_or.v | 1 + ...packing_options_and_defaults_via_or_else.v | 1 + .../unpacking_options_via_question_mark.v | 26 +- .../error_handling/wrapping_errors.v | 1 + .../examples/rust_book/expressions/blocks.v | 1 + .../expressions/const_underscore_expression.v | 5 +- .../rust_book/expressions/statement.v | 1 + .../variable_binding_and_expression.v | 1 + .../for_and_iterators_into_iter.v | 1 + .../flow_of_control/for_and_iterators_iter.v | 1 + .../for_and_iterators_iter_mut.v | 1 + .../for_and_range_completely_inclusive.v | 1 + .../for_and_range_inclusive_to_exclusive.v | 1 + .../rust_book/flow_of_control/if_else.v | 1 + .../rust_book/flow_of_control/if_let.v | 1 + .../flow_of_control/if_let_challenge.v | 1 + .../flow_of_control/if_let_dont_use_match.v | 1 + .../if_let_match_enum_values.v | 1 + .../rust_book/flow_of_control/infinite_loop.v | 1 + .../flow_of_control/loop_nesting_and_labels.v | 1 + .../loop_returning_from_loops.v | 1 + .../rust_book/flow_of_control/match.v | 1 + .../rust_book/flow_of_control/match_binding.v | 1 + .../match_binding_destructure_enum_variants.v | 1 + .../match_destructuring_arrays_slices.v | 1 + .../match_destructuring_enums.v | 1 + .../match_destructuring_pointers_ref.v | 1 + .../match_destructuring_structs.v | 1 + .../match_destructuring_tuples.v | 1 + .../match_destructuring_tuples_fixed.v | 1 + .../rust_book/flow_of_control/match_guards.v | 1 + .../match_guards_unreachable.v | 1 + .../rust_book/flow_of_control/while.v | 1 + .../rust_book/flow_of_control/while_let.v | 1 + .../while_let_match_is_weird.v | 1 + .../associated_functions_and_methods.v | 108 +++-- .../rust_book/functions/diverging_functions.v | 1 + ...erging_functions_example_sum_odd_numbers.v | 1 + ...verging_functions_no_info_in_return_type.v | 1 + .../examples/rust_book/functions/functions.v | 1 + .../rust_book/functions/functions_closures.v | 1 + .../functions_closures_as_input_parameters.v | 1 + .../functions_closures_as_output_parameters.v | 1 + .../functions/functions_closures_capturing.v | 1 + .../functions_closures_example_Iterator_any.v | 1 + ...earching_through_iterators_Iterator_find.v | 1 + ...hing_through_iterators_Iterator_position.v | 1 + ...ions_closures_forced_capturing_with_move.v | 1 + .../functions_closures_input_functions.v | 1 + ...functions_closures_type_anonymity_define.v | 1 + ...s_closures_type_anonymity_define_and_use.v | 1 + .../rust_book/functions/functions_order.v | 1 + .../functions/higher_order_functions.v | 1 + .../examples/rust_book/generics/generics.v | 1 + .../generics_associated_types_problem.v | 29 +- .../generics_associated_types_solution.v | 36 +- .../rust_book/generics/generics_bounds.v | 25 +- .../generics_bounds_test_case_empty_bounds.v | 1 + .../rust_book/generics/generics_functions.v | 1 + .../generics/generics_implementation.v | 9 +- .../generics/generics_multiple_bounds.v | 1 + .../generics/generics_new_type_idiom.v | 11 +- .../generics_new_type_idiom_as_base_type.v | 3 +- .../generics/generics_phantom_type.v | 61 ++- ...hantom_type_test_case_unit_clarification.v | 59 ++- .../rust_book/generics/generics_traits.v | 1 + .../generics/generics_where_clauses.v | 1 + .../rust_book/guessing_game/guessing_game.v | 1 + .../rust_book/hello_world/formatted_print.v | 1 + .../rust_book/hello_world/hello_world.v | 1 + .../rust_book/macro_rules/macro_example.v | 1 + .../macro_rules/macro_rules_designators.v | 1 + .../rust_book/macro_rules/macro_rules_dsl.v | 1 + .../macro_rules/macro_rules_overload.v | 1 + .../macro_rules/macro_rules_repeat.v | 1 + .../macro_rules_variadic_interfaces.v | 1 + .../rust_book/modules/struct_visibility.v | 8 +- .../rust_book/modules/super_and_self.v | 1 + .../modules/the_use_as_declaration.v | 1 + .../examples/rust_book/modules/visibility.v | 1 + .../rust_book/primitives/arrays_and_slices.v | 1 + .../rust_book/primitives/compound_types.v | 1 + .../rust_book/primitives/literals_operators.v | 1 + .../examples/rust_book/primitives/tuples.v | 12 +- .../scoping_rules/scoping_rules_borrowing.v | 1 + .../scoping_rules_borrowing_aliasing.v | 112 +++-- .../scoping_rules_borrowing_mutablity.v | 38 +- .../scoping_rules_borrowing_the_ref_pattern.v | 29 +- .../scoping_rules/scoping_rules_lifetimes.v | 1 + .../scoping_rules_lifetimes_bounds.v | 7 +- .../scoping_rules_lifetimes_coercion.v | 1 + .../scoping_rules_lifetimes_elision.v | 1 + .../scoping_rules_lifetimes_functions.v | 1 + .../scoping_rules_lifetimes_methods.v | 17 +- ...ules_lifetimes_reference_lifetime_static.v | 1 + .../scoping_rules_lifetimes_structs.v | 24 +- .../scoping_rules_lifetimes_traits.v | 8 +- .../scoping_rules_ownership_and_rules.v | 1 + ...ping_rules_ownership_and_rules_mutablity.v | 1 + ..._rules_ownership_and_rules_partial_moves.v | 24 +- .../scoping_rules/scoping_rules_raii.v | 1 + .../scoping_rules_raii_desctructor.v | 1 + .../rust_book/std_library_types/arc.v | 1 + .../std_library_types/box_stack_heap.v | 5 +- .../rust_book/std_library_types/hash_map.v | 1 + .../hash_map_alternate_or_custom_key_types.v | 65 +-- .../std_library_types/hash_map_hash_set.v | 1 + .../rust_book/std_library_types/option.v | 1 + .../rust_book/std_library_types/panic.v | 1 + .../examples/rust_book/std_library_types/rc.v | 1 + .../rust_book/std_library_types/result.v | 1 + .../result_chaining_with_question_mark.v | 1 + .../rust_book/std_library_types/strings.v | 1 + .../strings_byte_strings_as_non_utf8.v | 1 + .../strings_literals_and_escapes.v | 1 + .../strings_raw_string_literals.v | 1 + .../rust_book/std_library_types/vectors.v | 1 + .../examples/rust_book/std_misc/channels.v | 1 + .../rust_book/std_misc/child_processes.v | 9 +- .../std_misc/child_processes_pipes.v | 11 +- .../rust_book/std_misc/child_processes_wait.v | 1 + .../rust_book/std_misc/file_io_create.v | 1 + .../rust_book/std_misc/file_io_open.v | 1 + .../rust_book/std_misc/file_io_read_lines.v | 1 + .../file_io_read_lines_efficient_method.v | 1 + .../std_misc/filesystem_operations.v | 1 + .../std_misc/foreign_function_interface.v | 36 +- .../examples/rust_book/std_misc/path.v | 1 + .../rust_book/std_misc/program_arguments.v | 1 + .../std_misc/program_arguments_parsing.v | 1 + .../examples/rust_book/std_misc/threads.v | 1 + .../std_misc/threads_test_case_map_reduce.v | 1 + .../rust_book/testing/documentation_testing.v | 1 + .../examples/rust_book/testing/unit_testing.v | 1 + .../default/examples/rust_book/traits/clone.v | 9 +- .../examples/rust_book/traits/derive.v | 13 +- .../disambiguating_overlapping_traits.v | 15 +- .../default/examples/rust_book/traits/drop.v | 8 +- .../default/examples/rust_book/traits/hash.v | 7 +- .../traits/impl_trait_as_return_type.v | 1 + .../examples/rust_book/traits/iterators.v | 11 +- .../rust_book/traits/operator_overloading.v | 1 + .../traits/returning_traits_with_dyn.v | 1 + .../examples/rust_book/traits/supertraits.v | 1 + .../examples/rust_book/traits/traits.v | 21 +- .../examples/rust_book/traits/traits_parms.v | 1 + .../examples/rust_book/types/aliasing.v | 1 + .../examples/rust_book/types/casting.v | 1 + .../examples/rust_book/types/inference.v | 1 + .../examples/rust_book/types/literals.v | 1 + .../calling_unsafe_functions.v | 1 + .../unsafe_operations/inline_assembly.v | 1 + .../inline_assembly_clobbered_registers.v | 1 + ...line_assembly_explicit_register_operands.v | 1 + ...line_assembly_inlateout_case_implemented.v | 1 + .../inline_assembly_inlateout_case_non_used.v | 1 + .../inline_assembly_inlateout_mul.v | 1 + .../unsafe_operations/inline_assembly_inout.v | 1 + .../inline_assembly_inputs_and_outputs.v | 1 + ...embly_inputs_and_outputs_another_example.v | 1 + ..._and_outputs_another_example_without_mov.v | 1 + .../inline_assembly_labels.v | 1 + .../inline_assembly_memory_address_operands.v | 1 + .../inline_assembly_options.v | 1 + ...ine_assembly_register_template_modifiers.v | 1 + .../inline_assembly_scratch_register.v | 1 + ...ssembly_symbol_operands_and_abi_clobbers.v | 1 + .../unsafe_operations/raw_pointers.v | 1 + .../variable_bindings/declare_first.v | 1 + .../rust_book/variable_bindings/freezing.v | 1 + .../rust_book/variable_bindings/mutability.v | 1 + .../rust_book/variable_bindings/scope.v | 1 + .../variable_bindings/variable_bindings.v | 1 + .../variable_bindings/variable_shadowing.v | 1 + CoqOfRust/examples/default/examples/subtle.v | 115 +++-- CoqOfRust/typed/M.v | 170 +++++-- lib/src/header.rs | 1 + lib/src/path.rs | 11 +- lib/src/thir_expression.rs | 2 +- 523 files changed, 2126 insertions(+), 999 deletions(-) diff --git a/CoqOfRust/M.v b/CoqOfRust/M.v index 116636e6b..faa4bb9b0 100644 --- a/CoqOfRust/M.v +++ b/CoqOfRust/M.v @@ -333,9 +333,9 @@ End Value. Module Primitive. Inductive t : Set := | StateAlloc (value : Value.t) - | StateRead {A : Set} (to_value : A -> Value.t) (address : Pointer.Address.t Value.t) - | StateWrite {A : Set} - (to_value : A -> Value.t) (address : Pointer.Address.t Value.t) (update : Value.t) + | StateRead (pointer : Pointer.t Value.t) + | StateWrite (pointer : Pointer.t Value.t) (update : Value.t) + | MakeSubPointer (pointer : Pointer.t Value.t) (index : Pointer.Index.t) | EnvRead | GetFunction (path : string) (generic_tys : list Ty.t) | GetAssociatedFunction (ty : Ty.t) (name : string) (generic_tys : list Ty.t) @@ -558,24 +558,13 @@ Definition alloc (v : Value.t) : M := Definition read (r : Value.t) : M := match r with - | Value.Pointer (Pointer.Make to_value address path) => - let* value := call_primitive (Primitive.StateRead to_value address) in - match Value.read_path value path with - | Some sub_value => pure sub_value - | None => impossible - end + | Value.Pointer pointer => call_primitive (Primitive.StateRead pointer) | _ => impossible end. Definition write (r : Value.t) (update : Value.t) : M := match r with - | Value.Pointer (Pointer.Make to_value address path) => - let* current_value := call_primitive (Primitive.StateRead to_value address) in - match Value.write_value current_value path update with - | Some updated_value => - call_primitive (Primitive.StateWrite to_value address updated_value) - | None => impossible - end + | Value.Pointer pointer => call_primitive (Primitive.StateWrite pointer update) | _ => impossible end. @@ -746,10 +735,7 @@ Parameter get_array_field : forall (value : Value.t) (index : Value.t), M. | _ => pure (Value.Error "Expected a usize as an array index") end. *) -(** Same as for [get_tuple_field], an error should not occur. *) -Parameter get_struct_tuple_field : forall - (value : Value.t) (constructor : string) (index : Z), - Value.t. +Parameter get_struct_tuple_field : forall (value : Value.t) (constructor : string) (index : Z), M. (* Definition get_struct_tuple_field (value : Value.t) (constructor : string) (index : Z) : Value.t := @@ -775,15 +761,11 @@ Parameter get_struct_tuple_field : forall | _ => Value.Error "expected an address" end. *) -(** Same as for [get_tuple_field], an error should not occur. *) -Definition get_struct_record_field - (value : Value.t) (constructor field : string) : - Value.t := +Definition get_struct_record_field (value : Value.t) (constructor field : string) : M := match value with - | Value.Pointer (Pointer.Make to_value address path) => - let new_path := path ++ [Pointer.Index.StructRecord constructor field] in - Value.Pointer (Pointer.Make to_value address new_path) - | _ => Value.Error "expected an address" + | Value.Pointer pointer => + call_primitive (Primitive.MakeSubPointer pointer (Pointer.Index.StructRecord constructor field)) + | _ => impossible end. Parameter pointer_coercion : Value.t -> Value.t. diff --git a/CoqOfRust/examples/axiomatized/examples/custom/add_one.v b/CoqOfRust/examples/axiomatized/examples/custom/add_one.v index 986d5675c..bf2452fd2 100644 --- a/CoqOfRust/examples/axiomatized/examples/custom/add_one.v +++ b/CoqOfRust/examples/axiomatized/examples/custom/add_one.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter add_one : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/custom/constructor_as_function.v b/CoqOfRust/examples/axiomatized/examples/custom/constructor_as_function.v index 2120daa08..b3b0cbf1d 100644 --- a/CoqOfRust/examples/axiomatized/examples/custom/constructor_as_function.v +++ b/CoqOfRust/examples/axiomatized/examples/custom/constructor_as_function.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter matching : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/custom/hello_world.v b/CoqOfRust/examples/axiomatized/examples/custom/hello_world.v index 15a7f815c..24c422a32 100644 --- a/CoqOfRust/examples/axiomatized/examples/custom/hello_world.v +++ b/CoqOfRust/examples/axiomatized/examples/custom/hello_world.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter message : Value.t. diff --git a/CoqOfRust/examples/axiomatized/examples/custom/if_let.v b/CoqOfRust/examples/axiomatized/examples/custom/if_let.v index a22c93b58..80076c538 100644 --- a/CoqOfRust/examples/axiomatized/examples/custom/if_let.v +++ b/CoqOfRust/examples/axiomatized/examples/custom/if_let.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter order : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/custom/impl_param.v b/CoqOfRust/examples/axiomatized/examples/custom/impl_param.v index a7fa611ee..944e890a2 100644 --- a/CoqOfRust/examples/axiomatized/examples/custom/impl_param.v +++ b/CoqOfRust/examples/axiomatized/examples/custom/impl_param.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter with_impls : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/custom/module_duplicate.v b/CoqOfRust/examples/axiomatized/examples/custom/module_duplicate.v index 9bc0b2494..f56adcc45 100644 --- a/CoqOfRust/examples/axiomatized/examples/custom/module_duplicate.v +++ b/CoqOfRust/examples/axiomatized/examples/custom/module_duplicate.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Module foo. Module gre. diff --git a/CoqOfRust/examples/axiomatized/examples/custom/mutual_loop.v b/CoqOfRust/examples/axiomatized/examples/custom/mutual_loop.v index 70eb1dc21..f65b34fd5 100644 --- a/CoqOfRust/examples/axiomatized/examples/custom/mutual_loop.v +++ b/CoqOfRust/examples/axiomatized/examples/custom/mutual_loop.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/custom/pattern_in_function_parameters.v b/CoqOfRust/examples/axiomatized/examples/custom/pattern_in_function_parameters.v index 7fdc7ae38..e79d69f24 100644 --- a/CoqOfRust/examples/axiomatized/examples/custom/pattern_in_function_parameters.v +++ b/CoqOfRust/examples/axiomatized/examples/custom/pattern_in_function_parameters.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter sum : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/custom/polymorphic_associated_function.v b/CoqOfRust/examples/axiomatized/examples/custom/polymorphic_associated_function.v index 62b3f0f0c..4d9a15b74 100644 --- a/CoqOfRust/examples/axiomatized/examples/custom/polymorphic_associated_function.v +++ b/CoqOfRust/examples/axiomatized/examples/custom/polymorphic_associated_function.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/custom/provided_method.v b/CoqOfRust/examples/axiomatized/examples/custom/provided_method.v index 3113a0148..49183b20f 100644 --- a/CoqOfRust/examples/axiomatized/examples/custom/provided_method.v +++ b/CoqOfRust/examples/axiomatized/examples/custom/provided_method.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Trait *) Module ProvidedAndRequired. diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/basic_contract_caller.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/basic_contract_caller.v index b5d950909..91e2033c9 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/basic_contract_caller.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/basic_contract_caller.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/call_runtime.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/call_runtime.v index d5dd62699..e97d5cce0 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/call_runtime.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/call_runtime.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/conditional_compilation.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/conditional_compilation.v index 320e0abf8..7f86d363d 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/conditional_compilation.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/conditional_compilation.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/contract_terminate.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/contract_terminate.v index 9665cef03..327763b20 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/contract_terminate.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/contract_terminate.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/contract_transfer.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/contract_transfer.v index ebe681bb9..e00fa41ee 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/contract_transfer.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/contract_transfer.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/custom_allocator.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/custom_allocator.v index a3556d5c5..11a641e5b 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/custom_allocator.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/custom_allocator.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/custom_environment.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/custom_environment.v index 7ab5cf2a8..c6a7c0713 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/custom_environment.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/custom_environment.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/dns.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/dns.v index 311284135..d05694184 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/dns.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/dns.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/e2e_call_runtime.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/e2e_call_runtime.v index e410b0226..b89f05e25 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/e2e_call_runtime.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/e2e_call_runtime.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc1155.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc1155.v index 2e198bb7d..ef887c49d 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc1155.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc1155.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc20.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc20.v index 144fc78ef..f3f2a0049 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc20.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc20.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc721.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc721.v index 2425a2ad4..bd80dd47c 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc721.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc721.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/flipper.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/flipper.v index ad9be484a..892213400 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/flipper.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/flipper.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/incrementer.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/incrementer.v index f67051ae7..5761fb76e 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/incrementer.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/incrementer.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/lang_err_integration_tests/call_builder.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/lang_err_integration_tests/call_builder.v index 673e9ed1e..29fcb9e69 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/lang_err_integration_tests/call_builder.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/lang_err_integration_tests/call_builder.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/lang_err_integration_tests/call_builder_delegate.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/lang_err_integration_tests/call_builder_delegate.v index 69f472490..5a434522e 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/lang_err_integration_tests/call_builder_delegate.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/lang_err_integration_tests/call_builder_delegate.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Axiom Hash : (Ty.path "call_builder_delegate::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u8" ]). diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/lang_err_integration_tests/constructors_return_value.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/lang_err_integration_tests/constructors_return_value.v index 637329d57..18eb2493e 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/lang_err_integration_tests/constructors_return_value.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/lang_err_integration_tests/constructors_return_value.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/lang_err_integration_tests/contract_ref.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/lang_err_integration_tests/contract_ref.v index 6b0e22145..6a1a070a1 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/lang_err_integration_tests/contract_ref.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/lang_err_integration_tests/contract_ref.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/lang_err_integration_tests/integration_flipper.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/lang_err_integration_tests/integration_flipper.v index 56dc5246f..2d4acd077 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/lang_err_integration_tests/integration_flipper.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/lang_err_integration_tests/integration_flipper.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/mapping_integration_tests.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/mapping_integration_tests.v index 012c95204..9028957e9 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/mapping_integration_tests.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/mapping_integration_tests.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/mother.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/mother.v index d113ef885..72f65a433 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/mother.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/mother.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/multisig.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/multisig.v index 1ff8fa0a0..f0bec5f9c 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/multisig.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/multisig.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/payment_channel.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/payment_channel.v index 6077c79cb..3b9166b1d 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/payment_channel.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/payment_channel.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/set_code_hash.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/set_code_hash.v index 6e601253c..9a909e6f5 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/set_code_hash.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/set_code_hash.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Error diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/set_code_hash/updated_incrementer.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/set_code_hash/updated_incrementer.v index 5fb12b769..c7796a547 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/set_code_hash/updated_incrementer.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/set_code_hash/updated_incrementer.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/trait_erc20.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/trait_erc20.v index 9ce0910b2..ca3c3b459 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/trait_erc20.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/trait_erc20.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/trait_flipper.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/trait_flipper.v index 6505e5214..28098cff6 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/trait_flipper.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/trait_flipper.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Trait *) (* Empty module 'Flip' *) diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/trait_incrementer.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/trait_incrementer.v index 1da3518a1..27bce4ce5 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/trait_incrementer.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/trait_incrementer.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Trait *) (* Empty module 'Increment' *) diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/wildcard_selector.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/wildcard_selector.v index 935cb0544..a53c12edf 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/wildcard_selector.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/wildcard_selector.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter decode_input : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/monadic_transformation/example01.v b/CoqOfRust/examples/axiomatized/examples/monadic_transformation/example01.v index 67b04ee02..2b74b1fa2 100644 --- a/CoqOfRust/examples/axiomatized/examples/monadic_transformation/example01.v +++ b/CoqOfRust/examples/axiomatized/examples/monadic_transformation/example01.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter id : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/monadic_transformation/example02.v b/CoqOfRust/examples/axiomatized/examples/monadic_transformation/example02.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/monadic_transformation/example02.v +++ b/CoqOfRust/examples/axiomatized/examples/monadic_transformation/example02.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/monadic_transformation/example03.v b/CoqOfRust/examples/axiomatized/examples/monadic_transformation/example03.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/monadic_transformation/example03.v +++ b/CoqOfRust/examples/axiomatized/examples/monadic_transformation/example03.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/monadic_transformation/example04.v b/CoqOfRust/examples/axiomatized/examples/monadic_transformation/example04.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/monadic_transformation/example04.v +++ b/CoqOfRust/examples/axiomatized/examples/monadic_transformation/example04.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/monadic_transformation/example05.v b/CoqOfRust/examples/axiomatized/examples/monadic_transformation/example05.v index 31338a555..08e27b1ff 100644 --- a/CoqOfRust/examples/axiomatized/examples/monadic_transformation/example05.v +++ b/CoqOfRust/examples/axiomatized/examples/monadic_transformation/example05.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/attributes/dead_code.v b/CoqOfRust/examples/axiomatized/examples/rust_book/attributes/dead_code.v index a5bc42ca5..aa35b3386 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/attributes/dead_code.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/attributes/dead_code.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter used_function : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/cargo/concurrent_tests.v b/CoqOfRust/examples/axiomatized/examples/rust_book/cargo/concurrent_tests.v index 208727c5b..1f9115365 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/cargo/concurrent_tests.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/cargo/concurrent_tests.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter foo : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/conversion/converting_to_string.v b/CoqOfRust/examples/axiomatized/examples/rust_book/conversion/converting_to_string.v index 920a6bfdc..4ddda62ed 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/conversion/converting_to_string.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/conversion/converting_to_string.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/conversion/from.v b/CoqOfRust/examples/axiomatized/examples/rust_book/conversion/from.v index f36791ccf..3d6e96df1 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/conversion/from.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/conversion/from.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/conversion/into.v b/CoqOfRust/examples/axiomatized/examples/rust_book/conversion/into.v index 933a6f150..f6a3029ae 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/conversion/into.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/conversion/into.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/conversion/parsing_a_string.v b/CoqOfRust/examples/axiomatized/examples/rust_book/conversion/parsing_a_string.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/conversion/parsing_a_string.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/conversion/parsing_a_string.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/conversion/try_from_and_try_into.v b/CoqOfRust/examples/axiomatized/examples/rust_book/conversion/try_from_and_try_into.v index 196332e41..568ff68db 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/conversion/try_from_and_try_into.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/conversion/try_from_and_try_into.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/constants.v b/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/constants.v index c91d36a03..352650d2e 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/constants.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/constants.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter value_LANGUAGE : Value.t. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums.v b/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums.v index 18e53c016..2d429d00b 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum WebEvent diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums_c_like.v b/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums_c_like.v index 3c386b8a9..1d425fba9 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums_c_like.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums_c_like.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Number diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums_testcase_linked_list.v b/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums_testcase_linked_list.v index d083eabc2..7125fad9b 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums_testcase_linked_list.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums_testcase_linked_list.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum List diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums_type_aliases_v1.v b/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums_type_aliases_v1.v index 4da1b914f..2b4e9f47c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums_type_aliases_v1.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums_type_aliases_v1.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum VeryVerboseEnumOfThingsToDoWithNumbers diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums_type_aliases_v2.v b/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums_type_aliases_v2.v index 81943e55f..726e20649 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums_type_aliases_v2.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums_type_aliases_v2.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum VeryVerboseEnumOfThingsToDoWithNumbers diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums_use.v b/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums_use.v index a9c2f2f55..a17ed7aaa 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums_use.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/enums_use.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Status diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/structures.v b/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/structures.v index 7659d8cec..8cde038ed 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/structures.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/custom_types/structures.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/aliases_for_result.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/aliases_for_result.v index 6701feff3..e5cdd24c6 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/aliases_for_result.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/aliases_for_result.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Axiom AliasedResult : forall (T : Ty.t), diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/boxing_errors.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/boxing_errors.v index 2e45f3557..d0fa05f7d 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/boxing_errors.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/boxing_errors.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Axiom Result : forall (T : Ty.t), diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/combinators_and_then.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/combinators_and_then.v index 128adb766..d7b802e83 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/combinators_and_then.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/combinators_and_then.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Food diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/combinators_map.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/combinators_map.v index 76e7fb1b7..1c2d80713 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/combinators_map.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/combinators_map.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Food diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/defining_an_error_type.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/defining_an_error_type.v index 96697bafe..a5df3bd50 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/defining_an_error_type.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/defining_an_error_type.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/early_returns.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/early_returns.v index a4eee29c7..7dcacf56d 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/early_returns.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/early_returns.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter multiply : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/introducing_question_mark.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/introducing_question_mark.v index a4eee29c7..7dcacf56d 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/introducing_question_mark.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/introducing_question_mark.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter multiply : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/introducing_question_mark_is_an_replacement_for_deprecated_try.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/introducing_question_mark_is_an_replacement_for_deprecated_try.v index a4eee29c7..7dcacf56d 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/introducing_question_mark_is_an_replacement_for_deprecated_try.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/introducing_question_mark_is_an_replacement_for_deprecated_try.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter multiply : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_collect_valid_values_and_failures_via_partition.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_collect_valid_values_and_failures_via_partition.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_collect_valid_values_and_failures_via_partition.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_collect_valid_values_and_failures_via_partition.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_collect_valid_values_and_failures_via_partition_unwrapped.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_collect_valid_values_and_failures_via_partition_unwrapped.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_collect_valid_values_and_failures_via_partition_unwrapped.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_collect_valid_values_and_failures_via_partition_unwrapped.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_collect_via_map_err_and_filter_map.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_collect_via_map_err_and_filter_map.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_collect_via_map_err_and_filter_map.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_collect_via_map_err_and_filter_map.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_fail_entire_operation_via_collect.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_fail_entire_operation_via_collect.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_fail_entire_operation_via_collect.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_fail_entire_operation_via_collect.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_failed.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_failed.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_failed.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_failed.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_handle_via_filter_map.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_handle_via_filter_map.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_handle_via_filter_map.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/iterating_over_results_handle_via_filter_map.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/map_in_result_via_combinators.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/map_in_result_via_combinators.v index a4eee29c7..7dcacf56d 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/map_in_result_via_combinators.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/map_in_result_via_combinators.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter multiply : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/map_in_result_via_match.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/map_in_result_via_match.v index a4eee29c7..7dcacf56d 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/map_in_result_via_match.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/map_in_result_via_match.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter multiply : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/multiple_error_types.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/multiple_error_types.v index f8e090a30..7d6cfefcc 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/multiple_error_types.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/multiple_error_types.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter double_first : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/option_and_unwrap.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/option_and_unwrap.v index 3796a020e..5db339283 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/option_and_unwrap.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/option_and_unwrap.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter give_adult : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/other_uses_of_question_mark.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/other_uses_of_question_mark.v index 6f686a606..7446e62a2 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/other_uses_of_question_mark.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/other_uses_of_question_mark.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Axiom Result : forall (T : Ty.t), diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/panic.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/panic.v index 0cca8ff89..a20e03b15 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/panic.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/panic.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter drink : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/pulling_results_out_of_options.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/pulling_results_out_of_options.v index f8e090a30..7d6cfefcc 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/pulling_results_out_of_options.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/pulling_results_out_of_options.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter double_first : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/pulling_results_out_of_options_with_stop_error_processing.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/pulling_results_out_of_options_with_stop_error_processing.v index f8e090a30..7d6cfefcc 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/pulling_results_out_of_options_with_stop_error_processing.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/pulling_results_out_of_options_with_stop_error_processing.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter double_first : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/result_use_in_main.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/result_use_in_main.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/result_use_in_main.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/result_use_in_main.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/unpacking_options_and_defaults_via_get_or_insert.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/unpacking_options_and_defaults_via_get_or_insert.v index b934512b1..e617139d6 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/unpacking_options_and_defaults_via_get_or_insert.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/unpacking_options_and_defaults_via_get_or_insert.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Fruit diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/unpacking_options_and_defaults_via_get_or_insert_with.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/unpacking_options_and_defaults_via_get_or_insert_with.v index 85383ebd3..c1b1a00f7 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/unpacking_options_and_defaults_via_get_or_insert_with.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/unpacking_options_and_defaults_via_get_or_insert_with.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Fruit diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/unpacking_options_and_defaults_via_or.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/unpacking_options_and_defaults_via_or.v index 619c03891..c15af2b6f 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/unpacking_options_and_defaults_via_or.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/unpacking_options_and_defaults_via_or.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Fruit diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/unpacking_options_and_defaults_via_or_else.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/unpacking_options_and_defaults_via_or_else.v index fda9cd4ad..62cfcef0c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/unpacking_options_and_defaults_via_or_else.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/unpacking_options_and_defaults_via_or_else.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Fruit diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/unpacking_options_via_question_mark.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/unpacking_options_via_question_mark.v index bfc17fe38..a96ed2d85 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/unpacking_options_via_question_mark.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/unpacking_options_via_question_mark.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/wrapping_errors.v b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/wrapping_errors.v index 3b57a5579..5755b6d83 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/wrapping_errors.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/error_handling/wrapping_errors.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum DoubleError diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/expressions/blocks.v b/CoqOfRust/examples/axiomatized/examples/rust_book/expressions/blocks.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/expressions/blocks.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/expressions/blocks.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/expressions/const_underscore_expression.v b/CoqOfRust/examples/axiomatized/examples/rust_book/expressions/const_underscore_expression.v index b0113a251..9742436a9 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/expressions/const_underscore_expression.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/expressions/const_underscore_expression.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Module underscore. (* StructRecord diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/expressions/statement.v b/CoqOfRust/examples/axiomatized/examples/rust_book/expressions/statement.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/expressions/statement.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/expressions/statement.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/expressions/variable_binding_and_expression.v b/CoqOfRust/examples/axiomatized/examples/rust_book/expressions/variable_binding_and_expression.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/expressions/variable_binding_and_expression.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/expressions/variable_binding_and_expression.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/for_and_iterators_into_iter.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/for_and_iterators_into_iter.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/for_and_iterators_into_iter.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/for_and_iterators_into_iter.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/for_and_iterators_iter.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/for_and_iterators_iter.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/for_and_iterators_iter.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/for_and_iterators_iter.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/for_and_iterators_iter_mut.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/for_and_iterators_iter_mut.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/for_and_iterators_iter_mut.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/for_and_iterators_iter_mut.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/for_and_range_completely_inclusive.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/for_and_range_completely_inclusive.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/for_and_range_completely_inclusive.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/for_and_range_completely_inclusive.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/for_and_range_inclusive_to_exclusive.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/for_and_range_inclusive_to_exclusive.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/for_and_range_inclusive_to_exclusive.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/for_and_range_inclusive_to_exclusive.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/if_else.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/if_else.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/if_else.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/if_else.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/if_let.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/if_let.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/if_let.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/if_let.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/if_let_challenge.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/if_let_challenge.v index a11c00561..6154b7dd7 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/if_let_challenge.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/if_let_challenge.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Foo diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/if_let_dont_use_match.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/if_let_dont_use_match.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/if_let_dont_use_match.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/if_let_dont_use_match.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/if_let_match_enum_values.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/if_let_match_enum_values.v index 6324b6e9d..67d1e4267 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/if_let_match_enum_values.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/if_let_match_enum_values.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Foo diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/infinite_loop.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/infinite_loop.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/infinite_loop.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/infinite_loop.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/loop_nesting_and_labels.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/loop_nesting_and_labels.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/loop_nesting_and_labels.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/loop_nesting_and_labels.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/loop_returning_from_loops.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/loop_returning_from_loops.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/loop_returning_from_loops.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/loop_returning_from_loops.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_binding.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_binding.v index d69257563..fd1a63482 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_binding.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_binding.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter age : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_binding_destructure_enum_variants.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_binding_destructure_enum_variants.v index 3290a1718..29e245813 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_binding_destructure_enum_variants.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_binding_destructure_enum_variants.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter some_number : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_arrays_slices.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_arrays_slices.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_arrays_slices.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_arrays_slices.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_enums.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_enums.v index 02e7cf5bc..31c284a8c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_enums.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_enums.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Color diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_pointers_ref.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_pointers_ref.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_pointers_ref.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_pointers_ref.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_structs.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_structs.v index 945c40403..42e6888c3 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_structs.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_structs.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_tuples.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_tuples.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_tuples.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_tuples.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_tuples_fixed.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_tuples_fixed.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_tuples_fixed.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_destructuring_tuples_fixed.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_guards.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_guards.v index 0ee0a5b86..f0070c764 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_guards.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_guards.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Temperature diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_guards_unreachable.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_guards_unreachable.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_guards_unreachable.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/match_guards_unreachable.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/while.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/while.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/while.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/while.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/while_let.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/while_let.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/while_let.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/while_let.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/while_let_match_is_weird.v b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/while_let_match_is_weird.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/while_let_match_is_weird.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/flow_of_control/while_let_match_is_weird.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/associated_functions_and_methods.v b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/associated_functions_and_methods.v index 812e8c734..17fc820b7 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/associated_functions_and_methods.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/associated_functions_and_methods.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/diverging_functions.v b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/diverging_functions.v index d7603def4..a6df08fc1 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/diverging_functions.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/diverging_functions.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/diverging_functions_example_sum_odd_numbers.v b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/diverging_functions_example_sum_odd_numbers.v index b9cc8953a..f4d3d35fd 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/diverging_functions_example_sum_odd_numbers.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/diverging_functions_example_sum_odd_numbers.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/diverging_functions_no_info_in_return_type.v b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/diverging_functions_no_info_in_return_type.v index bd9a6c068..c5917766f 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/diverging_functions_no_info_in_return_type.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/diverging_functions_no_info_in_return_type.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter some_fn : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions.v b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions.v index c5db5b551..71a3ab91a 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter is_divisible_by : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures.v b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_as_input_parameters.v b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_as_input_parameters.v index 01910e6c5..986d2d54a 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_as_input_parameters.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_as_input_parameters.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter apply : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_as_output_parameters.v b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_as_output_parameters.v index 1baf2a0d0..f3508b1c1 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_as_output_parameters.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_as_output_parameters.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter create_fn : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_capturing.v b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_capturing.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_capturing.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_capturing.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_example_Iterator_any.v b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_example_Iterator_any.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_example_Iterator_any.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_example_Iterator_any.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_example_searching_through_iterators_Iterator_find.v b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_example_searching_through_iterators_Iterator_find.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_example_searching_through_iterators_Iterator_find.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_example_searching_through_iterators_Iterator_find.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_example_searching_through_iterators_Iterator_position.v b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_example_searching_through_iterators_Iterator_position.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_example_searching_through_iterators_Iterator_position.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_example_searching_through_iterators_Iterator_position.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_forced_capturing_with_move.v b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_forced_capturing_with_move.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_forced_capturing_with_move.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_forced_capturing_with_move.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_input_functions.v b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_input_functions.v index d7259e22e..306a98da6 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_input_functions.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_input_functions.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter call_me : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_type_anonymity_define.v b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_type_anonymity_define.v index a494e03e2..686d8252c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_type_anonymity_define.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_type_anonymity_define.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_type_anonymity_define_and_use.v b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_type_anonymity_define_and_use.v index 893a21d57..52987e00c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_type_anonymity_define_and_use.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_closures_type_anonymity_define_and_use.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter apply : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_order.v b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_order.v index 981261918..c166a2b6d 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_order.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/functions_order.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/higher_order_functions.v b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/higher_order_functions.v index 2456ea501..04664ce34 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/functions/higher_order_functions.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/functions/higher_order_functions.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter is_odd : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics.v b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics.v index a7f58b346..7d74d73ce 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_associated_types_problem.v b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_associated_types_problem.v index 4466decd2..354a3fdaa 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_associated_types_problem.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_associated_types_problem.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_associated_types_solution.v b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_associated_types_solution.v index 947002dcd..05132debb 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_associated_types_solution.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_associated_types_solution.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_bounds.v b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_bounds.v index 2b4802ea4..67c9f9931 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_bounds.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_bounds.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Trait *) (* Empty module 'HasArea' *) diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_bounds_test_case_empty_bounds.v b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_bounds_test_case_empty_bounds.v index b9a9bdc9d..78ad33bf8 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_bounds_test_case_empty_bounds.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_bounds_test_case_empty_bounds.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_functions.v b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_functions.v index ee273b20e..a16e5518e 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_functions.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_functions.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_implementation.v b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_implementation.v index 420d27974..15a944b05 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_implementation.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_implementation.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_multiple_bounds.v b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_multiple_bounds.v index c20f858d8..8a9eeec83 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_multiple_bounds.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_multiple_bounds.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter compare_prints : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_new_type_idiom.v b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_new_type_idiom.v index d6777da25..bb93ca9c5 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_new_type_idiom.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_new_type_idiom.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_new_type_idiom_as_base_type.v b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_new_type_idiom_as_base_type.v index 50f990080..547c39a4f 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_new_type_idiom_as_base_type.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_new_type_idiom_as_base_type.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_phantom_type.v b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_phantom_type.v index 4de541c7b..962f905d0 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_phantom_type.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_phantom_type.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_phantom_type_test_case_unit_clarification.v b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_phantom_type_test_case_unit_clarification.v index 8de494de0..ff4c9ba85 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_phantom_type_test_case_unit_clarification.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_phantom_type_test_case_unit_clarification.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Inch diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_traits.v b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_traits.v index 2da248e88..12f64d5ae 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_traits.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_traits.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_where_clauses.v b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_where_clauses.v index 1efaab50c..1f2f88346 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_where_clauses.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_where_clauses.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Trait *) (* Empty module 'PrintInOption' *) diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/guessing_game/guessing_game.v b/CoqOfRust/examples/axiomatized/examples/rust_book/guessing_game/guessing_game.v index 35f5dddfe..c4faad033 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/guessing_game/guessing_game.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/guessing_game/guessing_game.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter gen_range : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/hello_world/formatted_print.v b/CoqOfRust/examples/axiomatized/examples/rust_book/hello_world/formatted_print.v index 561a7290c..f0a95d6e9 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/hello_world/formatted_print.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/hello_world/formatted_print.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/hello_world/hello_world.v b/CoqOfRust/examples/axiomatized/examples/rust_book/hello_world/hello_world.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/hello_world/hello_world.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/hello_world/hello_world.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_example.v b/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_example.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_example.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_example.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_rules_designators.v b/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_rules_designators.v index d2812c0d7..f981cde8d 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_rules_designators.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_rules_designators.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter foo : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_rules_dsl.v b/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_rules_dsl.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_rules_dsl.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_rules_dsl.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_rules_overload.v b/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_rules_overload.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_rules_overload.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_rules_overload.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_rules_repeat.v b/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_rules_repeat.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_rules_repeat.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_rules_repeat.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_rules_variadic_interfaces.v b/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_rules_variadic_interfaces.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_rules_variadic_interfaces.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/macro_rules/macro_rules_variadic_interfaces.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/modules/struct_visibility.v b/CoqOfRust/examples/axiomatized/examples/rust_book/modules/struct_visibility.v index d37e0fb61..534537140 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/modules/struct_visibility.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/modules/struct_visibility.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Module my. (* StructRecord diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/modules/super_and_self.v b/CoqOfRust/examples/axiomatized/examples/rust_book/modules/super_and_self.v index 6b41ba686..13620039e 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/modules/super_and_self.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/modules/super_and_self.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter function : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/modules/the_use_as_declaration.v b/CoqOfRust/examples/axiomatized/examples/rust_book/modules/the_use_as_declaration.v index 0fa9a2673..4090fab02 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/modules/the_use_as_declaration.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/modules/the_use_as_declaration.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter function : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/modules/visibility.v b/CoqOfRust/examples/axiomatized/examples/rust_book/modules/visibility.v index 841e44901..785c90513 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/modules/visibility.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/modules/visibility.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Module my_mod. Parameter private_function : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/primitives/arrays_and_slices.v b/CoqOfRust/examples/axiomatized/examples/rust_book/primitives/arrays_and_slices.v index cd1e4ad4a..f77bd49c8 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/primitives/arrays_and_slices.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/primitives/arrays_and_slices.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter analyze_slice : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/primitives/compound_types.v b/CoqOfRust/examples/axiomatized/examples/rust_book/primitives/compound_types.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/primitives/compound_types.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/primitives/compound_types.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/primitives/literals_operators.v b/CoqOfRust/examples/axiomatized/examples/rust_book/primitives/literals_operators.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/primitives/literals_operators.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/primitives/literals_operators.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/primitives/tuples.v b/CoqOfRust/examples/axiomatized/examples/rust_book/primitives/tuples.v index e4f3a827b..3efc7c29f 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/primitives/tuples.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/primitives/tuples.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter reverse : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_borrowing.v b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_borrowing.v index 655dce63d..c739f1f62 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_borrowing.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_borrowing.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter eat_box_i32 : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_borrowing_aliasing.v b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_borrowing_aliasing.v index 6c232c5a8..c03db5ae6 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_borrowing_aliasing.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_borrowing_aliasing.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_borrowing_mutablity.v b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_borrowing_mutablity.v index 04dfbcfd9..b490a4d70 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_borrowing_mutablity.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_borrowing_mutablity.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_borrowing_the_ref_pattern.v b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_borrowing_the_ref_pattern.v index 78e76eaf3..d85d7516d 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_borrowing_the_ref_pattern.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_borrowing_the_ref_pattern.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes.v b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_bounds.v b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_bounds.v index 78d89c3c0..329e9ba43 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_bounds.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_bounds.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_coercion.v b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_coercion.v index 1b8e7700e..15032fa3b 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_coercion.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_coercion.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter multiply : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_elision.v b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_elision.v index 2d3e1f433..34d26c7bb 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_elision.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_elision.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter elided_input : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_functions.v b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_functions.v index 7b3dd52d8..8a3fa17f7 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_functions.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_functions.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter print_one : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_methods.v b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_methods.v index 589147a0a..553a2b212 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_methods.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_methods.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_reference_lifetime_static.v b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_reference_lifetime_static.v index 529acb278..9e81511d1 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_reference_lifetime_static.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_reference_lifetime_static.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter value_NUM : Value.t. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_structs.v b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_structs.v index bd1358155..99f8a8e52 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_structs.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_structs.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_traits.v b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_traits.v index 0f6934780..2bdd06225 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_traits.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_lifetimes_traits.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules.v b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules.v index 30ebc2e3f..4025d54eb 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter destroy_box : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules_mutablity.v b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules_mutablity.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules_mutablity.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules_mutablity.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules_partial_moves.v b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules_partial_moves.v index 743408cc1..c1166e499 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules_partial_moves.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules_partial_moves.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_raii.v b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_raii.v index 8ad20f92b..ab8366b9b 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_raii.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_raii.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter create_box : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_raii_desctructor.v b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_raii_desctructor.v index 30ffcf011..a0514ba1d 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_raii_desctructor.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/scoping_rules/scoping_rules_raii_desctructor.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/arc.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/arc.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/arc.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/arc.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/box_stack_heap.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/box_stack_heap.v index 41e971168..6ddc9abfe 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/box_stack_heap.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/box_stack_heap.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/hash_map.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/hash_map.v index 774d40789..a0bd17d93 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/hash_map.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/hash_map.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter call : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/hash_map_alternate_or_custom_key_types.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/hash_map_alternate_or_custom_key_types.v index 36b98776a..6d9dfd5db 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/hash_map_alternate_or_custom_key_types.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/hash_map_alternate_or_custom_key_types.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/hash_map_hash_set.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/hash_map_hash_set.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/hash_map_hash_set.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/hash_map_hash_set.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/option.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/option.v index a0a043304..c3a2b62ca 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/option.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/option.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter checked_division : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/panic.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/panic.v index 0d561a349..67a7da883 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/panic.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/panic.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter division : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/rc.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/rc.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/rc.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/rc.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/result.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/result.v index 4e432da29..df430c958 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/result.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/result.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Module checked. (* diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/result_chaining_with_question_mark.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/result_chaining_with_question_mark.v index 71f533fd7..9d3d4726b 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/result_chaining_with_question_mark.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/result_chaining_with_question_mark.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Module checked. (* diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/strings.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/strings.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/strings.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/strings.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/strings_byte_strings_as_non_utf8.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/strings_byte_strings_as_non_utf8.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/strings_byte_strings_as_non_utf8.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/strings_byte_strings_as_non_utf8.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/strings_literals_and_escapes.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/strings_literals_and_escapes.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/strings_literals_and_escapes.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/strings_literals_and_escapes.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/strings_raw_string_literals.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/strings_raw_string_literals.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/strings_raw_string_literals.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/strings_raw_string_literals.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/vectors.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/vectors.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/vectors.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_library_types/vectors.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/channels.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/channels.v index 078b67d5a..04812ed8d 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/channels.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/channels.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter value_NTHREADS : Value.t. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/child_processes.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/child_processes.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/child_processes.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/child_processes.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/child_processes_pipes.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/child_processes_pipes.v index 146ae9caa..93e5885ec 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/child_processes_pipes.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/child_processes_pipes.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter value_PANGRAM : Value.t. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/child_processes_wait.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/child_processes_wait.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/child_processes_wait.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/child_processes_wait.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/file_io_create.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/file_io_create.v index c53119360..17b22d569 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/file_io_create.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/file_io_create.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter value_LOREM_IPSUM : Value.t. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/file_io_open.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/file_io_open.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/file_io_open.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/file_io_open.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/file_io_read_lines.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/file_io_read_lines.v index 73847250a..8e224e88b 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/file_io_read_lines.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/file_io_read_lines.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter read_lines : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/file_io_read_lines_efficient_method.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/file_io_read_lines_efficient_method.v index 73847250a..8e224e88b 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/file_io_read_lines_efficient_method.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/file_io_read_lines_efficient_method.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter read_lines : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/filesystem_operations.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/filesystem_operations.v index 97580ab1b..ab52dcdec 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/filesystem_operations.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/filesystem_operations.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter cat : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/foreign_function_interface.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/foreign_function_interface.v index 70da26a20..582222a34 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/foreign_function_interface.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/foreign_function_interface.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Unhandled foreign module here *) diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/path.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/path.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/path.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/path.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/program_arguments.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/program_arguments.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/program_arguments.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/program_arguments.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/program_arguments_parsing.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/program_arguments_parsing.v index d54ec7172..55c2d42f4 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/program_arguments_parsing.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/program_arguments_parsing.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter increase : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/threads.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/threads.v index 078b67d5a..04812ed8d 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/threads.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/threads.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter value_NTHREADS : Value.t. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/threads_test_case_map_reduce.v b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/threads_test_case_map_reduce.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/threads_test_case_map_reduce.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/std_misc/threads_test_case_map_reduce.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/testing/documentation_testing.v b/CoqOfRust/examples/axiomatized/examples/rust_book/testing/documentation_testing.v index c6a606ada..33d73c087 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/testing/documentation_testing.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/testing/documentation_testing.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter add : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/testing/unit_testing.v b/CoqOfRust/examples/axiomatized/examples/rust_book/testing/unit_testing.v index dd3b6359d..f91dfe5d6 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/testing/unit_testing.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/testing/unit_testing.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter add : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/clone.v b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/clone.v index 0eba4b298..f09110c35 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/clone.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/clone.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/derive.v b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/derive.v index 081936625..42f4197a7 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/derive.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/derive.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/disambiguating_overlapping_traits.v b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/disambiguating_overlapping_traits.v index 12b3475a9..add6ac2fe 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/disambiguating_overlapping_traits.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/disambiguating_overlapping_traits.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Trait *) (* Empty module 'UsernameWidget' *) diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/drop.v b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/drop.v index 75fc1f013..0048c9bbd 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/drop.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/drop.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/hash.v b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/hash.v index 55a299105..e4ddff578 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/hash.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/hash.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/impl_trait_as_return_type.v b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/impl_trait_as_return_type.v index 79e3c7930..c2cc8542f 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/impl_trait_as_return_type.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/impl_trait_as_return_type.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter combine_vecs_explicit_return_type : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/iterators.v b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/iterators.v index 38b593180..8a23b20bd 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/iterators.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/iterators.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/operator_overloading.v b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/operator_overloading.v index c67709f5e..8542a142e 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/operator_overloading.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/operator_overloading.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/returning_traits_with_dyn.v b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/returning_traits_with_dyn.v index f02cb5ca7..7f383ac4a 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/returning_traits_with_dyn.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/returning_traits_with_dyn.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/supertraits.v b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/supertraits.v index a0866c821..096ed0390 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/supertraits.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/supertraits.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Trait *) (* Empty module 'Person' *) diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/traits.v b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/traits.v index 004a3910a..9ae8ff229 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/traits.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/traits.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/traits_parms.v b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/traits_parms.v index 1b69243ac..a51e40c2e 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/traits_parms.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/traits_parms.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Trait *) (* Empty module 'Foo' *) diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/types/aliasing.v b/CoqOfRust/examples/axiomatized/examples/rust_book/types/aliasing.v index 627462428..e3b53998f 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/types/aliasing.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/types/aliasing.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Axiom NanoSecond : (Ty.path "aliasing::NanoSecond") = (Ty.path "u64"). diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/types/casting.v b/CoqOfRust/examples/axiomatized/examples/rust_book/types/casting.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/types/casting.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/types/casting.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/types/inference.v b/CoqOfRust/examples/axiomatized/examples/rust_book/types/inference.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/types/inference.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/types/inference.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/types/literals.v b/CoqOfRust/examples/axiomatized/examples/rust_book/types/literals.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/types/literals.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/types/literals.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/calling_unsafe_functions.v b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/calling_unsafe_functions.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/calling_unsafe_functions.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/calling_unsafe_functions.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly.v b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_clobbered_registers.v b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_clobbered_registers.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_clobbered_registers.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_clobbered_registers.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_explicit_register_operands.v b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_explicit_register_operands.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_explicit_register_operands.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_explicit_register_operands.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inlateout_case_implemented.v b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inlateout_case_implemented.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inlateout_case_implemented.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inlateout_case_implemented.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inlateout_case_non_used.v b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inlateout_case_non_used.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inlateout_case_non_used.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inlateout_case_non_used.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inlateout_mul.v b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inlateout_mul.v index ad481d140..8f04c62d9 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inlateout_mul.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inlateout_mul.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inout.v b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inout.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inout.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inout.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs.v b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs_another_example.v b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs_another_example.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs_another_example.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs_another_example.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs_another_example_without_mov.v b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs_another_example_without_mov.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs_another_example_without_mov.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs_another_example_without_mov.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_labels.v b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_labels.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_labels.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_labels.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_memory_address_operands.v b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_memory_address_operands.v index 4bf2c70c6..d62cbea56 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_memory_address_operands.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_memory_address_operands.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_options.v b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_options.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_options.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_options.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_register_template_modifiers.v b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_register_template_modifiers.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_register_template_modifiers.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_register_template_modifiers.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_scratch_register.v b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_scratch_register.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_scratch_register.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_scratch_register.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_symbol_operands_and_abi_clobbers.v b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_symbol_operands_and_abi_clobbers.v index 7731fb2af..0ba6507ac 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_symbol_operands_and_abi_clobbers.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/inline_assembly_symbol_operands_and_abi_clobbers.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/raw_pointers.v b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/raw_pointers.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/raw_pointers.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/unsafe_operations/raw_pointers.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/declare_first.v b/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/declare_first.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/declare_first.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/declare_first.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/freezing.v b/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/freezing.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/freezing.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/freezing.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/mutability.v b/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/mutability.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/mutability.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/mutability.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/scope.v b/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/scope.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/scope.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/scope.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/variable_bindings.v b/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/variable_bindings.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/variable_bindings.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/variable_bindings.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/variable_shadowing.v b/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/variable_shadowing.v index cb8f119b6..26ddad53c 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/variable_shadowing.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/variable_bindings/variable_shadowing.v @@ -1,4 +1,5 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Parameter main : (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/axiomatized/examples/subtle.v b/CoqOfRust/examples/axiomatized/examples/subtle.v index 7ef7b576d..fc3da10a4 100644 --- a/CoqOfRust/examples/axiomatized/examples/subtle.v +++ b/CoqOfRust/examples/axiomatized/examples/subtle.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/default/examples/custom/add_one.v b/CoqOfRust/examples/default/examples/custom/add_one.v index 5002081aa..81427f464 100644 --- a/CoqOfRust/examples/default/examples/custom/add_one.v +++ b/CoqOfRust/examples/default/examples/custom/add_one.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn add_one(x: u32) -> u32 { diff --git a/CoqOfRust/examples/default/examples/custom/constructor_as_function.v b/CoqOfRust/examples/default/examples/custom/constructor_as_function.v index 8b26af397..1f4ee20e4 100644 --- a/CoqOfRust/examples/default/examples/custom/constructor_as_function.v +++ b/CoqOfRust/examples/default/examples/custom/constructor_as_function.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn matching(tuple: (i32, i32)) -> i32 { @@ -73,10 +74,11 @@ Module Impl_core_fmt_Debug_for_constructor_as_function_Constructor. (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_tuple_field - (M.read (| self |)) - "constructor_as_function::Constructor" + M.get_struct_tuple_field (| + M.read (| self |), + "constructor_as_function::Constructor", 0 + |) |)) ] |))) diff --git a/CoqOfRust/examples/default/examples/custom/hello_world.v b/CoqOfRust/examples/default/examples/custom/hello_world.v index 3f6694c07..0f350b5d1 100644 --- a/CoqOfRust/examples/default/examples/custom/hello_world.v +++ b/CoqOfRust/examples/default/examples/custom/hello_world.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Definition message : Value.t := M.run ltac:(M.monadic (Value.String "Hello, World!")). diff --git a/CoqOfRust/examples/default/examples/custom/if_let.v b/CoqOfRust/examples/default/examples/custom/if_let.v index c38f46a00..05ab45634 100644 --- a/CoqOfRust/examples/default/examples/custom/if_let.v +++ b/CoqOfRust/examples/default/examples/custom/if_let.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn order(b1: bool, b2: bool, b3: bool, b4: bool) -> bool { diff --git a/CoqOfRust/examples/default/examples/custom/impl_param.v b/CoqOfRust/examples/default/examples/custom/impl_param.v index acc3f942b..fddbbb606 100644 --- a/CoqOfRust/examples/default/examples/custom/impl_param.v +++ b/CoqOfRust/examples/default/examples/custom/impl_param.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn with_impls(func: impl Default, func2: impl Default, foo: A) { diff --git a/CoqOfRust/examples/default/examples/custom/module_duplicate.v b/CoqOfRust/examples/default/examples/custom/module_duplicate.v index 132c0a3f3..df64b8534 100644 --- a/CoqOfRust/examples/default/examples/custom/module_duplicate.v +++ b/CoqOfRust/examples/default/examples/custom/module_duplicate.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Module foo. Module gre. diff --git a/CoqOfRust/examples/default/examples/custom/mutual_loop.v b/CoqOfRust/examples/default/examples/custom/mutual_loop.v index 975d66d5f..26f8a9bf3 100644 --- a/CoqOfRust/examples/default/examples/custom/mutual_loop.v +++ b/CoqOfRust/examples/default/examples/custom/mutual_loop.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/default/examples/custom/pattern_in_function_parameters.v b/CoqOfRust/examples/default/examples/custom/pattern_in_function_parameters.v index 5420c1ba9..6c63d10cf 100644 --- a/CoqOfRust/examples/default/examples/custom/pattern_in_function_parameters.v +++ b/CoqOfRust/examples/default/examples/custom/pattern_in_function_parameters.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn sum((x, y): (i32, i32)) -> i32 { diff --git a/CoqOfRust/examples/default/examples/custom/polymorphic_associated_function.v b/CoqOfRust/examples/default/examples/custom/polymorphic_associated_function.v index b4ba64624..7f47ee7ec 100644 --- a/CoqOfRust/examples/default/examples/custom/polymorphic_associated_function.v +++ b/CoqOfRust/examples/default/examples/custom/polymorphic_associated_function.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -33,7 +34,11 @@ Module Impl_polymorphic_associated_function_Foo_A. M.get_trait_method (| "core::convert::Into", A, [ B ], "into", [] |), [ M.read (| - M.get_struct_record_field self "polymorphic_associated_function::Foo" "data" + M.get_struct_record_field (| + self, + "polymorphic_associated_function::Foo", + "data" + |) |) ] |)) @@ -81,7 +86,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (| Value.Tuple [ - M.get_struct_record_field bar "polymorphic_associated_function::Foo" "data"; + M.get_struct_record_field (| + bar, + "polymorphic_associated_function::Foo", + "data" + |); UnsupportedLiteral ] |), diff --git a/CoqOfRust/examples/default/examples/custom/provided_method.v b/CoqOfRust/examples/default/examples/custom/provided_method.v index 0da55b997..a5067ff58 100644 --- a/CoqOfRust/examples/default/examples/custom/provided_method.v +++ b/CoqOfRust/examples/default/examples/custom/provided_method.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Trait *) Module ProvidedAndRequired. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/basic_contract_caller.v b/CoqOfRust/examples/default/examples/ink_contracts/basic_contract_caller.v index 17f84065b..d0ef3f54b 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/basic_contract_caller.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/basic_contract_caller.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { @@ -120,16 +121,18 @@ Module Impl_basic_contract_caller_OtherContract. M.read (| let _ := M.write (| - M.get_struct_record_field - (M.read (| self |)) - "basic_contract_caller::OtherContract" - "value", + M.get_struct_record_field (| + M.read (| self |), + "basic_contract_caller::OtherContract", + "value" + |), UnOp.Pure.not (M.read (| - M.get_struct_record_field - (M.read (| self |)) - "basic_contract_caller::OtherContract" + M.get_struct_record_field (| + M.read (| self |), + "basic_contract_caller::OtherContract", "value" + |) |)) |) in M.alloc (| Value.Tuple [] |) @@ -150,10 +153,11 @@ Module Impl_basic_contract_caller_OtherContract. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field - (M.read (| self |)) - "basic_contract_caller::OtherContract" + M.get_struct_record_field (| + M.read (| self |), + "basic_contract_caller::OtherContract", "value" + |) |))) | _, _ => M.impossible end. @@ -230,10 +234,11 @@ Module Impl_basic_contract_caller_BasicContractCaller. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "basic_contract_caller::BasicContractCaller" + M.get_struct_record_field (| + M.read (| self |), + "basic_contract_caller::BasicContractCaller", "other_contract" + |) ] |) |) in @@ -245,10 +250,11 @@ Module Impl_basic_contract_caller_BasicContractCaller. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "basic_contract_caller::BasicContractCaller" + M.get_struct_record_field (| + M.read (| self |), + "basic_contract_caller::BasicContractCaller", "other_contract" + |) ] |) |) diff --git a/CoqOfRust/examples/default/examples/ink_contracts/call_runtime.v b/CoqOfRust/examples/default/examples/ink_contracts/call_runtime.v index b4f34be5f..79f9060ef 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/call_runtime.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/call_runtime.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/default/examples/ink_contracts/conditional_compilation.v b/CoqOfRust/examples/default/examples/ink_contracts/conditional_compilation.v index 8cbb2f8b7..79a7c717c 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/conditional_compilation.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/conditional_compilation.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { @@ -136,7 +137,11 @@ Module Impl_conditional_compilation_Env. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (M.read (| self |)) "conditional_compilation::Env" "caller" + M.get_struct_record_field (| + M.read (| self |), + "conditional_compilation::Env", + "caller" + |) |))) | _, _ => M.impossible end. @@ -307,16 +312,18 @@ Module Impl_conditional_compilation_ConditionalCompilation. M.read (| let _ := M.write (| - M.get_struct_record_field - (M.read (| self |)) - "conditional_compilation::ConditionalCompilation" - "value", + M.get_struct_record_field (| + M.read (| self |), + "conditional_compilation::ConditionalCompilation", + "value" + |), UnOp.Pure.not (M.read (| - M.get_struct_record_field - (M.read (| self |)) - "conditional_compilation::ConditionalCompilation" + M.get_struct_record_field (| + M.read (| self |), + "conditional_compilation::ConditionalCompilation", "value" + |) |)) |) in let caller := @@ -368,10 +375,11 @@ Module Impl_conditional_compilation_ConditionalCompilation. [ ("new_value", M.read (| - M.get_struct_record_field - (M.read (| self |)) - "conditional_compilation::ConditionalCompilation" + M.get_struct_record_field (| + M.read (| self |), + "conditional_compilation::ConditionalCompilation", "value" + |) |)); ("by_", M.read (| caller |)) ] @@ -451,16 +459,18 @@ Module Impl_conditional_compilation_ConditionalCompilation. |) in let _ := M.write (| - M.get_struct_record_field - (M.read (| self |)) - "conditional_compilation::ConditionalCompilation" - "value", + M.get_struct_record_field (| + M.read (| self |), + "conditional_compilation::ConditionalCompilation", + "value" + |), UnOp.Pure.not (M.read (| - M.get_struct_record_field - (M.read (| self |)) - "conditional_compilation::ConditionalCompilation" + M.get_struct_record_field (| + M.read (| self |), + "conditional_compilation::ConditionalCompilation", "value" + |) |)) |) in let _ := @@ -490,10 +500,11 @@ Module Impl_conditional_compilation_ConditionalCompilation. [ ("new_value", M.read (| - M.get_struct_record_field - (M.read (| self |)) - "conditional_compilation::ConditionalCompilation" + M.get_struct_record_field (| + M.read (| self |), + "conditional_compilation::ConditionalCompilation", "value" + |) |)); ("by_", M.read (| caller |)); ("when", M.read (| block_number |)) @@ -527,16 +538,18 @@ Module Impl_conditional_compilation_Flip_for_conditional_compilation_Conditional M.read (| let _ := M.write (| - M.get_struct_record_field - (M.read (| self |)) - "conditional_compilation::ConditionalCompilation" - "value", + M.get_struct_record_field (| + M.read (| self |), + "conditional_compilation::ConditionalCompilation", + "value" + |), UnOp.Pure.not (M.read (| - M.get_struct_record_field - (M.read (| self |)) - "conditional_compilation::ConditionalCompilation" + M.get_struct_record_field (| + M.read (| self |), + "conditional_compilation::ConditionalCompilation", "value" + |) |)) |) in M.alloc (| Value.Tuple [] |) @@ -555,10 +568,11 @@ Module Impl_conditional_compilation_Flip_for_conditional_compilation_Conditional ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field - (M.read (| self |)) - "conditional_compilation::ConditionalCompilation" + M.get_struct_record_field (| + M.read (| self |), + "conditional_compilation::ConditionalCompilation", "value" + |) |))) | _, _ => M.impossible end. @@ -633,10 +647,11 @@ Module Impl_conditional_compilation_Flip_for_conditional_compilation_Conditional |) in let _ := M.write (| - M.get_struct_record_field - (M.read (| self |)) - "conditional_compilation::ConditionalCompilation" - "value", + M.get_struct_record_field (| + M.read (| self |), + "conditional_compilation::ConditionalCompilation", + "value" + |), M.read (| value |) |) in M.alloc (| Value.Tuple [] |) diff --git a/CoqOfRust/examples/default/examples/ink_contracts/contract_terminate.v b/CoqOfRust/examples/default/examples/ink_contracts/contract_terminate.v index 432b32085..e652ad678 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/contract_terminate.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/contract_terminate.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { @@ -89,7 +90,7 @@ Module Impl_contract_terminate_Env. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (M.read (| self |)) "contract_terminate::Env" "caller" + M.get_struct_record_field (| M.read (| self |), "contract_terminate::Env", "caller" |) |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/contract_transfer.v b/CoqOfRust/examples/default/examples/ink_contracts/contract_transfer.v index def7c546a..7c4d6a2e8 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/contract_transfer.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/contract_transfer.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { @@ -91,7 +92,7 @@ Module Impl_contract_transfer_Env. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (M.read (| self |)) "contract_transfer::Env" "caller" + M.get_struct_record_field (| M.read (| self |), "contract_transfer::Env", "caller" |) |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/custom_allocator.v b/CoqOfRust/examples/default/examples/ink_contracts/custom_allocator.v index 7b96eb817..126d8895b 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/custom_allocator.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/custom_allocator.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -110,10 +111,11 @@ Module Impl_custom_allocator_CustomAllocator. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "custom_allocator::CustomAllocator" - "value"; + M.get_struct_record_field (| + M.read (| self |), + "custom_allocator::CustomAllocator", + "value" + |); Value.Integer Integer.Usize 0 ] |), @@ -130,10 +132,11 @@ Module Impl_custom_allocator_CustomAllocator. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "custom_allocator::CustomAllocator" - "value"; + M.get_struct_record_field (| + M.read (| self |), + "custom_allocator::CustomAllocator", + "value" + |); Value.Integer Integer.Usize 0 ] |) @@ -168,10 +171,11 @@ Module Impl_custom_allocator_CustomAllocator. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "custom_allocator::CustomAllocator" - "value"; + M.get_struct_record_field (| + M.read (| self |), + "custom_allocator::CustomAllocator", + "value" + |); Value.Integer Integer.Usize 0 ] |) diff --git a/CoqOfRust/examples/default/examples/ink_contracts/custom_environment.v b/CoqOfRust/examples/default/examples/ink_contracts/custom_environment.v index 804c0f989..e00e79148 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/custom_environment.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/custom_environment.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { @@ -223,7 +224,7 @@ Module Impl_custom_environment_Env. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (M.read (| self |)) "custom_environment::Env" "caller" + M.get_struct_record_field (| M.read (| self |), "custom_environment::Env", "caller" |) |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/dns.v b/CoqOfRust/examples/default/examples/ink_contracts/dns.v index 8166d89cd..d90a04aee 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/dns.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/dns.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -229,8 +230,8 @@ Module Impl_core_cmp_PartialEq_for_dns_AccountId. (let self := M.alloc (| self |) in let other := M.alloc (| other |) in BinOp.Pure.eq - (M.read (| M.get_struct_tuple_field (M.read (| self |)) "dns::AccountId" 0 |)) - (M.read (| M.get_struct_tuple_field (M.read (| other |)) "dns::AccountId" 0 |)))) + (M.read (| M.get_struct_tuple_field (| M.read (| self |), "dns::AccountId", 0 |) |)) + (M.read (| M.get_struct_tuple_field (| M.read (| other |), "dns::AccountId", 0 |) |)))) | _, _ => M.impossible end. @@ -343,7 +344,7 @@ Module Impl_dns_Env. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_record_field (M.read (| self |)) "dns::Env" "caller" |))) + M.read (| M.get_struct_record_field (| M.read (| self |), "dns::Env", "caller" |) |))) | _, _ => M.impossible end. @@ -751,10 +752,11 @@ Module Impl_dns_DomainNameService. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "dns::DomainNameService" - "name_to_owner"; + M.get_struct_record_field (| + M.read (| self |), + "dns::DomainNameService", + "name_to_owner" + |); name ] |) @@ -786,10 +788,11 @@ Module Impl_dns_DomainNameService. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "dns::DomainNameService" - "name_to_owner"; + M.get_struct_record_field (| + M.read (| self |), + "dns::DomainNameService", + "name_to_owner" + |); M.read (| name |); M.read (| caller |) ] @@ -857,18 +860,20 @@ Module Impl_dns_DomainNameService. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "dns::DomainNameService" - "name_to_owner"; + M.get_struct_record_field (| + M.read (| self |), + "dns::DomainNameService", + "name_to_owner" + |); name ] |); M.read (| - M.get_struct_record_field - (M.read (| self |)) - "dns::DomainNameService" + M.get_struct_record_field (| + M.read (| self |), + "dns::DomainNameService", "default_address" + |) |) ] |))) @@ -984,10 +989,11 @@ Module Impl_dns_DomainNameService. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "dns::DomainNameService" - "name_to_address"; + M.get_struct_record_field (| + M.read (| self |), + "dns::DomainNameService", + "name_to_address" + |); name ] |) @@ -1003,10 +1009,11 @@ Module Impl_dns_DomainNameService. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "dns::DomainNameService" - "name_to_address"; + M.get_struct_record_field (| + M.read (| self |), + "dns::DomainNameService", + "name_to_address" + |); M.read (| name |); M.read (| new_address |) ] @@ -1157,10 +1164,11 @@ Module Impl_dns_DomainNameService. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "dns::DomainNameService" - "name_to_owner"; + M.get_struct_record_field (| + M.read (| self |), + "dns::DomainNameService", + "name_to_owner" + |); name ] |) @@ -1176,10 +1184,11 @@ Module Impl_dns_DomainNameService. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "dns::DomainNameService" - "name_to_owner"; + M.get_struct_record_field (| + M.read (| self |), + "dns::DomainNameService", + "name_to_owner" + |); M.read (| name |); M.read (| to |) ] @@ -1252,18 +1261,20 @@ Module Impl_dns_DomainNameService. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "dns::DomainNameService" - "name_to_address"; + M.get_struct_record_field (| + M.read (| self |), + "dns::DomainNameService", + "name_to_address" + |); name ] |); M.read (| - M.get_struct_record_field - (M.read (| self |)) - "dns::DomainNameService" + M.get_struct_record_field (| + M.read (| self |), + "dns::DomainNameService", "default_address" + |) |) ] |))) diff --git a/CoqOfRust/examples/default/examples/ink_contracts/e2e_call_runtime.v b/CoqOfRust/examples/default/examples/ink_contracts/e2e_call_runtime.v index b06407de6..437817421 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/e2e_call_runtime.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/e2e_call_runtime.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/default/examples/ink_contracts/erc1155.v b/CoqOfRust/examples/default/examples/ink_contracts/erc1155.v index e8c020d1d..fef579b4d 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/erc1155.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/erc1155.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -218,8 +219,10 @@ Module Impl_core_cmp_PartialEq_for_erc1155_AccountId. (let self := M.alloc (| self |) in let other := M.alloc (| other |) in BinOp.Pure.eq - (M.read (| M.get_struct_tuple_field (M.read (| self |)) "erc1155::AccountId" 0 |)) - (M.read (| M.get_struct_tuple_field (M.read (| other |)) "erc1155::AccountId" 0 |)))) + (M.read (| M.get_struct_tuple_field (| M.read (| self |), "erc1155::AccountId", 0 |) |)) + (M.read (| + M.get_struct_tuple_field (| M.read (| other |), "erc1155::AccountId", 0 |) + |)))) | _, _ => M.impossible end. @@ -522,7 +525,7 @@ Module Impl_erc1155_Env. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_record_field (M.read (| self |)) "erc1155::Env" "caller" |))) + M.read (| M.get_struct_record_field (| M.read (| self |), "erc1155::Env", "caller" |) |))) | _, _ => M.impossible end. @@ -719,7 +722,11 @@ Module Impl_erc1155_Contract. |) in let _ := let β := - M.get_struct_record_field (M.read (| self |)) "erc1155::Contract" "token_id_nonce" in + M.get_struct_record_field (| + M.read (| self |), + "erc1155::Contract", + "token_id_nonce" + |) in M.write (| β, BinOp.Panic.add (| M.read (| β |), Value.Integer Integer.U128 1 |) |) in let _ := M.alloc (| @@ -732,15 +739,20 @@ Module Impl_erc1155_Contract. [] |), [ - M.get_struct_record_field (M.read (| self |)) "erc1155::Contract" "balances"; + M.get_struct_record_field (| + M.read (| self |), + "erc1155::Contract", + "balances" + |); Value.Tuple [ M.read (| caller |); M.read (| - M.get_struct_record_field - (M.read (| self |)) - "erc1155::Contract" + M.get_struct_record_field (| + M.read (| self |), + "erc1155::Contract", "token_id_nonce" + |) |) ]; M.read (| value |) @@ -801,10 +813,11 @@ Module Impl_erc1155_Contract. |)); ("token_id", M.read (| - M.get_struct_record_field - (M.read (| self |)) - "erc1155::Contract" + M.get_struct_record_field (| + M.read (| self |), + "erc1155::Contract", "token_id_nonce" + |) |)); ("value", M.read (| value |)) ] @@ -812,7 +825,7 @@ Module Impl_erc1155_Contract. ] |) |) in - M.get_struct_record_field (M.read (| self |)) "erc1155::Contract" "token_id_nonce" + M.get_struct_record_field (| M.read (| self |), "erc1155::Contract", "token_id_nonce" |) |))) | _, _ => M.impossible end. @@ -861,10 +874,11 @@ Module Impl_erc1155_Contract. (BinOp.Pure.le (M.read (| token_id |)) (M.read (| - M.get_struct_record_field - (M.read (| self |)) - "erc1155::Contract" + M.get_struct_record_field (| + M.read (| self |), + "erc1155::Contract", "token_id_nonce" + |) |))) |)) in let _ := @@ -920,7 +934,11 @@ Module Impl_erc1155_Contract. [] |), [ - M.get_struct_record_field (M.read (| self |)) "erc1155::Contract" "balances"; + M.get_struct_record_field (| + M.read (| self |), + "erc1155::Contract", + "balances" + |); Value.Tuple [ M.read (| caller |); M.read (| token_id |) ]; M.read (| value |) ] @@ -1025,7 +1043,11 @@ Module Impl_erc1155_Contract. [] |), [ - M.get_struct_record_field (M.read (| self |)) "erc1155::Contract" "balances"; + M.get_struct_record_field (| + M.read (| self |), + "erc1155::Contract", + "balances" + |); M.alloc (| Value.Tuple [ M.read (| from |); M.read (| token_id |) ] |) ] |); @@ -1049,7 +1071,11 @@ Module Impl_erc1155_Contract. [] |), [ - M.get_struct_record_field (M.read (| self |)) "erc1155::Contract" "balances"; + M.get_struct_record_field (| + M.read (| self |), + "erc1155::Contract", + "balances" + |); Value.Tuple [ M.read (| from |); M.read (| token_id |) ]; M.read (| sender_balance |) ] @@ -1074,7 +1100,11 @@ Module Impl_erc1155_Contract. [] |), [ - M.get_struct_record_field (M.read (| self |)) "erc1155::Contract" "balances"; + M.get_struct_record_field (| + M.read (| self |), + "erc1155::Contract", + "balances" + |); M.alloc (| Value.Tuple [ M.read (| to |); M.read (| token_id |) ] |) ] |); @@ -1096,7 +1126,11 @@ Module Impl_erc1155_Contract. [] |), [ - M.get_struct_record_field (M.read (| self |)) "erc1155::Contract" "balances"; + M.get_struct_record_field (| + M.read (| self |), + "erc1155::Contract", + "balances" + |); Value.Tuple [ M.read (| to |); M.read (| token_id |) ]; M.read (| recipient_balance |) ] @@ -1271,7 +1305,7 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. [] |), [ - M.get_struct_record_field (M.read (| self |)) "erc1155::Contract" "approvals"; + M.get_struct_record_field (| M.read (| self |), "erc1155::Contract", "approvals" |); M.alloc (| Value.Tuple [ M.read (| owner |); M.read (| operator |) ] |) ] |))) @@ -1306,7 +1340,7 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. [] |), [ - M.get_struct_record_field (M.read (| self |)) "erc1155::Contract" "balances"; + M.get_struct_record_field (| M.read (| self |), "erc1155::Contract", "balances" |); M.alloc (| Value.Tuple [ M.read (| owner |); M.read (| token_id |) ] |) ] |); @@ -2589,10 +2623,11 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "erc1155::Contract" - "approvals"; + M.get_struct_record_field (| + M.read (| self |), + "erc1155::Contract", + "approvals" + |); Value.Tuple [ M.read (| caller |); M.read (| operator |) ]; Value.Tuple [] ] @@ -2617,10 +2652,11 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "erc1155::Contract" - "approvals"; + M.get_struct_record_field (| + M.read (| self |), + "erc1155::Contract", + "approvals" + |); Value.Tuple [ M.read (| caller |); M.read (| operator |) ] ] |) diff --git a/CoqOfRust/examples/default/examples/ink_contracts/erc20.v b/CoqOfRust/examples/default/examples/ink_contracts/erc20.v index 49c658fa2..423e500f7 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/erc20.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/erc20.v @@ -323,7 +323,7 @@ Module Impl_erc20_Env. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_record_field (M.read (| self |)) "erc20::Env" "caller" |))) + M.read (| M.get_struct_record_field (| M.read (| self |), "erc20::Env", "caller" |) |))) | _, _ => M.impossible end. @@ -500,7 +500,9 @@ Module Impl_erc20_Erc20. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_record_field (M.read (| self |)) "erc20::Erc20" "total_supply" |))) + M.read (| + M.get_struct_record_field (| M.read (| self |), "erc20::Erc20", "total_supply" |) + |))) | _, _ => M.impossible end. @@ -531,7 +533,7 @@ Module Impl_erc20_Erc20. [] |), [ - M.get_struct_record_field (M.read (| self |)) "erc20::Erc20" "balances"; + M.get_struct_record_field (| M.read (| self |), "erc20::Erc20", "balances" |); M.read (| owner |) ] |) @@ -594,7 +596,7 @@ Module Impl_erc20_Erc20. [] |), [ - M.get_struct_record_field (M.read (| self |)) "erc20::Erc20" "allowances"; + M.get_struct_record_field (| M.read (| self |), "erc20::Erc20", "allowances" |); M.alloc (| Value.Tuple [ M.read (| M.read (| owner |) |); M.read (| M.read (| spender |) |) ] |) @@ -703,7 +705,7 @@ Module Impl_erc20_Erc20. [] |), [ - M.get_struct_record_field (M.read (| self |)) "erc20::Erc20" "balances"; + M.get_struct_record_field (| M.read (| self |), "erc20::Erc20", "balances" |); M.read (| M.read (| from |) |); BinOp.Panic.sub (| M.read (| from_balance |), M.read (| value |) |) ] @@ -727,7 +729,7 @@ Module Impl_erc20_Erc20. [] |), [ - M.get_struct_record_field (M.read (| self |)) "erc20::Erc20" "balances"; + M.get_struct_record_field (| M.read (| self |), "erc20::Erc20", "balances" |); M.read (| M.read (| to |) |); BinOp.Panic.add (| M.read (| to_balance |), M.read (| value |) |) ] @@ -861,7 +863,7 @@ Module Impl_erc20_Erc20. [] |), [ - M.get_struct_record_field (M.read (| self |)) "erc20::Erc20" "allowances"; + M.get_struct_record_field (| M.read (| self |), "erc20::Erc20", "allowances" |); Value.Tuple [ M.read (| owner |); M.read (| spender |) ]; M.read (| value |) ] @@ -1058,7 +1060,11 @@ Module Impl_erc20_Erc20. [] |), [ - M.get_struct_record_field (M.read (| self |)) "erc20::Erc20" "allowances"; + M.get_struct_record_field (| + M.read (| self |), + "erc20::Erc20", + "allowances" + |); Value.Tuple [ M.read (| from |); M.read (| caller |) ]; BinOp.Panic.sub (| M.read (| allowance |), M.read (| value |) |) ] diff --git a/CoqOfRust/examples/default/examples/ink_contracts/erc721.v b/CoqOfRust/examples/default/examples/ink_contracts/erc721.v index f1afc6c1c..5d2923c8a 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/erc721.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/erc721.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -218,8 +219,8 @@ Module Impl_core_cmp_PartialEq_for_erc721_AccountId. (let self := M.alloc (| self |) in let other := M.alloc (| other |) in BinOp.Pure.eq - (M.read (| M.get_struct_tuple_field (M.read (| self |)) "erc721::AccountId" 0 |)) - (M.read (| M.get_struct_tuple_field (M.read (| other |)) "erc721::AccountId" 0 |)))) + (M.read (| M.get_struct_tuple_field (| M.read (| self |), "erc721::AccountId", 0 |) |)) + (M.read (| M.get_struct_tuple_field (| M.read (| other |), "erc721::AccountId", 0 |) |)))) | _, _ => M.impossible end. @@ -592,7 +593,7 @@ Module Impl_erc721_Env. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_record_field (M.read (| self |)) "erc721::Env" "caller" |))) + M.read (| M.get_struct_record_field (| M.read (| self |), "erc721::Env", "caller" |) |))) | _, _ => M.impossible end. @@ -688,7 +689,11 @@ Module Impl_erc721_Erc721. [] |), [ - M.get_struct_record_field (M.read (| self |)) "erc721::Erc721" "owned_tokens_count"; + M.get_struct_record_field (| + M.read (| self |), + "erc721::Erc721", + "owned_tokens_count" + |); M.read (| of |) ] |); @@ -724,7 +729,11 @@ Module Impl_erc721_Erc721. [] |), [ - M.get_struct_record_field (M.read (| self |)) "erc721::Erc721" "token_approvals"; + M.get_struct_record_field (| + M.read (| self |), + "erc721::Erc721", + "token_approvals" + |); M.read (| id |) ] |) @@ -759,7 +768,11 @@ Module Impl_erc721_Erc721. [] |), [ - M.get_struct_record_field (M.read (| self |)) "erc721::Erc721" "operator_approvals"; + M.get_struct_record_field (| + M.read (| self |), + "erc721::Erc721", + "operator_approvals" + |); M.alloc (| Value.Tuple [ M.read (| owner |); M.read (| operator |) ] |) ] |))) @@ -786,7 +799,7 @@ Module Impl_erc721_Erc721. "get", [] |), - [ M.get_struct_record_field (M.read (| self |)) "erc721::Erc721" "token_owner"; id ] + [ M.get_struct_record_field (| M.read (| self |), "erc721::Erc721", "token_owner" |); id ] |))) | _, _ => M.impossible end. @@ -889,10 +902,11 @@ Module Impl_erc721_Erc721. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "erc721::Erc721" - "token_approvals"; + M.get_struct_record_field (| + M.read (| self |), + "erc721::Erc721", + "token_approvals" + |); id ] |) @@ -958,7 +972,7 @@ Module Impl_erc721_Erc721. "contains", [] |), - [ M.get_struct_record_field (M.read (| self |)) "erc721::Erc721" "token_owner"; id ] + [ M.get_struct_record_field (| M.read (| self |), "erc721::Erc721", "token_owner" |); id ] |))) | _, _ => M.impossible end. @@ -1002,7 +1016,10 @@ Module Impl_erc721_Erc721. "get", [] |), - [ M.get_struct_record_field (M.read (| self |)) "erc721::Erc721" "token_approvals"; id ] + [ + M.get_struct_record_field (| M.read (| self |), "erc721::Erc721", "token_approvals" |); + id + ] |))) | _, _ => M.impossible end. @@ -1161,10 +1178,11 @@ Module Impl_erc721_Erc721. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "erc721::Erc721" - "operator_approvals"; + M.get_struct_record_field (| + M.read (| self |), + "erc721::Erc721", + "operator_approvals" + |); Value.Tuple [ M.read (| caller |); M.read (| to |) ]; Value.Tuple [] ] @@ -1188,10 +1206,11 @@ Module Impl_erc721_Erc721. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "erc721::Erc721" - "operator_approvals"; + M.get_struct_record_field (| + M.read (| self |), + "erc721::Erc721", + "operator_approvals" + |); Value.Tuple [ M.read (| caller |); M.read (| to |) ] ] |) @@ -1512,10 +1531,11 @@ Module Impl_erc721_Erc721. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "erc721::Erc721" - "token_approvals"; + M.get_struct_record_field (| + M.read (| self |), + "erc721::Erc721", + "token_approvals" + |); id ] |) @@ -1546,10 +1566,11 @@ Module Impl_erc721_Erc721. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "erc721::Erc721" - "token_approvals"; + M.get_struct_record_field (| + M.read (| self |), + "erc721::Erc721", + "token_approvals" + |); M.read (| id |); M.read (| M.read (| to |) |) ] diff --git a/CoqOfRust/examples/default/examples/ink_contracts/flipper.v b/CoqOfRust/examples/default/examples/ink_contracts/flipper.v index 0ee172150..4c5500c9b 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/flipper.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/flipper.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -63,10 +64,10 @@ Module Impl_flipper_Flipper. M.read (| let _ := M.write (| - M.get_struct_record_field (M.read (| self |)) "flipper::Flipper" "value", + M.get_struct_record_field (| M.read (| self |), "flipper::Flipper", "value" |), UnOp.Pure.not (M.read (| - M.get_struct_record_field (M.read (| self |)) "flipper::Flipper" "value" + M.get_struct_record_field (| M.read (| self |), "flipper::Flipper", "value" |) |)) |) in M.alloc (| Value.Tuple [] |) @@ -86,7 +87,9 @@ Module Impl_flipper_Flipper. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_record_field (M.read (| self |)) "flipper::Flipper" "value" |))) + M.read (| + M.get_struct_record_field (| M.read (| self |), "flipper::Flipper", "value" |) + |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/incrementer.v b/CoqOfRust/examples/default/examples/ink_contracts/incrementer.v index 3823c63fe..11893cf1e 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/incrementer.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/incrementer.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -64,7 +65,11 @@ Module Impl_incrementer_Incrementer. M.read (| let _ := let β := - M.get_struct_record_field (M.read (| self |)) "incrementer::Incrementer" "value" in + M.get_struct_record_field (| + M.read (| self |), + "incrementer::Incrementer", + "value" + |) in M.write (| β, BinOp.Panic.add (| M.read (| β |), M.read (| by_ |) |) |) in M.alloc (| Value.Tuple [] |) |))) @@ -84,7 +89,7 @@ Module Impl_incrementer_Incrementer. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (M.read (| self |)) "incrementer::Incrementer" "value" + M.get_struct_record_field (| M.read (| self |), "incrementer::Incrementer", "value" |) |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/call_builder.v b/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/call_builder.v index b86d8d801..45cf04696 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/call_builder.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/call_builder.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/call_builder_delegate.v b/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/call_builder_delegate.v index d327eb561..eb078d83f 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/call_builder_delegate.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/call_builder_delegate.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Axiom Hash : (Ty.path "call_builder_delegate::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u8" ]). diff --git a/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/constructors_return_value.v b/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/constructors_return_value.v index 96251681c..9d800f7fc 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/constructors_return_value.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/constructors_return_value.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { @@ -433,10 +434,11 @@ Module Impl_constructors_return_value_ConstructorsReturnValue. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field - (M.read (| self |)) - "constructors_return_value::ConstructorsReturnValue" + M.get_struct_record_field (| + M.read (| self |), + "constructors_return_value::ConstructorsReturnValue", "value" + |) |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/contract_ref.v b/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/contract_ref.v index 023d42043..58096440e 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/contract_ref.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/contract_ref.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { @@ -252,10 +253,18 @@ Module Impl_contract_ref_FlipperRef. M.read (| let _ := M.write (| - M.get_struct_record_field (M.read (| self |)) "contract_ref::FlipperRef" "value", + M.get_struct_record_field (| + M.read (| self |), + "contract_ref::FlipperRef", + "value" + |), UnOp.Pure.not (M.read (| - M.get_struct_record_field (M.read (| self |)) "contract_ref::FlipperRef" "value" + M.get_struct_record_field (| + M.read (| self |), + "contract_ref::FlipperRef", + "value" + |) |)) |) in M.alloc (| Value.Tuple [] |) @@ -276,7 +285,7 @@ Module Impl_contract_ref_FlipperRef. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (M.read (| self |)) "contract_ref::FlipperRef" "value" + M.get_struct_record_field (| M.read (| self |), "contract_ref::FlipperRef", "value" |) |))) | _, _ => M.impossible end. @@ -420,10 +429,11 @@ Module Impl_contract_ref_ContractRef. M.call_closure (| M.get_associated_function (| Ty.path "contract_ref::FlipperRef", "flip", [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "contract_ref::ContractRef" + M.get_struct_record_field (| + M.read (| self |), + "contract_ref::ContractRef", "flipper" + |) ] |) |) in @@ -446,7 +456,13 @@ Module Impl_contract_ref_ContractRef. (let self := M.alloc (| self |) in M.call_closure (| M.get_associated_function (| Ty.path "contract_ref::FlipperRef", "get", [] |), - [ M.get_struct_record_field (M.read (| self |)) "contract_ref::ContractRef" "flipper" ] + [ + M.get_struct_record_field (| + M.read (| self |), + "contract_ref::ContractRef", + "flipper" + |) + ] |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/integration_flipper.v b/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/integration_flipper.v index 364a2a6a1..07a72add1 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/integration_flipper.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/integration_flipper.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -146,13 +147,18 @@ Module Impl_integration_flipper_Flipper. M.read (| let _ := M.write (| - M.get_struct_record_field (M.read (| self |)) "integration_flipper::Flipper" "value", + M.get_struct_record_field (| + M.read (| self |), + "integration_flipper::Flipper", + "value" + |), UnOp.Pure.not (M.read (| - M.get_struct_record_field - (M.read (| self |)) - "integration_flipper::Flipper" + M.get_struct_record_field (| + M.read (| self |), + "integration_flipper::Flipper", "value" + |) |)) |) in M.alloc (| Value.Tuple [] |) @@ -173,7 +179,7 @@ Module Impl_integration_flipper_Flipper. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (M.read (| self |)) "integration_flipper::Flipper" "value" + M.get_struct_record_field (| M.read (| self |), "integration_flipper::Flipper", "value" |) |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/mapping_integration_tests.v b/CoqOfRust/examples/default/examples/ink_contracts/mapping_integration_tests.v index f72e7f8d3..e24775c61 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/mapping_integration_tests.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/mapping_integration_tests.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -232,7 +233,11 @@ Module Impl_mapping_integration_tests_Env. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (M.read (| self |)) "mapping_integration_tests::Env" "caller" + M.get_struct_record_field (| + M.read (| self |), + "mapping_integration_tests::Env", + "caller" + |) |))) | _, _ => M.impossible end. @@ -391,10 +396,11 @@ Module Impl_mapping_integration_tests_Mappings. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "mapping_integration_tests::Mappings" - "balances"; + M.get_struct_record_field (| + M.read (| self |), + "mapping_integration_tests::Mappings", + "balances" + |); caller ] |) @@ -450,10 +456,11 @@ Module Impl_mapping_integration_tests_Mappings. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "mapping_integration_tests::Mappings" - "balances"; + M.get_struct_record_field (| + M.read (| self |), + "mapping_integration_tests::Mappings", + "balances" + |); M.read (| caller |); M.read (| value |) ] @@ -510,10 +517,11 @@ Module Impl_mapping_integration_tests_Mappings. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "mapping_integration_tests::Mappings" - "balances"; + M.get_struct_record_field (| + M.read (| self |), + "mapping_integration_tests::Mappings", + "balances" + |); M.read (| caller |) ] |) @@ -568,10 +576,11 @@ Module Impl_mapping_integration_tests_Mappings. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "mapping_integration_tests::Mappings" - "balances"; + M.get_struct_record_field (| + M.read (| self |), + "mapping_integration_tests::Mappings", + "balances" + |); caller ] |) @@ -628,10 +637,11 @@ Module Impl_mapping_integration_tests_Mappings. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "mapping_integration_tests::Mappings" - "balances"; + M.get_struct_record_field (| + M.read (| self |), + "mapping_integration_tests::Mappings", + "balances" + |); M.read (| caller |) ] |) @@ -688,10 +698,11 @@ Module Impl_mapping_integration_tests_Mappings. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "mapping_integration_tests::Mappings" - "balances"; + M.get_struct_record_field (| + M.read (| self |), + "mapping_integration_tests::Mappings", + "balances" + |); M.read (| caller |) ] |) diff --git a/CoqOfRust/examples/default/examples/ink_contracts/mother.v b/CoqOfRust/examples/default/examples/ink_contracts/mother.v index 77e457961..e9803ebe0 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/mother.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/mother.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -174,8 +175,8 @@ Module Impl_core_cmp_PartialEq_for_mother_AccountId. (let self := M.alloc (| self |) in let other := M.alloc (| other |) in BinOp.Pure.eq - (M.read (| M.get_struct_tuple_field (M.read (| self |)) "mother::AccountId" 0 |)) - (M.read (| M.get_struct_tuple_field (M.read (| other |)) "mother::AccountId" 0 |)))) + (M.read (| M.get_struct_tuple_field (| M.read (| self |), "mother::AccountId", 0 |) |)) + (M.read (| M.get_struct_tuple_field (| M.read (| other |), "mother::AccountId", 0 |) |)))) | _, _ => M.impossible end. @@ -361,8 +362,8 @@ Module Impl_core_cmp_PartialEq_for_mother_Bids. [] |), [ - M.get_struct_tuple_field (M.read (| self |)) "mother::Bids" 0; - M.get_struct_tuple_field (M.read (| other |)) "mother::Bids" 0 + M.get_struct_tuple_field (| M.read (| self |), "mother::Bids", 0 |); + M.get_struct_tuple_field (| M.read (| other |), "mother::Bids", 0 |) ] |))) | _, _ => M.impossible @@ -446,7 +447,7 @@ Module Impl_core_clone_Clone_for_mother_Bids. "clone", [] |), - [ M.get_struct_tuple_field (M.read (| self |)) "mother::Bids" 0 ] + [ M.get_struct_tuple_field (| M.read (| self |), "mother::Bids", 0 |) ] |) ])) | _, _ => M.impossible @@ -1000,8 +1001,16 @@ Module Impl_core_cmp_PartialEq_for_mother_Auction. [] |), [ - M.get_struct_record_field (M.read (| self |)) "mother::Auction" "name"; - M.get_struct_record_field (M.read (| other |)) "mother::Auction" "name" + M.get_struct_record_field (| + M.read (| self |), + "mother::Auction", + "name" + |); + M.get_struct_record_field (| + M.read (| other |), + "mother::Auction", + "name" + |) ] |), ltac:(M.monadic @@ -1014,8 +1023,16 @@ Module Impl_core_cmp_PartialEq_for_mother_Auction. [] |), [ - M.get_struct_record_field (M.read (| self |)) "mother::Auction" "subject"; - M.get_struct_record_field (M.read (| other |)) "mother::Auction" "subject" + M.get_struct_record_field (| + M.read (| self |), + "mother::Auction", + "subject" + |); + M.get_struct_record_field (| + M.read (| other |), + "mother::Auction", + "subject" + |) ] |))) |), @@ -1029,8 +1046,16 @@ Module Impl_core_cmp_PartialEq_for_mother_Auction. [] |), [ - M.get_struct_record_field (M.read (| self |)) "mother::Auction" "bids"; - M.get_struct_record_field (M.read (| other |)) "mother::Auction" "bids" + M.get_struct_record_field (| + M.read (| self |), + "mother::Auction", + "bids" + |); + M.get_struct_record_field (| + M.read (| other |), + "mother::Auction", + "bids" + |) ] |))) |), @@ -1044,8 +1069,8 @@ Module Impl_core_cmp_PartialEq_for_mother_Auction. [] |), [ - M.get_struct_record_field (M.read (| self |)) "mother::Auction" "terms"; - M.get_struct_record_field (M.read (| other |)) "mother::Auction" "terms" + M.get_struct_record_field (| M.read (| self |), "mother::Auction", "terms" |); + M.get_struct_record_field (| M.read (| other |), "mother::Auction", "terms" |) ] |))) |), @@ -1059,18 +1084,18 @@ Module Impl_core_cmp_PartialEq_for_mother_Auction. [] |), [ - M.get_struct_record_field (M.read (| self |)) "mother::Auction" "status"; - M.get_struct_record_field (M.read (| other |)) "mother::Auction" "status" + M.get_struct_record_field (| M.read (| self |), "mother::Auction", "status" |); + M.get_struct_record_field (| M.read (| other |), "mother::Auction", "status" |) ] |))) |), ltac:(M.monadic (BinOp.Pure.eq (M.read (| - M.get_struct_record_field (M.read (| self |)) "mother::Auction" "finalized" + M.get_struct_record_field (| M.read (| self |), "mother::Auction", "finalized" |) |)) (M.read (| - M.get_struct_record_field (M.read (| other |)) "mother::Auction" "finalized" + M.get_struct_record_field (| M.read (| other |), "mother::Auction", "finalized" |) |)))) |), ltac:(M.monadic @@ -1089,8 +1114,8 @@ Module Impl_core_cmp_PartialEq_for_mother_Auction. [] |), [ - M.get_struct_record_field (M.read (| self |)) "mother::Auction" "vector"; - M.get_struct_record_field (M.read (| other |)) "mother::Auction" "vector" + M.get_struct_record_field (| M.read (| self |), "mother::Auction", "vector" |); + M.get_struct_record_field (| M.read (| other |), "mother::Auction", "vector" |) ] |))) |))) @@ -1210,7 +1235,7 @@ Module Impl_core_clone_Clone_for_mother_Auction. "clone", [] |), - [ M.get_struct_record_field (M.read (| self |)) "mother::Auction" "name" ] + [ M.get_struct_record_field (| M.read (| self |), "mother::Auction", "name" |) ] |)); ("subject", M.call_closure (| @@ -1221,7 +1246,7 @@ Module Impl_core_clone_Clone_for_mother_Auction. "clone", [] |), - [ M.get_struct_record_field (M.read (| self |)) "mother::Auction" "subject" ] + [ M.get_struct_record_field (| M.read (| self |), "mother::Auction", "subject" |) ] |)); ("bids", M.call_closure (| @@ -1232,7 +1257,7 @@ Module Impl_core_clone_Clone_for_mother_Auction. "clone", [] |), - [ M.get_struct_record_field (M.read (| self |)) "mother::Auction" "bids" ] + [ M.get_struct_record_field (| M.read (| self |), "mother::Auction", "bids" |) ] |)); ("terms", M.call_closure (| @@ -1243,7 +1268,7 @@ Module Impl_core_clone_Clone_for_mother_Auction. "clone", [] |), - [ M.get_struct_record_field (M.read (| self |)) "mother::Auction" "terms" ] + [ M.get_struct_record_field (| M.read (| self |), "mother::Auction", "terms" |) ] |)); ("status", M.call_closure (| @@ -1254,12 +1279,13 @@ Module Impl_core_clone_Clone_for_mother_Auction. "clone", [] |), - [ M.get_struct_record_field (M.read (| self |)) "mother::Auction" "status" ] + [ M.get_struct_record_field (| M.read (| self |), "mother::Auction", "status" |) ] |)); ("finalized", M.call_closure (| M.get_trait_method (| "core::clone::Clone", Ty.path "bool", [], "clone", [] |), - [ M.get_struct_record_field (M.read (| self |)) "mother::Auction" "finalized" ] + [ M.get_struct_record_field (| M.read (| self |), "mother::Auction", "finalized" |) + ] |)); ("vector", M.call_closure (| @@ -1272,7 +1298,7 @@ Module Impl_core_clone_Clone_for_mother_Auction. "clone", [] |), - [ M.get_struct_record_field (M.read (| self |)) "mother::Auction" "vector" ] + [ M.get_struct_record_field (| M.read (| self |), "mother::Auction", "vector" |) ] |)) ])) | _, _ => M.impossible @@ -1573,7 +1599,7 @@ Module Impl_mother_Env. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_record_field (M.read (| self |)) "mother::Env" "caller" |))) + M.read (| M.get_struct_record_field (| M.read (| self |), "mother::Env", "caller" |) |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/multisig.v b/CoqOfRust/examples/default/examples/ink_contracts/multisig.v index 0c3be8e56..92b22f4b1 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/multisig.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/multisig.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -184,7 +185,9 @@ Module Impl_core_fmt_Debug_for_multisig_AccountId. M.read (| Value.String "AccountId" |); (* Unsize *) M.pointer_coercion - (M.alloc (| M.get_struct_tuple_field (M.read (| self |)) "multisig::AccountId" 0 |)) + (M.alloc (| + M.get_struct_tuple_field (| M.read (| self |), "multisig::AccountId", 0 |) + |)) ] |))) | _, _ => M.impossible @@ -253,8 +256,10 @@ Module Impl_core_cmp_PartialEq_for_multisig_AccountId. (let self := M.alloc (| self |) in let other := M.alloc (| other |) in BinOp.Pure.eq - (M.read (| M.get_struct_tuple_field (M.read (| self |)) "multisig::AccountId" 0 |)) - (M.read (| M.get_struct_tuple_field (M.read (| other |)) "multisig::AccountId" 0 |)))) + (M.read (| M.get_struct_tuple_field (| M.read (| self |), "multisig::AccountId", 0 |) |)) + (M.read (| + M.get_struct_tuple_field (| M.read (| other |), "multisig::AccountId", 0 |) + |)))) | _, _ => M.impossible end. @@ -323,8 +328,8 @@ Module Impl_core_cmp_PartialOrd_for_multisig_AccountId. [] |), [ - M.get_struct_tuple_field (M.read (| self |)) "multisig::AccountId" 0; - M.get_struct_tuple_field (M.read (| other |)) "multisig::AccountId" 0 + M.get_struct_tuple_field (| M.read (| self |), "multisig::AccountId", 0 |); + M.get_struct_tuple_field (| M.read (| other |), "multisig::AccountId", 0 |) ] |))) | _, _ => M.impossible @@ -351,8 +356,8 @@ Module Impl_core_cmp_Ord_for_multisig_AccountId. M.call_closure (| M.get_trait_method (| "core::cmp::Ord", Ty.path "u128", [], "cmp", [] |), [ - M.get_struct_tuple_field (M.read (| self |)) "multisig::AccountId" 0; - M.get_struct_tuple_field (M.read (| other |)) "multisig::AccountId" 0 + M.get_struct_tuple_field (| M.read (| self |), "multisig::AccountId", 0 |); + M.get_struct_tuple_field (| M.read (| other |), "multisig::AccountId", 0 |) ] |))) | _, _ => M.impossible @@ -846,7 +851,7 @@ Module Impl_multisig_Env. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_record_field (M.read (| self |)) "multisig::Env" "caller" |))) + M.read (| M.get_struct_record_field (| M.read (| self |), "multisig::Env", "caller" |) |))) | _, _ => M.impossible end. @@ -1260,10 +1265,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - contract - "multisig::Multisig" - "is_owner"; + M.get_struct_record_field (| + contract, + "multisig::Multisig", + "is_owner" + |); M.read (| M.read (| owner |) |); Value.Tuple [] ] @@ -1278,12 +1284,12 @@ Module Impl_multisig_Multisig. |)) in let _ := M.write (| - M.get_struct_record_field contract "multisig::Multisig" "owners", + M.get_struct_record_field (| contract, "multisig::Multisig", "owners" |), M.read (| owners |) |) in let _ := M.write (| - M.get_struct_record_field contract "multisig::Multisig" "transaction_list", + M.get_struct_record_field (| contract, "multisig::Multisig", "transaction_list" |), M.call_closure (| M.get_trait_method (| "core::default::Default", @@ -1297,7 +1303,7 @@ Module Impl_multisig_Multisig. |) in let _ := M.write (| - M.get_struct_record_field contract "multisig::Multisig" "requirement", + M.get_struct_record_field (| contract, "multisig::Multisig", "requirement" |), M.read (| requirement |) |) in contract @@ -1351,10 +1357,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "confirmation_count"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "confirmation_count" + |); trans_id ] |); @@ -1362,10 +1369,11 @@ Module Impl_multisig_Multisig. ] |)) (M.read (| - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", "requirement" + |) |))) |)) in let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in @@ -1426,10 +1434,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "transactions"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "transactions" + |); trans_id ] |); @@ -1476,10 +1485,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "is_owner"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "is_owner" + |); M.read (| owner |) ] |)) @@ -1701,10 +1711,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "is_owner"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "is_owner" + |); M.read (| owner |) ] |))) @@ -1785,16 +1796,21 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", "owners" + |) ] |)), Value.Integer Integer.U32 1 |); M.read (| - M.get_struct_record_field (M.read (| self |)) "multisig::Multisig" "requirement" + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "requirement" + |) |) ] |) @@ -1810,7 +1826,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (M.read (| self |)) "multisig::Multisig" "is_owner"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "is_owner" + |); M.read (| new_owner |); Value.Tuple [] ] @@ -1827,7 +1847,7 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (M.read (| self |)) "multisig::Multisig" "owners"; + M.get_struct_record_field (| M.read (| self |), "multisig::Multisig", "owners" |); M.read (| new_owner |) ] |) @@ -1914,10 +1934,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", "owners" + |) ] |) ] @@ -2000,13 +2021,15 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "transaction_list") - "multisig::Transactions" + M.get_struct_record_field (| + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "transaction_list" + |), + "multisig::Transactions", "transactions" + |) ] |) |), @@ -2075,10 +2098,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "confirmations"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "confirmations" + |); key ] |) @@ -2106,10 +2130,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "confirmations"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "confirmations" + |); M.read (| key |) ] |) @@ -2134,10 +2159,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "confirmation_count"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "confirmation_count" + |); M.read (| trans_id |) ] |); @@ -2168,10 +2194,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "confirmation_count"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "confirmation_count" + |); M.read (| M.read (| trans_id |) |); M.read (| count |) ] @@ -2247,7 +2274,13 @@ Module Impl_multisig_Multisig. "len", [] |), - [ M.get_struct_record_field (M.read (| self |)) "multisig::Multisig" "owners" ] + [ + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "owners" + |) + ] |)), Value.Integer Integer.U32 1 |) @@ -2259,7 +2292,11 @@ Module Impl_multisig_Multisig. [ M.read (| len |); M.read (| - M.get_struct_record_field (M.read (| self |)) "multisig::Multisig" "requirement" + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "requirement" + |) |) ] |) @@ -2290,7 +2327,7 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (M.read (| self |)) "multisig::Multisig" "owners"; + M.get_struct_record_field (| M.read (| self |), "multisig::Multisig", "owners" |); M.read (| owner_index |) ] |) @@ -2306,14 +2343,22 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (M.read (| self |)) "multisig::Multisig" "is_owner"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "is_owner" + |); M.read (| owner |) ] |) |) in let _ := M.write (| - M.get_struct_record_field (M.read (| self |)) "multisig::Multisig" "requirement", + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "requirement" + |), M.read (| requirement |) |) in let _ := @@ -2421,7 +2466,7 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (M.read (| self |)) "multisig::Multisig" "owners"; + M.get_struct_record_field (| M.read (| self |), "multisig::Multisig", "owners" |); M.rust_cast (M.read (| owner_index |)) ] |), @@ -2438,7 +2483,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (M.read (| self |)) "multisig::Multisig" "is_owner"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "is_owner" + |); M.read (| old_owner |) ] |) @@ -2454,7 +2503,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (M.read (| self |)) "multisig::Multisig" "is_owner"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "is_owner" + |); M.read (| new_owner |); Value.Tuple [] ] @@ -2564,7 +2617,12 @@ Module Impl_multisig_Multisig. "len", [] |), - [ M.get_struct_record_field (M.read (| self |)) "multisig::Multisig" "owners" + [ + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "owners" + |) ] |)); M.read (| new_requirement |) @@ -2573,7 +2631,11 @@ Module Impl_multisig_Multisig. |) in let _ := M.write (| - M.get_struct_record_field (M.read (| self |)) "multisig::Multisig" "requirement", + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "requirement" + |), M.read (| new_requirement |) |) in let _ := @@ -2663,10 +2725,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "confirmation_count"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "confirmation_count" + |); transaction ] |); @@ -2688,10 +2751,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "confirmations"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "confirmations" + |); key ] |)) @@ -2724,10 +2788,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "confirmations"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "confirmations" + |); M.read (| key |); Value.Tuple [] ] @@ -2742,10 +2807,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "confirmation_count"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "confirmation_count" + |); M.read (| transaction |); M.read (| count |) ] @@ -2768,10 +2834,11 @@ Module Impl_multisig_Multisig. BinOp.Pure.ge (M.read (| count |)) (M.read (| - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", "requirement" + |) |)) |)) in let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in @@ -2786,10 +2853,11 @@ Module Impl_multisig_Multisig. [ BinOp.Panic.sub (| M.read (| - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", "requirement" + |) |), M.read (| count |) |) @@ -2888,23 +2956,27 @@ Module Impl_multisig_Multisig. |) in let trans_id := M.copy (| - M.get_struct_record_field - (M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "transaction_list") - "multisig::Transactions" + M.get_struct_record_field (| + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "transaction_list" + |), + "multisig::Transactions", "next_id" + |) |) in let _ := M.write (| - M.get_struct_record_field - (M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "transaction_list") - "multisig::Transactions" - "next_id", + M.get_struct_record_field (| + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "transaction_list" + |), + "multisig::Transactions", + "next_id" + |), M.call_closure (| M.get_associated_function (| Ty.apply (Ty.path "core::option::Option") [ Ty.path "u32" ], @@ -2934,7 +3006,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (M.read (| self |)) "multisig::Multisig" "transactions"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "transactions" + |); M.read (| trans_id |); M.read (| transaction |) ] @@ -2951,13 +3027,15 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "transaction_list") - "multisig::Transactions" - "transactions"; + M.get_struct_record_field (| + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "transaction_list" + |), + "multisig::Transactions", + "transactions" + |); M.read (| trans_id |) ] |) @@ -3056,7 +3134,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (M.read (| self |)) "multisig::Multisig" "transactions"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "transactions" + |); trans_id ] |) @@ -3093,10 +3175,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "transactions"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "transactions" + |); M.read (| trans_id |) ] |) @@ -3142,13 +3225,15 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "transaction_list") - "multisig::Transactions" + M.get_struct_record_field (| + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "transaction_list" + |), + "multisig::Transactions", "transactions" + |) ] |) ] @@ -3199,13 +3284,15 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "transaction_list") - "multisig::Transactions" - "transactions"; + M.get_struct_record_field (| + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "transaction_list" + |), + "multisig::Transactions", + "transactions" + |); M.read (| pos |) ] |) @@ -3246,10 +3333,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", "owners" + |) ] |) ] @@ -3312,10 +3400,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "confirmations"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "confirmations" + |); Value.Tuple [ M.read (| trans_id |); @@ -3340,10 +3429,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "confirmation_count"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "confirmation_count" + |); M.read (| trans_id |) ] |) @@ -3590,10 +3680,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "confirmations"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "confirmations" + |); M.alloc (| Value.Tuple [ M.read (| trans_id |); M.read (| caller |) ] |) ] |) @@ -3611,10 +3702,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "confirmations"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "confirmations" + |); Value.Tuple [ M.read (| trans_id |); M.read (| caller |) ] ] |) @@ -3637,10 +3729,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "confirmation_count"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "confirmation_count" + |); trans_id ] |); @@ -3666,10 +3759,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "multisig::Multisig" - "confirmation_count"; + M.get_struct_record_field (| + M.read (| self |), + "multisig::Multisig", + "confirmation_count" + |); M.read (| trans_id |); M.read (| confirmation_count |) ] @@ -3811,10 +3905,11 @@ Module Impl_multisig_Multisig. ] |)) (M.read (| - M.get_struct_record_field - t - "multisig::Transaction" + M.get_struct_record_field (| + t, + "multisig::Transaction", "transferred_value" + |) |))) |)) in let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in diff --git a/CoqOfRust/examples/default/examples/ink_contracts/payment_channel.v b/CoqOfRust/examples/default/examples/ink_contracts/payment_channel.v index 7cd93f50f..6e3d2b372 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/payment_channel.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/payment_channel.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { @@ -90,9 +91,11 @@ Module Impl_core_cmp_PartialEq_for_payment_channel_AccountId. (let self := M.alloc (| self |) in let other := M.alloc (| other |) in BinOp.Pure.eq - (M.read (| M.get_struct_tuple_field (M.read (| self |)) "payment_channel::AccountId" 0 |)) (M.read (| - M.get_struct_tuple_field (M.read (| other |)) "payment_channel::AccountId" 0 + M.get_struct_tuple_field (| M.read (| self |), "payment_channel::AccountId", 0 |) + |)) + (M.read (| + M.get_struct_tuple_field (| M.read (| other |), "payment_channel::AccountId", 0 |) |)))) | _, _ => M.impossible end. @@ -354,7 +357,9 @@ Module Impl_payment_channel_Env. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_record_field (M.read (| self |)) "payment_channel::Env" "caller" |))) + M.read (| + M.get_struct_record_field (| M.read (| self |), "payment_channel::Env", "caller" |) + |))) | _, _ => M.impossible end. @@ -777,10 +782,11 @@ Module Impl_payment_channel_PaymentChannel. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "payment_channel::PaymentChannel" - "recipient"; + M.get_struct_record_field (| + M.read (| self |), + "payment_channel::PaymentChannel", + "recipient" + |); M.alloc (| M.call_closure (| M.get_trait_method (| @@ -920,10 +926,11 @@ Module Impl_payment_channel_PaymentChannel. ] |) |); - M.get_struct_record_field - (M.read (| self |)) - "payment_channel::PaymentChannel" + M.get_struct_record_field (| + M.read (| self |), + "payment_channel::PaymentChannel", "recipient" + |) ] |) |)) in @@ -959,10 +966,11 @@ Module Impl_payment_channel_PaymentChannel. BinOp.Pure.lt (M.read (| amount |)) (M.read (| - M.get_struct_record_field - (M.read (| self |)) - "payment_channel::PaymentChannel" + M.get_struct_record_field (| + M.read (| self |), + "payment_channel::PaymentChannel", "withdrawn" + |) |)) |)) in let _ := @@ -1067,18 +1075,20 @@ Module Impl_payment_channel_PaymentChannel. |) |); M.read (| - M.get_struct_record_field - (M.read (| self |)) - "payment_channel::PaymentChannel" + M.get_struct_record_field (| + M.read (| self |), + "payment_channel::PaymentChannel", "recipient" + |) |); BinOp.Panic.sub (| M.read (| amount |), M.read (| - M.get_struct_record_field - (M.read (| self |)) - "payment_channel::PaymentChannel" + M.get_struct_record_field (| + M.read (| self |), + "payment_channel::PaymentChannel", "withdrawn" + |) |) |) ] @@ -1274,10 +1284,11 @@ Module Impl_payment_channel_PaymentChannel. |) |); M.read (| - M.get_struct_record_field - (M.read (| self |)) - "payment_channel::PaymentChannel" + M.get_struct_record_field (| + M.read (| self |), + "payment_channel::PaymentChannel", "sender" + |) |) ] |) @@ -1357,10 +1368,11 @@ Module Impl_payment_channel_PaymentChannel. ] |) |); - M.get_struct_record_field - (M.read (| self |)) - "payment_channel::PaymentChannel" + M.get_struct_record_field (| + M.read (| self |), + "payment_channel::PaymentChannel", "sender" + |) ] |) |)) in @@ -1408,10 +1420,11 @@ Module Impl_payment_channel_PaymentChannel. BinOp.Panic.add (| M.read (| now |), M.read (| - M.get_struct_record_field - (M.read (| self |)) - "payment_channel::PaymentChannel" + M.get_struct_record_field (| + M.read (| self |), + "payment_channel::PaymentChannel", "close_duration" + |) |) |) |) in @@ -1443,10 +1456,11 @@ Module Impl_payment_channel_PaymentChannel. ("expiration", M.read (| expiration |)); ("close_duration", M.read (| - M.get_struct_record_field - (M.read (| self |)) - "payment_channel::PaymentChannel" + M.get_struct_record_field (| + M.read (| self |), + "payment_channel::PaymentChannel", "close_duration" + |) |)) ] ] @@ -1455,10 +1469,11 @@ Module Impl_payment_channel_PaymentChannel. |) in let _ := M.write (| - M.get_struct_record_field - (M.read (| self |)) - "payment_channel::PaymentChannel" - "expiration", + M.get_struct_record_field (| + M.read (| self |), + "payment_channel::PaymentChannel", + "expiration" + |), Value.StructTuple "core::option::Option::Some" [ M.read (| expiration |) ] |) in M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |) @@ -1499,10 +1514,11 @@ Module Impl_payment_channel_PaymentChannel. ltac:(M.monadic (M.read (| M.match_operator (| - M.get_struct_record_field - (M.read (| self |)) - "payment_channel::PaymentChannel" - "expiration", + M.get_struct_record_field (| + M.read (| self |), + "payment_channel::PaymentChannel", + "expiration" + |), [ fun γ => ltac:(M.monadic @@ -1589,10 +1605,11 @@ Module Impl_payment_channel_PaymentChannel. |) |); M.read (| - M.get_struct_record_field - (M.read (| self |)) - "payment_channel::PaymentChannel" + M.get_struct_record_field (| + M.read (| self |), + "payment_channel::PaymentChannel", "sender" + |) |) ] |) @@ -1692,10 +1709,11 @@ Module Impl_payment_channel_PaymentChannel. ] |) |); - M.get_struct_record_field - (M.read (| self |)) - "payment_channel::PaymentChannel" + M.get_struct_record_field (| + M.read (| self |), + "payment_channel::PaymentChannel", "recipient" + |) ] |) |)) in @@ -1767,10 +1785,11 @@ Module Impl_payment_channel_PaymentChannel. BinOp.Pure.lt (M.read (| amount |)) (M.read (| - M.get_struct_record_field - (M.read (| self |)) - "payment_channel::PaymentChannel" + M.get_struct_record_field (| + M.read (| self |), + "payment_channel::PaymentChannel", "withdrawn" + |) |)) |)) in let _ := @@ -1798,19 +1817,21 @@ Module Impl_payment_channel_PaymentChannel. BinOp.Panic.sub (| M.read (| amount |), M.read (| - M.get_struct_record_field - (M.read (| self |)) - "payment_channel::PaymentChannel" + M.get_struct_record_field (| + M.read (| self |), + "payment_channel::PaymentChannel", "withdrawn" + |) |) |) |) in let _ := let β := - M.get_struct_record_field - (M.read (| self |)) - "payment_channel::PaymentChannel" - "withdrawn" in + M.get_struct_record_field (| + M.read (| self |), + "payment_channel::PaymentChannel", + "withdrawn" + |) in M.write (| β, BinOp.Panic.add (| M.read (| β |), M.read (| amount_to_withdraw |) |) @@ -1861,10 +1882,11 @@ Module Impl_payment_channel_PaymentChannel. |) |); M.read (| - M.get_struct_record_field - (M.read (| self |)) - "payment_channel::PaymentChannel" + M.get_struct_record_field (| + M.read (| self |), + "payment_channel::PaymentChannel", "recipient" + |) |); M.read (| amount_to_withdraw |) ] @@ -1959,7 +1981,11 @@ Module Impl_payment_channel_PaymentChannel. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (M.read (| self |)) "payment_channel::PaymentChannel" "sender" + M.get_struct_record_field (| + M.read (| self |), + "payment_channel::PaymentChannel", + "sender" + |) |))) | _, _ => M.impossible end. @@ -1977,10 +2003,11 @@ Module Impl_payment_channel_PaymentChannel. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field - (M.read (| self |)) - "payment_channel::PaymentChannel" + M.get_struct_record_field (| + M.read (| self |), + "payment_channel::PaymentChannel", "recipient" + |) |))) | _, _ => M.impossible end. @@ -1999,10 +2026,11 @@ Module Impl_payment_channel_PaymentChannel. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field - (M.read (| self |)) - "payment_channel::PaymentChannel" + M.get_struct_record_field (| + M.read (| self |), + "payment_channel::PaymentChannel", "expiration" + |) |))) | _, _ => M.impossible end. @@ -2021,10 +2049,11 @@ Module Impl_payment_channel_PaymentChannel. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field - (M.read (| self |)) - "payment_channel::PaymentChannel" + M.get_struct_record_field (| + M.read (| self |), + "payment_channel::PaymentChannel", "withdrawn" + |) |))) | _, _ => M.impossible end. @@ -2043,10 +2072,11 @@ Module Impl_payment_channel_PaymentChannel. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field - (M.read (| self |)) - "payment_channel::PaymentChannel" + M.get_struct_record_field (| + M.read (| self |), + "payment_channel::PaymentChannel", "close_duration" + |) |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/set_code_hash.v b/CoqOfRust/examples/default/examples/ink_contracts/set_code_hash.v index bbb25491e..7e14dac1d 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/set_code_hash.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/set_code_hash.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Error @@ -95,7 +96,11 @@ Module Impl_set_code_hash_Incrementer. M.read (| let _ := let β := - M.get_struct_record_field (M.read (| self |)) "set_code_hash::Incrementer" "count" in + M.get_struct_record_field (| + M.read (| self |), + "set_code_hash::Incrementer", + "count" + |) in M.write (| β, BinOp.Panic.add (| M.read (| β |), Value.Integer Integer.U32 1 |) |) in let _ := let _ := @@ -131,10 +136,11 @@ Module Impl_set_code_hash_Incrementer. [ Ty.path "u32" ] |), [ - M.get_struct_record_field - (M.read (| self |)) - "set_code_hash::Incrementer" + M.get_struct_record_field (| + M.read (| self |), + "set_code_hash::Incrementer", "count" + |) ] |) ] @@ -163,7 +169,7 @@ Module Impl_set_code_hash_Incrementer. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (M.read (| self |)) "set_code_hash::Incrementer" "count" + M.get_struct_record_field (| M.read (| self |), "set_code_hash::Incrementer", "count" |) |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/set_code_hash/updated_incrementer.v b/CoqOfRust/examples/default/examples/ink_contracts/set_code_hash/updated_incrementer.v index 6e24d4c40..29201b268 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/set_code_hash/updated_incrementer.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/set_code_hash/updated_incrementer.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { @@ -181,10 +182,11 @@ Module Impl_updated_incrementer_Incrementer. M.read (| let _ := let β := - M.get_struct_record_field - (M.read (| self |)) - "updated_incrementer::Incrementer" - "count" in + M.get_struct_record_field (| + M.read (| self |), + "updated_incrementer::Incrementer", + "count" + |) in M.write (| β, BinOp.Panic.add (| M.read (| β |), Value.Integer Integer.U32 4 |) |) in let _ := let _ := @@ -220,10 +222,11 @@ Module Impl_updated_incrementer_Incrementer. [ Ty.path "u32" ] |), [ - M.get_struct_record_field - (M.read (| self |)) - "updated_incrementer::Incrementer" + M.get_struct_record_field (| + M.read (| self |), + "updated_incrementer::Incrementer", "count" + |) ] |) ] @@ -252,7 +255,11 @@ Module Impl_updated_incrementer_Incrementer. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (M.read (| self |)) "updated_incrementer::Incrementer" "count" + M.get_struct_record_field (| + M.read (| self |), + "updated_incrementer::Incrementer", + "count" + |) |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/trait_erc20.v b/CoqOfRust/examples/default/examples/ink_contracts/trait_erc20.v index 83ac65802..fed2565c5 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/trait_erc20.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/trait_erc20.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -461,7 +462,9 @@ Module Impl_trait_erc20_Env. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_record_field (M.read (| self |)) "trait_erc20::Env" "caller" |))) + M.read (| + M.get_struct_record_field (| M.read (| self |), "trait_erc20::Env", "caller" |) + |))) | _, _ => M.impossible end. @@ -657,7 +660,7 @@ Module Impl_trait_erc20_Erc20. [] |), [ - M.get_struct_record_field (M.read (| self |)) "trait_erc20::Erc20" "balances"; + M.get_struct_record_field (| M.read (| self |), "trait_erc20::Erc20", "balances" |); M.read (| owner |) ] |) @@ -700,7 +703,11 @@ Module Impl_trait_erc20_Erc20. [] |), [ - M.get_struct_record_field (M.read (| self |)) "trait_erc20::Erc20" "allowances"; + M.get_struct_record_field (| + M.read (| self |), + "trait_erc20::Erc20", + "allowances" + |); M.alloc (| Value.Tuple [ M.read (| M.read (| owner |) |); M.read (| M.read (| spender |) |) ] |) @@ -792,7 +799,11 @@ Module Impl_trait_erc20_Erc20. [] |), [ - M.get_struct_record_field (M.read (| self |)) "trait_erc20::Erc20" "balances"; + M.get_struct_record_field (| + M.read (| self |), + "trait_erc20::Erc20", + "balances" + |); M.read (| M.read (| from |) |); BinOp.Panic.sub (| M.read (| from_balance |), M.read (| value |) |) ] @@ -820,7 +831,11 @@ Module Impl_trait_erc20_Erc20. [] |), [ - M.get_struct_record_field (M.read (| self |)) "trait_erc20::Erc20" "balances"; + M.get_struct_record_field (| + M.read (| self |), + "trait_erc20::Erc20", + "balances" + |); M.read (| M.read (| to |) |); BinOp.Panic.add (| M.read (| to_balance |), M.read (| value |) |) ] @@ -881,7 +896,7 @@ Module Impl_trait_erc20_BaseErc20_for_trait_erc20_Erc20. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (M.read (| self |)) "trait_erc20::Erc20" "total_supply" + M.get_struct_record_field (| M.read (| self |), "trait_erc20::Erc20", "total_supply" |) |))) | _, _ => M.impossible end. @@ -1010,7 +1025,11 @@ Module Impl_trait_erc20_BaseErc20_for_trait_erc20_Erc20. [] |), [ - M.get_struct_record_field (M.read (| self |)) "trait_erc20::Erc20" "allowances"; + M.get_struct_record_field (| + M.read (| self |), + "trait_erc20::Erc20", + "allowances" + |); Value.Tuple [ M.read (| owner |); M.read (| spender |) ]; M.read (| value |) ] @@ -1211,10 +1230,11 @@ Module Impl_trait_erc20_BaseErc20_for_trait_erc20_Erc20. [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "trait_erc20::Erc20" - "allowances"; + M.get_struct_record_field (| + M.read (| self |), + "trait_erc20::Erc20", + "allowances" + |); Value.Tuple [ M.read (| from |); M.read (| caller |) ]; BinOp.Panic.sub (| M.read (| allowance |), M.read (| value |) |) ] diff --git a/CoqOfRust/examples/default/examples/ink_contracts/trait_flipper.v b/CoqOfRust/examples/default/examples/ink_contracts/trait_flipper.v index 429694805..47d1b0448 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/trait_flipper.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/trait_flipper.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Trait *) (* Empty module 'Flip' *) @@ -62,10 +63,14 @@ Module Impl_trait_flipper_Flip_for_trait_flipper_Flipper. M.read (| let _ := M.write (| - M.get_struct_record_field (M.read (| self |)) "trait_flipper::Flipper" "value", + M.get_struct_record_field (| M.read (| self |), "trait_flipper::Flipper", "value" |), UnOp.Pure.not (M.read (| - M.get_struct_record_field (M.read (| self |)) "trait_flipper::Flipper" "value" + M.get_struct_record_field (| + M.read (| self |), + "trait_flipper::Flipper", + "value" + |) |)) |) in M.alloc (| Value.Tuple [] |) @@ -84,7 +89,7 @@ Module Impl_trait_flipper_Flip_for_trait_flipper_Flipper. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (M.read (| self |)) "trait_flipper::Flipper" "value" + M.get_struct_record_field (| M.read (| self |), "trait_flipper::Flipper", "value" |) |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/trait_incrementer.v b/CoqOfRust/examples/default/examples/ink_contracts/trait_incrementer.v index 0b814e53e..320a4a848 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/trait_incrementer.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/trait_incrementer.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Trait *) (* Empty module 'Increment' *) @@ -47,10 +48,11 @@ Module Impl_trait_incrementer_Incrementer. M.read (| let _ := let β := - M.get_struct_record_field - (M.read (| self |)) - "trait_incrementer::Incrementer" - "value" in + M.get_struct_record_field (| + M.read (| self |), + "trait_incrementer::Incrementer", + "value" + |) in M.write (| β, BinOp.Panic.add (| M.read (| β |), M.read (| delta |) |) |) in M.alloc (| Value.Tuple [] |) |))) @@ -91,7 +93,11 @@ Module Impl_trait_incrementer_Increment_for_trait_incrementer_Incrementer. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (M.read (| self |)) "trait_incrementer::Incrementer" "value" + M.get_struct_record_field (| + M.read (| self |), + "trait_incrementer::Incrementer", + "value" + |) |))) | _, _ => M.impossible end. @@ -120,10 +126,11 @@ Module Impl_trait_incrementer_Reset_for_trait_incrementer_Incrementer. M.read (| let _ := M.write (| - M.get_struct_record_field - (M.read (| self |)) - "trait_incrementer::Incrementer" - "value", + M.get_struct_record_field (| + M.read (| self |), + "trait_incrementer::Incrementer", + "value" + |), Value.Integer Integer.U64 0 |) in M.alloc (| Value.Tuple [] |) diff --git a/CoqOfRust/examples/default/examples/ink_contracts/wildcard_selector.v b/CoqOfRust/examples/default/examples/ink_contracts/wildcard_selector.v index a3987925f..1fa707894 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/wildcard_selector.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/wildcard_selector.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn decode_input() -> Result { diff --git a/CoqOfRust/examples/default/examples/monadic_transformation/example01.v b/CoqOfRust/examples/default/examples/monadic_transformation/example01.v index 818e76867..04cc74b6b 100644 --- a/CoqOfRust/examples/default/examples/monadic_transformation/example01.v +++ b/CoqOfRust/examples/default/examples/monadic_transformation/example01.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn id(x: u64) -> u64 { diff --git a/CoqOfRust/examples/default/examples/monadic_transformation/example02.v b/CoqOfRust/examples/default/examples/monadic_transformation/example02.v index 96ac96aff..c568d9cda 100644 --- a/CoqOfRust/examples/default/examples/monadic_transformation/example02.v +++ b/CoqOfRust/examples/default/examples/monadic_transformation/example02.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/monadic_transformation/example03.v b/CoqOfRust/examples/default/examples/monadic_transformation/example03.v index 23be3bce9..c8e7f6d13 100644 --- a/CoqOfRust/examples/default/examples/monadic_transformation/example03.v +++ b/CoqOfRust/examples/default/examples/monadic_transformation/example03.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/monadic_transformation/example04.v b/CoqOfRust/examples/default/examples/monadic_transformation/example04.v index 9eacefa8e..0e39a8e49 100644 --- a/CoqOfRust/examples/default/examples/monadic_transformation/example04.v +++ b/CoqOfRust/examples/default/examples/monadic_transformation/example04.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/monadic_transformation/example05.v b/CoqOfRust/examples/default/examples/monadic_transformation/example05.v index 2d94e842c..35f95cee9 100644 --- a/CoqOfRust/examples/default/examples/monadic_transformation/example05.v +++ b/CoqOfRust/examples/default/examples/monadic_transformation/example05.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { @@ -22,7 +23,7 @@ Module Impl_example05_Foo. ltac:(M.monadic (let self := M.alloc (| self |) in BinOp.Panic.add (| - M.read (| M.get_struct_tuple_field self "example05::Foo" 0 |), + M.read (| M.get_struct_tuple_field (| self, "example05::Foo", 0 |) |), Value.Integer Integer.U32 1 |))) | _, _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/rust_book/attributes/dead_code.v b/CoqOfRust/examples/default/examples/rust_book/attributes/dead_code.v index d22481da5..79d6f0ddf 100644 --- a/CoqOfRust/examples/default/examples/rust_book/attributes/dead_code.v +++ b/CoqOfRust/examples/default/examples/rust_book/attributes/dead_code.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn used_function() {} *) Definition used_function (τ : list Ty.t) (α : list Value.t) : M := diff --git a/CoqOfRust/examples/default/examples/rust_book/cargo/concurrent_tests.v b/CoqOfRust/examples/default/examples/rust_book/cargo/concurrent_tests.v index e450ac909..e4f9b6638 100644 --- a/CoqOfRust/examples/default/examples/rust_book/cargo/concurrent_tests.v +++ b/CoqOfRust/examples/default/examples/rust_book/cargo/concurrent_tests.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn foo(o: Option) { diff --git a/CoqOfRust/examples/default/examples/rust_book/conversion/converting_to_string.v b/CoqOfRust/examples/default/examples/rust_book/conversion/converting_to_string.v index ccf74eb74..2e9c530a0 100644 --- a/CoqOfRust/examples/default/examples/rust_book/conversion/converting_to_string.v +++ b/CoqOfRust/examples/default/examples/rust_book/conversion/converting_to_string.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -44,10 +45,11 @@ Module Impl_core_fmt_Display_for_converting_to_string_Circle. [ Ty.path "i32" ] |), [ - M.get_struct_record_field - (M.read (| self |)) - "converting_to_string::Circle" + M.get_struct_record_field (| + M.read (| self |), + "converting_to_string::Circle", "radius" + |) ] |) ] diff --git a/CoqOfRust/examples/default/examples/rust_book/conversion/from.v b/CoqOfRust/examples/default/examples/rust_book/conversion/from.v index 5cb59e996..247e8c365 100644 --- a/CoqOfRust/examples/default/examples/rust_book/conversion/from.v +++ b/CoqOfRust/examples/default/examples/rust_book/conversion/from.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/default/examples/rust_book/conversion/into.v b/CoqOfRust/examples/default/examples/rust_book/conversion/into.v index 40ffc727e..3a1e95aae 100644 --- a/CoqOfRust/examples/default/examples/rust_book/conversion/into.v +++ b/CoqOfRust/examples/default/examples/rust_book/conversion/into.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/default/examples/rust_book/conversion/parsing_a_string.v b/CoqOfRust/examples/default/examples/rust_book/conversion/parsing_a_string.v index 1036b97dc..831adcf38 100644 --- a/CoqOfRust/examples/default/examples/rust_book/conversion/parsing_a_string.v +++ b/CoqOfRust/examples/default/examples/rust_book/conversion/parsing_a_string.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/conversion/try_from_and_try_into.v b/CoqOfRust/examples/default/examples/rust_book/conversion/try_from_and_try_into.v index 750cce2b8..f37f5539e 100644 --- a/CoqOfRust/examples/default/examples/rust_book/conversion/try_from_and_try_into.v +++ b/CoqOfRust/examples/default/examples/rust_book/conversion/try_from_and_try_into.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { @@ -30,7 +31,11 @@ Module Impl_core_fmt_Debug_for_try_from_and_try_into_EvenNumber. (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_tuple_field (M.read (| self |)) "try_from_and_try_into::EvenNumber" 0 + M.get_struct_tuple_field (| + M.read (| self |), + "try_from_and_try_into::EvenNumber", + 0 + |) |)) ] |))) @@ -68,10 +73,14 @@ Module Impl_core_cmp_PartialEq_for_try_from_and_try_into_EvenNumber. let other := M.alloc (| other |) in BinOp.Pure.eq (M.read (| - M.get_struct_tuple_field (M.read (| self |)) "try_from_and_try_into::EvenNumber" 0 + M.get_struct_tuple_field (| M.read (| self |), "try_from_and_try_into::EvenNumber", 0 |) |)) (M.read (| - M.get_struct_tuple_field (M.read (| other |)) "try_from_and_try_into::EvenNumber" 0 + M.get_struct_tuple_field (| + M.read (| other |), + "try_from_and_try_into::EvenNumber", + 0 + |) |)))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/rust_book/custom_types/constants.v b/CoqOfRust/examples/default/examples/rust_book/custom_types/constants.v index 99d1dc0a0..ddf9b1b88 100644 --- a/CoqOfRust/examples/default/examples/rust_book/custom_types/constants.v +++ b/CoqOfRust/examples/default/examples/rust_book/custom_types/constants.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Definition value_LANGUAGE : Value.t := M.run ltac:(M.monadic (M.alloc (| Value.String "Rust" |))). diff --git a/CoqOfRust/examples/default/examples/rust_book/custom_types/enums.v b/CoqOfRust/examples/default/examples/rust_book/custom_types/enums.v index 223b49ed0..fd337bac4 100644 --- a/CoqOfRust/examples/default/examples/rust_book/custom_types/enums.v +++ b/CoqOfRust/examples/default/examples/rust_book/custom_types/enums.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum WebEvent diff --git a/CoqOfRust/examples/default/examples/rust_book/custom_types/enums_c_like.v b/CoqOfRust/examples/default/examples/rust_book/custom_types/enums_c_like.v index d4d38bacd..45a24bee7 100644 --- a/CoqOfRust/examples/default/examples/rust_book/custom_types/enums_c_like.v +++ b/CoqOfRust/examples/default/examples/rust_book/custom_types/enums_c_like.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Number diff --git a/CoqOfRust/examples/default/examples/rust_book/custom_types/enums_testcase_linked_list.v b/CoqOfRust/examples/default/examples/rust_book/custom_types/enums_testcase_linked_list.v index 957a02bf0..052f7e6f7 100644 --- a/CoqOfRust/examples/default/examples/rust_book/custom_types/enums_testcase_linked_list.v +++ b/CoqOfRust/examples/default/examples/rust_book/custom_types/enums_testcase_linked_list.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum List diff --git a/CoqOfRust/examples/default/examples/rust_book/custom_types/enums_type_aliases_v1.v b/CoqOfRust/examples/default/examples/rust_book/custom_types/enums_type_aliases_v1.v index ee6ffb86f..b3147af29 100644 --- a/CoqOfRust/examples/default/examples/rust_book/custom_types/enums_type_aliases_v1.v +++ b/CoqOfRust/examples/default/examples/rust_book/custom_types/enums_type_aliases_v1.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum VeryVerboseEnumOfThingsToDoWithNumbers diff --git a/CoqOfRust/examples/default/examples/rust_book/custom_types/enums_type_aliases_v2.v b/CoqOfRust/examples/default/examples/rust_book/custom_types/enums_type_aliases_v2.v index 7f7d37ff2..0dabaf1c7 100644 --- a/CoqOfRust/examples/default/examples/rust_book/custom_types/enums_type_aliases_v2.v +++ b/CoqOfRust/examples/default/examples/rust_book/custom_types/enums_type_aliases_v2.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum VeryVerboseEnumOfThingsToDoWithNumbers diff --git a/CoqOfRust/examples/default/examples/rust_book/custom_types/enums_use.v b/CoqOfRust/examples/default/examples/rust_book/custom_types/enums_use.v index 7f142d392..5fc9793b0 100644 --- a/CoqOfRust/examples/default/examples/rust_book/custom_types/enums_use.v +++ b/CoqOfRust/examples/default/examples/rust_book/custom_types/enums_use.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Status diff --git a/CoqOfRust/examples/default/examples/rust_book/custom_types/structures.v b/CoqOfRust/examples/default/examples/rust_book/custom_types/structures.v index 11986141a..e87ffa8b9 100644 --- a/CoqOfRust/examples/default/examples/rust_book/custom_types/structures.v +++ b/CoqOfRust/examples/default/examples/rust_book/custom_types/structures.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -30,12 +31,12 @@ Module Impl_core_fmt_Debug_for_structures_Person. M.read (| Value.String "name" |); (* Unsize *) M.pointer_coercion - (M.get_struct_record_field (M.read (| self |)) "structures::Person" "name"); + (M.get_struct_record_field (| M.read (| self |), "structures::Person", "name" |)); M.read (| Value.String "age" |); (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_record_field (M.read (| self |)) "structures::Person" "age" + M.get_struct_record_field (| M.read (| self |), "structures::Person", "age" |) |)) ] |))) @@ -232,7 +233,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "new_display", [ Ty.path "f32" ] |), - [ M.get_struct_record_field point "structures::Point" "x" ] + [ M.get_struct_record_field (| point, "structures::Point", "x" |) ] |); M.call_closure (| M.get_associated_function (| @@ -240,7 +241,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "new_display", [ Ty.path "f32" ] |), - [ M.get_struct_record_field point "structures::Point" "y" ] + [ M.get_struct_record_field (| point, "structures::Point", "y" |) ] |) ] |)) @@ -285,7 +286,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "new_display", [ Ty.path "f32" ] |), - [ M.get_struct_record_field bottom_right "structures::Point" "x" ] + [ + M.get_struct_record_field (| + bottom_right, + "structures::Point", + "x" + |) + ] |); M.call_closure (| M.get_associated_function (| @@ -293,7 +300,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "new_display", [ Ty.path "f32" ] |), - [ M.get_struct_record_field bottom_right "structures::Point" "y" ] + [ + M.get_struct_record_field (| + bottom_right, + "structures::Point", + "y" + |) + ] |) ] |)) @@ -368,7 +381,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "new_debug", [ Ty.path "i32" ] |), - [ M.get_struct_tuple_field pair_ "structures::Pair" 0 ] + [ + M.get_struct_tuple_field (| + pair_, + "structures::Pair", + 0 + |) + ] |); M.call_closure (| M.get_associated_function (| @@ -376,7 +395,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "new_debug", [ Ty.path "f32" ] |), - [ M.get_struct_tuple_field pair_ "structures::Pair" 1 ] + [ + M.get_struct_tuple_field (| + pair_, + "structures::Pair", + 1 + |) + ] |) ] |)) diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/aliases_for_result.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/aliases_for_result.v index 607a890a5..a6107dffc 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/aliases_for_result.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/aliases_for_result.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Axiom AliasedResult : forall (T : Ty.t), diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/boxing_errors.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/boxing_errors.v index 64d2a1b55..5a04584ec 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/boxing_errors.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/boxing_errors.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Axiom Result : forall (T : Ty.t), diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/combinators_and_then.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/combinators_and_then.v index 2e2f1ae54..e990ded34 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/combinators_and_then.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/combinators_and_then.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Food diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/combinators_map.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/combinators_map.v index f238761cb..009991b4f 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/combinators_map.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/combinators_map.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Food @@ -101,7 +102,7 @@ Module Impl_core_fmt_Debug_for_combinators_map_Peeled. (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_tuple_field (M.read (| self |)) "combinators_map::Peeled" 0 + M.get_struct_tuple_field (| M.read (| self |), "combinators_map::Peeled", 0 |) |)) ] |))) @@ -145,7 +146,7 @@ Module Impl_core_fmt_Debug_for_combinators_map_Chopped. (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_tuple_field (M.read (| self |)) "combinators_map::Chopped" 0 + M.get_struct_tuple_field (| M.read (| self |), "combinators_map::Chopped", 0 |) |)) ] |))) @@ -189,7 +190,7 @@ Module Impl_core_fmt_Debug_for_combinators_map_Cooked. (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_tuple_field (M.read (| self |)) "combinators_map::Cooked" 0 + M.get_struct_tuple_field (| M.read (| self |), "combinators_map::Cooked", 0 |) |)) ] |))) diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/defining_an_error_type.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/defining_an_error_type.v index d0a4e77d5..e7cd21c6d 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/defining_an_error_type.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/defining_an_error_type.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/early_returns.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/early_returns.v index 75a4c1f85..6ff2fa09c 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/early_returns.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/early_returns.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn multiply(first_number_str: &str, second_number_str: &str) -> Result { diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/introducing_question_mark.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/introducing_question_mark.v index c06908142..4f588b5b5 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/introducing_question_mark.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/introducing_question_mark.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn multiply(first_number_str: &str, second_number_str: &str) -> Result { diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/introducing_question_mark_is_an_replacement_for_deprecated_try.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/introducing_question_mark_is_an_replacement_for_deprecated_try.v index d3a22ba1d..4b8cefef4 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/introducing_question_mark_is_an_replacement_for_deprecated_try.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/introducing_question_mark_is_an_replacement_for_deprecated_try.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn multiply(first_number_str: &str, second_number_str: &str) -> Result { diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_collect_valid_values_and_failures_via_partition.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_collect_valid_values_and_failures_via_partition.v index e74b6d22f..b579d97a5 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_collect_valid_values_and_failures_via_partition.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_collect_valid_values_and_failures_via_partition.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_collect_valid_values_and_failures_via_partition_unwrapped.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_collect_valid_values_and_failures_via_partition_unwrapped.v index 6e274fbff..615603eeb 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_collect_valid_values_and_failures_via_partition_unwrapped.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_collect_valid_values_and_failures_via_partition_unwrapped.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_collect_via_map_err_and_filter_map.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_collect_via_map_err_and_filter_map.v index 3427fdcf8..6f0dc3ec2 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_collect_via_map_err_and_filter_map.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_collect_via_map_err_and_filter_map.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_fail_entire_operation_via_collect.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_fail_entire_operation_via_collect.v index cde460028..c4feab5cb 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_fail_entire_operation_via_collect.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_fail_entire_operation_via_collect.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_failed.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_failed.v index 1388d0414..842909e28 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_failed.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_failed.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_handle_via_filter_map.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_handle_via_filter_map.v index 8400f305c..fae4bda74 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_handle_via_filter_map.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/iterating_over_results_handle_via_filter_map.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/map_in_result_via_combinators.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/map_in_result_via_combinators.v index c9d7f4c6b..29bcc2771 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/map_in_result_via_combinators.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/map_in_result_via_combinators.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn multiply(first_number_str: &str, second_number_str: &str) -> Result { diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/map_in_result_via_match.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/map_in_result_via_match.v index 691a04e63..c4c626be1 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/map_in_result_via_match.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/map_in_result_via_match.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn multiply(first_number_str: &str, second_number_str: &str) -> Result { diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/multiple_error_types.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/multiple_error_types.v index 197245c09..c27aa1878 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/multiple_error_types.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/multiple_error_types.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn double_first(vec: Vec<&str>) -> i32 { diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/option_and_unwrap.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/option_and_unwrap.v index ed5cfeccc..c71c8633e 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/option_and_unwrap.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/option_and_unwrap.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn give_adult(drink: Option<&str>) { diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/other_uses_of_question_mark.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/other_uses_of_question_mark.v index 8c1c2d389..2e0c54109 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/other_uses_of_question_mark.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/other_uses_of_question_mark.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Axiom Result : forall (T : Ty.t), diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/panic.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/panic.v index c00a7471b..3f2a5f232 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/panic.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/panic.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn drink(beverage: &str) { diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/pulling_results_out_of_options.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/pulling_results_out_of_options.v index 57cca0372..8c4286ac1 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/pulling_results_out_of_options.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/pulling_results_out_of_options.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn double_first(vec: Vec<&str>) -> Option> { diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/pulling_results_out_of_options_with_stop_error_processing.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/pulling_results_out_of_options_with_stop_error_processing.v index 7d9a6581f..8a769ab0b 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/pulling_results_out_of_options_with_stop_error_processing.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/pulling_results_out_of_options_with_stop_error_processing.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn double_first(vec: Vec<&str>) -> Result, ParseIntError> { diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/result_use_in_main.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/result_use_in_main.v index a9e1e2b82..22dc4877c 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/result_use_in_main.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/result_use_in_main.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() -> Result<(), ParseIntError> { diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_and_defaults_via_get_or_insert.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_and_defaults_via_get_or_insert.v index 888ab5f75..c56978a7d 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_and_defaults_via_get_or_insert.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_and_defaults_via_get_or_insert.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Fruit diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_and_defaults_via_get_or_insert_with.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_and_defaults_via_get_or_insert_with.v index 016588f2a..81bf0a32f 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_and_defaults_via_get_or_insert_with.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_and_defaults_via_get_or_insert_with.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Fruit diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_and_defaults_via_or.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_and_defaults_via_or.v index 15da2a247..ff2d07541 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_and_defaults_via_or.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_and_defaults_via_or.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Fruit diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_and_defaults_via_or_else.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_and_defaults_via_or_else.v index cb5808d6d..fa5bae9d6 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_and_defaults_via_or_else.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_and_defaults_via_or_else.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Fruit diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_via_question_mark.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_via_question_mark.v index 82c196a7f..2858f07a9 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_via_question_mark.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_via_question_mark.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -130,8 +131,8 @@ Module Impl_unpacking_options_via_question_mark_Person. M.catch_return (| ltac:(M.monadic (M.read (| - M.get_struct_record_field - (M.match_operator (| + M.get_struct_record_field (| + M.match_operator (| M.alloc (| M.call_closure (| M.get_trait_method (| @@ -145,8 +146,8 @@ Module Impl_unpacking_options_via_question_mark_Person. |), [ M.read (| - M.get_struct_record_field - (M.match_operator (| + M.get_struct_record_field (| + M.match_operator (| M.alloc (| M.call_closure (| M.get_trait_method (| @@ -160,10 +161,11 @@ Module Impl_unpacking_options_via_question_mark_Person. |), [ M.read (| - M.get_struct_record_field - (M.read (| self |)) - "unpacking_options_via_question_mark::Person" + M.get_struct_record_field (| + M.read (| self |), + "unpacking_options_via_question_mark::Person", "job" + |) |) ] |) @@ -213,9 +215,10 @@ Module Impl_unpacking_options_via_question_mark_Person. let val := M.copy (| γ0_0 |) in val)) ] - |)) - "unpacking_options_via_question_mark::Job" + |), + "unpacking_options_via_question_mark::Job", "phone_number" + |) |) ] |) @@ -263,9 +266,10 @@ Module Impl_unpacking_options_via_question_mark_Person. let val := M.copy (| γ0_0 |) in val)) ] - |)) - "unpacking_options_via_question_mark::PhoneNumber" + |), + "unpacking_options_via_question_mark::PhoneNumber", "area_code" + |) |))) |))) | _, _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/wrapping_errors.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/wrapping_errors.v index 305461d39..c6738adbd 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/wrapping_errors.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/wrapping_errors.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum DoubleError diff --git a/CoqOfRust/examples/default/examples/rust_book/expressions/blocks.v b/CoqOfRust/examples/default/examples/rust_book/expressions/blocks.v index ccb882c13..5c6dad917 100644 --- a/CoqOfRust/examples/default/examples/rust_book/expressions/blocks.v +++ b/CoqOfRust/examples/default/examples/rust_book/expressions/blocks.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/expressions/const_underscore_expression.v b/CoqOfRust/examples/default/examples/rust_book/expressions/const_underscore_expression.v index 94a9475a6..817e4a2eb 100644 --- a/CoqOfRust/examples/default/examples/rust_book/expressions/const_underscore_expression.v +++ b/CoqOfRust/examples/default/examples/rust_book/expressions/const_underscore_expression.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Module underscore. (* StructRecord @@ -21,7 +22,9 @@ Module underscore. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_record_field self "const_underscore_expression::Bar" "test" |))) + M.read (| + M.get_struct_record_field (| self, "const_underscore_expression::Bar", "test" |) + |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/rust_book/expressions/statement.v b/CoqOfRust/examples/default/examples/rust_book/expressions/statement.v index d8689eab8..4c7b90ba4 100644 --- a/CoqOfRust/examples/default/examples/rust_book/expressions/statement.v +++ b/CoqOfRust/examples/default/examples/rust_book/expressions/statement.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/expressions/variable_binding_and_expression.v b/CoqOfRust/examples/default/examples/rust_book/expressions/variable_binding_and_expression.v index cd02af4df..8ffbc277c 100644 --- a/CoqOfRust/examples/default/examples/rust_book/expressions/variable_binding_and_expression.v +++ b/CoqOfRust/examples/default/examples/rust_book/expressions/variable_binding_and_expression.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_into_iter.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_into_iter.v index 4a13d3739..b737a7d58 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_into_iter.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_into_iter.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_iter.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_iter.v index 00e48f430..d3aa5ea27 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_iter.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_iter.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_iter_mut.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_iter_mut.v index 65dbf3821..8971f0107 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_iter_mut.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_iter_mut.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_range_completely_inclusive.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_range_completely_inclusive.v index 41e3c9c86..15f602f5f 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_range_completely_inclusive.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_range_completely_inclusive.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_range_inclusive_to_exclusive.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_range_inclusive_to_exclusive.v index bcaf99f8a..d052fb59d 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_range_inclusive_to_exclusive.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_range_inclusive_to_exclusive.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/if_else.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/if_else.v index a40877035..95a78fefb 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/if_else.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/if_else.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/if_let.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/if_let.v index 4641fe3fb..7a762ac8a 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/if_let.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/if_let.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/if_let_challenge.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/if_let_challenge.v index 2ef138a17..5a9ef788e 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/if_let_challenge.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/if_let_challenge.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Foo diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/if_let_dont_use_match.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/if_let_dont_use_match.v index 464afe81e..dac9d279d 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/if_let_dont_use_match.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/if_let_dont_use_match.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/if_let_match_enum_values.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/if_let_match_enum_values.v index 6b6084c2d..d49a0e9ba 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/if_let_match_enum_values.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/if_let_match_enum_values.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Foo diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/infinite_loop.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/infinite_loop.v index 4403b3f19..1b1254cc3 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/infinite_loop.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/infinite_loop.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/loop_nesting_and_labels.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/loop_nesting_and_labels.v index 25ba47f8f..df9a8fea9 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/loop_nesting_and_labels.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/loop_nesting_and_labels.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/loop_returning_from_loops.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/loop_returning_from_loops.v index f7bbd27d6..4048cf5d6 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/loop_returning_from_loops.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/loop_returning_from_loops.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match.v index d32a2aac2..9688a09c9 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_binding.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_binding.v index 1827a8fd2..a8d694daa 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_binding.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_binding.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn age() -> u32 { diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_binding_destructure_enum_variants.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_binding_destructure_enum_variants.v index f6ea204b2..1eab464bf 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_binding_destructure_enum_variants.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_binding_destructure_enum_variants.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn some_number() -> Option { diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_arrays_slices.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_arrays_slices.v index 88dd9b9ac..1fa6c85df 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_arrays_slices.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_arrays_slices.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_enums.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_enums.v index b9d076b9a..79019262d 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_enums.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_enums.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Color diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_pointers_ref.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_pointers_ref.v index df857d5e8..43e02a3c3 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_pointers_ref.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_pointers_ref.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_structs.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_structs.v index 7711017ba..fd664372f 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_structs.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_structs.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_tuples.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_tuples.v index 60b0edf6c..7ac9dbca9 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_tuples.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_tuples.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_tuples_fixed.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_tuples_fixed.v index 0f0d57579..ebc0e1f15 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_tuples_fixed.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_destructuring_tuples_fixed.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_guards.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_guards.v index b01623435..f55c5abf7 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_guards.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_guards.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Temperature diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_guards_unreachable.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_guards_unreachable.v index 15dccd799..4b7560477 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_guards_unreachable.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/match_guards_unreachable.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/while.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/while.v index b7e607a0f..d84f3cfa5 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/while.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/while.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/while_let.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/while_let.v index ea7d10719..4d3cc6701 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/while_let.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/while_let.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/while_let_match_is_weird.v b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/while_let_match_is_weird.v index fe9dfa6a7..e2e4a9592 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/while_let_match_is_weird.v +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/while_let_match_is_weird.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/functions/associated_functions_and_methods.v b/CoqOfRust/examples/default/examples/rust_book/functions/associated_functions_and_methods.v index 1ea9563a8..17284a797 100644 --- a/CoqOfRust/examples/default/examples/rust_book/functions/associated_functions_and_methods.v +++ b/CoqOfRust/examples/default/examples/rust_book/functions/associated_functions_and_methods.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -73,10 +74,11 @@ Module Impl_associated_functions_and_methods_Rectangle. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field - (M.read (| self |)) - "associated_functions_and_methods::Rectangle" + M.get_struct_record_field (| + M.read (| self |), + "associated_functions_and_methods::Rectangle", "p1" + |) |))) | _, _ => M.impossible end. @@ -101,10 +103,11 @@ Module Impl_associated_functions_and_methods_Rectangle. (let self := M.alloc (| self |) in M.read (| M.match_operator (| - M.get_struct_record_field - (M.read (| self |)) - "associated_functions_and_methods::Rectangle" - "p1", + M.get_struct_record_field (| + M.read (| self |), + "associated_functions_and_methods::Rectangle", + "p1" + |), [ fun γ => ltac:(M.monadic @@ -123,10 +126,11 @@ Module Impl_associated_functions_and_methods_Rectangle. let x1 := M.copy (| γ0_0 |) in let y1 := M.copy (| γ0_1 |) in M.match_operator (| - M.get_struct_record_field - (M.read (| self |)) - "associated_functions_and_methods::Rectangle" - "p2", + M.get_struct_record_field (| + M.read (| self |), + "associated_functions_and_methods::Rectangle", + "p2" + |), [ fun γ => ltac:(M.monadic @@ -180,10 +184,11 @@ Module Impl_associated_functions_and_methods_Rectangle. (let self := M.alloc (| self |) in M.read (| M.match_operator (| - M.get_struct_record_field - (M.read (| self |)) - "associated_functions_and_methods::Rectangle" - "p1", + M.get_struct_record_field (| + M.read (| self |), + "associated_functions_and_methods::Rectangle", + "p1" + |), [ fun γ => ltac:(M.monadic @@ -202,10 +207,11 @@ Module Impl_associated_functions_and_methods_Rectangle. let x1 := M.copy (| γ0_0 |) in let y1 := M.copy (| γ0_1 |) in M.match_operator (| - M.get_struct_record_field - (M.read (| self |)) - "associated_functions_and_methods::Rectangle" - "p2", + M.get_struct_record_field (| + M.read (| self |), + "associated_functions_and_methods::Rectangle", + "p2" + |), [ fun γ => ltac:(M.monadic @@ -267,43 +273,51 @@ Module Impl_associated_functions_and_methods_Rectangle. M.read (| let _ := let β := - M.get_struct_record_field - (M.get_struct_record_field - (M.read (| self |)) - "associated_functions_and_methods::Rectangle" - "p1") - "associated_functions_and_methods::Point" - "x" in + M.get_struct_record_field (| + M.get_struct_record_field (| + M.read (| self |), + "associated_functions_and_methods::Rectangle", + "p1" + |), + "associated_functions_and_methods::Point", + "x" + |) in M.write (| β, BinOp.Panic.add (| M.read (| β |), M.read (| x |) |) |) in let _ := let β := - M.get_struct_record_field - (M.get_struct_record_field - (M.read (| self |)) - "associated_functions_and_methods::Rectangle" - "p2") - "associated_functions_and_methods::Point" - "x" in + M.get_struct_record_field (| + M.get_struct_record_field (| + M.read (| self |), + "associated_functions_and_methods::Rectangle", + "p2" + |), + "associated_functions_and_methods::Point", + "x" + |) in M.write (| β, BinOp.Panic.add (| M.read (| β |), M.read (| x |) |) |) in let _ := let β := - M.get_struct_record_field - (M.get_struct_record_field - (M.read (| self |)) - "associated_functions_and_methods::Rectangle" - "p1") - "associated_functions_and_methods::Point" - "y" in + M.get_struct_record_field (| + M.get_struct_record_field (| + M.read (| self |), + "associated_functions_and_methods::Rectangle", + "p1" + |), + "associated_functions_and_methods::Point", + "y" + |) in M.write (| β, BinOp.Panic.add (| M.read (| β |), M.read (| y |) |) |) in let _ := let β := - M.get_struct_record_field - (M.get_struct_record_field - (M.read (| self |)) - "associated_functions_and_methods::Rectangle" - "p2") - "associated_functions_and_methods::Point" - "y" in + M.get_struct_record_field (| + M.get_struct_record_field (| + M.read (| self |), + "associated_functions_and_methods::Rectangle", + "p2" + |), + "associated_functions_and_methods::Point", + "y" + |) in M.write (| β, BinOp.Panic.add (| M.read (| β |), M.read (| y |) |) |) in M.alloc (| Value.Tuple [] |) |))) diff --git a/CoqOfRust/examples/default/examples/rust_book/functions/diverging_functions.v b/CoqOfRust/examples/default/examples/rust_book/functions/diverging_functions.v index 94169526c..7198a4021 100644 --- a/CoqOfRust/examples/default/examples/rust_book/functions/diverging_functions.v +++ b/CoqOfRust/examples/default/examples/rust_book/functions/diverging_functions.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/functions/diverging_functions_example_sum_odd_numbers.v b/CoqOfRust/examples/default/examples/rust_book/functions/diverging_functions_example_sum_odd_numbers.v index bc10c94c8..9399800d4 100644 --- a/CoqOfRust/examples/default/examples/rust_book/functions/diverging_functions_example_sum_odd_numbers.v +++ b/CoqOfRust/examples/default/examples/rust_book/functions/diverging_functions_example_sum_odd_numbers.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/functions/diverging_functions_no_info_in_return_type.v b/CoqOfRust/examples/default/examples/rust_book/functions/diverging_functions_no_info_in_return_type.v index b53ffdba7..ceb78c28a 100644 --- a/CoqOfRust/examples/default/examples/rust_book/functions/diverging_functions_no_info_in_return_type.v +++ b/CoqOfRust/examples/default/examples/rust_book/functions/diverging_functions_no_info_in_return_type.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn some_fn() { diff --git a/CoqOfRust/examples/default/examples/rust_book/functions/functions.v b/CoqOfRust/examples/default/examples/rust_book/functions/functions.v index d1abdeeb3..95042b4de 100644 --- a/CoqOfRust/examples/default/examples/rust_book/functions/functions.v +++ b/CoqOfRust/examples/default/examples/rust_book/functions/functions.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn is_divisible_by(lhs: u32, rhs: u32) -> bool { diff --git a/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures.v b/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures.v index 22cb16400..12e4984fc 100644 --- a/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures.v +++ b/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_as_input_parameters.v b/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_as_input_parameters.v index 05be82b05..b397640c3 100644 --- a/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_as_input_parameters.v +++ b/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_as_input_parameters.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn apply(f: F) diff --git a/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_as_output_parameters.v b/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_as_output_parameters.v index e18ae03df..2963d1aab 100644 --- a/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_as_output_parameters.v +++ b/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_as_output_parameters.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn create_fn() -> impl Fn() { diff --git a/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_capturing.v b/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_capturing.v index 620a0cba7..e34d0837f 100644 --- a/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_capturing.v +++ b/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_capturing.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_example_Iterator_any.v b/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_example_Iterator_any.v index a7ef66946..921d0bfcc 100644 --- a/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_example_Iterator_any.v +++ b/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_example_Iterator_any.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_example_searching_through_iterators_Iterator_find.v b/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_example_searching_through_iterators_Iterator_find.v index 492c32eed..e175c0788 100644 --- a/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_example_searching_through_iterators_Iterator_find.v +++ b/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_example_searching_through_iterators_Iterator_find.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_example_searching_through_iterators_Iterator_position.v b/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_example_searching_through_iterators_Iterator_position.v index f1482fff5..60be25b7d 100644 --- a/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_example_searching_through_iterators_Iterator_position.v +++ b/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_example_searching_through_iterators_Iterator_position.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_forced_capturing_with_move.v b/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_forced_capturing_with_move.v index 5b029fc05..180414422 100644 --- a/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_forced_capturing_with_move.v +++ b/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_forced_capturing_with_move.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_input_functions.v b/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_input_functions.v index c75ff23fa..f7dadbf4b 100644 --- a/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_input_functions.v +++ b/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_input_functions.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn call_me(f: F) { diff --git a/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_type_anonymity_define.v b/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_type_anonymity_define.v index 6db32a3aa..b6a6f9a8e 100644 --- a/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_type_anonymity_define.v +++ b/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_type_anonymity_define.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_type_anonymity_define_and_use.v b/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_type_anonymity_define_and_use.v index abd7a42ad..806988940 100644 --- a/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_type_anonymity_define_and_use.v +++ b/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures_type_anonymity_define_and_use.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn apply(f: F) diff --git a/CoqOfRust/examples/default/examples/rust_book/functions/functions_order.v b/CoqOfRust/examples/default/examples/rust_book/functions/functions_order.v index 7e421b5a9..607d7b9bb 100644 --- a/CoqOfRust/examples/default/examples/rust_book/functions/functions_order.v +++ b/CoqOfRust/examples/default/examples/rust_book/functions/functions_order.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/default/examples/rust_book/functions/higher_order_functions.v b/CoqOfRust/examples/default/examples/rust_book/functions/higher_order_functions.v index 28906b1df..124816384 100644 --- a/CoqOfRust/examples/default/examples/rust_book/functions/higher_order_functions.v +++ b/CoqOfRust/examples/default/examples/rust_book/functions/higher_order_functions.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn is_odd(n: u32) -> bool { diff --git a/CoqOfRust/examples/default/examples/rust_book/generics/generics.v b/CoqOfRust/examples/default/examples/rust_book/generics/generics.v index c1c1d919e..4e1115a52 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/default/examples/rust_book/generics/generics_associated_types_problem.v b/CoqOfRust/examples/default/examples/rust_book/generics/generics_associated_types_problem.v index 432227132..b330eec89 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_associated_types_problem.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_associated_types_problem.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { @@ -37,10 +38,11 @@ Module Impl_generics_associated_types_problem_Contains_i32_i32_for_generics_asso |), [ M.alloc (| - M.get_struct_tuple_field - (M.read (| self |)) - "generics_associated_types_problem::Container" + M.get_struct_tuple_field (| + M.read (| self |), + "generics_associated_types_problem::Container", 0 + |) |); number_1 ] @@ -56,10 +58,11 @@ Module Impl_generics_associated_types_problem_Contains_i32_i32_for_generics_asso |), [ M.alloc (| - M.get_struct_tuple_field - (M.read (| self |)) - "generics_associated_types_problem::Container" + M.get_struct_tuple_field (| + M.read (| self |), + "generics_associated_types_problem::Container", 1 + |) |); number_2 ] @@ -79,10 +82,11 @@ Module Impl_generics_associated_types_problem_Contains_i32_i32_for_generics_asso ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_tuple_field - (M.read (| self |)) - "generics_associated_types_problem::Container" + M.get_struct_tuple_field (| + M.read (| self |), + "generics_associated_types_problem::Container", 0 + |) |))) | _, _ => M.impossible end. @@ -98,10 +102,11 @@ Module Impl_generics_associated_types_problem_Contains_i32_i32_for_generics_asso ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_tuple_field - (M.read (| self |)) - "generics_associated_types_problem::Container" + M.get_struct_tuple_field (| + M.read (| self |), + "generics_associated_types_problem::Container", 1 + |) |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/rust_book/generics/generics_associated_types_solution.v b/CoqOfRust/examples/default/examples/rust_book/generics/generics_associated_types_solution.v index c3812e585..4c3584533 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_associated_types_solution.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_associated_types_solution.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { @@ -43,10 +44,11 @@ Module Impl_generics_associated_types_solution_Contains_for_generics_associated_ |), [ M.alloc (| - M.get_struct_tuple_field - (M.read (| self |)) - "generics_associated_types_solution::Container" + M.get_struct_tuple_field (| + M.read (| self |), + "generics_associated_types_solution::Container", 0 + |) |); number_1 ] @@ -62,10 +64,11 @@ Module Impl_generics_associated_types_solution_Contains_for_generics_associated_ |), [ M.alloc (| - M.get_struct_tuple_field - (M.read (| self |)) - "generics_associated_types_solution::Container" + M.get_struct_tuple_field (| + M.read (| self |), + "generics_associated_types_solution::Container", 1 + |) |); number_2 ] @@ -85,10 +88,11 @@ Module Impl_generics_associated_types_solution_Contains_for_generics_associated_ ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_tuple_field - (M.read (| self |)) - "generics_associated_types_solution::Container" + M.get_struct_tuple_field (| + M.read (| self |), + "generics_associated_types_solution::Container", 0 + |) |))) | _, _ => M.impossible end. @@ -104,10 +108,11 @@ Module Impl_generics_associated_types_solution_Contains_for_generics_associated_ ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_tuple_field - (M.read (| self |)) - "generics_associated_types_solution::Container" + M.get_struct_tuple_field (| + M.read (| self |), + "generics_associated_types_solution::Container", 1 + |) |))) | _, _ => M.impossible end. @@ -123,10 +128,11 @@ Module Impl_generics_associated_types_solution_Contains_for_generics_associated_ ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_tuple_field - (M.read (| self |)) - "generics_associated_types_solution::Container" + M.get_struct_tuple_field (| + M.read (| self |), + "generics_associated_types_solution::Container", 0 + |) |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/rust_book/generics/generics_bounds.v b/CoqOfRust/examples/default/examples/rust_book/generics/generics_bounds.v index 13878f2f7..f674dd3a1 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_bounds.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_bounds.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Trait *) (* Empty module 'HasArea' *) @@ -33,12 +34,20 @@ Module Impl_core_fmt_Debug_for_generics_bounds_Rectangle. M.read (| Value.String "length" |); (* Unsize *) M.pointer_coercion - (M.get_struct_record_field (M.read (| self |)) "generics_bounds::Rectangle" "length"); + (M.get_struct_record_field (| + M.read (| self |), + "generics_bounds::Rectangle", + "length" + |)); M.read (| Value.String "height" |); (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_record_field (M.read (| self |)) "generics_bounds::Rectangle" "height" + M.get_struct_record_field (| + M.read (| self |), + "generics_bounds::Rectangle", + "height" + |) |)) ] |))) @@ -75,10 +84,18 @@ Module Impl_generics_bounds_HasArea_for_generics_bounds_Rectangle. (let self := M.alloc (| self |) in BinOp.Panic.mul (| M.read (| - M.get_struct_record_field (M.read (| self |)) "generics_bounds::Rectangle" "length" + M.get_struct_record_field (| + M.read (| self |), + "generics_bounds::Rectangle", + "length" + |) |), M.read (| - M.get_struct_record_field (M.read (| self |)) "generics_bounds::Rectangle" "height" + M.get_struct_record_field (| + M.read (| self |), + "generics_bounds::Rectangle", + "height" + |) |) |))) | _, _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/rust_book/generics/generics_bounds_test_case_empty_bounds.v b/CoqOfRust/examples/default/examples/rust_book/generics/generics_bounds_test_case_empty_bounds.v index 77e19dcdb..68078ccb0 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_bounds_test_case_empty_bounds.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_bounds_test_case_empty_bounds.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/default/examples/rust_book/generics/generics_functions.v b/CoqOfRust/examples/default/examples/rust_book/generics/generics_functions.v index 1e0ad887b..590b0df8d 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_functions.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_functions.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/default/examples/rust_book/generics/generics_implementation.v b/CoqOfRust/examples/default/examples/rust_book/generics/generics_implementation.v index 7c7ae6ddc..8f4754305 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_implementation.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_implementation.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -28,7 +29,7 @@ Module Impl_generics_implementation_Val. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.get_struct_record_field (M.read (| self |)) "generics_implementation::Val" "val")) + M.get_struct_record_field (| M.read (| self |), "generics_implementation::Val", "val" |))) | _, _ => M.impossible end. @@ -49,7 +50,11 @@ Module Impl_generics_implementation_GenVal_T. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.get_struct_record_field (M.read (| self |)) "generics_implementation::GenVal" "gen_val")) + M.get_struct_record_field (| + M.read (| self |), + "generics_implementation::GenVal", + "gen_val" + |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/rust_book/generics/generics_multiple_bounds.v b/CoqOfRust/examples/default/examples/rust_book/generics/generics_multiple_bounds.v index b1b597946..eb5f151f5 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_multiple_bounds.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_multiple_bounds.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn compare_prints(t: &T) { diff --git a/CoqOfRust/examples/default/examples/rust_book/generics/generics_new_type_idiom.v b/CoqOfRust/examples/default/examples/rust_book/generics/generics_new_type_idiom.v index 0a309d6cb..157a630f0 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_new_type_idiom.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_new_type_idiom.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { @@ -33,7 +34,11 @@ Module Impl_generics_new_type_idiom_Years. [ BinOp.Panic.mul (| M.read (| - M.get_struct_tuple_field (M.read (| self |)) "generics_new_type_idiom::Years" 0 + M.get_struct_tuple_field (| + M.read (| self |), + "generics_new_type_idiom::Years", + 0 + |) |), Value.Integer Integer.I64 365 |) @@ -62,7 +67,7 @@ Module Impl_generics_new_type_idiom_Days. [ BinOp.Panic.div (| M.read (| - M.get_struct_tuple_field (M.read (| self |)) "generics_new_type_idiom::Days" 0 + M.get_struct_tuple_field (| M.read (| self |), "generics_new_type_idiom::Days", 0 |) |), Value.Integer Integer.I64 365 |) @@ -85,7 +90,7 @@ Definition old_enough (τ : list Ty.t) (α : list Value.t) : M := (let age := M.alloc (| age |) in BinOp.Pure.ge (M.read (| - M.get_struct_tuple_field (M.read (| age |)) "generics_new_type_idiom::Years" 0 + M.get_struct_tuple_field (| M.read (| age |), "generics_new_type_idiom::Years", 0 |) |)) (Value.Integer Integer.I64 18))) | _, _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/rust_book/generics/generics_new_type_idiom_as_base_type.v b/CoqOfRust/examples/default/examples/rust_book/generics/generics_new_type_idiom_as_base_type.v index 49eb3433f..0300ffd70 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_new_type_idiom_as_base_type.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_new_type_idiom_as_base_type.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { @@ -28,7 +29,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := |) in let years_as_primitive_1 := M.copy (| - M.get_struct_tuple_field years "generics_new_type_idiom_as_base_type::Years" 0 + M.get_struct_tuple_field (| years, "generics_new_type_idiom_as_base_type::Years", 0 |) |) in M.match_operator (| years, diff --git a/CoqOfRust/examples/default/examples/rust_book/generics/generics_phantom_type.v b/CoqOfRust/examples/default/examples/rust_book/generics/generics_phantom_type.v index a6b54ef1e..031d6958e 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_phantom_type.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_phantom_type.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { @@ -37,8 +38,16 @@ Module Impl_core_cmp_PartialEq_where_core_cmp_PartialEq_A_where_core_cmp_Partial M.call_closure (| M.get_trait_method (| "core::cmp::PartialEq", A, [ A ], "eq", [] |), [ - M.get_struct_tuple_field (M.read (| self |)) "generics_phantom_type::PhantomTuple" 0; - M.get_struct_tuple_field (M.read (| other |)) "generics_phantom_type::PhantomTuple" 0 + M.get_struct_tuple_field (| + M.read (| self |), + "generics_phantom_type::PhantomTuple", + 0 + |); + M.get_struct_tuple_field (| + M.read (| other |), + "generics_phantom_type::PhantomTuple", + 0 + |) ] |), ltac:(M.monadic @@ -51,14 +60,16 @@ Module Impl_core_cmp_PartialEq_where_core_cmp_PartialEq_A_where_core_cmp_Partial [] |), [ - M.get_struct_tuple_field - (M.read (| self |)) - "generics_phantom_type::PhantomTuple" - 1; - M.get_struct_tuple_field - (M.read (| other |)) - "generics_phantom_type::PhantomTuple" + M.get_struct_tuple_field (| + M.read (| self |), + "generics_phantom_type::PhantomTuple", 1 + |); + M.get_struct_tuple_field (| + M.read (| other |), + "generics_phantom_type::PhantomTuple", + 1 + |) ] |))) |))) @@ -110,14 +121,16 @@ Module Impl_core_cmp_PartialEq_where_core_cmp_PartialEq_A_where_core_cmp_Partial M.call_closure (| M.get_trait_method (| "core::cmp::PartialEq", A, [ A ], "eq", [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "generics_phantom_type::PhantomStruct" - "first"; - M.get_struct_record_field - (M.read (| other |)) - "generics_phantom_type::PhantomStruct" + M.get_struct_record_field (| + M.read (| self |), + "generics_phantom_type::PhantomStruct", + "first" + |); + M.get_struct_record_field (| + M.read (| other |), + "generics_phantom_type::PhantomStruct", "first" + |) ] |), ltac:(M.monadic @@ -130,14 +143,16 @@ Module Impl_core_cmp_PartialEq_where_core_cmp_PartialEq_A_where_core_cmp_Partial [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "generics_phantom_type::PhantomStruct" - "phantom"; - M.get_struct_record_field - (M.read (| other |)) - "generics_phantom_type::PhantomStruct" + M.get_struct_record_field (| + M.read (| self |), + "generics_phantom_type::PhantomStruct", + "phantom" + |); + M.get_struct_record_field (| + M.read (| other |), + "generics_phantom_type::PhantomStruct", "phantom" + |) ] |))) |))) diff --git a/CoqOfRust/examples/default/examples/rust_book/generics/generics_phantom_type_test_case_unit_clarification.v b/CoqOfRust/examples/default/examples/rust_book/generics/generics_phantom_type_test_case_unit_clarification.v index 9104c797f..432a3a1da 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_phantom_type_test_case_unit_clarification.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_phantom_type_test_case_unit_clarification.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Enum Inch @@ -147,17 +148,19 @@ Module Impl_core_fmt_Debug_where_core_fmt_Debug_Unit_for_generics_phantom_type_t M.read (| Value.String "Length" |); (* Unsize *) M.pointer_coercion - (M.get_struct_tuple_field - (M.read (| self |)) - "generics_phantom_type_test_case_unit_clarification::Length" - 0); + (M.get_struct_tuple_field (| + M.read (| self |), + "generics_phantom_type_test_case_unit_clarification::Length", + 0 + |)); (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_tuple_field - (M.read (| self |)) - "generics_phantom_type_test_case_unit_clarification::Length" + M.get_struct_tuple_field (| + M.read (| self |), + "generics_phantom_type_test_case_unit_clarification::Length", 1 + |) |)) ] |))) @@ -190,10 +193,11 @@ Module Impl_core_clone_Clone_where_core_clone_Clone_Unit_for_generics_phantom_ty M.call_closure (| M.get_trait_method (| "core::clone::Clone", Ty.path "f64", [], "clone", [] |), [ - M.get_struct_tuple_field - (M.read (| self |)) - "generics_phantom_type_test_case_unit_clarification::Length" + M.get_struct_tuple_field (| + M.read (| self |), + "generics_phantom_type_test_case_unit_clarification::Length", 0 + |) ] |); M.call_closure (| @@ -205,10 +209,11 @@ Module Impl_core_clone_Clone_where_core_clone_Clone_Unit_for_generics_phantom_ty [] |), [ - M.get_struct_tuple_field - (M.read (| self |)) - "generics_phantom_type_test_case_unit_clarification::Length" + M.get_struct_tuple_field (| + M.read (| self |), + "generics_phantom_type_test_case_unit_clarification::Length", 1 + |) ] |) ])) @@ -263,16 +268,18 @@ Module Impl_core_ops_arith_Add_for_generics_phantom_type_test_case_unit_clarific [ BinOp.Panic.add (| M.read (| - M.get_struct_tuple_field - self - "generics_phantom_type_test_case_unit_clarification::Length" + M.get_struct_tuple_field (| + self, + "generics_phantom_type_test_case_unit_clarification::Length", 0 + |) |), M.read (| - M.get_struct_tuple_field - rhs - "generics_phantom_type_test_case_unit_clarification::Length" + M.get_struct_tuple_field (| + rhs, + "generics_phantom_type_test_case_unit_clarification::Length", 0 + |) |) |); Value.StructTuple "core::marker::PhantomData" [] @@ -399,10 +406,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "f64" ] |), [ - M.get_struct_tuple_field - two_feet - "generics_phantom_type_test_case_unit_clarification::Length" + M.get_struct_tuple_field (| + two_feet, + "generics_phantom_type_test_case_unit_clarification::Length", 0 + |) ] |) ] @@ -444,10 +452,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "f64" ] |), [ - M.get_struct_tuple_field - two_meters - "generics_phantom_type_test_case_unit_clarification::Length" + M.get_struct_tuple_field (| + two_meters, + "generics_phantom_type_test_case_unit_clarification::Length", 0 + |) ] |) ] diff --git a/CoqOfRust/examples/default/examples/rust_book/generics/generics_traits.v b/CoqOfRust/examples/default/examples/rust_book/generics/generics_traits.v index 02e4a197e..5b5e0fd8b 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_traits.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_traits.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/default/examples/rust_book/generics/generics_where_clauses.v b/CoqOfRust/examples/default/examples/rust_book/generics/generics_where_clauses.v index 7001d5512..e18a4d5b8 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_where_clauses.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_where_clauses.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Trait *) (* Empty module 'PrintInOption' *) diff --git a/CoqOfRust/examples/default/examples/rust_book/guessing_game/guessing_game.v b/CoqOfRust/examples/default/examples/rust_book/guessing_game/guessing_game.v index cf46fe332..537186e96 100644 --- a/CoqOfRust/examples/default/examples/rust_book/guessing_game/guessing_game.v +++ b/CoqOfRust/examples/default/examples/rust_book/guessing_game/guessing_game.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn gen_range() -> u32 { diff --git a/CoqOfRust/examples/default/examples/rust_book/hello_world/formatted_print.v b/CoqOfRust/examples/default/examples/rust_book/hello_world/formatted_print.v index bf6c68c66..da28204b0 100644 --- a/CoqOfRust/examples/default/examples/rust_book/hello_world/formatted_print.v +++ b/CoqOfRust/examples/default/examples/rust_book/hello_world/formatted_print.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/hello_world/hello_world.v b/CoqOfRust/examples/default/examples/rust_book/hello_world/hello_world.v index d3ea4451c..ab0c4924c 100644 --- a/CoqOfRust/examples/default/examples/rust_book/hello_world/hello_world.v +++ b/CoqOfRust/examples/default/examples/rust_book/hello_world/hello_world.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_example.v b/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_example.v index 4b3c55e46..260981f04 100644 --- a/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_example.v +++ b/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_example.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_rules_designators.v b/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_rules_designators.v index 5b3ebfa1b..9db726cc4 100644 --- a/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_rules_designators.v +++ b/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_rules_designators.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn $func_name() { diff --git a/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_rules_dsl.v b/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_rules_dsl.v index effe126ee..6e6d953cd 100644 --- a/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_rules_dsl.v +++ b/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_rules_dsl.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_rules_overload.v b/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_rules_overload.v index 8aa0dba54..aef998694 100644 --- a/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_rules_overload.v +++ b/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_rules_overload.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_rules_repeat.v b/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_rules_repeat.v index 46c916959..a33781f37 100644 --- a/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_rules_repeat.v +++ b/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_rules_repeat.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_rules_variadic_interfaces.v b/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_rules_variadic_interfaces.v index 2d375a672..c943a129d 100644 --- a/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_rules_variadic_interfaces.v +++ b/CoqOfRust/examples/default/examples/rust_book/macro_rules/macro_rules_variadic_interfaces.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/modules/struct_visibility.v b/CoqOfRust/examples/default/examples/rust_book/modules/struct_visibility.v index a0b53ea27..9403c0085 100644 --- a/CoqOfRust/examples/default/examples/rust_book/modules/struct_visibility.v +++ b/CoqOfRust/examples/default/examples/rust_book/modules/struct_visibility.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Module my. (* StructRecord @@ -108,10 +109,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] |), [ - M.get_struct_record_field - open_box - "struct_visibility::my::OpenBox" + M.get_struct_record_field (| + open_box, + "struct_visibility::my::OpenBox", "contents" + |) ] |) ] diff --git a/CoqOfRust/examples/default/examples/rust_book/modules/super_and_self.v b/CoqOfRust/examples/default/examples/rust_book/modules/super_and_self.v index dab788279..460616390 100644 --- a/CoqOfRust/examples/default/examples/rust_book/modules/super_and_self.v +++ b/CoqOfRust/examples/default/examples/rust_book/modules/super_and_self.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn function() { diff --git a/CoqOfRust/examples/default/examples/rust_book/modules/the_use_as_declaration.v b/CoqOfRust/examples/default/examples/rust_book/modules/the_use_as_declaration.v index 76f4daa94..5df1a85d5 100644 --- a/CoqOfRust/examples/default/examples/rust_book/modules/the_use_as_declaration.v +++ b/CoqOfRust/examples/default/examples/rust_book/modules/the_use_as_declaration.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn function() { diff --git a/CoqOfRust/examples/default/examples/rust_book/modules/visibility.v b/CoqOfRust/examples/default/examples/rust_book/modules/visibility.v index 809ca35a8..7f498a603 100644 --- a/CoqOfRust/examples/default/examples/rust_book/modules/visibility.v +++ b/CoqOfRust/examples/default/examples/rust_book/modules/visibility.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Module my_mod. (* diff --git a/CoqOfRust/examples/default/examples/rust_book/primitives/arrays_and_slices.v b/CoqOfRust/examples/default/examples/rust_book/primitives/arrays_and_slices.v index 93a0d96b5..768e37051 100644 --- a/CoqOfRust/examples/default/examples/rust_book/primitives/arrays_and_slices.v +++ b/CoqOfRust/examples/default/examples/rust_book/primitives/arrays_and_slices.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn analyze_slice(slice: &[i32]) { diff --git a/CoqOfRust/examples/default/examples/rust_book/primitives/compound_types.v b/CoqOfRust/examples/default/examples/rust_book/primitives/compound_types.v index bfc813093..3ee41f354 100644 --- a/CoqOfRust/examples/default/examples/rust_book/primitives/compound_types.v +++ b/CoqOfRust/examples/default/examples/rust_book/primitives/compound_types.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/primitives/literals_operators.v b/CoqOfRust/examples/default/examples/rust_book/primitives/literals_operators.v index eb394456f..c81e2d182 100644 --- a/CoqOfRust/examples/default/examples/rust_book/primitives/literals_operators.v +++ b/CoqOfRust/examples/default/examples/rust_book/primitives/literals_operators.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/primitives/tuples.v b/CoqOfRust/examples/default/examples/rust_book/primitives/tuples.v index c2cc84144..09081b727 100644 --- a/CoqOfRust/examples/default/examples/rust_book/primitives/tuples.v +++ b/CoqOfRust/examples/default/examples/rust_book/primitives/tuples.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn reverse(pair: (i32, bool)) -> (bool, i32) { @@ -58,14 +59,17 @@ Module Impl_core_fmt_Debug_for_tuples_Matrix. M.read (| f |); M.read (| Value.String "Matrix" |); (* Unsize *) - M.pointer_coercion (M.get_struct_tuple_field (M.read (| self |)) "tuples::Matrix" 0); + M.pointer_coercion + (M.get_struct_tuple_field (| M.read (| self |), "tuples::Matrix", 0 |)); (* Unsize *) - M.pointer_coercion (M.get_struct_tuple_field (M.read (| self |)) "tuples::Matrix" 1); + M.pointer_coercion + (M.get_struct_tuple_field (| M.read (| self |), "tuples::Matrix", 1 |)); (* Unsize *) - M.pointer_coercion (M.get_struct_tuple_field (M.read (| self |)) "tuples::Matrix" 2); + M.pointer_coercion + (M.get_struct_tuple_field (| M.read (| self |), "tuples::Matrix", 2 |)); (* Unsize *) M.pointer_coercion - (M.alloc (| M.get_struct_tuple_field (M.read (| self |)) "tuples::Matrix" 3 |)) + (M.alloc (| M.get_struct_tuple_field (| M.read (| self |), "tuples::Matrix", 3 |) |)) ] |))) | _, _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing.v index dc871cf99..9c6f7b7f1 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn eat_box_i32(boxed_i32: Box) { diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_aliasing.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_aliasing.v index 654e9f033..c5c0f71a5 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_aliasing.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_aliasing.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -115,10 +116,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field - (M.read (| borrowed_point |)) - "scoping_rules_borrowing_aliasing::Point" + M.get_struct_record_field (| + M.read (| borrowed_point |), + "scoping_rules_borrowing_aliasing::Point", "x" + |) ] |); M.call_closure (| @@ -128,10 +130,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field - (M.read (| another_borrow |)) - "scoping_rules_borrowing_aliasing::Point" + M.get_struct_record_field (| + M.read (| another_borrow |), + "scoping_rules_borrowing_aliasing::Point", "y" + |) ] |); M.call_closure (| @@ -141,10 +144,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field - point - "scoping_rules_borrowing_aliasing::Point" + M.get_struct_record_field (| + point, + "scoping_rules_borrowing_aliasing::Point", "z" + |) ] |) ] @@ -188,10 +192,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field - (M.read (| borrowed_point |)) - "scoping_rules_borrowing_aliasing::Point" + M.get_struct_record_field (| + M.read (| borrowed_point |), + "scoping_rules_borrowing_aliasing::Point", "x" + |) ] |); M.call_closure (| @@ -201,10 +206,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field - (M.read (| another_borrow |)) - "scoping_rules_borrowing_aliasing::Point" + M.get_struct_record_field (| + M.read (| another_borrow |), + "scoping_rules_borrowing_aliasing::Point", "y" + |) ] |); M.call_closure (| @@ -214,10 +220,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field - point - "scoping_rules_borrowing_aliasing::Point" + M.get_struct_record_field (| + point, + "scoping_rules_borrowing_aliasing::Point", "z" + |) ] |) ] @@ -231,26 +238,29 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let mutable_borrow := M.alloc (| point |) in let _ := M.write (| - M.get_struct_record_field - (M.read (| mutable_borrow |)) - "scoping_rules_borrowing_aliasing::Point" - "x", + M.get_struct_record_field (| + M.read (| mutable_borrow |), + "scoping_rules_borrowing_aliasing::Point", + "x" + |), Value.Integer Integer.I32 5 |) in let _ := M.write (| - M.get_struct_record_field - (M.read (| mutable_borrow |)) - "scoping_rules_borrowing_aliasing::Point" - "y", + M.get_struct_record_field (| + M.read (| mutable_borrow |), + "scoping_rules_borrowing_aliasing::Point", + "y" + |), Value.Integer Integer.I32 2 |) in let _ := M.write (| - M.get_struct_record_field - (M.read (| mutable_borrow |)) - "scoping_rules_borrowing_aliasing::Point" - "z", + M.get_struct_record_field (| + M.read (| mutable_borrow |), + "scoping_rules_borrowing_aliasing::Point", + "z" + |), Value.Integer Integer.I32 1 |) in let _ := @@ -286,10 +296,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field - (M.read (| mutable_borrow |)) - "scoping_rules_borrowing_aliasing::Point" + M.get_struct_record_field (| + M.read (| mutable_borrow |), + "scoping_rules_borrowing_aliasing::Point", "x" + |) ] |); M.call_closure (| @@ -299,10 +310,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field - (M.read (| mutable_borrow |)) - "scoping_rules_borrowing_aliasing::Point" + M.get_struct_record_field (| + M.read (| mutable_borrow |), + "scoping_rules_borrowing_aliasing::Point", "y" + |) ] |); M.call_closure (| @@ -312,10 +324,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field - (M.read (| mutable_borrow |)) - "scoping_rules_borrowing_aliasing::Point" + M.get_struct_record_field (| + M.read (| mutable_borrow |), + "scoping_rules_borrowing_aliasing::Point", "z" + |) ] |) ] @@ -360,10 +373,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field - (M.read (| new_borrowed_point |)) - "scoping_rules_borrowing_aliasing::Point" + M.get_struct_record_field (| + M.read (| new_borrowed_point |), + "scoping_rules_borrowing_aliasing::Point", "x" + |) ] |); M.call_closure (| @@ -373,10 +387,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field - (M.read (| new_borrowed_point |)) - "scoping_rules_borrowing_aliasing::Point" + M.get_struct_record_field (| + M.read (| new_borrowed_point |), + "scoping_rules_borrowing_aliasing::Point", "y" + |) ] |); M.call_closure (| @@ -386,10 +401,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field - (M.read (| new_borrowed_point |)) - "scoping_rules_borrowing_aliasing::Point" + M.get_struct_record_field (| + M.read (| new_borrowed_point |), + "scoping_rules_borrowing_aliasing::Point", "z" + |) ] |) ] diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_mutablity.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_mutablity.v index 404088bc0..5a0f37ad9 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_mutablity.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_mutablity.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -106,10 +107,11 @@ Definition borrow_book (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] |), [ - M.get_struct_record_field - (M.read (| book |)) - "scoping_rules_borrowing_mutablity::Book" + M.get_struct_record_field (| + M.read (| book |), + "scoping_rules_borrowing_mutablity::Book", "title" + |) ] |); M.call_closure (| @@ -119,10 +121,11 @@ Definition borrow_book (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "u32" ] |), [ - M.get_struct_record_field - (M.read (| book |)) - "scoping_rules_borrowing_mutablity::Book" + M.get_struct_record_field (| + M.read (| book |), + "scoping_rules_borrowing_mutablity::Book", "year" + |) ] |) ] @@ -152,10 +155,11 @@ Definition new_edition (τ : list Ty.t) (α : list Value.t) : M := M.read (| let _ := M.write (| - M.get_struct_record_field - (M.read (| book |)) - "scoping_rules_borrowing_mutablity::Book" - "year", + M.get_struct_record_field (| + M.read (| book |), + "scoping_rules_borrowing_mutablity::Book", + "year" + |), Value.Integer Integer.U32 2014 |) in let _ := @@ -190,10 +194,11 @@ Definition new_edition (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] |), [ - M.get_struct_record_field - (M.read (| book |)) - "scoping_rules_borrowing_mutablity::Book" + M.get_struct_record_field (| + M.read (| book |), + "scoping_rules_borrowing_mutablity::Book", "title" + |) ] |); M.call_closure (| @@ -203,10 +208,11 @@ Definition new_edition (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "u32" ] |), [ - M.get_struct_record_field - (M.read (| book |)) - "scoping_rules_borrowing_mutablity::Book" + M.get_struct_record_field (| + M.read (| book |), + "scoping_rules_borrowing_mutablity::Book", "year" + |) ] |) ] diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_the_ref_pattern.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_the_ref_pattern.v index cdb930b8f..e3c7e7fbf 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_the_ref_pattern.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_the_ref_pattern.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -252,10 +253,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field - point - "scoping_rules_borrowing_the_ref_pattern::Point" + M.get_struct_record_field (| + point, + "scoping_rules_borrowing_the_ref_pattern::Point", "x" + |) ] |); M.call_closure (| @@ -265,10 +267,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field - point - "scoping_rules_borrowing_the_ref_pattern::Point" + M.get_struct_record_field (| + point, + "scoping_rules_borrowing_the_ref_pattern::Point", "y" + |) ] |) ] @@ -315,10 +318,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field - mutable_point - "scoping_rules_borrowing_the_ref_pattern::Point" + M.get_struct_record_field (| + mutable_point, + "scoping_rules_borrowing_the_ref_pattern::Point", "x" + |) ] |); M.call_closure (| @@ -328,10 +332,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field - mutable_point - "scoping_rules_borrowing_the_ref_pattern::Point" + M.get_struct_record_field (| + mutable_point, + "scoping_rules_borrowing_the_ref_pattern::Point", "y" + |) ] |) ] diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes.v index 1f61baf74..ed924c8e0 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_bounds.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_bounds.v index 9468629af..9b14b4d66 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_bounds.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_bounds.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { @@ -32,7 +33,11 @@ Module Impl_core_fmt_Debug_where_core_fmt_Debug_T_for_scoping_rules_lifetimes_bo (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_tuple_field (M.read (| self |)) "scoping_rules_lifetimes_bounds::Ref" 0 + M.get_struct_tuple_field (| + M.read (| self |), + "scoping_rules_lifetimes_bounds::Ref", + 0 + |) |)) ] |))) diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_coercion.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_coercion.v index f888ab960..af56cbcf0 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_coercion.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_coercion.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn multiply<'a>(first: &'a i32, second: &'a i32) -> i32 { diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_elision.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_elision.v index 11bbd6c8c..aa314f172 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_elision.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_elision.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn elided_input(x: &i32) { diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_functions.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_functions.v index f4ce2f686..82cba5e7f 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_functions.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_functions.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn print_one<'a>(x: &'a i32) { diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_methods.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_methods.v index 189574b93..069532dab 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_methods.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_methods.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { @@ -24,10 +25,11 @@ Module Impl_scoping_rules_lifetimes_methods_Owner. M.read (| let _ := let β := - M.get_struct_tuple_field - (M.read (| self |)) - "scoping_rules_lifetimes_methods::Owner" - 0 in + M.get_struct_tuple_field (| + M.read (| self |), + "scoping_rules_lifetimes_methods::Owner", + 0 + |) in M.write (| β, BinOp.Panic.add (| M.read (| β |), Value.Integer Integer.I32 1 |) |) in M.alloc (| Value.Tuple [] |) |))) @@ -76,10 +78,11 @@ Module Impl_scoping_rules_lifetimes_methods_Owner. [ Ty.path "i32" ] |), [ - M.get_struct_tuple_field - (M.read (| self |)) - "scoping_rules_lifetimes_methods::Owner" + M.get_struct_tuple_field (| + M.read (| self |), + "scoping_rules_lifetimes_methods::Owner", 0 + |) ] |) ] diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_reference_lifetime_static.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_reference_lifetime_static.v index 21f08ca4a..59655947a 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_reference_lifetime_static.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_reference_lifetime_static.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Definition value_NUM : Value.t := M.run ltac:(M.monadic (M.alloc (| M.alloc (| Value.Integer Integer.I32 18 |) |))). diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_structs.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_structs.v index 4679506d7..1db0c7f7c 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_structs.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_structs.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { @@ -30,10 +31,11 @@ Module Impl_core_fmt_Debug_for_scoping_rules_lifetimes_structs_Borrowed. (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_tuple_field - (M.read (| self |)) - "scoping_rules_lifetimes_structs::Borrowed" + M.get_struct_tuple_field (| + M.read (| self |), + "scoping_rules_lifetimes_structs::Borrowed", 0 + |) |)) ] |))) @@ -81,18 +83,20 @@ Module Impl_core_fmt_Debug_for_scoping_rules_lifetimes_structs_NamedBorrowed. M.read (| Value.String "x" |); (* Unsize *) M.pointer_coercion - (M.get_struct_record_field - (M.read (| self |)) - "scoping_rules_lifetimes_structs::NamedBorrowed" - "x"); + (M.get_struct_record_field (| + M.read (| self |), + "scoping_rules_lifetimes_structs::NamedBorrowed", + "x" + |)); M.read (| Value.String "y" |); (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_record_field - (M.read (| self |)) - "scoping_rules_lifetimes_structs::NamedBorrowed" + M.get_struct_record_field (| + M.read (| self |), + "scoping_rules_lifetimes_structs::NamedBorrowed", "y" + |) |)) ] |))) diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_traits.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_traits.v index 5de59a34e..7a1575590 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_traits.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_traits.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -31,10 +32,11 @@ Module Impl_core_fmt_Debug_for_scoping_rules_lifetimes_traits_Borrowed. (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_record_field - (M.read (| self |)) - "scoping_rules_lifetimes_traits::Borrowed" + M.get_struct_record_field (| + M.read (| self |), + "scoping_rules_lifetimes_traits::Borrowed", "x" + |) |)) ] |))) diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules.v index abfb69b56..4fe1929d8 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn destroy_box(c: Box) { diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules_mutablity.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules_mutablity.v index bca0f51ca..9f02d3b5b 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules_mutablity.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules_mutablity.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules_partial_moves.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules_partial_moves.v index a8c54c493..763450853 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules_partial_moves.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules_partial_moves.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { @@ -218,10 +219,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ] |), [ - M.get_struct_record_field - person - "scoping_rules_ownership_and_rules_partial_moves::main::Person" + M.get_struct_record_field (| + person, + "scoping_rules_ownership_and_rules_partial_moves::main::Person", "age" + |) ] |) ] @@ -275,18 +277,20 @@ Module main. M.read (| Value.String "name" |); (* Unsize *) M.pointer_coercion - (M.get_struct_record_field - (M.read (| self |)) - "scoping_rules_ownership_and_rules_partial_moves::main::Person" - "name"); + (M.get_struct_record_field (| + M.read (| self |), + "scoping_rules_ownership_and_rules_partial_moves::main::Person", + "name" + |)); M.read (| Value.String "age" |); (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_record_field - (M.read (| self |)) - "scoping_rules_ownership_and_rules_partial_moves::main::Person" + M.get_struct_record_field (| + M.read (| self |), + "scoping_rules_ownership_and_rules_partial_moves::main::Person", "age" + |) |)) ] |))) diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_raii.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_raii.v index 1a9542ee9..31da9edf6 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_raii.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_raii.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn create_box() { diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_raii_desctructor.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_raii_desctructor.v index c60115168..93278ee8e 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_raii_desctructor.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_raii_desctructor.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/default/examples/rust_book/std_library_types/arc.v b/CoqOfRust/examples/default/examples/rust_book/std_library_types/arc.v index adc61a47f..679e4093c 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_library_types/arc.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_library_types/arc.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/std_library_types/box_stack_heap.v b/CoqOfRust/examples/default/examples/rust_book/std_library_types/box_stack_heap.v index 32b572c65..d927f0dc1 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_library_types/box_stack_heap.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_library_types/box_stack_heap.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -30,12 +31,12 @@ Module Impl_core_fmt_Debug_for_box_stack_heap_Point. M.read (| Value.String "x" |); (* Unsize *) M.pointer_coercion - (M.get_struct_record_field (M.read (| self |)) "box_stack_heap::Point" "x"); + (M.get_struct_record_field (| M.read (| self |), "box_stack_heap::Point", "x" |)); M.read (| Value.String "y" |); (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_record_field (M.read (| self |)) "box_stack_heap::Point" "y" + M.get_struct_record_field (| M.read (| self |), "box_stack_heap::Point", "y" |) |)) ] |))) diff --git a/CoqOfRust/examples/default/examples/rust_book/std_library_types/hash_map.v b/CoqOfRust/examples/default/examples/rust_book/std_library_types/hash_map.v index 823185f3a..09afd159b 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_library_types/hash_map.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_library_types/hash_map.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn call(number: &str) -> &str { diff --git a/CoqOfRust/examples/default/examples/rust_book/std_library_types/hash_map_alternate_or_custom_key_types.v b/CoqOfRust/examples/default/examples/rust_book/std_library_types/hash_map_alternate_or_custom_key_types.v index 4810c8601..c3c3d4335 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_library_types/hash_map_alternate_or_custom_key_types.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_library_types/hash_map_alternate_or_custom_key_types.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -43,14 +44,16 @@ Module Impl_core_cmp_PartialEq_for_hash_map_alternate_or_custom_key_types_Accoun [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "hash_map_alternate_or_custom_key_types::Account" - "username"; - M.get_struct_record_field - (M.read (| other |)) - "hash_map_alternate_or_custom_key_types::Account" + M.get_struct_record_field (| + M.read (| self |), + "hash_map_alternate_or_custom_key_types::Account", "username" + |); + M.get_struct_record_field (| + M.read (| other |), + "hash_map_alternate_or_custom_key_types::Account", + "username" + |) ] |), ltac:(M.monadic @@ -63,14 +66,16 @@ Module Impl_core_cmp_PartialEq_for_hash_map_alternate_or_custom_key_types_Accoun [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "hash_map_alternate_or_custom_key_types::Account" - "password"; - M.get_struct_record_field - (M.read (| other |)) - "hash_map_alternate_or_custom_key_types::Account" + M.get_struct_record_field (| + M.read (| self |), + "hash_map_alternate_or_custom_key_types::Account", "password" + |); + M.get_struct_record_field (| + M.read (| other |), + "hash_map_alternate_or_custom_key_types::Account", + "password" + |) ] |))) |))) @@ -152,10 +157,11 @@ Module Impl_core_hash_Hash_for_hash_map_alternate_or_custom_key_types_Account. [ __H ] |), [ - M.get_struct_record_field - (M.read (| self |)) - "hash_map_alternate_or_custom_key_types::Account" - "username"; + M.get_struct_record_field (| + M.read (| self |), + "hash_map_alternate_or_custom_key_types::Account", + "username" + |); M.read (| state |) ] |) @@ -170,10 +176,11 @@ Module Impl_core_hash_Hash_for_hash_map_alternate_or_custom_key_types_Account. [ __H ] |), [ - M.get_struct_record_field - (M.read (| self |)) - "hash_map_alternate_or_custom_key_types::Account" - "password"; + M.get_struct_record_field (| + M.read (| self |), + "hash_map_alternate_or_custom_key_types::Account", + "password" + |); M.read (| state |) ] |) @@ -427,10 +434,11 @@ Definition try_logon (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] |), [ - M.get_struct_record_field - (M.read (| account_info |)) - "hash_map_alternate_or_custom_key_types::AccountInfo" + M.get_struct_record_field (| + M.read (| account_info |), + "hash_map_alternate_or_custom_key_types::AccountInfo", "name" + |) ] |) ] @@ -476,10 +484,11 @@ Definition try_logon (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] |), [ - M.get_struct_record_field - (M.read (| account_info |)) - "hash_map_alternate_or_custom_key_types::AccountInfo" + M.get_struct_record_field (| + M.read (| account_info |), + "hash_map_alternate_or_custom_key_types::AccountInfo", "email" + |) ] |) ] diff --git a/CoqOfRust/examples/default/examples/rust_book/std_library_types/hash_map_hash_set.v b/CoqOfRust/examples/default/examples/rust_book/std_library_types/hash_map_hash_set.v index 4c3f207ab..dc3c33fce 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_library_types/hash_map_hash_set.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_library_types/hash_map_hash_set.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/std_library_types/option.v b/CoqOfRust/examples/default/examples/rust_book/std_library_types/option.v index 7eb66c878..97dc7e516 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_library_types/option.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_library_types/option.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn checked_division(dividend: i32, divisor: i32) -> Option { diff --git a/CoqOfRust/examples/default/examples/rust_book/std_library_types/panic.v b/CoqOfRust/examples/default/examples/rust_book/std_library_types/panic.v index 334493da9..bb123694c 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_library_types/panic.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_library_types/panic.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn division(dividend: i32, divisor: i32) -> i32 { diff --git a/CoqOfRust/examples/default/examples/rust_book/std_library_types/rc.v b/CoqOfRust/examples/default/examples/rust_book/std_library_types/rc.v index 254aff09f..789a9854e 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_library_types/rc.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_library_types/rc.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/std_library_types/result.v b/CoqOfRust/examples/default/examples/rust_book/std_library_types/result.v index d129d020a..816a00dc5 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_library_types/result.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_library_types/result.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Module checked. (* diff --git a/CoqOfRust/examples/default/examples/rust_book/std_library_types/result_chaining_with_question_mark.v b/CoqOfRust/examples/default/examples/rust_book/std_library_types/result_chaining_with_question_mark.v index f939941cc..82b5f6be0 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_library_types/result_chaining_with_question_mark.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_library_types/result_chaining_with_question_mark.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Module checked. (* diff --git a/CoqOfRust/examples/default/examples/rust_book/std_library_types/strings.v b/CoqOfRust/examples/default/examples/rust_book/std_library_types/strings.v index 0ace87b51..612f3b5d5 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_library_types/strings.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_library_types/strings.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/std_library_types/strings_byte_strings_as_non_utf8.v b/CoqOfRust/examples/default/examples/rust_book/std_library_types/strings_byte_strings_as_non_utf8.v index a4e80ff64..1dab9d956 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_library_types/strings_byte_strings_as_non_utf8.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_library_types/strings_byte_strings_as_non_utf8.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/std_library_types/strings_literals_and_escapes.v b/CoqOfRust/examples/default/examples/rust_book/std_library_types/strings_literals_and_escapes.v index 8b738961e..a7129384a 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_library_types/strings_literals_and_escapes.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_library_types/strings_literals_and_escapes.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/std_library_types/strings_raw_string_literals.v b/CoqOfRust/examples/default/examples/rust_book/std_library_types/strings_raw_string_literals.v index 5da747534..57736ef46 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_library_types/strings_raw_string_literals.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_library_types/strings_raw_string_literals.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/std_library_types/vectors.v b/CoqOfRust/examples/default/examples/rust_book/std_library_types/vectors.v index 9eb90a808..150aa7e90 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_library_types/vectors.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_library_types/vectors.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/std_misc/channels.v b/CoqOfRust/examples/default/examples/rust_book/std_misc/channels.v index ab1bde6a1..1bbf79e04 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_misc/channels.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_misc/channels.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Definition value_NTHREADS : Value.t := M.run ltac:(M.monadic (M.alloc (| M.alloc (| Value.Integer Integer.I32 3 |) |))). diff --git a/CoqOfRust/examples/default/examples/rust_book/std_misc/child_processes.v b/CoqOfRust/examples/default/examples/rust_book/std_misc/child_processes.v index 21731bb2e..9a19e6cef 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_misc/child_processes.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_misc/child_processes.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { @@ -137,7 +138,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "success", [] |), - [ M.get_struct_record_field output "std::process::Output" "status" ] + [ M.get_struct_record_field (| output, "std::process::Output", "status" |) ] |) |)) in let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in @@ -160,7 +161,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "deref", [] |), - [ M.get_struct_record_field output "std::process::Output" "stdout" ] + [ M.get_struct_record_field (| output, "std::process::Output", "stdout" |) + ] |) ] |) @@ -232,7 +234,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "deref", [] |), - [ M.get_struct_record_field output "std::process::Output" "stderr" ] + [ M.get_struct_record_field (| output, "std::process::Output", "stderr" |) + ] |) ] |) diff --git a/CoqOfRust/examples/default/examples/rust_book/std_misc/child_processes_pipes.v b/CoqOfRust/examples/default/examples/rust_book/std_misc/child_processes_pipes.v index ab585c5bf..1c1410307 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_misc/child_processes_pipes.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_misc/child_processes_pipes.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Definition value_PANGRAM : Value.t := M.run @@ -182,7 +183,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "unwrap", [] |), - [ M.read (| M.get_struct_record_field process "std::process::Child" "stdin" |) + [ + M.read (| + M.get_struct_record_field (| process, "std::process::Child", "stdin" |) + |) ] |) |); @@ -307,7 +311,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "unwrap", [] |), - [ M.read (| M.get_struct_record_field process "std::process::Child" "stdout" |) + [ + M.read (| + M.get_struct_record_field (| process, "std::process::Child", "stdout" |) + |) ] |) |); diff --git a/CoqOfRust/examples/default/examples/rust_book/std_misc/child_processes_wait.v b/CoqOfRust/examples/default/examples/rust_book/std_misc/child_processes_wait.v index 893438178..eb8efb7d7 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_misc/child_processes_wait.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_misc/child_processes_wait.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/std_misc/file_io_create.v b/CoqOfRust/examples/default/examples/rust_book/std_misc/file_io_create.v index 853780e74..537572972 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_misc/file_io_create.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_misc/file_io_create.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Definition value_LOREM_IPSUM : Value.t := M.run diff --git a/CoqOfRust/examples/default/examples/rust_book/std_misc/file_io_open.v b/CoqOfRust/examples/default/examples/rust_book/std_misc/file_io_open.v index de4f53491..6516b90c4 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_misc/file_io_open.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_misc/file_io_open.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/std_misc/file_io_read_lines.v b/CoqOfRust/examples/default/examples/rust_book/std_misc/file_io_read_lines.v index 92eebf085..3876c26e2 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_misc/file_io_read_lines.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_misc/file_io_read_lines.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn read_lines(filename: String) -> io::Lines> { diff --git a/CoqOfRust/examples/default/examples/rust_book/std_misc/file_io_read_lines_efficient_method.v b/CoqOfRust/examples/default/examples/rust_book/std_misc/file_io_read_lines_efficient_method.v index a792122d7..50c86a7b0 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_misc/file_io_read_lines_efficient_method.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_misc/file_io_read_lines_efficient_method.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn read_lines

(filename: P) -> io::Result>> diff --git a/CoqOfRust/examples/default/examples/rust_book/std_misc/filesystem_operations.v b/CoqOfRust/examples/default/examples/rust_book/std_misc/filesystem_operations.v index ca851c403..1d16cdc54 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_misc/filesystem_operations.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_misc/filesystem_operations.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn cat(path: &Path) -> io::Result { diff --git a/CoqOfRust/examples/default/examples/rust_book/std_misc/foreign_function_interface.v b/CoqOfRust/examples/default/examples/rust_book/std_misc/foreign_function_interface.v index de51e2c71..0d45fa27f 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_misc/foreign_function_interface.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_misc/foreign_function_interface.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Unhandled foreign module here *) @@ -231,10 +232,11 @@ Module Impl_core_fmt_Debug_for_foreign_function_interface_Complex. (M.alloc (| BinOp.Pure.lt (M.read (| - M.get_struct_record_field - (M.read (| self |)) - "foreign_function_interface::Complex" + M.get_struct_record_field (| + M.read (| self |), + "foreign_function_interface::Complex", "im" + |) |)) (M.read (| UnsupportedLiteral |)) |)) in @@ -277,10 +279,11 @@ Module Impl_core_fmt_Debug_for_foreign_function_interface_Complex. [ Ty.path "f32" ] |), [ - M.get_struct_record_field - (M.read (| self |)) - "foreign_function_interface::Complex" + M.get_struct_record_field (| + M.read (| self |), + "foreign_function_interface::Complex", "re" + |) ] |); M.call_closure (| @@ -293,10 +296,11 @@ Module Impl_core_fmt_Debug_for_foreign_function_interface_Complex. M.alloc (| UnOp.Panic.neg (| M.read (| - M.get_struct_record_field - (M.read (| self |)) - "foreign_function_interface::Complex" + M.get_struct_record_field (| + M.read (| self |), + "foreign_function_interface::Complex", "im" + |) |) |) |) @@ -349,10 +353,11 @@ Module Impl_core_fmt_Debug_for_foreign_function_interface_Complex. [ Ty.path "f32" ] |), [ - M.get_struct_record_field - (M.read (| self |)) - "foreign_function_interface::Complex" + M.get_struct_record_field (| + M.read (| self |), + "foreign_function_interface::Complex", "re" + |) ] |); M.call_closure (| @@ -362,10 +367,11 @@ Module Impl_core_fmt_Debug_for_foreign_function_interface_Complex. [ Ty.path "f32" ] |), [ - M.get_struct_record_field - (M.read (| self |)) - "foreign_function_interface::Complex" + M.get_struct_record_field (| + M.read (| self |), + "foreign_function_interface::Complex", "im" + |) ] |) ] diff --git a/CoqOfRust/examples/default/examples/rust_book/std_misc/path.v b/CoqOfRust/examples/default/examples/rust_book/std_misc/path.v index c636dcda8..1eee7b0a4 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_misc/path.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_misc/path.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/std_misc/program_arguments.v b/CoqOfRust/examples/default/examples/rust_book/std_misc/program_arguments.v index 96acd0902..c13c99818 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_misc/program_arguments.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_misc/program_arguments.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/std_misc/program_arguments_parsing.v b/CoqOfRust/examples/default/examples/rust_book/std_misc/program_arguments_parsing.v index 3a8f435f5..4b28691a7 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_misc/program_arguments_parsing.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_misc/program_arguments_parsing.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn increase(number: i32) { diff --git a/CoqOfRust/examples/default/examples/rust_book/std_misc/threads.v b/CoqOfRust/examples/default/examples/rust_book/std_misc/threads.v index e39c4e739..9331a6728 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_misc/threads.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_misc/threads.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Definition value_NTHREADS : Value.t := M.run ltac:(M.monadic (M.alloc (| Value.Integer Integer.U32 10 |))). diff --git a/CoqOfRust/examples/default/examples/rust_book/std_misc/threads_test_case_map_reduce.v b/CoqOfRust/examples/default/examples/rust_book/std_misc/threads_test_case_map_reduce.v index 5f4cfae9a..88ee516d8 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_misc/threads_test_case_map_reduce.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_misc/threads_test_case_map_reduce.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/testing/documentation_testing.v b/CoqOfRust/examples/default/examples/rust_book/testing/documentation_testing.v index 388b5926e..5eb79c5d9 100644 --- a/CoqOfRust/examples/default/examples/rust_book/testing/documentation_testing.v +++ b/CoqOfRust/examples/default/examples/rust_book/testing/documentation_testing.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* pub fn add(a: i32, b: i32) -> i32 { diff --git a/CoqOfRust/examples/default/examples/rust_book/testing/unit_testing.v b/CoqOfRust/examples/default/examples/rust_book/testing/unit_testing.v index 011c0ea31..b6f7661fd 100644 --- a/CoqOfRust/examples/default/examples/rust_book/testing/unit_testing.v +++ b/CoqOfRust/examples/default/examples/rust_book/testing/unit_testing.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* pub fn add(a: i32, b: i32) -> i32 { diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/clone.v b/CoqOfRust/examples/default/examples/rust_book/traits/clone.v index 11abc4d4a..3005e47cf 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/clone.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/clone.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { @@ -94,7 +95,7 @@ Module Impl_core_clone_Clone_for_clone_Pair. "clone", [] |), - [ M.get_struct_tuple_field (M.read (| self |)) "clone::Pair" 0 ] + [ M.get_struct_tuple_field (| M.read (| self |), "clone::Pair", 0 |) ] |); M.call_closure (| M.get_trait_method (| @@ -106,7 +107,7 @@ Module Impl_core_clone_Clone_for_clone_Pair. "clone", [] |), - [ M.get_struct_tuple_field (M.read (| self |)) "clone::Pair" 1 ] + [ M.get_struct_tuple_field (| M.read (| self |), "clone::Pair", 1 |) ] |) ])) | _, _ => M.impossible @@ -140,10 +141,10 @@ Module Impl_core_fmt_Debug_for_clone_Pair. M.read (| f |); M.read (| Value.String "Pair" |); (* Unsize *) - M.pointer_coercion (M.get_struct_tuple_field (M.read (| self |)) "clone::Pair" 0); + M.pointer_coercion (M.get_struct_tuple_field (| M.read (| self |), "clone::Pair", 0 |)); (* Unsize *) M.pointer_coercion - (M.alloc (| M.get_struct_tuple_field (M.read (| self |)) "clone::Pair" 1 |)) + (M.alloc (| M.get_struct_tuple_field (| M.read (| self |), "clone::Pair", 1 |) |)) ] |))) | _, _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/derive.v b/CoqOfRust/examples/default/examples/rust_book/traits/derive.v index 640c4ad3a..b16c959ae 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/derive.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/derive.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { @@ -30,8 +31,10 @@ Module Impl_core_cmp_PartialEq_for_derive_Centimeters. (let self := M.alloc (| self |) in let other := M.alloc (| other |) in BinOp.Pure.eq - (M.read (| M.get_struct_tuple_field (M.read (| self |)) "derive::Centimeters" 0 |)) - (M.read (| M.get_struct_tuple_field (M.read (| other |)) "derive::Centimeters" 0 |)))) + (M.read (| M.get_struct_tuple_field (| M.read (| self |), "derive::Centimeters", 0 |) |)) + (M.read (| + M.get_struct_tuple_field (| M.read (| other |), "derive::Centimeters", 0 |) + |)))) | _, _ => M.impossible end. @@ -62,8 +65,8 @@ Module Impl_core_cmp_PartialOrd_for_derive_Centimeters. [] |), [ - M.get_struct_tuple_field (M.read (| self |)) "derive::Centimeters" 0; - M.get_struct_tuple_field (M.read (| other |)) "derive::Centimeters" 0 + M.get_struct_tuple_field (| M.read (| self |), "derive::Centimeters", 0 |); + M.get_struct_tuple_field (| M.read (| other |), "derive::Centimeters", 0 |) ] |))) | _, _ => M.impossible @@ -105,7 +108,7 @@ Module Impl_core_fmt_Debug_for_derive_Inches. M.read (| Value.String "Inches" |); (* Unsize *) M.pointer_coercion - (M.alloc (| M.get_struct_tuple_field (M.read (| self |)) "derive::Inches" 0 |)) + (M.alloc (| M.get_struct_tuple_field (| M.read (| self |), "derive::Inches", 0 |) |)) ] |))) | _, _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/disambiguating_overlapping_traits.v b/CoqOfRust/examples/default/examples/rust_book/traits/disambiguating_overlapping_traits.v index 73adee82b..853ebd793 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/disambiguating_overlapping_traits.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/disambiguating_overlapping_traits.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Trait *) (* Empty module 'UsernameWidget' *) @@ -36,10 +37,11 @@ Module Impl_disambiguating_overlapping_traits_UsernameWidget_for_disambiguating_ [] |), [ - M.get_struct_record_field - (M.read (| self |)) - "disambiguating_overlapping_traits::Form" + M.get_struct_record_field (| + M.read (| self |), + "disambiguating_overlapping_traits::Form", "username" + |) ] |))) | _, _ => M.impossible @@ -67,10 +69,11 @@ Module Impl_disambiguating_overlapping_traits_AgeWidget_for_disambiguating_overl ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field - (M.read (| self |)) - "disambiguating_overlapping_traits::Form" + M.get_struct_record_field (| + M.read (| self |), + "disambiguating_overlapping_traits::Form", "age" + |) |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/drop.v b/CoqOfRust/examples/default/examples/rust_book/traits/drop.v index 9f9d464ad..a3c0dc794 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/drop.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/drop.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -53,10 +54,11 @@ Module Impl_core_ops_drop_Drop_for_drop_Droppable. [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] |), [ - M.get_struct_record_field - (M.read (| self |)) - "drop::Droppable" + M.get_struct_record_field (| + M.read (| self |), + "drop::Droppable", "name" + |) ] |) ] diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/hash.v b/CoqOfRust/examples/default/examples/rust_book/traits/hash.v index 0dbae73ec..16bd8f914 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/hash.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/hash.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -26,7 +27,7 @@ Module Impl_core_hash_Hash_for_hash_Person. M.call_closure (| M.get_trait_method (| "core::hash::Hash", Ty.path "u32", [], "hash", [ __H ] |), [ - M.get_struct_record_field (M.read (| self |)) "hash::Person" "id"; + M.get_struct_record_field (| M.read (| self |), "hash::Person", "id" |); M.read (| state |) ] |) @@ -42,7 +43,7 @@ Module Impl_core_hash_Hash_for_hash_Person. [ __H ] |), [ - M.get_struct_record_field (M.read (| self |)) "hash::Person" "name"; + M.get_struct_record_field (| M.read (| self |), "hash::Person", "name" |); M.read (| state |) ] |) @@ -51,7 +52,7 @@ Module Impl_core_hash_Hash_for_hash_Person. M.call_closure (| M.get_trait_method (| "core::hash::Hash", Ty.path "u64", [], "hash", [ __H ] |), [ - M.get_struct_record_field (M.read (| self |)) "hash::Person" "phone"; + M.get_struct_record_field (| M.read (| self |), "hash::Person", "phone" |); M.read (| state |) ] |) diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/impl_trait_as_return_type.v b/CoqOfRust/examples/default/examples/rust_book/traits/impl_trait_as_return_type.v index c5bc0ddec..373f8b107 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/impl_trait_as_return_type.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/impl_trait_as_return_type.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn combine_vecs_explicit_return_type( diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/iterators.v b/CoqOfRust/examples/default/examples/rust_book/traits/iterators.v index fdbb07763..38fba6b4f 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/iterators.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/iterators.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -34,22 +35,22 @@ Module Impl_core_iter_traits_iterator_Iterator_for_iterators_Fibonacci. M.read (| let current := M.copy (| - M.get_struct_record_field (M.read (| self |)) "iterators::Fibonacci" "curr" + M.get_struct_record_field (| M.read (| self |), "iterators::Fibonacci", "curr" |) |) in let _ := M.write (| - M.get_struct_record_field (M.read (| self |)) "iterators::Fibonacci" "curr", + M.get_struct_record_field (| M.read (| self |), "iterators::Fibonacci", "curr" |), M.read (| - M.get_struct_record_field (M.read (| self |)) "iterators::Fibonacci" "next" + M.get_struct_record_field (| M.read (| self |), "iterators::Fibonacci", "next" |) |) |) in let _ := M.write (| - M.get_struct_record_field (M.read (| self |)) "iterators::Fibonacci" "next", + M.get_struct_record_field (| M.read (| self |), "iterators::Fibonacci", "next" |), BinOp.Panic.add (| M.read (| current |), M.read (| - M.get_struct_record_field (M.read (| self |)) "iterators::Fibonacci" "next" + M.get_struct_record_field (| M.read (| self |), "iterators::Fibonacci", "next" |) |) |) |) in diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/operator_overloading.v b/CoqOfRust/examples/default/examples/rust_book/traits/operator_overloading.v index c668642c4..2a72f17af 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/operator_overloading.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/operator_overloading.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/returning_traits_with_dyn.v b/CoqOfRust/examples/default/examples/rust_book/traits/returning_traits_with_dyn.v index f12147188..67f6bb151 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/returning_traits_with_dyn.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/returning_traits_with_dyn.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/supertraits.v b/CoqOfRust/examples/default/examples/rust_book/traits/supertraits.v index a4471c40c..9f22b7198 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/supertraits.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/supertraits.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Trait *) (* Empty module 'Person' *) diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/traits.v b/CoqOfRust/examples/default/examples/rust_book/traits/traits.v index 6b966e81f..4bc0d292a 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/traits.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/traits.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructRecord { @@ -112,7 +113,7 @@ Module Impl_traits_Sheep. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_record_field (M.read (| self |)) "traits::Sheep" "naked" |))) + M.read (| M.get_struct_record_field (| M.read (| self |), "traits::Sheep", "naked" |) |))) | _, _ => M.impossible end. @@ -244,10 +245,11 @@ Module Impl_traits_Sheep. [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] |), [ - M.get_struct_record_field - (M.read (| self |)) - "traits::Sheep" + M.get_struct_record_field (| + M.read (| self |), + "traits::Sheep", "name" + |) ] |) ] @@ -260,7 +262,7 @@ Module Impl_traits_Sheep. M.alloc (| Value.Tuple [] |) in let _ := M.write (| - M.get_struct_record_field (M.read (| self |)) "traits::Sheep" "naked", + M.get_struct_record_field (| M.read (| self |), "traits::Sheep", "naked" |), Value.Bool true |) in M.alloc (| Value.Tuple [] |))) @@ -305,7 +307,7 @@ Module Impl_traits_Animal_for_traits_Sheep. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_record_field (M.read (| self |)) "traits::Sheep" "name" |))) + M.read (| M.get_struct_record_field (| M.read (| self |), "traits::Sheep", "name" |) |))) | _, _ => M.impossible end. @@ -390,10 +392,11 @@ Module Impl_traits_Animal_for_traits_Sheep. [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] |), [ - M.get_struct_record_field - (M.read (| self |)) - "traits::Sheep" + M.get_struct_record_field (| + M.read (| self |), + "traits::Sheep", "name" + |) ] |); M.call_closure (| diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/traits_parms.v b/CoqOfRust/examples/default/examples/rust_book/traits/traits_parms.v index 69d70dcad..55ebc12c8 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/traits_parms.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/traits_parms.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* Trait *) (* Empty module 'Foo' *) diff --git a/CoqOfRust/examples/default/examples/rust_book/types/aliasing.v b/CoqOfRust/examples/default/examples/rust_book/types/aliasing.v index e8476395b..7e187516d 100644 --- a/CoqOfRust/examples/default/examples/rust_book/types/aliasing.v +++ b/CoqOfRust/examples/default/examples/rust_book/types/aliasing.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. Axiom NanoSecond : (Ty.path "aliasing::NanoSecond") = (Ty.path "u64"). diff --git a/CoqOfRust/examples/default/examples/rust_book/types/casting.v b/CoqOfRust/examples/default/examples/rust_book/types/casting.v index 693041862..bcd63dad2 100644 --- a/CoqOfRust/examples/default/examples/rust_book/types/casting.v +++ b/CoqOfRust/examples/default/examples/rust_book/types/casting.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/types/inference.v b/CoqOfRust/examples/default/examples/rust_book/types/inference.v index f2fd95a2d..f5658aa06 100644 --- a/CoqOfRust/examples/default/examples/rust_book/types/inference.v +++ b/CoqOfRust/examples/default/examples/rust_book/types/inference.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/types/literals.v b/CoqOfRust/examples/default/examples/rust_book/types/literals.v index 24439cb22..e8a800184 100644 --- a/CoqOfRust/examples/default/examples/rust_book/types/literals.v +++ b/CoqOfRust/examples/default/examples/rust_book/types/literals.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/calling_unsafe_functions.v b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/calling_unsafe_functions.v index b088ae23d..bff0d5e6f 100644 --- a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/calling_unsafe_functions.v +++ b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/calling_unsafe_functions.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly.v b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly.v index 858ce2035..1e6d39e09 100644 --- a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly.v +++ b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_clobbered_registers.v b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_clobbered_registers.v index 0f8377644..d7dcbea23 100644 --- a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_clobbered_registers.v +++ b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_clobbered_registers.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_explicit_register_operands.v b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_explicit_register_operands.v index 456a311ff..e0da008f5 100644 --- a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_explicit_register_operands.v +++ b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_explicit_register_operands.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inlateout_case_implemented.v b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inlateout_case_implemented.v index 8ff325782..ce30a7eb8 100644 --- a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inlateout_case_implemented.v +++ b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inlateout_case_implemented.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inlateout_case_non_used.v b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inlateout_case_non_used.v index ec2a3759b..9741b5439 100644 --- a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inlateout_case_non_used.v +++ b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inlateout_case_non_used.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inlateout_mul.v b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inlateout_mul.v index 9b58e0445..1dc3e5c36 100644 --- a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inlateout_mul.v +++ b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inlateout_mul.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inout.v b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inout.v index c0bbad186..9f5518527 100644 --- a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inout.v +++ b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inout.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs.v b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs.v index 179eef422..f20550bcb 100644 --- a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs.v +++ b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs_another_example.v b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs_another_example.v index 830fa868b..e83140af6 100644 --- a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs_another_example.v +++ b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs_another_example.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs_another_example_without_mov.v b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs_another_example_without_mov.v index dfe380cae..e004cf2e6 100644 --- a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs_another_example_without_mov.v +++ b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_inputs_and_outputs_another_example_without_mov.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_labels.v b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_labels.v index ac7a95f5b..1ce6024ad 100644 --- a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_labels.v +++ b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_labels.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_memory_address_operands.v b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_memory_address_operands.v index d3b9d31fd..6f14933cf 100644 --- a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_memory_address_operands.v +++ b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_memory_address_operands.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_options.v b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_options.v index 4c995e79f..a4e700e91 100644 --- a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_options.v +++ b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_options.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_register_template_modifiers.v b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_register_template_modifiers.v index 1c2519a9b..bdfd7d514 100644 --- a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_register_template_modifiers.v +++ b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_register_template_modifiers.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_scratch_register.v b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_scratch_register.v index f02179803..98982b47e 100644 --- a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_scratch_register.v +++ b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_scratch_register.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_symbol_operands_and_abi_clobbers.v b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_symbol_operands_and_abi_clobbers.v index a8df505be..b81650550 100644 --- a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_symbol_operands_and_abi_clobbers.v +++ b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/inline_assembly_symbol_operands_and_abi_clobbers.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/raw_pointers.v b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/raw_pointers.v index b4c03af1e..67800b88f 100644 --- a/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/raw_pointers.v +++ b/CoqOfRust/examples/default/examples/rust_book/unsafe_operations/raw_pointers.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/variable_bindings/declare_first.v b/CoqOfRust/examples/default/examples/rust_book/variable_bindings/declare_first.v index 0900821cb..78d506d07 100644 --- a/CoqOfRust/examples/default/examples/rust_book/variable_bindings/declare_first.v +++ b/CoqOfRust/examples/default/examples/rust_book/variable_bindings/declare_first.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/variable_bindings/freezing.v b/CoqOfRust/examples/default/examples/rust_book/variable_bindings/freezing.v index 452c0ae6a..5c4aa0cf3 100644 --- a/CoqOfRust/examples/default/examples/rust_book/variable_bindings/freezing.v +++ b/CoqOfRust/examples/default/examples/rust_book/variable_bindings/freezing.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/variable_bindings/mutability.v b/CoqOfRust/examples/default/examples/rust_book/variable_bindings/mutability.v index c205c2e63..2f970fe4e 100644 --- a/CoqOfRust/examples/default/examples/rust_book/variable_bindings/mutability.v +++ b/CoqOfRust/examples/default/examples/rust_book/variable_bindings/mutability.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/variable_bindings/scope.v b/CoqOfRust/examples/default/examples/rust_book/variable_bindings/scope.v index 8ddf0306c..d014d02ed 100644 --- a/CoqOfRust/examples/default/examples/rust_book/variable_bindings/scope.v +++ b/CoqOfRust/examples/default/examples/rust_book/variable_bindings/scope.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/variable_bindings/variable_bindings.v b/CoqOfRust/examples/default/examples/rust_book/variable_bindings/variable_bindings.v index eaf8144a8..c4aa20578 100644 --- a/CoqOfRust/examples/default/examples/rust_book/variable_bindings/variable_bindings.v +++ b/CoqOfRust/examples/default/examples/rust_book/variable_bindings/variable_bindings.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/rust_book/variable_bindings/variable_shadowing.v b/CoqOfRust/examples/default/examples/rust_book/variable_bindings/variable_shadowing.v index befc19127..fa0ba90b5 100644 --- a/CoqOfRust/examples/default/examples/rust_book/variable_bindings/variable_shadowing.v +++ b/CoqOfRust/examples/default/examples/rust_book/variable_bindings/variable_shadowing.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* fn main() { diff --git a/CoqOfRust/examples/default/examples/subtle.v b/CoqOfRust/examples/default/examples/subtle.v index df28c0f62..6a4545311 100644 --- a/CoqOfRust/examples/default/examples/subtle.v +++ b/CoqOfRust/examples/default/examples/subtle.v @@ -1,5 +1,6 @@ (* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. (* StructTuple { @@ -62,7 +63,7 @@ Module Impl_core_fmt_Debug_for_subtle_Choice. M.read (| Value.String "Choice" |); (* Unsize *) M.pointer_coercion - (M.alloc (| M.get_struct_tuple_field (M.read (| self |)) "subtle::Choice" 0 |)) + (M.alloc (| M.get_struct_tuple_field (| M.read (| self |), "subtle::Choice", 0 |) |)) ] |))) | _, _ => M.impossible @@ -89,7 +90,7 @@ Module Impl_subtle_Choice. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_tuple_field (M.read (| self |)) "subtle::Choice" 0 |))) + M.read (| M.get_struct_tuple_field (| M.read (| self |), "subtle::Choice", 0 |) |))) | _, _ => M.impossible end. @@ -132,12 +133,20 @@ Module Impl_core_convert_From_subtle_Choice_for_bool. (BinOp.Pure.bit_or (BinOp.Pure.eq (M.read (| - M.get_struct_tuple_field source "subtle::Choice" 0 + M.get_struct_tuple_field (| + source, + "subtle::Choice", + 0 + |) |)) (Value.Integer Integer.U8 0)) (BinOp.Pure.eq (M.read (| - M.get_struct_tuple_field source "subtle::Choice" 0 + M.get_struct_tuple_field (| + source, + "subtle::Choice", + 0 + |) |)) (Value.Integer Integer.U8 1))) |)) in @@ -168,7 +177,7 @@ Module Impl_core_convert_From_subtle_Choice_for_bool. |) in M.alloc (| BinOp.Pure.ne - (M.read (| M.get_struct_tuple_field source "subtle::Choice" 0 |)) + (M.read (| M.get_struct_tuple_field (| source, "subtle::Choice", 0 |) |)) (Value.Integer Integer.U8 0) |) |))) @@ -210,8 +219,8 @@ Module Impl_core_ops_bit_BitAnd_for_subtle_Choice. |), [ BinOp.Pure.bit_and - (M.read (| M.get_struct_tuple_field self "subtle::Choice" 0 |)) - (M.read (| M.get_struct_tuple_field rhs "subtle::Choice" 0 |)) + (M.read (| M.get_struct_tuple_field (| self, "subtle::Choice", 0 |) |)) + (M.read (| M.get_struct_tuple_field (| rhs, "subtle::Choice", 0 |) |)) ] |))) | _, _ => M.impossible @@ -295,8 +304,8 @@ Module Impl_core_ops_bit_BitOr_for_subtle_Choice. |), [ BinOp.Pure.bit_or - (M.read (| M.get_struct_tuple_field self "subtle::Choice" 0 |)) - (M.read (| M.get_struct_tuple_field rhs "subtle::Choice" 0 |)) + (M.read (| M.get_struct_tuple_field (| self, "subtle::Choice", 0 |) |)) + (M.read (| M.get_struct_tuple_field (| rhs, "subtle::Choice", 0 |) |)) ] |))) | _, _ => M.impossible @@ -380,8 +389,8 @@ Module Impl_core_ops_bit_BitXor_for_subtle_Choice. |), [ BinOp.Pure.bit_xor - (M.read (| M.get_struct_tuple_field self "subtle::Choice" 0 |)) - (M.read (| M.get_struct_tuple_field rhs "subtle::Choice" 0 |)) + (M.read (| M.get_struct_tuple_field (| self, "subtle::Choice", 0 |) |)) + (M.read (| M.get_struct_tuple_field (| rhs, "subtle::Choice", 0 |) |)) ] |))) | _, _ => M.impossible @@ -465,7 +474,8 @@ Module Impl_core_ops_bit_Not_for_subtle_Choice. [ BinOp.Pure.bit_and (Value.Integer Integer.U8 1) - (UnOp.Pure.not (M.read (| M.get_struct_tuple_field self "subtle::Choice" 0 |))) + (UnOp.Pure.not + (M.read (| M.get_struct_tuple_field (| self, "subtle::Choice", 0 |) |))) ] |))) | _, _ => M.impossible @@ -2887,8 +2897,8 @@ Module Impl_subtle_ConditionallySelectable_for_subtle_Choice. [] |), [ - M.get_struct_tuple_field (M.read (| a |)) "subtle::Choice" 0; - M.get_struct_tuple_field (M.read (| b |)) "subtle::Choice" 0; + M.get_struct_tuple_field (| M.read (| a |), "subtle::Choice", 0 |); + M.get_struct_tuple_field (| M.read (| b |), "subtle::Choice", 0 |); M.read (| choice |) ] |) @@ -2988,7 +2998,7 @@ Module Impl_core_clone_Clone_where_core_clone_Clone_T_for_subtle_CtOption_T. ("value", M.call_closure (| M.get_trait_method (| "core::clone::Clone", T, [], "clone", [] |), - [ M.get_struct_record_field (M.read (| self |)) "subtle::CtOption" "value" ] + [ M.get_struct_record_field (| M.read (| self |), "subtle::CtOption", "value" |) ] |)); ("is_some", M.call_closure (| @@ -2999,7 +3009,7 @@ Module Impl_core_clone_Clone_where_core_clone_Clone_T_for_subtle_CtOption_T. "clone", [] |), - [ M.get_struct_record_field (M.read (| self |)) "subtle::CtOption" "is_some" ] + [ M.get_struct_record_field (| M.read (| self |), "subtle::CtOption", "is_some" |) ] |)) ])) | _, _ => M.impossible @@ -3049,12 +3059,12 @@ Module Impl_core_fmt_Debug_where_core_fmt_Debug_T_for_subtle_CtOption_T. M.read (| Value.String "value" |); (* Unsize *) M.pointer_coercion - (M.get_struct_record_field (M.read (| self |)) "subtle::CtOption" "value"); + (M.get_struct_record_field (| M.read (| self |), "subtle::CtOption", "value" |)); M.read (| Value.String "is_some" |); (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_record_field (M.read (| self |)) "subtle::CtOption" "is_some" + M.get_struct_record_field (| M.read (| self |), "subtle::CtOption", "is_some" |) |)) ] |))) @@ -3123,7 +3133,11 @@ Module Impl_core_convert_From_subtle_CtOption_T_for_core_option_Option_T. M.alloc (| Value.StructTuple "core::option::Option::Some" - [ M.read (| M.get_struct_record_field source "subtle::CtOption" "value" |) ] + [ + M.read (| + M.get_struct_record_field (| source, "subtle::CtOption", "value" |) + |) + ] |))); fun γ => ltac:(M.monadic (M.alloc (| Value.StructTuple "core::option::Option::None" [] |))) @@ -3191,7 +3205,7 @@ Module Impl_subtle_CtOption_T. M.alloc (| M.call_closure (| M.get_associated_function (| Ty.path "subtle::Choice", "unwrap_u8", [] |), - [ M.get_struct_record_field self "subtle::CtOption" "is_some" ] + [ M.get_struct_record_field (| self, "subtle::CtOption", "is_some" |) ] |) |); M.alloc (| Value.Integer Integer.U8 1 |) @@ -3284,7 +3298,7 @@ Module Impl_subtle_CtOption_T. |))) ] |) in - M.get_struct_record_field self "subtle::CtOption" "value" + M.get_struct_record_field (| self, "subtle::CtOption", "value" |) |))) | _, _ => M.impossible end. @@ -3315,7 +3329,7 @@ Module Impl_subtle_CtOption_T. M.alloc (| M.call_closure (| M.get_associated_function (| Ty.path "subtle::Choice", "unwrap_u8", [] |), - [ M.get_struct_record_field self "subtle::CtOption" "is_some" ] + [ M.get_struct_record_field (| self, "subtle::CtOption", "is_some" |) ] |) |); M.alloc (| Value.Integer Integer.U8 1 |) @@ -3372,7 +3386,7 @@ Module Impl_subtle_CtOption_T. |))) ] |) in - M.get_struct_record_field self "subtle::CtOption" "value" + M.get_struct_record_field (| self, "subtle::CtOption", "value" |) |))) | _, _ => M.impossible end. @@ -3406,8 +3420,8 @@ Module Impl_subtle_CtOption_T. |), [ def; - M.get_struct_record_field self "subtle::CtOption" "value"; - M.read (| M.get_struct_record_field self "subtle::CtOption" "is_some" |) + M.get_struct_record_field (| self, "subtle::CtOption", "value" |); + M.read (| M.get_struct_record_field (| self, "subtle::CtOption", "is_some" |) |) ] |))) | _, _ => M.impossible @@ -3454,8 +3468,8 @@ Module Impl_subtle_CtOption_T. [ M.read (| f |); Value.Tuple [] ] |) |); - M.get_struct_record_field self "subtle::CtOption" "value"; - M.read (| M.get_struct_record_field self "subtle::CtOption" "is_some" |) + M.get_struct_record_field (| self, "subtle::CtOption", "value" |); + M.read (| M.get_struct_record_field (| self, "subtle::CtOption", "is_some" |) |) ] |))) | _, _ => M.impossible @@ -3476,7 +3490,9 @@ Module Impl_subtle_CtOption_T. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_record_field (M.read (| self |)) "subtle::CtOption" "is_some" |))) + M.read (| + M.get_struct_record_field (| M.read (| self |), "subtle::CtOption", "is_some" |) + |))) | _, _ => M.impossible end. @@ -3497,7 +3513,10 @@ Module Impl_subtle_CtOption_T. (let self := M.alloc (| self |) in M.call_closure (| M.get_trait_method (| "core::ops::bit::Not", Ty.path "subtle::Choice", [], "not", [] |), - [ M.read (| M.get_struct_record_field (M.read (| self |)) "subtle::CtOption" "is_some" |) + [ + M.read (| + M.get_struct_record_field (| M.read (| self |), "subtle::CtOption", "is_some" |) + |) ] |))) | _, _ => M.impossible @@ -3560,14 +3579,16 @@ Module Impl_subtle_CtOption_T. [] |) |); - M.get_struct_record_field self "subtle::CtOption" "value"; - M.read (| M.get_struct_record_field self "subtle::CtOption" "is_some" |) + M.get_struct_record_field (| self, "subtle::CtOption", "value" |); + M.read (| + M.get_struct_record_field (| self, "subtle::CtOption", "is_some" |) + |) ] |) ] ] |); - M.read (| M.get_struct_record_field self "subtle::CtOption" "is_some" |) + M.read (| M.get_struct_record_field (| self, "subtle::CtOption", "is_some" |) |) ] |))) | _, _ => M.impossible @@ -3634,8 +3655,10 @@ Module Impl_subtle_CtOption_T. [] |) |); - M.get_struct_record_field self "subtle::CtOption" "value"; - M.read (| M.get_struct_record_field self "subtle::CtOption" "is_some" |) + M.get_struct_record_field (| self, "subtle::CtOption", "value" |); + M.read (| + M.get_struct_record_field (| self, "subtle::CtOption", "is_some" |) + |) ] |) ] @@ -3653,8 +3676,8 @@ Module Impl_subtle_CtOption_T. [] |), [ - M.get_struct_record_field tmp "subtle::CtOption" "is_some"; - M.read (| M.get_struct_record_field self "subtle::CtOption" "is_some" |) + M.get_struct_record_field (| tmp, "subtle::CtOption", "is_some" |); + M.read (| M.get_struct_record_field (| self, "subtle::CtOption", "is_some" |) |) ] |) |) in @@ -3763,8 +3786,8 @@ Module Impl_subtle_ConditionallySelectable_where_subtle_ConditionallySelectable_ [] |), [ - M.get_struct_record_field (M.read (| a |)) "subtle::CtOption" "value"; - M.get_struct_record_field (M.read (| b |)) "subtle::CtOption" "value"; + M.get_struct_record_field (| M.read (| a |), "subtle::CtOption", "value" |); + M.get_struct_record_field (| M.read (| b |), "subtle::CtOption", "value" |); M.read (| choice |) ] |); @@ -3777,8 +3800,8 @@ Module Impl_subtle_ConditionallySelectable_where_subtle_ConditionallySelectable_ [] |), [ - M.get_struct_record_field (M.read (| a |)) "subtle::CtOption" "is_some"; - M.get_struct_record_field (M.read (| b |)) "subtle::CtOption" "is_some"; + M.get_struct_record_field (| M.read (| a |), "subtle::CtOption", "is_some" |); + M.get_struct_record_field (| M.read (| b |), "subtle::CtOption", "is_some" |); M.read (| choice |) ] |) @@ -3869,8 +3892,16 @@ Module Impl_subtle_ConstantTimeEq_where_subtle_ConstantTimeEq_T_for_subtle_CtOpt M.call_closure (| M.get_trait_method (| "subtle::ConstantTimeEq", T, [], "ct_eq", [] |), [ - M.get_struct_record_field (M.read (| self |)) "subtle::CtOption" "value"; - M.get_struct_record_field (M.read (| rhs |)) "subtle::CtOption" "value" + M.get_struct_record_field (| + M.read (| self |), + "subtle::CtOption", + "value" + |); + M.get_struct_record_field (| + M.read (| rhs |), + "subtle::CtOption", + "value" + |) ] |) ] diff --git a/CoqOfRust/typed/M.v b/CoqOfRust/typed/M.v index 5c31c272e..99bd1ae9e 100644 --- a/CoqOfRust/typed/M.v +++ b/CoqOfRust/typed/M.v @@ -133,25 +133,57 @@ Module Pointer. | Immediate v => CoqOfRust.M.Pointer.Address.Immediate (to_value v) | Mutable address => CoqOfRust.M.Pointer.Address.Mutable address end. + + Definition map {A A' : Set} (projection : A -> option A') (address : t A) : option (t A') := + match address with + | Immediate v => + match projection v with + | Some v' => Some (Immediate v') + | None => None + end + | Mutable address => Some (Mutable address) + end. End Address. + (** Information about the origin of the pointer in case of sub-pointer. *) + Module Origin. + Inductive t (A : Set) : Set := + | Make {Big_A : Set} + (big_to_value : Big_A -> Value.t) + (projection : Big_A -> option A) + (injection : Big_A -> A -> option Big_A). + Arguments Make {_ _}. + End Origin. + Inductive t (A : Set) : Set := - | Make {Big_A : Set} - (to_value : Big_A -> Value.t) - (address : Address.t Big_A) - (path : Pointer.Path.t) - (projection : Big_A -> option A) - (injection : Big_A -> A -> option Big_A). - Arguments Make {_ _}. - - Definition map {Big Small : Set} + | Make + (origin : Origin.t A) + (to_value : A -> Value.t) + (address : Address.t A) + (path : Pointer.Path.t). + Arguments Make {_}. + + Definition to_pointer {A : Set} (pointer : t A) : CoqOfRust.M.Pointer.t Value.t := + let 'Make origin to_value address path := pointer in + let 'Origin.Make big_to_value projection injection := origin in + CoqOfRust.M.Pointer.Make + big_to_value + to_value + projection + injection + (Address.to_address to_value address) + path. + + (* Definition map {Big Small : Set} (pointer : t Big) (index : Pointer.Index.t) + (to_value : Small -> Value.t) (projection : Big -> option Small) (injection : Big -> Small -> option Big) : t Small := - let 'Make to_value address path projection' injection' := pointer in + let 'Make big_to_value to_value projection' injection' address path := pointer in Make + big_to_value to_value address (path ++ [index]) @@ -170,7 +202,7 @@ Module Pointer. end | None => None end - ). + ). *) (* Definition to_value_pointer {A : Set} (pointer : t A) : CoqOfRust.M.Pointer.t Value.t := let 'Make address projection injection := pointer in @@ -188,8 +220,15 @@ End Pointer. Module Primitive. Inductive t : Set -> Set := | StateAlloc {A : Set} (to_value : A -> Value.t) (value : A) : t (Pointer.t A) - | StateRead {A : Set} (address : Pointer.Address.t A) : t A - | StateWrite {A : Set} (address : Pointer.Address.t A) (update : A) : t unit + | StateRead {A : Set} (pointer : Pointer.t A) : t A + | StateWrite {A : Set} (pointer : Pointer.t A) (update : A) : t unit + | MakeSubPointer {A A' : Set} + (pointer : Pointer.t A) + (index : Pointer.Index.t) + (to_value : A' -> Value.t) + (projection : A -> option A') + (injection : A -> A' -> option A) : + t (Pointer.t A') | EnvRead {A : Set} : t A. End Primitive. @@ -394,20 +433,16 @@ Definition alloc {A R : Set} `{ToValue A} (value : A) : MBody (Pointer.t A) R := call_primitive (Primitive.StateAlloc φ value). Definition read {A R : Set} (pointer : Pointer.t A) : MBody A R := - let 'Pointer.Make _ address _ injection _ := pointer in - let* value := call_primitive (Primitive.StateRead address) in - match injection value with - | Some sub_value => pure sub_value - | None => impossible - end. + call_primitive (Primitive.StateRead pointer). Definition write {A R : Set} (pointer : Pointer.t A) (update : A) : MBody unit R := - let 'Pointer.Make _ address _ _ projection := pointer in - let* current_value := call_primitive (Primitive.StateRead address) in - match projection current_value update with - | Some updated_value => call_primitive (Primitive.StateWrite address updated_value) - | None => impossible - end. + call_primitive (Primitive.StateWrite pointer update). + +Definition make_sub_pointer {A A' R : Set} `{ToValue A'} + (pointer : Pointer.t A) (index : Pointer.Index.t) + (projection : A -> option A') (injection : A -> A' -> option A) : + MBody (Pointer.t A') R := + call_primitive (Primitive.MakeSubPointer pointer index φ projection injection). Definition copy {A R : Set} `{ToValue A} (p : Pointer.t A) : MBody (Pointer.t A) R := let* v := read p in @@ -485,9 +520,15 @@ Module Run. (k' : Value.t -> CoqOfRust.M.M) (k : Pointer.t B -> MBody A R) : (forall (address : Pointer.Address.t B), + let pointer := + Pointer.Make + (Pointer.Origin.Make φ (fun x => Some x) (fun _ x => Some x)) + φ + address + [] in {{ Address, env_to_value | - k' (Value.Pointer (CoqOfRust.M.Pointer.Make φ (Pointer.Address.to_address φ address) [])) ~ - k (Pointer.Make φ address [] (fun x => Some x) (fun _ x => Some x)) + k' (Value.Pointer (Pointer.to_pointer pointer)) ~ + k pointer }} ) -> {{ Address, env_to_value | @@ -495,10 +536,10 @@ Module Run. LowM.CallPrimitive (Primitive.StateAlloc φ value) k }} | CallPrimitiveStateRead {B : Set} - (to_value : B -> Value.t) - (address : Pointer.Address.t B) + origin to_value address path (k' : Value.t -> CoqOfRust.M.M) (k : B -> MBody A R) : + let pointer : Pointer.t B := Pointer.Make origin to_value address path in (forall (value : B), {{ Address, env_to_value | k' (to_value value) ~ @@ -507,16 +548,16 @@ Module Run. ) -> {{ Address, env_to_value | CoqOfRust.M.LowM.CallPrimitive - (CoqOfRust.M.Primitive.StateRead to_value (Pointer.Address.to_address to_value address)) + (CoqOfRust.M.Primitive.StateRead (Pointer.to_pointer pointer)) k' ~ - LowM.CallPrimitive (Primitive.StateRead address) k + LowM.CallPrimitive (Primitive.StateRead pointer) k }} | CallPrimitiveStateWrite {B : Set} - (to_value : B -> Value.t) - (address : Pointer.Address.t B) + origin to_value address path (update : B) (k' : Value.t -> CoqOfRust.M.M) (k : unit -> MBody A R) : + let pointer : Pointer.t B := Pointer.Make origin to_value address path in {{ Address, env_to_value | k' (Value.Tuple []) ~ k tt @@ -524,12 +565,69 @@ Module Run. {{ Address, env_to_value | CoqOfRust.M.LowM.CallPrimitive (CoqOfRust.M.Primitive.StateWrite - to_value - (Pointer.Address.to_address to_value address) + (Pointer.to_pointer pointer) (to_value update) ) k' ~ - LowM.CallPrimitive (Primitive.StateWrite address update) k + LowM.CallPrimitive (Primitive.StateWrite pointer update) k + }} + | CallPrimitiveMakeSubPointer {Big_B B B' : Set} + (big_to_value : Big_B -> Value.t) projection injection + (to_value : B -> Value.t) address path + index (to_value' : B' -> Value.t) projection' injection' + (address' : Pointer.Address.t B') + (k' : Value.t -> CoqOfRust.M.M) + (k : Pointer.t B' -> MBody A R) : + let origin : Pointer.Origin.t B := Pointer.Origin.Make big_to_value projection injection in + let pointer : Pointer.t B := Pointer.Make origin to_value address path in + let origin' : Pointer.Origin.t B' := + Pointer.Origin.Make + big_to_value + (fun big_b => + match projection big_b with + | Some b => projection' b + | None => None + end) + (fun big_b new_b' => + match projection big_b with + | Some b => + match injection' b new_b' with + | Some new_b => injection big_b new_b + | None => None + end + | None => None + end) in + Pointer.Address.map projection' address = Some address' -> + let pointer' : Pointer.t B' := + Pointer.Make + origin' + to_value' + address' + (path ++ [index]) in + (* Communtativity of the read *) + (forall (b : B) (b' : B'), + Option.map (projection' b) to_value' = + Value.read_path (to_value b) [index] + ) -> + (* Communtativity of the write *) + (forall (b : B) (b' : B'), + Option.map (injection' b b') to_value = + Value.write_value (to_value b) [index] (to_value' b') + ) -> + (forall (value : B), + {{ Address, env_to_value | + k' (Value.Pointer (Pointer.to_pointer pointer')) ~ + k pointer' + }} + ) -> + {{ Address, env_to_value | + CoqOfRust.M.LowM.CallPrimitive + (CoqOfRust.M.Primitive.MakeSubPointer + (Pointer.to_pointer pointer) + index + ) + k' ~ + LowM.CallPrimitive (Primitive.MakeSubPointer pointer index to_value' projection' injection') k }} | CallPrimitiveEnvRead (k' : Value.t -> CoqOfRust.M.M) diff --git a/lib/src/header.rs b/lib/src/header.rs index 9402daf03..a19a4604b 100644 --- a/lib/src/header.rs +++ b/lib/src/header.rs @@ -1,4 +1,5 @@ pub const HEADER: &str = "(* Generated by coq-of-rust *) Require Import CoqOfRust.CoqOfRust. +Import M.Notations. "; diff --git a/lib/src/path.rs b/lib/src/path.rs index 473477df6..58b0f05b0 100644 --- a/lib/src/path.rs +++ b/lib/src/path.rs @@ -106,13 +106,10 @@ pub(crate) fn compile_path(env: &Env, path: &rustc_hir::Path) -> Path { pub(crate) fn compile_qpath(env: &Env, hir_id: HirId, qpath: &QPath) -> Path { let type_check_results = rustc_middle::ty::TypeckResults::new(hir_id.owner); - compile_def_id( - env, - type_check_results - .qpath_res(qpath, hir_id) - .opt_def_id() - .unwrap(), - ) + match type_check_results.qpath_res(qpath, hir_id).opt_def_id() { + Some(def_id) => compile_def_id(env, def_id), + None => Path::new(&["QPath", "without_def_id"]), + } } #[derive(Eq, PartialEq)] diff --git a/lib/src/thir_expression.rs b/lib/src/thir_expression.rs index c5252c0ca..b1ff0a693 100644 --- a/lib/src/thir_expression.rs +++ b/lib/src/thir_expression.rs @@ -693,7 +693,7 @@ pub(crate) fn compile_expr<'a>( Rc::new(Expr::Call { func: Expr::local_var(getter_name), args: vec![base, constructor, index], - kind: CallKind::Pure, + kind: CallKind::Effectful, }) } None => { From 9edaeb7f159abbc982dbd1253480e59198027fff Mon Sep 17 00:00:00 2001 From: Guillaume Claret Date: Tue, 30 Apr 2024 19:13:29 +0200 Subject: [PATCH 6/7] proof of total_supply_run --- CoqOfRust/M.v | 2 + .../examples/ink_contracts/typed/erc20.v | 80 +++++------ CoqOfRust/typed/M.v | 126 ++++++++++-------- 3 files changed, 111 insertions(+), 97 deletions(-) diff --git a/CoqOfRust/M.v b/CoqOfRust/M.v index faa4bb9b0..13876e9e2 100644 --- a/CoqOfRust/M.v +++ b/CoqOfRust/M.v @@ -100,8 +100,10 @@ Module Pointer. Module Address. (** The type [Value] is know just after as [Value.t], but not defined here yet. *) Inductive t (Value : Set) : Set := + | Null | Immediate (value : Value) | Mutable {Address : Set} (address : Address). + Arguments Null {_}. Arguments Immediate {_}. Arguments Mutable {_ _}. End Address. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/typed/erc20.v b/CoqOfRust/examples/default/examples/ink_contracts/typed/erc20.v index 6617459f6..153c52572 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/typed/erc20.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/typed/erc20.v @@ -18,9 +18,11 @@ Module Mapping. End Mapping. Module Impl_erc20_Mapping_K_V. - Parameter get : forall {K V : Set}, Pointer.t (Mapping.t K V) -> Pointer.t K -> M (option V). + Parameter get : forall {K V : Set} `{ToValue K} `{ToValue V}, + Pointer.t (Mapping.t K V) -> Pointer.t K -> M (option V). - Parameter insert : forall {K V : Set}, Pointer.t (Mapping.t K V) -> K -> V -> M unit. + Parameter insert : forall {K V : Set} `{ToValue K} `{ToValue V}, + Pointer.t (Mapping.t K V) -> K -> V -> M unit. End Impl_erc20_Mapping_K_V. Module Balance. @@ -40,30 +42,9 @@ End AccountId. (* TODO: move to the right place *) Module Pointer. Global Instance IsToValue {T : Set} `{ToValue T} : ToValue (Pointer.t T) := { - Φ := Ty.path "erc20::Pointer"; - φ x := - let '(Pointer.Make to_value address path _ _) := x in - Value.Pointer (CoqOfRust.M.Pointer.Make - to_value - (Pointer.Address.to_address to_value address) - path - ); + Φ := Ty.path "erc20::Pointer"; (* TODO *) + φ x := Value.Pointer (Pointer.to_pointer x); }. - - Module Valid. - Inductive t {A : Set} `{ToValue A} : Pointer.t A -> Prop := - | Intro {Big_A : Set} - (to_value : Big_A -> Value.t) - (address : Pointer.Address.t Big_A) - (path : Pointer.Path.t) - (projection : Big_A -> option A) - (injection : Big_A -> A -> option Big_A) : - (forall (value : Big_A), - Value.read_path (to_value value) path = - Option.map (projection value) φ - ) -> - t (Pointer.Make to_value address path projection injection). - End Valid. End Pointer. Module Erc20. @@ -83,22 +64,11 @@ Module Erc20. ]; }. - Definition get_total_supply (self : Pointer.t t) : Pointer.t Balance.t := - Pointer.map self (Pointer.Index.StructRecord "erc20::Erc20" "total_supply") + Definition get_total_supply {R : Set} (self : Pointer.t t) : + MBody (Pointer.t Balance.t) R := + M.make_sub_pointer self (Pointer.Index.StructRecord "erc20::Erc20" "total_supply") (fun x => Some x.(total_supply)) (fun x v => Some (x <| total_supply := v |>)). - - Lemma get_total_supply_is_valid (self : Pointer.t t) - (H_self : Pointer.Valid.t self) : - Pointer.Valid.t (get_total_supply self). - Proof. - destruct H_self. - constructor. - intros. - rewrite Value.read_path_suffix_eq. - rewrite H. - now destruct (projection value). - Qed. End Erc20. Module Impl_erc20_Erc20. @@ -107,11 +77,11 @@ Module Impl_erc20_Erc20. Definition total_supply (self : Pointer.t Self) : M Balance.t := let* self := M.alloc self in let* self := M.read self in - M.read (Erc20.get_total_supply self). + let* self_total_supply := Erc20.get_total_supply self in + M.read self_total_supply. Lemma total_supply_run {Address Env : Set} (env_to_value : Env -> Value.t) - (self : Pointer.t Self) - (H_self : Pointer.Valid.t self) : + (self : Pointer.t Self) : {{ Address, env_to_value | ink_contracts.erc20.Impl_erc20_Erc20.total_supply [] [φ self] ~ total_supply self @@ -119,9 +89,33 @@ Module Impl_erc20_Erc20. Proof. Opaque φ. cbn. - (* destruct self. *) apply Run.CallPrimitiveStateAlloc. intros; cbn. + apply Run.CallPrimitiveStateRead; [reflexivity|]. + intros. + unfold M.get_struct_record_field. + Transparent φ. + cbn. + destruct value, origin. + apply Run.CallPrimitiveMakeSubPointer. + { sfirstorder. } + { sfirstorder. } + unfold M.read; cbn. + apply Run.CallPrimitiveStateRead; [reflexivity|]. + intros. + apply Run.Pure. + reflexivity. + Qed. + destruct value. + apply Run.Pure. + + run_symbolic_state_read. + + apply H. + set (origin := Pointer.Origin.Make _ _ _). + pose proof (H := Run.CallPrimitiveStateRead Address env_to_value origin). + apply H. + apply Run.CallPrimitiveStateRead. intros. unfold M.get_struct_record_field. diff --git a/CoqOfRust/typed/M.v b/CoqOfRust/typed/M.v index 99bd1ae9e..d3498e04b 100644 --- a/CoqOfRust/typed/M.v +++ b/CoqOfRust/typed/M.v @@ -122,26 +122,30 @@ End TupleIsToValue. Module Pointer. Module Address. Inductive t (A : Set) : Set := + | Null | Immediate (value : A) | Mutable {Address : Set} (address : Address). + Arguments Null {_}. Arguments Immediate {_}. Arguments Mutable {_ _}. Definition to_address {A : Set} (to_value : A -> Value.t) (address : t A) : CoqOfRust.M.Pointer.Address.t Value.t := match address with + | Null => CoqOfRust.M.Pointer.Address.Null | Immediate v => CoqOfRust.M.Pointer.Address.Immediate (to_value v) | Mutable address => CoqOfRust.M.Pointer.Address.Mutable address end. - Definition map {A A' : Set} (projection : A -> option A') (address : t A) : option (t A') := + Definition map {A A' : Set} (projection : A -> option A') (address : t A) : t A' := match address with + | Null => Null | Immediate v => match projection v with - | Some v' => Some (Immediate v') - | None => None + | Some v' => Immediate v' + | None => Null (* This is where the null addresses can be created *) end - | Mutable address => Some (Mutable address) + | Mutable address => Mutable address end. End Address. @@ -155,23 +159,22 @@ Module Pointer. Arguments Make {_ _}. End Origin. - Inductive t (A : Set) : Set := + Inductive t (A : Set) `{ToValue A} : Set := | Make (origin : Origin.t A) - (to_value : A -> Value.t) (address : Address.t A) (path : Pointer.Path.t). - Arguments Make {_}. + Arguments Make {_ _}. - Definition to_pointer {A : Set} (pointer : t A) : CoqOfRust.M.Pointer.t Value.t := - let 'Make origin to_value address path := pointer in + Definition to_pointer {A : Set} `{ToValue A} (pointer : t A) : CoqOfRust.M.Pointer.t Value.t := + let 'Make origin address path := pointer in let 'Origin.Make big_to_value projection injection := origin in CoqOfRust.M.Pointer.Make big_to_value - to_value + φ projection injection - (Address.to_address to_value address) + (Address.to_address φ address) path. (* Definition map {Big Small : Set} @@ -219,13 +222,12 @@ End Pointer. Module Primitive. Inductive t : Set -> Set := - | StateAlloc {A : Set} (to_value : A -> Value.t) (value : A) : t (Pointer.t A) - | StateRead {A : Set} (pointer : Pointer.t A) : t A - | StateWrite {A : Set} (pointer : Pointer.t A) (update : A) : t unit - | MakeSubPointer {A A' : Set} + | StateAlloc {A : Set} `{ToValue A} (value : A) : t (Pointer.t A) + | StateRead {A : Set} `{ToValue A} (pointer : Pointer.t A) : t A + | StateWrite {A : Set} `{ToValue A} (pointer : Pointer.t A) (update : A) : t unit + | MakeSubPointer {A A' : Set} `{ToValue A} `{ToValue A'} (pointer : Pointer.t A) (index : Pointer.Index.t) - (to_value : A' -> Value.t) (projection : A -> option A') (injection : A -> A' -> option A) : t (Pointer.t A') @@ -430,19 +432,19 @@ Definition call_primitive {A R : Set} (primitive : Primitive.t A) : MBody A R := LowM.Pure (inl result)). Definition alloc {A R : Set} `{ToValue A} (value : A) : MBody (Pointer.t A) R := - call_primitive (Primitive.StateAlloc φ value). + call_primitive (Primitive.StateAlloc value). -Definition read {A R : Set} (pointer : Pointer.t A) : MBody A R := +Definition read {A R : Set} `{ToValue A} (pointer : Pointer.t A) : MBody A R := call_primitive (Primitive.StateRead pointer). -Definition write {A R : Set} (pointer : Pointer.t A) (update : A) : MBody unit R := +Definition write {A R : Set} `{ToValue A} (pointer : Pointer.t A) (update : A) : MBody unit R := call_primitive (Primitive.StateWrite pointer update). -Definition make_sub_pointer {A A' R : Set} `{ToValue A'} +Definition make_sub_pointer {A A' R : Set} `{ToValue A} `{ToValue A'} (pointer : Pointer.t A) (index : Pointer.Index.t) (projection : A -> option A') (injection : A -> A' -> option A) : MBody (Pointer.t A') R := - call_primitive (Primitive.MakeSubPointer pointer index φ projection injection). + call_primitive (Primitive.MakeSubPointer pointer index projection injection). Definition copy {A R : Set} `{ToValue A} (p : Pointer.t A) : MBody (Pointer.t A) R := let* v := read p in @@ -510,9 +512,12 @@ Module Run. Inductive t (Address : Set) {Env : Set} (env_to_value : Env -> Value.t) {A R : Set} `{ToValue A} `{ToValue R} : CoqOfRust.M.M -> MBody A R -> Prop := - | Pure (result : A + Exception.t R) : + | Pure + (result : A + Exception.t R) + (result' : Value.t + CoqOfRust.M.Exception.t) : + result' = result_to_value φ result -> {{ Address, env_to_value | - CoqOfRust.M.LowM.Pure (result_to_value φ result) ~ + CoqOfRust.M.LowM.Pure result' ~ LowM.Pure result }} | CallPrimitiveStateAlloc {B : Set} `{ToValue B} @@ -523,7 +528,6 @@ Module Run. let pointer := Pointer.Make (Pointer.Origin.Make φ (fun x => Some x) (fun _ x => Some x)) - φ address [] in {{ Address, env_to_value | @@ -533,31 +537,33 @@ Module Run. ) -> {{ Address, env_to_value | CoqOfRust.M.LowM.CallPrimitive (CoqOfRust.M.Primitive.StateAlloc (φ value)) k' ~ - LowM.CallPrimitive (Primitive.StateAlloc φ value) k + LowM.CallPrimitive (Primitive.StateAlloc value) k }} - | CallPrimitiveStateRead {B : Set} - origin to_value address path + | CallPrimitiveStateRead {B : Set} `{ToValue B} + origin address path + pointer' (k' : Value.t -> CoqOfRust.M.M) (k : B -> MBody A R) : - let pointer : Pointer.t B := Pointer.Make origin to_value address path in + let pointer : Pointer.t B := Pointer.Make origin address path in + pointer' = Pointer.to_pointer pointer -> (forall (value : B), {{ Address, env_to_value | - k' (to_value value) ~ + k' (φ value) ~ k value }} ) -> {{ Address, env_to_value | CoqOfRust.M.LowM.CallPrimitive - (CoqOfRust.M.Primitive.StateRead (Pointer.to_pointer pointer)) + (CoqOfRust.M.Primitive.StateRead pointer') k' ~ LowM.CallPrimitive (Primitive.StateRead pointer) k }} - | CallPrimitiveStateWrite {B : Set} - origin to_value address path + | CallPrimitiveStateWrite {B : Set} `{ToValue B} + origin address path (update : B) (k' : Value.t -> CoqOfRust.M.M) (k : unit -> MBody A R) : - let pointer : Pointer.t B := Pointer.Make origin to_value address path in + let pointer : Pointer.t B := Pointer.Make origin address path in {{ Address, env_to_value | k' (Value.Tuple []) ~ k tt @@ -566,20 +572,19 @@ Module Run. CoqOfRust.M.LowM.CallPrimitive (CoqOfRust.M.Primitive.StateWrite (Pointer.to_pointer pointer) - (to_value update) + (φ update) ) k' ~ LowM.CallPrimitive (Primitive.StateWrite pointer update) k }} - | CallPrimitiveMakeSubPointer {Big_B B B' : Set} + | CallPrimitiveMakeSubPointer {Big_B B B' : Set} `{ToValue B} `{ToValue B'} (big_to_value : Big_B -> Value.t) projection injection - (to_value : B -> Value.t) address path - index (to_value' : B' -> Value.t) projection' injection' - (address' : Pointer.Address.t B') + address path + index projection' injection' (k' : Value.t -> CoqOfRust.M.M) (k : Pointer.t B' -> MBody A R) : let origin : Pointer.Origin.t B := Pointer.Origin.Make big_to_value projection injection in - let pointer : Pointer.t B := Pointer.Make origin to_value address path in + let pointer : Pointer.t B := Pointer.Make origin address path in let origin' : Pointer.Origin.t B' := Pointer.Origin.Make big_to_value @@ -597,29 +602,25 @@ Module Run. end | None => None end) in - Pointer.Address.map projection' address = Some address' -> let pointer' : Pointer.t B' := Pointer.Make origin' - to_value' - address' + (Pointer.Address.map projection' address) (path ++ [index]) in (* Communtativity of the read *) - (forall (b : B) (b' : B'), - Option.map (projection' b) to_value' = - Value.read_path (to_value b) [index] + (forall (b : B), + Option.map (projection' b) φ = + Value.read_path (φ b) [index] ) -> (* Communtativity of the write *) (forall (b : B) (b' : B'), - Option.map (injection' b b') to_value = - Value.write_value (to_value b) [index] (to_value' b') - ) -> - (forall (value : B), - {{ Address, env_to_value | - k' (Value.Pointer (Pointer.to_pointer pointer')) ~ - k pointer' - }} + Option.map (injection' b b') φ = + Value.write_value (φ b) [index] (φ b') ) -> + {{ Address, env_to_value | + k' (Value.Pointer (Pointer.to_pointer pointer')) ~ + k pointer' + }} -> {{ Address, env_to_value | CoqOfRust.M.LowM.CallPrimitive (CoqOfRust.M.Primitive.MakeSubPointer @@ -627,7 +628,7 @@ Module Run. index ) k' ~ - LowM.CallPrimitive (Primitive.MakeSubPointer pointer index to_value' projection' injection') k + LowM.CallPrimitive (Primitive.MakeSubPointer pointer index projection' injection') k }} | CallPrimitiveEnvRead (k' : Value.t -> CoqOfRust.M.M) @@ -664,6 +665,23 @@ Module Run. (t Address env_to_value untyped typed). End Run. +Import Run. + +Ltac run_symbolic_state_read := + match goal with + | |- {{ ?Address, ?env_to_value | + CoqOfRust.M.LowM.CallPrimitive + (CoqOfRust.M.Primitive.StateRead ?pointer') + ?k' ~ + LowM.CallPrimitive (Primitive.StateRead (Pointer.Make ?origin ?address ?path)) ?k + }} => + let H := fresh "H" in + pose proof (H := + Run.CallPrimitiveStateRead Address env_to_value origin address path k' k + ); + apply H; + clear H + end. (* Ltac run_symbolic_state_read := match goal with From c4785dc7c168f57eb3f389c3857e5ec3d34c1372 Mon Sep 17 00:00:00 2001 From: Guillaume Claret Date: Wed, 1 May 2024 23:56:32 +0200 Subject: [PATCH 7/7] more wip --- CoqOfRust/M.v | 22 +- CoqOfRust/blacklist.txt | 3 + .../examples/custom/constructor_as_function.v | 7 +- .../custom/polymorphic_associated_function.v | 14 +- .../ink_contracts/basic_contract_caller.v | 39 +- .../ink_contracts/conditional_compilation.v | 87 ++-- .../ink_contracts/contract_terminate.v | 5 +- .../ink_contracts/contract_transfer.v | 5 +- .../examples/ink_contracts/custom_allocator.v | 21 +- .../ink_contracts/custom_environment.v | 5 +- .../default/examples/ink_contracts/dns.v | 84 ++-- .../default/examples/ink_contracts/erc1155.v | 120 +++-- .../default/examples/ink_contracts/erc20.v | 44 +- .../default/examples/ink_contracts/erc721.v | 98 ++-- .../default/examples/ink_contracts/flipper.v | 15 +- .../examples/ink_contracts/incrementer.v | 12 +- .../constructors_return_value.v | 7 +- .../lang_err_integration_tests/contract_ref.v | 33 +- .../integration_flipper.v | 19 +- .../ink_contracts/mapping_integration_tests.v | 49 +- .../default/examples/ink_contracts/mother.v | 162 ++++-- .../default/examples/ink_contracts/multisig.v | 463 +++++++++--------- .../examples/ink_contracts/payment_channel.v | 191 ++++---- .../examples/ink_contracts/set_code_hash.v | 21 +- .../set_code_hash/updated_incrementer.v | 23 +- .../examples/ink_contracts/trait_erc20.v | 50 +- .../examples/ink_contracts/trait_flipper.v | 17 +- .../ink_contracts/trait_incrementer.v | 21 +- .../examples/ink_contracts/typed/erc20.v | 67 +-- .../monadic_transformation/example05.v | 2 +- .../conversion/converting_to_string.v | 7 +- .../conversion/try_from_and_try_into.v | 19 +- .../rust_book/custom_types/structures.v | 52 +- .../error_handling/combinators_map.v | 15 +- .../unpacking_options_via_question_mark.v | 265 +++++----- .../expressions/const_underscore_expression.v | 5 +- .../associated_functions_and_methods.v | 99 ++-- .../generics_associated_types_problem.v | 28 +- .../generics_associated_types_solution.v | 35 +- .../rust_book/generics/generics_bounds.v | 28 +- .../generics/generics_implementation.v | 12 +- .../generics/generics_new_type_idiom.v | 17 +- .../generics_new_type_idiom_as_base_type.v | 5 +- .../generics/generics_phantom_type.v | 56 +-- ...hantom_type_test_case_unit_clarification.v | 72 +-- .../rust_book/modules/struct_visibility.v | 9 +- .../examples/rust_book/primitives/tuples.v | 22 +- .../scoping_rules_borrowing_aliasing.v | 129 ++--- .../scoping_rules_borrowing_mutablity.v | 43 +- .../scoping_rules_borrowing_the_ref_pattern.v | 36 +- .../scoping_rules_lifetimes_bounds.v | 7 +- .../scoping_rules_lifetimes_methods.v | 16 +- .../scoping_rules_lifetimes_structs.v | 21 +- .../scoping_rules_lifetimes_traits.v | 7 +- ..._rules_ownership_and_rules_partial_moves.v | 27 +- .../std_library_types/box_stack_heap.v | 10 +- .../hash_map_alternate_or_custom_key_types.v | 72 +-- .../rust_book/std_misc/child_processes.v | 19 +- .../std_misc/child_processes_pipes.v | 10 +- .../std_misc/foreign_function_interface.v | 43 +- .../default/examples/rust_book/traits/clone.v | 16 +- .../examples/rust_book/traits/derive.v | 29 +- .../disambiguating_overlapping_traits.v | 14 +- .../default/examples/rust_book/traits/drop.v | 7 +- .../default/examples/rust_book/traits/hash.v | 15 +- .../examples/rust_book/traits/iterators.v | 25 +- .../examples/rust_book/traits/traits.v | 33 +- CoqOfRust/examples/default/examples/subtle.v | 206 ++++++-- CoqOfRust/typed/M.v | 89 ++-- lib/src/thir_expression.rs | 10 +- 70 files changed, 1880 insertions(+), 1456 deletions(-) diff --git a/CoqOfRust/M.v b/CoqOfRust/M.v index 13876e9e2..3a87593b8 100644 --- a/CoqOfRust/M.v +++ b/CoqOfRust/M.v @@ -697,6 +697,9 @@ Definition never_to_any (x : Value.t) : M := Definition use (x : Value.t) : Value.t := x. +Definition closure (f : list Value.t -> M) : Value.t := + Value.Closure (existS (Value.t, M) f). + (** An error should not occur as we statically know the number of fields in a tuple, but the code for the error branch is still there for typing and debugging reasons. *) @@ -737,7 +740,7 @@ Parameter get_array_field : forall (value : Value.t) (index : Value.t), M. | _ => pure (Value.Error "Expected a usize as an array index") end. *) -Parameter get_struct_tuple_field : forall (value : Value.t) (constructor : string) (index : Z), M. +Parameter get_struct_tuple_field : forall (constructor : string) (index : Z), Value.t. (* Definition get_struct_tuple_field (value : Value.t) (constructor : string) (index : Z) : Value.t := @@ -763,13 +766,19 @@ Parameter get_struct_tuple_field : forall (value : Value.t) (constructor : strin | _ => Value.Error "expected an address" end. *) -Definition get_struct_record_field (value : Value.t) (constructor field : string) : M := - match value with - | Value.Pointer pointer => - call_primitive (Primitive.MakeSubPointer pointer (Pointer.Index.StructRecord constructor field)) +Definition get_struct_record_field_closure (constructor field : string) (args : list Value.t) : M := + match args with + | [Value.Pointer pointer] => + call_primitive (Primitive.MakeSubPointer + pointer + (Pointer.Index.StructRecord constructor field) + ) | _ => impossible end. +Definition get_struct_record_field (constructor field : string) : Value.t := + closure (get_struct_record_field_closure constructor field). + Parameter pointer_coercion : Value.t -> Value.t. Definition get_struct_tuple_field_or_break_match @@ -872,9 +881,6 @@ Parameter get_slice_rest_or_break_match : integers. *) Parameter rust_cast : Value.t -> Value.t. -Definition closure (f : list Value.t -> M) : Value.t := - Value.Closure (existS (Value.t, M) f). - Definition constructor_as_closure (constructor : string) : Value.t := closure (fun args => pure (Value.StructTuple constructor args)). diff --git a/CoqOfRust/blacklist.txt b/CoqOfRust/blacklist.txt index 6d1a02d7e..26a62706b 100644 --- a/CoqOfRust/blacklist.txt +++ b/CoqOfRust/blacklist.txt @@ -1,3 +1,6 @@ +alloc/ +core/ +move/ alloc/boxed.v core/any.v core/array/mod.v diff --git a/CoqOfRust/examples/default/examples/custom/constructor_as_function.v b/CoqOfRust/examples/default/examples/custom/constructor_as_function.v index 1f4ee20e4..e3662024b 100644 --- a/CoqOfRust/examples/default/examples/custom/constructor_as_function.v +++ b/CoqOfRust/examples/default/examples/custom/constructor_as_function.v @@ -74,10 +74,9 @@ Module Impl_core_fmt_Debug_for_constructor_as_function_Constructor. (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_tuple_field (| - M.read (| self |), - "constructor_as_function::Constructor", - 0 + M.call_closure (| + M.get_struct_tuple_field "constructor_as_function::Constructor" 0, + [ M.read (| self |) ] |) |)) ] diff --git a/CoqOfRust/examples/default/examples/custom/polymorphic_associated_function.v b/CoqOfRust/examples/default/examples/custom/polymorphic_associated_function.v index 7f47ee7ec..d69041cbb 100644 --- a/CoqOfRust/examples/default/examples/custom/polymorphic_associated_function.v +++ b/CoqOfRust/examples/default/examples/custom/polymorphic_associated_function.v @@ -34,10 +34,9 @@ Module Impl_polymorphic_associated_function_Foo_A. M.get_trait_method (| "core::convert::Into", A, [ B ], "into", [] |), [ M.read (| - M.get_struct_record_field (| - self, - "polymorphic_associated_function::Foo", - "data" + M.call_closure (| + M.get_struct_record_field "polymorphic_associated_function::Foo" "data", + [ self ] |) |) ] @@ -86,10 +85,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (| Value.Tuple [ - M.get_struct_record_field (| - bar, - "polymorphic_associated_function::Foo", - "data" + M.call_closure (| + M.get_struct_record_field "polymorphic_associated_function::Foo" "data", + [ bar ] |); UnsupportedLiteral ] diff --git a/CoqOfRust/examples/default/examples/ink_contracts/basic_contract_caller.v b/CoqOfRust/examples/default/examples/ink_contracts/basic_contract_caller.v index d0ef3f54b..097ca71d0 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/basic_contract_caller.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/basic_contract_caller.v @@ -121,17 +121,15 @@ Module Impl_basic_contract_caller_OtherContract. M.read (| let _ := M.write (| - M.get_struct_record_field (| - M.read (| self |), - "basic_contract_caller::OtherContract", - "value" + M.call_closure (| + M.get_struct_record_field "basic_contract_caller::OtherContract" "value", + [ M.read (| self |) ] |), UnOp.Pure.not (M.read (| - M.get_struct_record_field (| - M.read (| self |), - "basic_contract_caller::OtherContract", - "value" + M.call_closure (| + M.get_struct_record_field "basic_contract_caller::OtherContract" "value", + [ M.read (| self |) ] |) |)) |) in @@ -153,10 +151,9 @@ Module Impl_basic_contract_caller_OtherContract. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| - M.read (| self |), - "basic_contract_caller::OtherContract", - "value" + M.call_closure (| + M.get_struct_record_field "basic_contract_caller::OtherContract" "value", + [ M.read (| self |) ] |) |))) | _, _ => M.impossible @@ -234,10 +231,11 @@ Module Impl_basic_contract_caller_BasicContractCaller. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "basic_contract_caller::BasicContractCaller", - "other_contract" + M.call_closure (| + M.get_struct_record_field + "basic_contract_caller::BasicContractCaller" + "other_contract", + [ M.read (| self |) ] |) ] |) @@ -250,10 +248,11 @@ Module Impl_basic_contract_caller_BasicContractCaller. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "basic_contract_caller::BasicContractCaller", - "other_contract" + M.call_closure (| + M.get_struct_record_field + "basic_contract_caller::BasicContractCaller" + "other_contract", + [ M.read (| self |) ] |) ] |) diff --git a/CoqOfRust/examples/default/examples/ink_contracts/conditional_compilation.v b/CoqOfRust/examples/default/examples/ink_contracts/conditional_compilation.v index 79a7c717c..0cb810444 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/conditional_compilation.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/conditional_compilation.v @@ -137,10 +137,9 @@ Module Impl_conditional_compilation_Env. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| - M.read (| self |), - "conditional_compilation::Env", - "caller" + M.call_closure (| + M.get_struct_record_field "conditional_compilation::Env" "caller", + [ M.read (| self |) ] |) |))) | _, _ => M.impossible @@ -312,17 +311,17 @@ Module Impl_conditional_compilation_ConditionalCompilation. M.read (| let _ := M.write (| - M.get_struct_record_field (| - M.read (| self |), - "conditional_compilation::ConditionalCompilation", - "value" + M.call_closure (| + M.get_struct_record_field "conditional_compilation::ConditionalCompilation" "value", + [ M.read (| self |) ] |), UnOp.Pure.not (M.read (| - M.get_struct_record_field (| - M.read (| self |), - "conditional_compilation::ConditionalCompilation", - "value" + M.call_closure (| + M.get_struct_record_field + "conditional_compilation::ConditionalCompilation" + "value", + [ M.read (| self |) ] |) |)) |) in @@ -375,10 +374,11 @@ Module Impl_conditional_compilation_ConditionalCompilation. [ ("new_value", M.read (| - M.get_struct_record_field (| - M.read (| self |), - "conditional_compilation::ConditionalCompilation", - "value" + M.call_closure (| + M.get_struct_record_field + "conditional_compilation::ConditionalCompilation" + "value", + [ M.read (| self |) ] |) |)); ("by_", M.read (| caller |)) @@ -459,17 +459,17 @@ Module Impl_conditional_compilation_ConditionalCompilation. |) in let _ := M.write (| - M.get_struct_record_field (| - M.read (| self |), - "conditional_compilation::ConditionalCompilation", - "value" + M.call_closure (| + M.get_struct_record_field "conditional_compilation::ConditionalCompilation" "value", + [ M.read (| self |) ] |), UnOp.Pure.not (M.read (| - M.get_struct_record_field (| - M.read (| self |), - "conditional_compilation::ConditionalCompilation", - "value" + M.call_closure (| + M.get_struct_record_field + "conditional_compilation::ConditionalCompilation" + "value", + [ M.read (| self |) ] |) |)) |) in @@ -500,10 +500,11 @@ Module Impl_conditional_compilation_ConditionalCompilation. [ ("new_value", M.read (| - M.get_struct_record_field (| - M.read (| self |), - "conditional_compilation::ConditionalCompilation", - "value" + M.call_closure (| + M.get_struct_record_field + "conditional_compilation::ConditionalCompilation" + "value", + [ M.read (| self |) ] |) |)); ("by_", M.read (| caller |)); @@ -538,17 +539,17 @@ Module Impl_conditional_compilation_Flip_for_conditional_compilation_Conditional M.read (| let _ := M.write (| - M.get_struct_record_field (| - M.read (| self |), - "conditional_compilation::ConditionalCompilation", - "value" + M.call_closure (| + M.get_struct_record_field "conditional_compilation::ConditionalCompilation" "value", + [ M.read (| self |) ] |), UnOp.Pure.not (M.read (| - M.get_struct_record_field (| - M.read (| self |), - "conditional_compilation::ConditionalCompilation", - "value" + M.call_closure (| + M.get_struct_record_field + "conditional_compilation::ConditionalCompilation" + "value", + [ M.read (| self |) ] |) |)) |) in @@ -568,10 +569,9 @@ Module Impl_conditional_compilation_Flip_for_conditional_compilation_Conditional ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| - M.read (| self |), - "conditional_compilation::ConditionalCompilation", - "value" + M.call_closure (| + M.get_struct_record_field "conditional_compilation::ConditionalCompilation" "value", + [ M.read (| self |) ] |) |))) | _, _ => M.impossible @@ -647,10 +647,9 @@ Module Impl_conditional_compilation_Flip_for_conditional_compilation_Conditional |) in let _ := M.write (| - M.get_struct_record_field (| - M.read (| self |), - "conditional_compilation::ConditionalCompilation", - "value" + M.call_closure (| + M.get_struct_record_field "conditional_compilation::ConditionalCompilation" "value", + [ M.read (| self |) ] |), M.read (| value |) |) in diff --git a/CoqOfRust/examples/default/examples/ink_contracts/contract_terminate.v b/CoqOfRust/examples/default/examples/ink_contracts/contract_terminate.v index e652ad678..1ce624e63 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/contract_terminate.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/contract_terminate.v @@ -90,7 +90,10 @@ Module Impl_contract_terminate_Env. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| M.read (| self |), "contract_terminate::Env", "caller" |) + M.call_closure (| + M.get_struct_record_field "contract_terminate::Env" "caller", + [ M.read (| self |) ] + |) |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/contract_transfer.v b/CoqOfRust/examples/default/examples/ink_contracts/contract_transfer.v index 7c4d6a2e8..a5bd442f9 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/contract_transfer.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/contract_transfer.v @@ -92,7 +92,10 @@ Module Impl_contract_transfer_Env. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| M.read (| self |), "contract_transfer::Env", "caller" |) + M.call_closure (| + M.get_struct_record_field "contract_transfer::Env" "caller", + [ M.read (| self |) ] + |) |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/custom_allocator.v b/CoqOfRust/examples/default/examples/ink_contracts/custom_allocator.v index 126d8895b..7fd7ebb5f 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/custom_allocator.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/custom_allocator.v @@ -111,10 +111,9 @@ Module Impl_custom_allocator_CustomAllocator. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "custom_allocator::CustomAllocator", - "value" + M.call_closure (| + M.get_struct_record_field "custom_allocator::CustomAllocator" "value", + [ M.read (| self |) ] |); Value.Integer Integer.Usize 0 ] @@ -132,10 +131,9 @@ Module Impl_custom_allocator_CustomAllocator. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "custom_allocator::CustomAllocator", - "value" + M.call_closure (| + M.get_struct_record_field "custom_allocator::CustomAllocator" "value", + [ M.read (| self |) ] |); Value.Integer Integer.Usize 0 ] @@ -171,10 +169,9 @@ Module Impl_custom_allocator_CustomAllocator. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "custom_allocator::CustomAllocator", - "value" + M.call_closure (| + M.get_struct_record_field "custom_allocator::CustomAllocator" "value", + [ M.read (| self |) ] |); Value.Integer Integer.Usize 0 ] diff --git a/CoqOfRust/examples/default/examples/ink_contracts/custom_environment.v b/CoqOfRust/examples/default/examples/ink_contracts/custom_environment.v index e00e79148..ba27b9d0f 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/custom_environment.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/custom_environment.v @@ -224,7 +224,10 @@ Module Impl_custom_environment_Env. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| M.read (| self |), "custom_environment::Env", "caller" |) + M.call_closure (| + M.get_struct_record_field "custom_environment::Env" "caller", + [ M.read (| self |) ] + |) |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/dns.v b/CoqOfRust/examples/default/examples/ink_contracts/dns.v index d90a04aee..0dcd1c708 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/dns.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/dns.v @@ -230,8 +230,12 @@ Module Impl_core_cmp_PartialEq_for_dns_AccountId. (let self := M.alloc (| self |) in let other := M.alloc (| other |) in BinOp.Pure.eq - (M.read (| M.get_struct_tuple_field (| M.read (| self |), "dns::AccountId", 0 |) |)) - (M.read (| M.get_struct_tuple_field (| M.read (| other |), "dns::AccountId", 0 |) |)))) + (M.read (| + M.call_closure (| M.get_struct_tuple_field "dns::AccountId" 0, [ M.read (| self |) ] |) + |)) + (M.read (| + M.call_closure (| M.get_struct_tuple_field "dns::AccountId" 0, [ M.read (| other |) ] |) + |)))) | _, _ => M.impossible end. @@ -344,7 +348,9 @@ Module Impl_dns_Env. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_record_field (| M.read (| self |), "dns::Env", "caller" |) |))) + M.read (| + M.call_closure (| M.get_struct_record_field "dns::Env" "caller", [ M.read (| self |) ] |) + |))) | _, _ => M.impossible end. @@ -752,10 +758,11 @@ Module Impl_dns_DomainNameService. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "dns::DomainNameService", - "name_to_owner" + M.call_closure (| + M.get_struct_record_field + "dns::DomainNameService" + "name_to_owner", + [ M.read (| self |) ] |); name ] @@ -788,10 +795,9 @@ Module Impl_dns_DomainNameService. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "dns::DomainNameService", - "name_to_owner" + M.call_closure (| + M.get_struct_record_field "dns::DomainNameService" "name_to_owner", + [ M.read (| self |) ] |); M.read (| name |); M.read (| caller |) @@ -860,19 +866,17 @@ Module Impl_dns_DomainNameService. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "dns::DomainNameService", - "name_to_owner" + M.call_closure (| + M.get_struct_record_field "dns::DomainNameService" "name_to_owner", + [ M.read (| self |) ] |); name ] |); M.read (| - M.get_struct_record_field (| - M.read (| self |), - "dns::DomainNameService", - "default_address" + M.call_closure (| + M.get_struct_record_field "dns::DomainNameService" "default_address", + [ M.read (| self |) ] |) |) ] @@ -989,10 +993,9 @@ Module Impl_dns_DomainNameService. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "dns::DomainNameService", - "name_to_address" + M.call_closure (| + M.get_struct_record_field "dns::DomainNameService" "name_to_address", + [ M.read (| self |) ] |); name ] @@ -1009,10 +1012,9 @@ Module Impl_dns_DomainNameService. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "dns::DomainNameService", - "name_to_address" + M.call_closure (| + M.get_struct_record_field "dns::DomainNameService" "name_to_address", + [ M.read (| self |) ] |); M.read (| name |); M.read (| new_address |) @@ -1164,10 +1166,9 @@ Module Impl_dns_DomainNameService. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "dns::DomainNameService", - "name_to_owner" + M.call_closure (| + M.get_struct_record_field "dns::DomainNameService" "name_to_owner", + [ M.read (| self |) ] |); name ] @@ -1184,10 +1185,9 @@ Module Impl_dns_DomainNameService. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "dns::DomainNameService", - "name_to_owner" + M.call_closure (| + M.get_struct_record_field "dns::DomainNameService" "name_to_owner", + [ M.read (| self |) ] |); M.read (| name |); M.read (| to |) @@ -1261,19 +1261,17 @@ Module Impl_dns_DomainNameService. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "dns::DomainNameService", - "name_to_address" + M.call_closure (| + M.get_struct_record_field "dns::DomainNameService" "name_to_address", + [ M.read (| self |) ] |); name ] |); M.read (| - M.get_struct_record_field (| - M.read (| self |), - "dns::DomainNameService", - "default_address" + M.call_closure (| + M.get_struct_record_field "dns::DomainNameService" "default_address", + [ M.read (| self |) ] |) |) ] diff --git a/CoqOfRust/examples/default/examples/ink_contracts/erc1155.v b/CoqOfRust/examples/default/examples/ink_contracts/erc1155.v index fef579b4d..6d87ac812 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/erc1155.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/erc1155.v @@ -219,9 +219,17 @@ Module Impl_core_cmp_PartialEq_for_erc1155_AccountId. (let self := M.alloc (| self |) in let other := M.alloc (| other |) in BinOp.Pure.eq - (M.read (| M.get_struct_tuple_field (| M.read (| self |), "erc1155::AccountId", 0 |) |)) (M.read (| - M.get_struct_tuple_field (| M.read (| other |), "erc1155::AccountId", 0 |) + M.call_closure (| + M.get_struct_tuple_field "erc1155::AccountId" 0, + [ M.read (| self |) ] + |) + |)) + (M.read (| + M.call_closure (| + M.get_struct_tuple_field "erc1155::AccountId" 0, + [ M.read (| other |) ] + |) |)))) | _, _ => M.impossible end. @@ -525,7 +533,12 @@ Module Impl_erc1155_Env. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_record_field (| M.read (| self |), "erc1155::Env", "caller" |) |))) + M.read (| + M.call_closure (| + M.get_struct_record_field "erc1155::Env" "caller", + [ M.read (| self |) ] + |) + |))) | _, _ => M.impossible end. @@ -722,10 +735,9 @@ Module Impl_erc1155_Contract. |) in let _ := let β := - M.get_struct_record_field (| - M.read (| self |), - "erc1155::Contract", - "token_id_nonce" + M.call_closure (| + M.get_struct_record_field "erc1155::Contract" "token_id_nonce", + [ M.read (| self |) ] |) in M.write (| β, BinOp.Panic.add (| M.read (| β |), Value.Integer Integer.U128 1 |) |) in let _ := @@ -739,19 +751,17 @@ Module Impl_erc1155_Contract. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "erc1155::Contract", - "balances" + M.call_closure (| + M.get_struct_record_field "erc1155::Contract" "balances", + [ M.read (| self |) ] |); Value.Tuple [ M.read (| caller |); M.read (| - M.get_struct_record_field (| - M.read (| self |), - "erc1155::Contract", - "token_id_nonce" + M.call_closure (| + M.get_struct_record_field "erc1155::Contract" "token_id_nonce", + [ M.read (| self |) ] |) |) ]; @@ -813,10 +823,9 @@ Module Impl_erc1155_Contract. |)); ("token_id", M.read (| - M.get_struct_record_field (| - M.read (| self |), - "erc1155::Contract", - "token_id_nonce" + M.call_closure (| + M.get_struct_record_field "erc1155::Contract" "token_id_nonce", + [ M.read (| self |) ] |) |)); ("value", M.read (| value |)) @@ -825,7 +834,10 @@ Module Impl_erc1155_Contract. ] |) |) in - M.get_struct_record_field (| M.read (| self |), "erc1155::Contract", "token_id_nonce" |) + M.call_closure (| + M.get_struct_record_field "erc1155::Contract" "token_id_nonce", + [ M.read (| self |) ] + |) |))) | _, _ => M.impossible end. @@ -874,10 +886,11 @@ Module Impl_erc1155_Contract. (BinOp.Pure.le (M.read (| token_id |)) (M.read (| - M.get_struct_record_field (| - M.read (| self |), - "erc1155::Contract", - "token_id_nonce" + M.call_closure (| + M.get_struct_record_field + "erc1155::Contract" + "token_id_nonce", + [ M.read (| self |) ] |) |))) |)) in @@ -934,10 +947,9 @@ Module Impl_erc1155_Contract. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "erc1155::Contract", - "balances" + M.call_closure (| + M.get_struct_record_field "erc1155::Contract" "balances", + [ M.read (| self |) ] |); Value.Tuple [ M.read (| caller |); M.read (| token_id |) ]; M.read (| value |) @@ -1043,10 +1055,9 @@ Module Impl_erc1155_Contract. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "erc1155::Contract", - "balances" + M.call_closure (| + M.get_struct_record_field "erc1155::Contract" "balances", + [ M.read (| self |) ] |); M.alloc (| Value.Tuple [ M.read (| from |); M.read (| token_id |) ] |) ] @@ -1071,10 +1082,9 @@ Module Impl_erc1155_Contract. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "erc1155::Contract", - "balances" + M.call_closure (| + M.get_struct_record_field "erc1155::Contract" "balances", + [ M.read (| self |) ] |); Value.Tuple [ M.read (| from |); M.read (| token_id |) ]; M.read (| sender_balance |) @@ -1100,10 +1110,9 @@ Module Impl_erc1155_Contract. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "erc1155::Contract", - "balances" + M.call_closure (| + M.get_struct_record_field "erc1155::Contract" "balances", + [ M.read (| self |) ] |); M.alloc (| Value.Tuple [ M.read (| to |); M.read (| token_id |) ] |) ] @@ -1126,10 +1135,9 @@ Module Impl_erc1155_Contract. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "erc1155::Contract", - "balances" + M.call_closure (| + M.get_struct_record_field "erc1155::Contract" "balances", + [ M.read (| self |) ] |); Value.Tuple [ M.read (| to |); M.read (| token_id |) ]; M.read (| recipient_balance |) @@ -1305,7 +1313,10 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. [] |), [ - M.get_struct_record_field (| M.read (| self |), "erc1155::Contract", "approvals" |); + M.call_closure (| + M.get_struct_record_field "erc1155::Contract" "approvals", + [ M.read (| self |) ] + |); M.alloc (| Value.Tuple [ M.read (| owner |); M.read (| operator |) ] |) ] |))) @@ -1340,7 +1351,10 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. [] |), [ - M.get_struct_record_field (| M.read (| self |), "erc1155::Contract", "balances" |); + M.call_closure (| + M.get_struct_record_field "erc1155::Contract" "balances", + [ M.read (| self |) ] + |); M.alloc (| Value.Tuple [ M.read (| owner |); M.read (| token_id |) ] |) ] |); @@ -2623,10 +2637,9 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "erc1155::Contract", - "approvals" + M.call_closure (| + M.get_struct_record_field "erc1155::Contract" "approvals", + [ M.read (| self |) ] |); Value.Tuple [ M.read (| caller |); M.read (| operator |) ]; Value.Tuple [] @@ -2652,10 +2665,9 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "erc1155::Contract", - "approvals" + M.call_closure (| + M.get_struct_record_field "erc1155::Contract" "approvals", + [ M.read (| self |) ] |); Value.Tuple [ M.read (| caller |); M.read (| operator |) ] ] diff --git a/CoqOfRust/examples/default/examples/ink_contracts/erc20.v b/CoqOfRust/examples/default/examples/ink_contracts/erc20.v index 423e500f7..3b5d2da93 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/erc20.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/erc20.v @@ -323,7 +323,12 @@ Module Impl_erc20_Env. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_record_field (| M.read (| self |), "erc20::Env", "caller" |) |))) + M.read (| + M.call_closure (| + M.get_struct_record_field "erc20::Env" "caller", + [ M.read (| self |) ] + |) + |))) | _, _ => M.impossible end. @@ -501,7 +506,10 @@ Module Impl_erc20_Erc20. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| M.read (| self |), "erc20::Erc20", "total_supply" |) + M.call_closure (| + M.get_struct_record_field "erc20::Erc20" "total_supply", + [ M.read (| self |) ] + |) |))) | _, _ => M.impossible end. @@ -533,7 +541,10 @@ Module Impl_erc20_Erc20. [] |), [ - M.get_struct_record_field (| M.read (| self |), "erc20::Erc20", "balances" |); + M.call_closure (| + M.get_struct_record_field "erc20::Erc20" "balances", + [ M.read (| self |) ] + |); M.read (| owner |) ] |) @@ -596,7 +607,10 @@ Module Impl_erc20_Erc20. [] |), [ - M.get_struct_record_field (| M.read (| self |), "erc20::Erc20", "allowances" |); + M.call_closure (| + M.get_struct_record_field "erc20::Erc20" "allowances", + [ M.read (| self |) ] + |); M.alloc (| Value.Tuple [ M.read (| M.read (| owner |) |); M.read (| M.read (| spender |) |) ] |) @@ -705,7 +719,10 @@ Module Impl_erc20_Erc20. [] |), [ - M.get_struct_record_field (| M.read (| self |), "erc20::Erc20", "balances" |); + M.call_closure (| + M.get_struct_record_field "erc20::Erc20" "balances", + [ M.read (| self |) ] + |); M.read (| M.read (| from |) |); BinOp.Panic.sub (| M.read (| from_balance |), M.read (| value |) |) ] @@ -729,7 +746,10 @@ Module Impl_erc20_Erc20. [] |), [ - M.get_struct_record_field (| M.read (| self |), "erc20::Erc20", "balances" |); + M.call_closure (| + M.get_struct_record_field "erc20::Erc20" "balances", + [ M.read (| self |) ] + |); M.read (| M.read (| to |) |); BinOp.Panic.add (| M.read (| to_balance |), M.read (| value |) |) ] @@ -863,7 +883,10 @@ Module Impl_erc20_Erc20. [] |), [ - M.get_struct_record_field (| M.read (| self |), "erc20::Erc20", "allowances" |); + M.call_closure (| + M.get_struct_record_field "erc20::Erc20" "allowances", + [ M.read (| self |) ] + |); Value.Tuple [ M.read (| owner |); M.read (| spender |) ]; M.read (| value |) ] @@ -1060,10 +1083,9 @@ Module Impl_erc20_Erc20. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "erc20::Erc20", - "allowances" + M.call_closure (| + M.get_struct_record_field "erc20::Erc20" "allowances", + [ M.read (| self |) ] |); Value.Tuple [ M.read (| from |); M.read (| caller |) ]; BinOp.Panic.sub (| M.read (| allowance |), M.read (| value |) |) diff --git a/CoqOfRust/examples/default/examples/ink_contracts/erc721.v b/CoqOfRust/examples/default/examples/ink_contracts/erc721.v index 5d2923c8a..204bc6cb4 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/erc721.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/erc721.v @@ -219,8 +219,18 @@ Module Impl_core_cmp_PartialEq_for_erc721_AccountId. (let self := M.alloc (| self |) in let other := M.alloc (| other |) in BinOp.Pure.eq - (M.read (| M.get_struct_tuple_field (| M.read (| self |), "erc721::AccountId", 0 |) |)) - (M.read (| M.get_struct_tuple_field (| M.read (| other |), "erc721::AccountId", 0 |) |)))) + (M.read (| + M.call_closure (| + M.get_struct_tuple_field "erc721::AccountId" 0, + [ M.read (| self |) ] + |) + |)) + (M.read (| + M.call_closure (| + M.get_struct_tuple_field "erc721::AccountId" 0, + [ M.read (| other |) ] + |) + |)))) | _, _ => M.impossible end. @@ -593,7 +603,12 @@ Module Impl_erc721_Env. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_record_field (| M.read (| self |), "erc721::Env", "caller" |) |))) + M.read (| + M.call_closure (| + M.get_struct_record_field "erc721::Env" "caller", + [ M.read (| self |) ] + |) + |))) | _, _ => M.impossible end. @@ -689,10 +704,9 @@ Module Impl_erc721_Erc721. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "erc721::Erc721", - "owned_tokens_count" + M.call_closure (| + M.get_struct_record_field "erc721::Erc721" "owned_tokens_count", + [ M.read (| self |) ] |); M.read (| of |) ] @@ -729,10 +743,9 @@ Module Impl_erc721_Erc721. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "erc721::Erc721", - "token_approvals" + M.call_closure (| + M.get_struct_record_field "erc721::Erc721" "token_approvals", + [ M.read (| self |) ] |); M.read (| id |) ] @@ -768,10 +781,9 @@ Module Impl_erc721_Erc721. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "erc721::Erc721", - "operator_approvals" + M.call_closure (| + M.get_struct_record_field "erc721::Erc721" "operator_approvals", + [ M.read (| self |) ] |); M.alloc (| Value.Tuple [ M.read (| owner |); M.read (| operator |) ] |) ] @@ -799,7 +811,13 @@ Module Impl_erc721_Erc721. "get", [] |), - [ M.get_struct_record_field (| M.read (| self |), "erc721::Erc721", "token_owner" |); id ] + [ + M.call_closure (| + M.get_struct_record_field "erc721::Erc721" "token_owner", + [ M.read (| self |) ] + |); + id + ] |))) | _, _ => M.impossible end. @@ -902,10 +920,9 @@ Module Impl_erc721_Erc721. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "erc721::Erc721", - "token_approvals" + M.call_closure (| + M.get_struct_record_field "erc721::Erc721" "token_approvals", + [ M.read (| self |) ] |); id ] @@ -972,7 +989,13 @@ Module Impl_erc721_Erc721. "contains", [] |), - [ M.get_struct_record_field (| M.read (| self |), "erc721::Erc721", "token_owner" |); id ] + [ + M.call_closure (| + M.get_struct_record_field "erc721::Erc721" "token_owner", + [ M.read (| self |) ] + |); + id + ] |))) | _, _ => M.impossible end. @@ -1017,7 +1040,10 @@ Module Impl_erc721_Erc721. [] |), [ - M.get_struct_record_field (| M.read (| self |), "erc721::Erc721", "token_approvals" |); + M.call_closure (| + M.get_struct_record_field "erc721::Erc721" "token_approvals", + [ M.read (| self |) ] + |); id ] |))) @@ -1178,10 +1204,9 @@ Module Impl_erc721_Erc721. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "erc721::Erc721", - "operator_approvals" + M.call_closure (| + M.get_struct_record_field "erc721::Erc721" "operator_approvals", + [ M.read (| self |) ] |); Value.Tuple [ M.read (| caller |); M.read (| to |) ]; Value.Tuple [] @@ -1206,10 +1231,9 @@ Module Impl_erc721_Erc721. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "erc721::Erc721", - "operator_approvals" + M.call_closure (| + M.get_struct_record_field "erc721::Erc721" "operator_approvals", + [ M.read (| self |) ] |); Value.Tuple [ M.read (| caller |); M.read (| to |) ] ] @@ -1531,10 +1555,9 @@ Module Impl_erc721_Erc721. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "erc721::Erc721", - "token_approvals" + M.call_closure (| + M.get_struct_record_field "erc721::Erc721" "token_approvals", + [ M.read (| self |) ] |); id ] @@ -1566,10 +1589,9 @@ Module Impl_erc721_Erc721. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "erc721::Erc721", - "token_approvals" + M.call_closure (| + M.get_struct_record_field "erc721::Erc721" "token_approvals", + [ M.read (| self |) ] |); M.read (| id |); M.read (| M.read (| to |) |) diff --git a/CoqOfRust/examples/default/examples/ink_contracts/flipper.v b/CoqOfRust/examples/default/examples/ink_contracts/flipper.v index 4c5500c9b..b265372c1 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/flipper.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/flipper.v @@ -64,10 +64,16 @@ Module Impl_flipper_Flipper. M.read (| let _ := M.write (| - M.get_struct_record_field (| M.read (| self |), "flipper::Flipper", "value" |), + M.call_closure (| + M.get_struct_record_field "flipper::Flipper" "value", + [ M.read (| self |) ] + |), UnOp.Pure.not (M.read (| - M.get_struct_record_field (| M.read (| self |), "flipper::Flipper", "value" |) + M.call_closure (| + M.get_struct_record_field "flipper::Flipper" "value", + [ M.read (| self |) ] + |) |)) |) in M.alloc (| Value.Tuple [] |) @@ -88,7 +94,10 @@ Module Impl_flipper_Flipper. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| M.read (| self |), "flipper::Flipper", "value" |) + M.call_closure (| + M.get_struct_record_field "flipper::Flipper" "value", + [ M.read (| self |) ] + |) |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/incrementer.v b/CoqOfRust/examples/default/examples/ink_contracts/incrementer.v index 11893cf1e..853f097c6 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/incrementer.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/incrementer.v @@ -65,10 +65,9 @@ Module Impl_incrementer_Incrementer. M.read (| let _ := let β := - M.get_struct_record_field (| - M.read (| self |), - "incrementer::Incrementer", - "value" + M.call_closure (| + M.get_struct_record_field "incrementer::Incrementer" "value", + [ M.read (| self |) ] |) in M.write (| β, BinOp.Panic.add (| M.read (| β |), M.read (| by_ |) |) |) in M.alloc (| Value.Tuple [] |) @@ -89,7 +88,10 @@ Module Impl_incrementer_Incrementer. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| M.read (| self |), "incrementer::Incrementer", "value" |) + M.call_closure (| + M.get_struct_record_field "incrementer::Incrementer" "value", + [ M.read (| self |) ] + |) |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/constructors_return_value.v b/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/constructors_return_value.v index 9d800f7fc..1e3b22bf0 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/constructors_return_value.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/constructors_return_value.v @@ -434,10 +434,9 @@ Module Impl_constructors_return_value_ConstructorsReturnValue. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| - M.read (| self |), - "constructors_return_value::ConstructorsReturnValue", - "value" + M.call_closure (| + M.get_struct_record_field "constructors_return_value::ConstructorsReturnValue" "value", + [ M.read (| self |) ] |) |))) | _, _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/contract_ref.v b/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/contract_ref.v index 58096440e..f796ef5e7 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/contract_ref.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/contract_ref.v @@ -253,17 +253,15 @@ Module Impl_contract_ref_FlipperRef. M.read (| let _ := M.write (| - M.get_struct_record_field (| - M.read (| self |), - "contract_ref::FlipperRef", - "value" + M.call_closure (| + M.get_struct_record_field "contract_ref::FlipperRef" "value", + [ M.read (| self |) ] |), UnOp.Pure.not (M.read (| - M.get_struct_record_field (| - M.read (| self |), - "contract_ref::FlipperRef", - "value" + M.call_closure (| + M.get_struct_record_field "contract_ref::FlipperRef" "value", + [ M.read (| self |) ] |) |)) |) in @@ -285,7 +283,10 @@ Module Impl_contract_ref_FlipperRef. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| M.read (| self |), "contract_ref::FlipperRef", "value" |) + M.call_closure (| + M.get_struct_record_field "contract_ref::FlipperRef" "value", + [ M.read (| self |) ] + |) |))) | _, _ => M.impossible end. @@ -429,10 +430,9 @@ Module Impl_contract_ref_ContractRef. M.call_closure (| M.get_associated_function (| Ty.path "contract_ref::FlipperRef", "flip", [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "contract_ref::ContractRef", - "flipper" + M.call_closure (| + M.get_struct_record_field "contract_ref::ContractRef" "flipper", + [ M.read (| self |) ] |) ] |) @@ -457,10 +457,9 @@ Module Impl_contract_ref_ContractRef. M.call_closure (| M.get_associated_function (| Ty.path "contract_ref::FlipperRef", "get", [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "contract_ref::ContractRef", - "flipper" + M.call_closure (| + M.get_struct_record_field "contract_ref::ContractRef" "flipper", + [ M.read (| self |) ] |) ] |))) diff --git a/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/integration_flipper.v b/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/integration_flipper.v index 07a72add1..7224ed45e 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/integration_flipper.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/lang_err_integration_tests/integration_flipper.v @@ -147,17 +147,15 @@ Module Impl_integration_flipper_Flipper. M.read (| let _ := M.write (| - M.get_struct_record_field (| - M.read (| self |), - "integration_flipper::Flipper", - "value" + M.call_closure (| + M.get_struct_record_field "integration_flipper::Flipper" "value", + [ M.read (| self |) ] |), UnOp.Pure.not (M.read (| - M.get_struct_record_field (| - M.read (| self |), - "integration_flipper::Flipper", - "value" + M.call_closure (| + M.get_struct_record_field "integration_flipper::Flipper" "value", + [ M.read (| self |) ] |) |)) |) in @@ -179,7 +177,10 @@ Module Impl_integration_flipper_Flipper. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| M.read (| self |), "integration_flipper::Flipper", "value" |) + M.call_closure (| + M.get_struct_record_field "integration_flipper::Flipper" "value", + [ M.read (| self |) ] + |) |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/mapping_integration_tests.v b/CoqOfRust/examples/default/examples/ink_contracts/mapping_integration_tests.v index e24775c61..fb97870d8 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/mapping_integration_tests.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/mapping_integration_tests.v @@ -233,10 +233,9 @@ Module Impl_mapping_integration_tests_Env. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| - M.read (| self |), - "mapping_integration_tests::Env", - "caller" + M.call_closure (| + M.get_struct_record_field "mapping_integration_tests::Env" "caller", + [ M.read (| self |) ] |) |))) | _, _ => M.impossible @@ -396,10 +395,9 @@ Module Impl_mapping_integration_tests_Mappings. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "mapping_integration_tests::Mappings", - "balances" + M.call_closure (| + M.get_struct_record_field "mapping_integration_tests::Mappings" "balances", + [ M.read (| self |) ] |); caller ] @@ -456,10 +454,9 @@ Module Impl_mapping_integration_tests_Mappings. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "mapping_integration_tests::Mappings", - "balances" + M.call_closure (| + M.get_struct_record_field "mapping_integration_tests::Mappings" "balances", + [ M.read (| self |) ] |); M.read (| caller |); M.read (| value |) @@ -517,10 +514,9 @@ Module Impl_mapping_integration_tests_Mappings. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "mapping_integration_tests::Mappings", - "balances" + M.call_closure (| + M.get_struct_record_field "mapping_integration_tests::Mappings" "balances", + [ M.read (| self |) ] |); M.read (| caller |) ] @@ -576,10 +572,9 @@ Module Impl_mapping_integration_tests_Mappings. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "mapping_integration_tests::Mappings", - "balances" + M.call_closure (| + M.get_struct_record_field "mapping_integration_tests::Mappings" "balances", + [ M.read (| self |) ] |); caller ] @@ -637,10 +632,9 @@ Module Impl_mapping_integration_tests_Mappings. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "mapping_integration_tests::Mappings", - "balances" + M.call_closure (| + M.get_struct_record_field "mapping_integration_tests::Mappings" "balances", + [ M.read (| self |) ] |); M.read (| caller |) ] @@ -698,10 +692,9 @@ Module Impl_mapping_integration_tests_Mappings. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "mapping_integration_tests::Mappings", - "balances" + M.call_closure (| + M.get_struct_record_field "mapping_integration_tests::Mappings" "balances", + [ M.read (| self |) ] |); M.read (| caller |) ] diff --git a/CoqOfRust/examples/default/examples/ink_contracts/mother.v b/CoqOfRust/examples/default/examples/ink_contracts/mother.v index e9803ebe0..62e35cf17 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/mother.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/mother.v @@ -175,8 +175,18 @@ Module Impl_core_cmp_PartialEq_for_mother_AccountId. (let self := M.alloc (| self |) in let other := M.alloc (| other |) in BinOp.Pure.eq - (M.read (| M.get_struct_tuple_field (| M.read (| self |), "mother::AccountId", 0 |) |)) - (M.read (| M.get_struct_tuple_field (| M.read (| other |), "mother::AccountId", 0 |) |)))) + (M.read (| + M.call_closure (| + M.get_struct_tuple_field "mother::AccountId" 0, + [ M.read (| self |) ] + |) + |)) + (M.read (| + M.call_closure (| + M.get_struct_tuple_field "mother::AccountId" 0, + [ M.read (| other |) ] + |) + |)))) | _, _ => M.impossible end. @@ -362,8 +372,8 @@ Module Impl_core_cmp_PartialEq_for_mother_Bids. [] |), [ - M.get_struct_tuple_field (| M.read (| self |), "mother::Bids", 0 |); - M.get_struct_tuple_field (| M.read (| other |), "mother::Bids", 0 |) + M.call_closure (| M.get_struct_tuple_field "mother::Bids" 0, [ M.read (| self |) ] |); + M.call_closure (| M.get_struct_tuple_field "mother::Bids" 0, [ M.read (| other |) ] |) ] |))) | _, _ => M.impossible @@ -447,7 +457,12 @@ Module Impl_core_clone_Clone_for_mother_Bids. "clone", [] |), - [ M.get_struct_tuple_field (| M.read (| self |), "mother::Bids", 0 |) ] + [ + M.call_closure (| + M.get_struct_tuple_field "mother::Bids" 0, + [ M.read (| self |) ] + |) + ] |) ])) | _, _ => M.impossible @@ -1001,15 +1016,13 @@ Module Impl_core_cmp_PartialEq_for_mother_Auction. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "mother::Auction", - "name" + M.call_closure (| + M.get_struct_record_field "mother::Auction" "name", + [ M.read (| self |) ] |); - M.get_struct_record_field (| - M.read (| other |), - "mother::Auction", - "name" + M.call_closure (| + M.get_struct_record_field "mother::Auction" "name", + [ M.read (| other |) ] |) ] |), @@ -1023,15 +1036,13 @@ Module Impl_core_cmp_PartialEq_for_mother_Auction. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "mother::Auction", - "subject" + M.call_closure (| + M.get_struct_record_field "mother::Auction" "subject", + [ M.read (| self |) ] |); - M.get_struct_record_field (| - M.read (| other |), - "mother::Auction", - "subject" + M.call_closure (| + M.get_struct_record_field "mother::Auction" "subject", + [ M.read (| other |) ] |) ] |))) @@ -1046,15 +1057,13 @@ Module Impl_core_cmp_PartialEq_for_mother_Auction. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "mother::Auction", - "bids" + M.call_closure (| + M.get_struct_record_field "mother::Auction" "bids", + [ M.read (| self |) ] |); - M.get_struct_record_field (| - M.read (| other |), - "mother::Auction", - "bids" + M.call_closure (| + M.get_struct_record_field "mother::Auction" "bids", + [ M.read (| other |) ] |) ] |))) @@ -1069,8 +1078,14 @@ Module Impl_core_cmp_PartialEq_for_mother_Auction. [] |), [ - M.get_struct_record_field (| M.read (| self |), "mother::Auction", "terms" |); - M.get_struct_record_field (| M.read (| other |), "mother::Auction", "terms" |) + M.call_closure (| + M.get_struct_record_field "mother::Auction" "terms", + [ M.read (| self |) ] + |); + M.call_closure (| + M.get_struct_record_field "mother::Auction" "terms", + [ M.read (| other |) ] + |) ] |))) |), @@ -1084,18 +1099,30 @@ Module Impl_core_cmp_PartialEq_for_mother_Auction. [] |), [ - M.get_struct_record_field (| M.read (| self |), "mother::Auction", "status" |); - M.get_struct_record_field (| M.read (| other |), "mother::Auction", "status" |) + M.call_closure (| + M.get_struct_record_field "mother::Auction" "status", + [ M.read (| self |) ] + |); + M.call_closure (| + M.get_struct_record_field "mother::Auction" "status", + [ M.read (| other |) ] + |) ] |))) |), ltac:(M.monadic (BinOp.Pure.eq (M.read (| - M.get_struct_record_field (| M.read (| self |), "mother::Auction", "finalized" |) + M.call_closure (| + M.get_struct_record_field "mother::Auction" "finalized", + [ M.read (| self |) ] + |) |)) (M.read (| - M.get_struct_record_field (| M.read (| other |), "mother::Auction", "finalized" |) + M.call_closure (| + M.get_struct_record_field "mother::Auction" "finalized", + [ M.read (| other |) ] + |) |)))) |), ltac:(M.monadic @@ -1114,8 +1141,14 @@ Module Impl_core_cmp_PartialEq_for_mother_Auction. [] |), [ - M.get_struct_record_field (| M.read (| self |), "mother::Auction", "vector" |); - M.get_struct_record_field (| M.read (| other |), "mother::Auction", "vector" |) + M.call_closure (| + M.get_struct_record_field "mother::Auction" "vector", + [ M.read (| self |) ] + |); + M.call_closure (| + M.get_struct_record_field "mother::Auction" "vector", + [ M.read (| other |) ] + |) ] |))) |))) @@ -1235,7 +1268,12 @@ Module Impl_core_clone_Clone_for_mother_Auction. "clone", [] |), - [ M.get_struct_record_field (| M.read (| self |), "mother::Auction", "name" |) ] + [ + M.call_closure (| + M.get_struct_record_field "mother::Auction" "name", + [ M.read (| self |) ] + |) + ] |)); ("subject", M.call_closure (| @@ -1246,7 +1284,12 @@ Module Impl_core_clone_Clone_for_mother_Auction. "clone", [] |), - [ M.get_struct_record_field (| M.read (| self |), "mother::Auction", "subject" |) ] + [ + M.call_closure (| + M.get_struct_record_field "mother::Auction" "subject", + [ M.read (| self |) ] + |) + ] |)); ("bids", M.call_closure (| @@ -1257,7 +1300,12 @@ Module Impl_core_clone_Clone_for_mother_Auction. "clone", [] |), - [ M.get_struct_record_field (| M.read (| self |), "mother::Auction", "bids" |) ] + [ + M.call_closure (| + M.get_struct_record_field "mother::Auction" "bids", + [ M.read (| self |) ] + |) + ] |)); ("terms", M.call_closure (| @@ -1268,7 +1316,12 @@ Module Impl_core_clone_Clone_for_mother_Auction. "clone", [] |), - [ M.get_struct_record_field (| M.read (| self |), "mother::Auction", "terms" |) ] + [ + M.call_closure (| + M.get_struct_record_field "mother::Auction" "terms", + [ M.read (| self |) ] + |) + ] |)); ("status", M.call_closure (| @@ -1279,12 +1332,21 @@ Module Impl_core_clone_Clone_for_mother_Auction. "clone", [] |), - [ M.get_struct_record_field (| M.read (| self |), "mother::Auction", "status" |) ] + [ + M.call_closure (| + M.get_struct_record_field "mother::Auction" "status", + [ M.read (| self |) ] + |) + ] |)); ("finalized", M.call_closure (| M.get_trait_method (| "core::clone::Clone", Ty.path "bool", [], "clone", [] |), - [ M.get_struct_record_field (| M.read (| self |), "mother::Auction", "finalized" |) + [ + M.call_closure (| + M.get_struct_record_field "mother::Auction" "finalized", + [ M.read (| self |) ] + |) ] |)); ("vector", @@ -1298,7 +1360,12 @@ Module Impl_core_clone_Clone_for_mother_Auction. "clone", [] |), - [ M.get_struct_record_field (| M.read (| self |), "mother::Auction", "vector" |) ] + [ + M.call_closure (| + M.get_struct_record_field "mother::Auction" "vector", + [ M.read (| self |) ] + |) + ] |)) ])) | _, _ => M.impossible @@ -1599,7 +1666,12 @@ Module Impl_mother_Env. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_record_field (| M.read (| self |), "mother::Env", "caller" |) |))) + M.read (| + M.call_closure (| + M.get_struct_record_field "mother::Env" "caller", + [ M.read (| self |) ] + |) + |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/multisig.v b/CoqOfRust/examples/default/examples/ink_contracts/multisig.v index 92b22f4b1..a378eadcd 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/multisig.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/multisig.v @@ -186,7 +186,10 @@ Module Impl_core_fmt_Debug_for_multisig_AccountId. (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_tuple_field (| M.read (| self |), "multisig::AccountId", 0 |) + M.call_closure (| + M.get_struct_tuple_field "multisig::AccountId" 0, + [ M.read (| self |) ] + |) |)) ] |))) @@ -256,9 +259,17 @@ Module Impl_core_cmp_PartialEq_for_multisig_AccountId. (let self := M.alloc (| self |) in let other := M.alloc (| other |) in BinOp.Pure.eq - (M.read (| M.get_struct_tuple_field (| M.read (| self |), "multisig::AccountId", 0 |) |)) (M.read (| - M.get_struct_tuple_field (| M.read (| other |), "multisig::AccountId", 0 |) + M.call_closure (| + M.get_struct_tuple_field "multisig::AccountId" 0, + [ M.read (| self |) ] + |) + |)) + (M.read (| + M.call_closure (| + M.get_struct_tuple_field "multisig::AccountId" 0, + [ M.read (| other |) ] + |) |)))) | _, _ => M.impossible end. @@ -328,8 +339,14 @@ Module Impl_core_cmp_PartialOrd_for_multisig_AccountId. [] |), [ - M.get_struct_tuple_field (| M.read (| self |), "multisig::AccountId", 0 |); - M.get_struct_tuple_field (| M.read (| other |), "multisig::AccountId", 0 |) + M.call_closure (| + M.get_struct_tuple_field "multisig::AccountId" 0, + [ M.read (| self |) ] + |); + M.call_closure (| + M.get_struct_tuple_field "multisig::AccountId" 0, + [ M.read (| other |) ] + |) ] |))) | _, _ => M.impossible @@ -356,8 +373,14 @@ Module Impl_core_cmp_Ord_for_multisig_AccountId. M.call_closure (| M.get_trait_method (| "core::cmp::Ord", Ty.path "u128", [], "cmp", [] |), [ - M.get_struct_tuple_field (| M.read (| self |), "multisig::AccountId", 0 |); - M.get_struct_tuple_field (| M.read (| other |), "multisig::AccountId", 0 |) + M.call_closure (| + M.get_struct_tuple_field "multisig::AccountId" 0, + [ M.read (| self |) ] + |); + M.call_closure (| + M.get_struct_tuple_field "multisig::AccountId" 0, + [ M.read (| other |) ] + |) ] |))) | _, _ => M.impossible @@ -851,7 +874,12 @@ Module Impl_multisig_Env. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_record_field (| M.read (| self |), "multisig::Env", "caller" |) |))) + M.read (| + M.call_closure (| + M.get_struct_record_field "multisig::Env" "caller", + [ M.read (| self |) ] + |) + |))) | _, _ => M.impossible end. @@ -1265,10 +1293,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - contract, - "multisig::Multisig", - "is_owner" + M.call_closure (| + M.get_struct_record_field + "multisig::Multisig" + "is_owner", + [ contract ] |); M.read (| M.read (| owner |) |); Value.Tuple [] @@ -1284,12 +1313,18 @@ Module Impl_multisig_Multisig. |)) in let _ := M.write (| - M.get_struct_record_field (| contract, "multisig::Multisig", "owners" |), + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "owners", + [ contract ] + |), M.read (| owners |) |) in let _ := M.write (| - M.get_struct_record_field (| contract, "multisig::Multisig", "transaction_list" |), + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "transaction_list", + [ contract ] + |), M.call_closure (| M.get_trait_method (| "core::default::Default", @@ -1303,7 +1338,10 @@ Module Impl_multisig_Multisig. |) in let _ := M.write (| - M.get_struct_record_field (| contract, "multisig::Multisig", "requirement" |), + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "requirement", + [ contract ] + |), M.read (| requirement |) |) in contract @@ -1357,10 +1395,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "confirmation_count" + M.call_closure (| + M.get_struct_record_field + "multisig::Multisig" + "confirmation_count", + [ M.read (| self |) ] |); trans_id ] @@ -1369,10 +1408,9 @@ Module Impl_multisig_Multisig. ] |)) (M.read (| - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "requirement" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "requirement", + [ M.read (| self |) ] |) |))) |)) in @@ -1434,10 +1472,9 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "transactions" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "transactions", + [ M.read (| self |) ] |); trans_id ] @@ -1485,10 +1522,9 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "is_owner" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "is_owner", + [ M.read (| self |) ] |); M.read (| owner |) ] @@ -1711,10 +1747,9 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "is_owner" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "is_owner", + [ M.read (| self |) ] |); M.read (| owner |) ] @@ -1796,20 +1831,18 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "owners" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "owners", + [ M.read (| self |) ] |) ] |)), Value.Integer Integer.U32 1 |); M.read (| - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "requirement" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "requirement", + [ M.read (| self |) ] |) |) ] @@ -1826,10 +1859,9 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "is_owner" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "is_owner", + [ M.read (| self |) ] |); M.read (| new_owner |); Value.Tuple [] @@ -1847,7 +1879,10 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| M.read (| self |), "multisig::Multisig", "owners" |); + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "owners", + [ M.read (| self |) ] + |); M.read (| new_owner |) ] |) @@ -1934,10 +1969,9 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "owners" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "owners", + [ M.read (| self |) ] |) ] |) @@ -2021,14 +2055,14 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "transaction_list" - |), - "multisig::Transactions", - "transactions" + M.call_closure (| + M.get_struct_record_field "multisig::Transactions" "transactions", + [ + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "transaction_list", + [ M.read (| self |) ] + |) + ] |) ] |) @@ -2098,10 +2132,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "confirmations" + M.call_closure (| + M.get_struct_record_field + "multisig::Multisig" + "confirmations", + [ M.read (| self |) ] |); key ] @@ -2130,10 +2165,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "confirmations" + M.call_closure (| + M.get_struct_record_field + "multisig::Multisig" + "confirmations", + [ M.read (| self |) ] |); M.read (| key |) ] @@ -2159,10 +2195,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "confirmation_count" + M.call_closure (| + M.get_struct_record_field + "multisig::Multisig" + "confirmation_count", + [ M.read (| self |) ] |); M.read (| trans_id |) ] @@ -2194,10 +2231,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "confirmation_count" + M.call_closure (| + M.get_struct_record_field + "multisig::Multisig" + "confirmation_count", + [ M.read (| self |) ] |); M.read (| M.read (| trans_id |) |); M.read (| count |) @@ -2275,10 +2313,9 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "owners" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "owners", + [ M.read (| self |) ] |) ] |)), @@ -2292,10 +2329,9 @@ Module Impl_multisig_Multisig. [ M.read (| len |); M.read (| - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "requirement" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "requirement", + [ M.read (| self |) ] |) |) ] @@ -2327,7 +2363,10 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| M.read (| self |), "multisig::Multisig", "owners" |); + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "owners", + [ M.read (| self |) ] + |); M.read (| owner_index |) ] |) @@ -2343,10 +2382,9 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "is_owner" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "is_owner", + [ M.read (| self |) ] |); M.read (| owner |) ] @@ -2354,10 +2392,9 @@ Module Impl_multisig_Multisig. |) in let _ := M.write (| - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "requirement" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "requirement", + [ M.read (| self |) ] |), M.read (| requirement |) |) in @@ -2466,7 +2503,10 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| M.read (| self |), "multisig::Multisig", "owners" |); + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "owners", + [ M.read (| self |) ] + |); M.rust_cast (M.read (| owner_index |)) ] |), @@ -2483,10 +2523,9 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "is_owner" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "is_owner", + [ M.read (| self |) ] |); M.read (| old_owner |) ] @@ -2503,10 +2542,9 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "is_owner" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "is_owner", + [ M.read (| self |) ] |); M.read (| new_owner |); Value.Tuple [] @@ -2618,10 +2656,9 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "owners" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "owners", + [ M.read (| self |) ] |) ] |)); @@ -2631,10 +2668,9 @@ Module Impl_multisig_Multisig. |) in let _ := M.write (| - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "requirement" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "requirement", + [ M.read (| self |) ] |), M.read (| new_requirement |) |) in @@ -2725,10 +2761,9 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "confirmation_count" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "confirmation_count", + [ M.read (| self |) ] |); transaction ] @@ -2751,10 +2786,9 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "confirmations" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "confirmations", + [ M.read (| self |) ] |); key ] @@ -2788,10 +2822,9 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "confirmations" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "confirmations", + [ M.read (| self |) ] |); M.read (| key |); Value.Tuple [] @@ -2807,10 +2840,9 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "confirmation_count" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "confirmation_count", + [ M.read (| self |) ] |); M.read (| transaction |); M.read (| count |) @@ -2834,10 +2866,9 @@ Module Impl_multisig_Multisig. BinOp.Pure.ge (M.read (| count |)) (M.read (| - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "requirement" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "requirement", + [ M.read (| self |) ] |) |)) |)) in @@ -2853,10 +2884,9 @@ Module Impl_multisig_Multisig. [ BinOp.Panic.sub (| M.read (| - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "requirement" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "requirement", + [ M.read (| self |) ] |) |), M.read (| count |) @@ -2956,26 +2986,26 @@ Module Impl_multisig_Multisig. |) in let trans_id := M.copy (| - M.get_struct_record_field (| - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "transaction_list" - |), - "multisig::Transactions", - "next_id" + M.call_closure (| + M.get_struct_record_field "multisig::Transactions" "next_id", + [ + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "transaction_list", + [ M.read (| self |) ] + |) + ] |) |) in let _ := M.write (| - M.get_struct_record_field (| - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "transaction_list" - |), - "multisig::Transactions", - "next_id" + M.call_closure (| + M.get_struct_record_field "multisig::Transactions" "next_id", + [ + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "transaction_list", + [ M.read (| self |) ] + |) + ] |), M.call_closure (| M.get_associated_function (| @@ -3006,10 +3036,9 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "transactions" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "transactions", + [ M.read (| self |) ] |); M.read (| trans_id |); M.read (| transaction |) @@ -3027,14 +3056,14 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "transaction_list" - |), - "multisig::Transactions", - "transactions" + M.call_closure (| + M.get_struct_record_field "multisig::Transactions" "transactions", + [ + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "transaction_list", + [ M.read (| self |) ] + |) + ] |); M.read (| trans_id |) ] @@ -3134,10 +3163,9 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "transactions" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "transactions", + [ M.read (| self |) ] |); trans_id ] @@ -3175,10 +3203,9 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "transactions" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "transactions", + [ M.read (| self |) ] |); M.read (| trans_id |) ] @@ -3225,14 +3252,18 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "transaction_list" - |), - "multisig::Transactions", - "transactions" + M.call_closure (| + M.get_struct_record_field + "multisig::Transactions" + "transactions", + [ + M.call_closure (| + M.get_struct_record_field + "multisig::Multisig" + "transaction_list", + [ M.read (| self |) ] + |) + ] |) ] |) @@ -3284,14 +3315,14 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "transaction_list" - |), - "multisig::Transactions", - "transactions" + M.call_closure (| + M.get_struct_record_field "multisig::Transactions" "transactions", + [ + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "transaction_list", + [ M.read (| self |) ] + |) + ] |); M.read (| pos |) ] @@ -3333,10 +3364,9 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "owners" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "owners", + [ M.read (| self |) ] |) ] |) @@ -3400,10 +3430,11 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "confirmations" + M.call_closure (| + M.get_struct_record_field + "multisig::Multisig" + "confirmations", + [ M.read (| self |) ] |); Value.Tuple [ @@ -3429,10 +3460,9 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "confirmation_count" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "confirmation_count", + [ M.read (| self |) ] |); M.read (| trans_id |) ] @@ -3680,10 +3710,9 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "confirmations" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "confirmations", + [ M.read (| self |) ] |); M.alloc (| Value.Tuple [ M.read (| trans_id |); M.read (| caller |) ] |) ] @@ -3702,10 +3731,9 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "confirmations" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "confirmations", + [ M.read (| self |) ] |); Value.Tuple [ M.read (| trans_id |); M.read (| caller |) ] ] @@ -3729,10 +3757,9 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "confirmation_count" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "confirmation_count", + [ M.read (| self |) ] |); trans_id ] @@ -3759,10 +3786,9 @@ Module Impl_multisig_Multisig. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "multisig::Multisig", - "confirmation_count" + M.call_closure (| + M.get_struct_record_field "multisig::Multisig" "confirmation_count", + [ M.read (| self |) ] |); M.read (| trans_id |); M.read (| confirmation_count |) @@ -3905,10 +3931,11 @@ Module Impl_multisig_Multisig. ] |)) (M.read (| - M.get_struct_record_field (| - t, - "multisig::Transaction", - "transferred_value" + M.call_closure (| + M.get_struct_record_field + "multisig::Transaction" + "transferred_value", + [ t ] |) |))) |)) in diff --git a/CoqOfRust/examples/default/examples/ink_contracts/payment_channel.v b/CoqOfRust/examples/default/examples/ink_contracts/payment_channel.v index 6e3d2b372..8dd07240f 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/payment_channel.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/payment_channel.v @@ -92,10 +92,16 @@ Module Impl_core_cmp_PartialEq_for_payment_channel_AccountId. let other := M.alloc (| other |) in BinOp.Pure.eq (M.read (| - M.get_struct_tuple_field (| M.read (| self |), "payment_channel::AccountId", 0 |) + M.call_closure (| + M.get_struct_tuple_field "payment_channel::AccountId" 0, + [ M.read (| self |) ] + |) |)) (M.read (| - M.get_struct_tuple_field (| M.read (| other |), "payment_channel::AccountId", 0 |) + M.call_closure (| + M.get_struct_tuple_field "payment_channel::AccountId" 0, + [ M.read (| other |) ] + |) |)))) | _, _ => M.impossible end. @@ -358,7 +364,10 @@ Module Impl_payment_channel_Env. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| M.read (| self |), "payment_channel::Env", "caller" |) + M.call_closure (| + M.get_struct_record_field "payment_channel::Env" "caller", + [ M.read (| self |) ] + |) |))) | _, _ => M.impossible end. @@ -782,10 +791,9 @@ Module Impl_payment_channel_PaymentChannel. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "payment_channel::PaymentChannel", - "recipient" + M.call_closure (| + M.get_struct_record_field "payment_channel::PaymentChannel" "recipient", + [ M.read (| self |) ] |); M.alloc (| M.call_closure (| @@ -926,10 +934,11 @@ Module Impl_payment_channel_PaymentChannel. ] |) |); - M.get_struct_record_field (| - M.read (| self |), - "payment_channel::PaymentChannel", - "recipient" + M.call_closure (| + M.get_struct_record_field + "payment_channel::PaymentChannel" + "recipient", + [ M.read (| self |) ] |) ] |) @@ -966,10 +975,11 @@ Module Impl_payment_channel_PaymentChannel. BinOp.Pure.lt (M.read (| amount |)) (M.read (| - M.get_struct_record_field (| - M.read (| self |), - "payment_channel::PaymentChannel", - "withdrawn" + M.call_closure (| + M.get_struct_record_field + "payment_channel::PaymentChannel" + "withdrawn", + [ M.read (| self |) ] |) |)) |)) in @@ -1075,19 +1085,21 @@ Module Impl_payment_channel_PaymentChannel. |) |); M.read (| - M.get_struct_record_field (| - M.read (| self |), - "payment_channel::PaymentChannel", - "recipient" + M.call_closure (| + M.get_struct_record_field + "payment_channel::PaymentChannel" + "recipient", + [ M.read (| self |) ] |) |); BinOp.Panic.sub (| M.read (| amount |), M.read (| - M.get_struct_record_field (| - M.read (| self |), - "payment_channel::PaymentChannel", - "withdrawn" + M.call_closure (| + M.get_struct_record_field + "payment_channel::PaymentChannel" + "withdrawn", + [ M.read (| self |) ] |) |) |) @@ -1284,10 +1296,9 @@ Module Impl_payment_channel_PaymentChannel. |) |); M.read (| - M.get_struct_record_field (| - M.read (| self |), - "payment_channel::PaymentChannel", - "sender" + M.call_closure (| + M.get_struct_record_field "payment_channel::PaymentChannel" "sender", + [ M.read (| self |) ] |) |) ] @@ -1368,10 +1379,11 @@ Module Impl_payment_channel_PaymentChannel. ] |) |); - M.get_struct_record_field (| - M.read (| self |), - "payment_channel::PaymentChannel", - "sender" + M.call_closure (| + M.get_struct_record_field + "payment_channel::PaymentChannel" + "sender", + [ M.read (| self |) ] |) ] |) @@ -1420,10 +1432,11 @@ Module Impl_payment_channel_PaymentChannel. BinOp.Panic.add (| M.read (| now |), M.read (| - M.get_struct_record_field (| - M.read (| self |), - "payment_channel::PaymentChannel", - "close_duration" + M.call_closure (| + M.get_struct_record_field + "payment_channel::PaymentChannel" + "close_duration", + [ M.read (| self |) ] |) |) |) @@ -1456,10 +1469,11 @@ Module Impl_payment_channel_PaymentChannel. ("expiration", M.read (| expiration |)); ("close_duration", M.read (| - M.get_struct_record_field (| - M.read (| self |), - "payment_channel::PaymentChannel", - "close_duration" + M.call_closure (| + M.get_struct_record_field + "payment_channel::PaymentChannel" + "close_duration", + [ M.read (| self |) ] |) |)) ] @@ -1469,10 +1483,9 @@ Module Impl_payment_channel_PaymentChannel. |) in let _ := M.write (| - M.get_struct_record_field (| - M.read (| self |), - "payment_channel::PaymentChannel", - "expiration" + M.call_closure (| + M.get_struct_record_field "payment_channel::PaymentChannel" "expiration", + [ M.read (| self |) ] |), Value.StructTuple "core::option::Option::Some" [ M.read (| expiration |) ] |) in @@ -1514,10 +1527,9 @@ Module Impl_payment_channel_PaymentChannel. ltac:(M.monadic (M.read (| M.match_operator (| - M.get_struct_record_field (| - M.read (| self |), - "payment_channel::PaymentChannel", - "expiration" + M.call_closure (| + M.get_struct_record_field "payment_channel::PaymentChannel" "expiration", + [ M.read (| self |) ] |), [ fun γ => @@ -1605,10 +1617,11 @@ Module Impl_payment_channel_PaymentChannel. |) |); M.read (| - M.get_struct_record_field (| - M.read (| self |), - "payment_channel::PaymentChannel", - "sender" + M.call_closure (| + M.get_struct_record_field + "payment_channel::PaymentChannel" + "sender", + [ M.read (| self |) ] |) |) ] @@ -1709,10 +1722,11 @@ Module Impl_payment_channel_PaymentChannel. ] |) |); - M.get_struct_record_field (| - M.read (| self |), - "payment_channel::PaymentChannel", - "recipient" + M.call_closure (| + M.get_struct_record_field + "payment_channel::PaymentChannel" + "recipient", + [ M.read (| self |) ] |) ] |) @@ -1785,10 +1799,11 @@ Module Impl_payment_channel_PaymentChannel. BinOp.Pure.lt (M.read (| amount |)) (M.read (| - M.get_struct_record_field (| - M.read (| self |), - "payment_channel::PaymentChannel", - "withdrawn" + M.call_closure (| + M.get_struct_record_field + "payment_channel::PaymentChannel" + "withdrawn", + [ M.read (| self |) ] |) |)) |)) in @@ -1817,20 +1832,18 @@ Module Impl_payment_channel_PaymentChannel. BinOp.Panic.sub (| M.read (| amount |), M.read (| - M.get_struct_record_field (| - M.read (| self |), - "payment_channel::PaymentChannel", - "withdrawn" + M.call_closure (| + M.get_struct_record_field "payment_channel::PaymentChannel" "withdrawn", + [ M.read (| self |) ] |) |) |) |) in let _ := let β := - M.get_struct_record_field (| - M.read (| self |), - "payment_channel::PaymentChannel", - "withdrawn" + M.call_closure (| + M.get_struct_record_field "payment_channel::PaymentChannel" "withdrawn", + [ M.read (| self |) ] |) in M.write (| β, @@ -1882,10 +1895,11 @@ Module Impl_payment_channel_PaymentChannel. |) |); M.read (| - M.get_struct_record_field (| - M.read (| self |), - "payment_channel::PaymentChannel", - "recipient" + M.call_closure (| + M.get_struct_record_field + "payment_channel::PaymentChannel" + "recipient", + [ M.read (| self |) ] |) |); M.read (| amount_to_withdraw |) @@ -1981,10 +1995,9 @@ Module Impl_payment_channel_PaymentChannel. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| - M.read (| self |), - "payment_channel::PaymentChannel", - "sender" + M.call_closure (| + M.get_struct_record_field "payment_channel::PaymentChannel" "sender", + [ M.read (| self |) ] |) |))) | _, _ => M.impossible @@ -2003,10 +2016,9 @@ Module Impl_payment_channel_PaymentChannel. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| - M.read (| self |), - "payment_channel::PaymentChannel", - "recipient" + M.call_closure (| + M.get_struct_record_field "payment_channel::PaymentChannel" "recipient", + [ M.read (| self |) ] |) |))) | _, _ => M.impossible @@ -2026,10 +2038,9 @@ Module Impl_payment_channel_PaymentChannel. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| - M.read (| self |), - "payment_channel::PaymentChannel", - "expiration" + M.call_closure (| + M.get_struct_record_field "payment_channel::PaymentChannel" "expiration", + [ M.read (| self |) ] |) |))) | _, _ => M.impossible @@ -2049,10 +2060,9 @@ Module Impl_payment_channel_PaymentChannel. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| - M.read (| self |), - "payment_channel::PaymentChannel", - "withdrawn" + M.call_closure (| + M.get_struct_record_field "payment_channel::PaymentChannel" "withdrawn", + [ M.read (| self |) ] |) |))) | _, _ => M.impossible @@ -2072,10 +2082,9 @@ Module Impl_payment_channel_PaymentChannel. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| - M.read (| self |), - "payment_channel::PaymentChannel", - "close_duration" + M.call_closure (| + M.get_struct_record_field "payment_channel::PaymentChannel" "close_duration", + [ M.read (| self |) ] |) |))) | _, _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/ink_contracts/set_code_hash.v b/CoqOfRust/examples/default/examples/ink_contracts/set_code_hash.v index 7e14dac1d..7ce25a8b2 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/set_code_hash.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/set_code_hash.v @@ -96,10 +96,9 @@ Module Impl_set_code_hash_Incrementer. M.read (| let _ := let β := - M.get_struct_record_field (| - M.read (| self |), - "set_code_hash::Incrementer", - "count" + M.call_closure (| + M.get_struct_record_field "set_code_hash::Incrementer" "count", + [ M.read (| self |) ] |) in M.write (| β, BinOp.Panic.add (| M.read (| β |), Value.Integer Integer.U32 1 |) |) in let _ := @@ -136,10 +135,11 @@ Module Impl_set_code_hash_Incrementer. [ Ty.path "u32" ] |), [ - M.get_struct_record_field (| - M.read (| self |), - "set_code_hash::Incrementer", - "count" + M.call_closure (| + M.get_struct_record_field + "set_code_hash::Incrementer" + "count", + [ M.read (| self |) ] |) ] |) @@ -169,7 +169,10 @@ Module Impl_set_code_hash_Incrementer. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| M.read (| self |), "set_code_hash::Incrementer", "count" |) + M.call_closure (| + M.get_struct_record_field "set_code_hash::Incrementer" "count", + [ M.read (| self |) ] + |) |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/set_code_hash/updated_incrementer.v b/CoqOfRust/examples/default/examples/ink_contracts/set_code_hash/updated_incrementer.v index 29201b268..e2cd67012 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/set_code_hash/updated_incrementer.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/set_code_hash/updated_incrementer.v @@ -182,10 +182,9 @@ Module Impl_updated_incrementer_Incrementer. M.read (| let _ := let β := - M.get_struct_record_field (| - M.read (| self |), - "updated_incrementer::Incrementer", - "count" + M.call_closure (| + M.get_struct_record_field "updated_incrementer::Incrementer" "count", + [ M.read (| self |) ] |) in M.write (| β, BinOp.Panic.add (| M.read (| β |), Value.Integer Integer.U32 4 |) |) in let _ := @@ -222,10 +221,11 @@ Module Impl_updated_incrementer_Incrementer. [ Ty.path "u32" ] |), [ - M.get_struct_record_field (| - M.read (| self |), - "updated_incrementer::Incrementer", - "count" + M.call_closure (| + M.get_struct_record_field + "updated_incrementer::Incrementer" + "count", + [ M.read (| self |) ] |) ] |) @@ -255,10 +255,9 @@ Module Impl_updated_incrementer_Incrementer. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| - M.read (| self |), - "updated_incrementer::Incrementer", - "count" + M.call_closure (| + M.get_struct_record_field "updated_incrementer::Incrementer" "count", + [ M.read (| self |) ] |) |))) | _, _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/ink_contracts/trait_erc20.v b/CoqOfRust/examples/default/examples/ink_contracts/trait_erc20.v index fed2565c5..9b08865b4 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/trait_erc20.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/trait_erc20.v @@ -463,7 +463,10 @@ Module Impl_trait_erc20_Env. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| M.read (| self |), "trait_erc20::Env", "caller" |) + M.call_closure (| + M.get_struct_record_field "trait_erc20::Env" "caller", + [ M.read (| self |) ] + |) |))) | _, _ => M.impossible end. @@ -660,7 +663,10 @@ Module Impl_trait_erc20_Erc20. [] |), [ - M.get_struct_record_field (| M.read (| self |), "trait_erc20::Erc20", "balances" |); + M.call_closure (| + M.get_struct_record_field "trait_erc20::Erc20" "balances", + [ M.read (| self |) ] + |); M.read (| owner |) ] |) @@ -703,10 +709,9 @@ Module Impl_trait_erc20_Erc20. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "trait_erc20::Erc20", - "allowances" + M.call_closure (| + M.get_struct_record_field "trait_erc20::Erc20" "allowances", + [ M.read (| self |) ] |); M.alloc (| Value.Tuple [ M.read (| M.read (| owner |) |); M.read (| M.read (| spender |) |) ] @@ -799,10 +804,9 @@ Module Impl_trait_erc20_Erc20. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "trait_erc20::Erc20", - "balances" + M.call_closure (| + M.get_struct_record_field "trait_erc20::Erc20" "balances", + [ M.read (| self |) ] |); M.read (| M.read (| from |) |); BinOp.Panic.sub (| M.read (| from_balance |), M.read (| value |) |) @@ -831,10 +835,9 @@ Module Impl_trait_erc20_Erc20. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "trait_erc20::Erc20", - "balances" + M.call_closure (| + M.get_struct_record_field "trait_erc20::Erc20" "balances", + [ M.read (| self |) ] |); M.read (| M.read (| to |) |); BinOp.Panic.add (| M.read (| to_balance |), M.read (| value |) |) @@ -896,7 +899,10 @@ Module Impl_trait_erc20_BaseErc20_for_trait_erc20_Erc20. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| M.read (| self |), "trait_erc20::Erc20", "total_supply" |) + M.call_closure (| + M.get_struct_record_field "trait_erc20::Erc20" "total_supply", + [ M.read (| self |) ] + |) |))) | _, _ => M.impossible end. @@ -1025,10 +1031,9 @@ Module Impl_trait_erc20_BaseErc20_for_trait_erc20_Erc20. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "trait_erc20::Erc20", - "allowances" + M.call_closure (| + M.get_struct_record_field "trait_erc20::Erc20" "allowances", + [ M.read (| self |) ] |); Value.Tuple [ M.read (| owner |); M.read (| spender |) ]; M.read (| value |) @@ -1230,10 +1235,9 @@ Module Impl_trait_erc20_BaseErc20_for_trait_erc20_Erc20. [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "trait_erc20::Erc20", - "allowances" + M.call_closure (| + M.get_struct_record_field "trait_erc20::Erc20" "allowances", + [ M.read (| self |) ] |); Value.Tuple [ M.read (| from |); M.read (| caller |) ]; BinOp.Panic.sub (| M.read (| allowance |), M.read (| value |) |) diff --git a/CoqOfRust/examples/default/examples/ink_contracts/trait_flipper.v b/CoqOfRust/examples/default/examples/ink_contracts/trait_flipper.v index 47d1b0448..60c969cba 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/trait_flipper.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/trait_flipper.v @@ -63,13 +63,15 @@ Module Impl_trait_flipper_Flip_for_trait_flipper_Flipper. M.read (| let _ := M.write (| - M.get_struct_record_field (| M.read (| self |), "trait_flipper::Flipper", "value" |), + M.call_closure (| + M.get_struct_record_field "trait_flipper::Flipper" "value", + [ M.read (| self |) ] + |), UnOp.Pure.not (M.read (| - M.get_struct_record_field (| - M.read (| self |), - "trait_flipper::Flipper", - "value" + M.call_closure (| + M.get_struct_record_field "trait_flipper::Flipper" "value", + [ M.read (| self |) ] |) |)) |) in @@ -89,7 +91,10 @@ Module Impl_trait_flipper_Flip_for_trait_flipper_Flipper. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| M.read (| self |), "trait_flipper::Flipper", "value" |) + M.call_closure (| + M.get_struct_record_field "trait_flipper::Flipper" "value", + [ M.read (| self |) ] + |) |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/ink_contracts/trait_incrementer.v b/CoqOfRust/examples/default/examples/ink_contracts/trait_incrementer.v index 320a4a848..8669826d6 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/trait_incrementer.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/trait_incrementer.v @@ -48,10 +48,9 @@ Module Impl_trait_incrementer_Incrementer. M.read (| let _ := let β := - M.get_struct_record_field (| - M.read (| self |), - "trait_incrementer::Incrementer", - "value" + M.call_closure (| + M.get_struct_record_field "trait_incrementer::Incrementer" "value", + [ M.read (| self |) ] |) in M.write (| β, BinOp.Panic.add (| M.read (| β |), M.read (| delta |) |) |) in M.alloc (| Value.Tuple [] |) @@ -93,10 +92,9 @@ Module Impl_trait_incrementer_Increment_for_trait_incrementer_Incrementer. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| - M.read (| self |), - "trait_incrementer::Incrementer", - "value" + M.call_closure (| + M.get_struct_record_field "trait_incrementer::Incrementer" "value", + [ M.read (| self |) ] |) |))) | _, _ => M.impossible @@ -126,10 +124,9 @@ Module Impl_trait_incrementer_Reset_for_trait_incrementer_Incrementer. M.read (| let _ := M.write (| - M.get_struct_record_field (| - M.read (| self |), - "trait_incrementer::Incrementer", - "value" + M.call_closure (| + M.get_struct_record_field "trait_incrementer::Incrementer" "value", + [ M.read (| self |) ] |), Value.Integer Integer.U64 0 |) in diff --git a/CoqOfRust/examples/default/examples/ink_contracts/typed/erc20.v b/CoqOfRust/examples/default/examples/ink_contracts/typed/erc20.v index 153c52572..2a4e8e890 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/typed/erc20.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/typed/erc20.v @@ -64,11 +64,23 @@ Module Erc20. ]; }. - Definition get_total_supply {R : Set} (self : Pointer.t t) : - MBody (Pointer.t Balance.t) R := + Definition get_total_supply (self : Pointer.t t) : M (Pointer.t Balance.t) := M.make_sub_pointer self (Pointer.Index.StructRecord "erc20::Erc20" "total_supply") (fun x => Some x.(total_supply)) (fun x v => Some (x <| total_supply := v |>)). + + Lemma get_total_supply_run {Address Env : Set} (env_to_value : Env -> Value.t) + (self : Pointer.t t) : + {{ Address, env_to_value | + get_struct_record_field_closure "erc20::Erc20" "total_supply" [φ self] ~ + Erc20.get_total_supply self + }}. + Proof. + destruct self, origin. + apply Run.CallPrimitiveMakeSubPointer; try reflexivity. + apply Run.Pure. + reflexivity. + Qed. End Erc20. Module Impl_erc20_Erc20. @@ -77,7 +89,7 @@ Module Impl_erc20_Erc20. Definition total_supply (self : Pointer.t Self) : M Balance.t := let* self := M.alloc self in let* self := M.read self in - let* self_total_supply := Erc20.get_total_supply self in + let* self_total_supply := M.call_closure Erc20.get_total_supply <[self]> in M.read self_total_supply. Lemma total_supply_run {Address Env : Set} (env_to_value : Env -> Value.t) @@ -93,51 +105,16 @@ Module Impl_erc20_Erc20. intros; cbn. apply Run.CallPrimitiveStateRead; [reflexivity|]. intros. - unfold M.get_struct_record_field. - Transparent φ. - cbn. - destruct value, origin. - apply Run.CallPrimitiveMakeSubPointer. - { sfirstorder. } - { sfirstorder. } - unfold M.read; cbn. - apply Run.CallPrimitiveStateRead; [reflexivity|]. - intros. - apply Run.Pure. - reflexivity. - Qed. - destruct value. - apply Run.Pure. - - run_symbolic_state_read. - - apply H. - set (origin := Pointer.Origin.Make _ _ _). - pose proof (H := Run.CallPrimitiveStateRead Address env_to_value origin). - apply H. - - apply Run.CallPrimitiveStateRead. - intros. - unfold M.get_struct_record_field. - unfold M.read. - assert (H_total_supply := Erc20.get_total_supply_is_valid self H_self). - unfold Erc20.get_total_supply in *. - cbn. - unfold Pointer.map. - Transparent φ. - cbn. - destruct H_self. - (* destruct value. *) - apply Run.CallPrimitiveStateRead. + eapply Run.CallClosure; try constructor. { + apply Erc20.get_total_supply_run. + } intros. - rewrite Value.read_path_suffix_eq. - destruct H_self. - rewrite H. - - inversion H_total_supply. + destruct result as [|[[] | | | | ]]; cbn; try now apply Run.Pure. + destruct t0. + apply Run.CallPrimitiveStateRead; [reflexivity|]; intros. + now apply Run.Pure. Qed. - (* Definition balance_of_impl (self : Pointer.t Erc20.t) (owner : Pointer.t AccountId) : M (option Balance.t) := let* self := M.read self in *) diff --git a/CoqOfRust/examples/default/examples/monadic_transformation/example05.v b/CoqOfRust/examples/default/examples/monadic_transformation/example05.v index 35f95cee9..c7c6fabbf 100644 --- a/CoqOfRust/examples/default/examples/monadic_transformation/example05.v +++ b/CoqOfRust/examples/default/examples/monadic_transformation/example05.v @@ -23,7 +23,7 @@ Module Impl_example05_Foo. ltac:(M.monadic (let self := M.alloc (| self |) in BinOp.Panic.add (| - M.read (| M.get_struct_tuple_field (| self, "example05::Foo", 0 |) |), + M.read (| M.call_closure (| M.get_struct_tuple_field "example05::Foo" 0, [ self ] |) |), Value.Integer Integer.U32 1 |))) | _, _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/rust_book/conversion/converting_to_string.v b/CoqOfRust/examples/default/examples/rust_book/conversion/converting_to_string.v index 2e9c530a0..0ddda381d 100644 --- a/CoqOfRust/examples/default/examples/rust_book/conversion/converting_to_string.v +++ b/CoqOfRust/examples/default/examples/rust_book/conversion/converting_to_string.v @@ -45,10 +45,9 @@ Module Impl_core_fmt_Display_for_converting_to_string_Circle. [ Ty.path "i32" ] |), [ - M.get_struct_record_field (| - M.read (| self |), - "converting_to_string::Circle", - "radius" + M.call_closure (| + M.get_struct_record_field "converting_to_string::Circle" "radius", + [ M.read (| self |) ] |) ] |) diff --git a/CoqOfRust/examples/default/examples/rust_book/conversion/try_from_and_try_into.v b/CoqOfRust/examples/default/examples/rust_book/conversion/try_from_and_try_into.v index f37f5539e..d7aee618a 100644 --- a/CoqOfRust/examples/default/examples/rust_book/conversion/try_from_and_try_into.v +++ b/CoqOfRust/examples/default/examples/rust_book/conversion/try_from_and_try_into.v @@ -31,10 +31,9 @@ Module Impl_core_fmt_Debug_for_try_from_and_try_into_EvenNumber. (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_tuple_field (| - M.read (| self |), - "try_from_and_try_into::EvenNumber", - 0 + M.call_closure (| + M.get_struct_tuple_field "try_from_and_try_into::EvenNumber" 0, + [ M.read (| self |) ] |) |)) ] @@ -73,13 +72,15 @@ Module Impl_core_cmp_PartialEq_for_try_from_and_try_into_EvenNumber. let other := M.alloc (| other |) in BinOp.Pure.eq (M.read (| - M.get_struct_tuple_field (| M.read (| self |), "try_from_and_try_into::EvenNumber", 0 |) + M.call_closure (| + M.get_struct_tuple_field "try_from_and_try_into::EvenNumber" 0, + [ M.read (| self |) ] + |) |)) (M.read (| - M.get_struct_tuple_field (| - M.read (| other |), - "try_from_and_try_into::EvenNumber", - 0 + M.call_closure (| + M.get_struct_tuple_field "try_from_and_try_into::EvenNumber" 0, + [ M.read (| other |) ] |) |)))) | _, _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/rust_book/custom_types/structures.v b/CoqOfRust/examples/default/examples/rust_book/custom_types/structures.v index e87ffa8b9..e6cfbb7da 100644 --- a/CoqOfRust/examples/default/examples/rust_book/custom_types/structures.v +++ b/CoqOfRust/examples/default/examples/rust_book/custom_types/structures.v @@ -31,12 +31,18 @@ Module Impl_core_fmt_Debug_for_structures_Person. M.read (| Value.String "name" |); (* Unsize *) M.pointer_coercion - (M.get_struct_record_field (| M.read (| self |), "structures::Person", "name" |)); + (M.call_closure (| + M.get_struct_record_field "structures::Person" "name", + [ M.read (| self |) ] + |)); M.read (| Value.String "age" |); (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_record_field (| M.read (| self |), "structures::Person", "age" |) + M.call_closure (| + M.get_struct_record_field "structures::Person" "age", + [ M.read (| self |) ] + |) |)) ] |))) @@ -233,7 +239,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "new_display", [ Ty.path "f32" ] |), - [ M.get_struct_record_field (| point, "structures::Point", "x" |) ] + [ + M.call_closure (| + M.get_struct_record_field "structures::Point" "x", + [ point ] + |) + ] |); M.call_closure (| M.get_associated_function (| @@ -241,7 +252,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "new_display", [ Ty.path "f32" ] |), - [ M.get_struct_record_field (| point, "structures::Point", "y" |) ] + [ + M.call_closure (| + M.get_struct_record_field "structures::Point" "y", + [ point ] + |) + ] |) ] |)) @@ -287,10 +303,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "f32" ] |), [ - M.get_struct_record_field (| - bottom_right, - "structures::Point", - "x" + M.call_closure (| + M.get_struct_record_field "structures::Point" "x", + [ bottom_right ] |) ] |); @@ -301,10 +316,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "f32" ] |), [ - M.get_struct_record_field (| - bottom_right, - "structures::Point", - "y" + M.call_closure (| + M.get_struct_record_field "structures::Point" "y", + [ bottom_right ] |) ] |) @@ -382,10 +396,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_tuple_field (| - pair_, - "structures::Pair", - 0 + M.call_closure (| + M.get_struct_tuple_field "structures::Pair" 0, + [ pair_ ] |) ] |); @@ -396,10 +409,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "f32" ] |), [ - M.get_struct_tuple_field (| - pair_, - "structures::Pair", - 1 + M.call_closure (| + M.get_struct_tuple_field "structures::Pair" 1, + [ pair_ ] |) ] |) diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/combinators_map.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/combinators_map.v index 009991b4f..e128b1b03 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/combinators_map.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/combinators_map.v @@ -102,7 +102,10 @@ Module Impl_core_fmt_Debug_for_combinators_map_Peeled. (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_tuple_field (| M.read (| self |), "combinators_map::Peeled", 0 |) + M.call_closure (| + M.get_struct_tuple_field "combinators_map::Peeled" 0, + [ M.read (| self |) ] + |) |)) ] |))) @@ -146,7 +149,10 @@ Module Impl_core_fmt_Debug_for_combinators_map_Chopped. (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_tuple_field (| M.read (| self |), "combinators_map::Chopped", 0 |) + M.call_closure (| + M.get_struct_tuple_field "combinators_map::Chopped" 0, + [ M.read (| self |) ] + |) |)) ] |))) @@ -190,7 +196,10 @@ Module Impl_core_fmt_Debug_for_combinators_map_Cooked. (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_tuple_field (| M.read (| self |), "combinators_map::Cooked", 0 |) + M.call_closure (| + M.get_struct_tuple_field "combinators_map::Cooked" 0, + [ M.read (| self |) ] + |) |)) ] |))) diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_via_question_mark.v b/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_via_question_mark.v index 2858f07a9..f016de79d 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_via_question_mark.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/unpacking_options_via_question_mark.v @@ -131,144 +131,151 @@ Module Impl_unpacking_options_via_question_mark_Person. M.catch_return (| ltac:(M.monadic (M.read (| - M.get_struct_record_field (| - M.match_operator (| - M.alloc (| - M.call_closure (| - M.get_trait_method (| - "core::ops::try_trait::Try", - Ty.apply - (Ty.path "core::option::Option") - [ Ty.path "unpacking_options_via_question_mark::PhoneNumber" ], - [], - "branch", - [] - |), - [ - M.read (| - M.get_struct_record_field (| - M.match_operator (| - M.alloc (| - M.call_closure (| - M.get_trait_method (| - "core::ops::try_trait::Try", - Ty.apply - (Ty.path "core::option::Option") - [ Ty.path "unpacking_options_via_question_mark::Job" ], - [], - "branch", - [] - |), - [ - M.read (| - M.get_struct_record_field (| - M.read (| self |), - "unpacking_options_via_question_mark::Person", - "job" - |) - |) - ] - |) - |), + M.call_closure (| + M.get_struct_record_field + "unpacking_options_via_question_mark::PhoneNumber" + "area_code", + [ + M.match_operator (| + M.alloc (| + M.call_closure (| + M.get_trait_method (| + "core::ops::try_trait::Try", + Ty.apply + (Ty.path "core::option::Option") + [ Ty.path "unpacking_options_via_question_mark::PhoneNumber" ], + [], + "branch", + [] + |), + [ + M.read (| + M.call_closure (| + M.get_struct_record_field + "unpacking_options_via_question_mark::Job" + "phone_number", [ - fun γ => - ltac:(M.monadic - (let γ0_0 := - M.get_struct_tuple_field_or_break_match (| - γ, - "core::ops::control_flow::ControlFlow::Break", - 0 - |) in - let residual := M.copy (| γ0_0 |) in - M.alloc (| - M.never_to_any (| + M.match_operator (| + M.alloc (| + M.call_closure (| + M.get_trait_method (| + "core::ops::try_trait::Try", + Ty.apply + (Ty.path "core::option::Option") + [ Ty.path "unpacking_options_via_question_mark::Job" ], + [], + "branch", + [] + |), + [ M.read (| - M.return_ (| - M.call_closure (| - M.get_trait_method (| - "core::ops::try_trait::FromResidual", - Ty.apply - (Ty.path "core::option::Option") - [ Ty.path "u8" ], - [ - Ty.apply - (Ty.path "core::option::Option") - [ Ty.path "core::convert::Infallible" ] - ], - "from_residual", - [] - |), - [ M.read (| residual |) ] - |) + M.call_closure (| + M.get_struct_record_field + "unpacking_options_via_question_mark::Person" + "job", + [ M.read (| self |) ] |) |) - |) - |))); - fun γ => - ltac:(M.monadic - (let γ0_0 := - M.get_struct_tuple_field_or_break_match (| - γ, - "core::ops::control_flow::ControlFlow::Continue", - 0 - |) in - let val := M.copy (| γ0_0 |) in - val)) + ] + |) + |), + [ + fun γ => + ltac:(M.monadic + (let γ0_0 := + M.get_struct_tuple_field_or_break_match (| + γ, + "core::ops::control_flow::ControlFlow::Break", + 0 + |) in + let residual := M.copy (| γ0_0 |) in + M.alloc (| + M.never_to_any (| + M.read (| + M.return_ (| + M.call_closure (| + M.get_trait_method (| + "core::ops::try_trait::FromResidual", + Ty.apply + (Ty.path "core::option::Option") + [ Ty.path "u8" ], + [ + Ty.apply + (Ty.path "core::option::Option") + [ Ty.path "core::convert::Infallible" ] + ], + "from_residual", + [] + |), + [ M.read (| residual |) ] + |) + |) + |) + |) + |))); + fun γ => + ltac:(M.monadic + (let γ0_0 := + M.get_struct_tuple_field_or_break_match (| + γ, + "core::ops::control_flow::ControlFlow::Continue", + 0 + |) in + let val := M.copy (| γ0_0 |) in + val)) + ] + |) ] - |), - "unpacking_options_via_question_mark::Job", - "phone_number" + |) |) - |) - ] - |) - |), - [ - fun γ => - ltac:(M.monadic - (let γ0_0 := - M.get_struct_tuple_field_or_break_match (| - γ, - "core::ops::control_flow::ControlFlow::Break", - 0 - |) in - let residual := M.copy (| γ0_0 |) in - M.alloc (| - M.never_to_any (| - M.read (| - M.return_ (| - M.call_closure (| - M.get_trait_method (| - "core::ops::try_trait::FromResidual", - Ty.apply (Ty.path "core::option::Option") [ Ty.path "u8" ], - [ - Ty.apply - (Ty.path "core::option::Option") - [ Ty.path "core::convert::Infallible" ] - ], - "from_residual", - [] - |), - [ M.read (| residual |) ] + ] + |) + |), + [ + fun γ => + ltac:(M.monadic + (let γ0_0 := + M.get_struct_tuple_field_or_break_match (| + γ, + "core::ops::control_flow::ControlFlow::Break", + 0 + |) in + let residual := M.copy (| γ0_0 |) in + M.alloc (| + M.never_to_any (| + M.read (| + M.return_ (| + M.call_closure (| + M.get_trait_method (| + "core::ops::try_trait::FromResidual", + Ty.apply (Ty.path "core::option::Option") [ Ty.path "u8" ], + [ + Ty.apply + (Ty.path "core::option::Option") + [ Ty.path "core::convert::Infallible" ] + ], + "from_residual", + [] + |), + [ M.read (| residual |) ] + |) |) |) |) - |) - |))); - fun γ => - ltac:(M.monadic - (let γ0_0 := - M.get_struct_tuple_field_or_break_match (| - γ, - "core::ops::control_flow::ControlFlow::Continue", - 0 - |) in - let val := M.copy (| γ0_0 |) in - val)) - ] - |), - "unpacking_options_via_question_mark::PhoneNumber", - "area_code" + |))); + fun γ => + ltac:(M.monadic + (let γ0_0 := + M.get_struct_tuple_field_or_break_match (| + γ, + "core::ops::control_flow::ControlFlow::Continue", + 0 + |) in + let val := M.copy (| γ0_0 |) in + val)) + ] + |) + ] |) |))) |))) diff --git a/CoqOfRust/examples/default/examples/rust_book/expressions/const_underscore_expression.v b/CoqOfRust/examples/default/examples/rust_book/expressions/const_underscore_expression.v index 817e4a2eb..20208bf31 100644 --- a/CoqOfRust/examples/default/examples/rust_book/expressions/const_underscore_expression.v +++ b/CoqOfRust/examples/default/examples/rust_book/expressions/const_underscore_expression.v @@ -23,7 +23,10 @@ Module underscore. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| self, "const_underscore_expression::Bar", "test" |) + M.call_closure (| + M.get_struct_record_field "const_underscore_expression::Bar" "test", + [ self ] + |) |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/rust_book/functions/associated_functions_and_methods.v b/CoqOfRust/examples/default/examples/rust_book/functions/associated_functions_and_methods.v index 17284a797..3ed3dab94 100644 --- a/CoqOfRust/examples/default/examples/rust_book/functions/associated_functions_and_methods.v +++ b/CoqOfRust/examples/default/examples/rust_book/functions/associated_functions_and_methods.v @@ -74,10 +74,9 @@ Module Impl_associated_functions_and_methods_Rectangle. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| - M.read (| self |), - "associated_functions_and_methods::Rectangle", - "p1" + M.call_closure (| + M.get_struct_record_field "associated_functions_and_methods::Rectangle" "p1", + [ M.read (| self |) ] |) |))) | _, _ => M.impossible @@ -103,10 +102,9 @@ Module Impl_associated_functions_and_methods_Rectangle. (let self := M.alloc (| self |) in M.read (| M.match_operator (| - M.get_struct_record_field (| - M.read (| self |), - "associated_functions_and_methods::Rectangle", - "p1" + M.call_closure (| + M.get_struct_record_field "associated_functions_and_methods::Rectangle" "p1", + [ M.read (| self |) ] |), [ fun γ => @@ -126,10 +124,9 @@ Module Impl_associated_functions_and_methods_Rectangle. let x1 := M.copy (| γ0_0 |) in let y1 := M.copy (| γ0_1 |) in M.match_operator (| - M.get_struct_record_field (| - M.read (| self |), - "associated_functions_and_methods::Rectangle", - "p2" + M.call_closure (| + M.get_struct_record_field "associated_functions_and_methods::Rectangle" "p2", + [ M.read (| self |) ] |), [ fun γ => @@ -184,10 +181,9 @@ Module Impl_associated_functions_and_methods_Rectangle. (let self := M.alloc (| self |) in M.read (| M.match_operator (| - M.get_struct_record_field (| - M.read (| self |), - "associated_functions_and_methods::Rectangle", - "p1" + M.call_closure (| + M.get_struct_record_field "associated_functions_and_methods::Rectangle" "p1", + [ M.read (| self |) ] |), [ fun γ => @@ -207,10 +203,9 @@ Module Impl_associated_functions_and_methods_Rectangle. let x1 := M.copy (| γ0_0 |) in let y1 := M.copy (| γ0_1 |) in M.match_operator (| - M.get_struct_record_field (| - M.read (| self |), - "associated_functions_and_methods::Rectangle", - "p2" + M.call_closure (| + M.get_struct_record_field "associated_functions_and_methods::Rectangle" "p2", + [ M.read (| self |) ] |), [ fun γ => @@ -273,50 +268,50 @@ Module Impl_associated_functions_and_methods_Rectangle. M.read (| let _ := let β := - M.get_struct_record_field (| - M.get_struct_record_field (| - M.read (| self |), - "associated_functions_and_methods::Rectangle", - "p1" - |), - "associated_functions_and_methods::Point", - "x" + M.call_closure (| + M.get_struct_record_field "associated_functions_and_methods::Point" "x", + [ + M.call_closure (| + M.get_struct_record_field "associated_functions_and_methods::Rectangle" "p1", + [ M.read (| self |) ] + |) + ] |) in M.write (| β, BinOp.Panic.add (| M.read (| β |), M.read (| x |) |) |) in let _ := let β := - M.get_struct_record_field (| - M.get_struct_record_field (| - M.read (| self |), - "associated_functions_and_methods::Rectangle", - "p2" - |), - "associated_functions_and_methods::Point", - "x" + M.call_closure (| + M.get_struct_record_field "associated_functions_and_methods::Point" "x", + [ + M.call_closure (| + M.get_struct_record_field "associated_functions_and_methods::Rectangle" "p2", + [ M.read (| self |) ] + |) + ] |) in M.write (| β, BinOp.Panic.add (| M.read (| β |), M.read (| x |) |) |) in let _ := let β := - M.get_struct_record_field (| - M.get_struct_record_field (| - M.read (| self |), - "associated_functions_and_methods::Rectangle", - "p1" - |), - "associated_functions_and_methods::Point", - "y" + M.call_closure (| + M.get_struct_record_field "associated_functions_and_methods::Point" "y", + [ + M.call_closure (| + M.get_struct_record_field "associated_functions_and_methods::Rectangle" "p1", + [ M.read (| self |) ] + |) + ] |) in M.write (| β, BinOp.Panic.add (| M.read (| β |), M.read (| y |) |) |) in let _ := let β := - M.get_struct_record_field (| - M.get_struct_record_field (| - M.read (| self |), - "associated_functions_and_methods::Rectangle", - "p2" - |), - "associated_functions_and_methods::Point", - "y" + M.call_closure (| + M.get_struct_record_field "associated_functions_and_methods::Point" "y", + [ + M.call_closure (| + M.get_struct_record_field "associated_functions_and_methods::Rectangle" "p2", + [ M.read (| self |) ] + |) + ] |) in M.write (| β, BinOp.Panic.add (| M.read (| β |), M.read (| y |) |) |) in M.alloc (| Value.Tuple [] |) diff --git a/CoqOfRust/examples/default/examples/rust_book/generics/generics_associated_types_problem.v b/CoqOfRust/examples/default/examples/rust_book/generics/generics_associated_types_problem.v index b330eec89..31231cb5c 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_associated_types_problem.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_associated_types_problem.v @@ -38,10 +38,9 @@ Module Impl_generics_associated_types_problem_Contains_i32_i32_for_generics_asso |), [ M.alloc (| - M.get_struct_tuple_field (| - M.read (| self |), - "generics_associated_types_problem::Container", - 0 + M.call_closure (| + M.get_struct_tuple_field "generics_associated_types_problem::Container" 0, + [ M.read (| self |) ] |) |); number_1 @@ -58,10 +57,9 @@ Module Impl_generics_associated_types_problem_Contains_i32_i32_for_generics_asso |), [ M.alloc (| - M.get_struct_tuple_field (| - M.read (| self |), - "generics_associated_types_problem::Container", - 1 + M.call_closure (| + M.get_struct_tuple_field "generics_associated_types_problem::Container" 1, + [ M.read (| self |) ] |) |); number_2 @@ -82,10 +80,9 @@ Module Impl_generics_associated_types_problem_Contains_i32_i32_for_generics_asso ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_tuple_field (| - M.read (| self |), - "generics_associated_types_problem::Container", - 0 + M.call_closure (| + M.get_struct_tuple_field "generics_associated_types_problem::Container" 0, + [ M.read (| self |) ] |) |))) | _, _ => M.impossible @@ -102,10 +99,9 @@ Module Impl_generics_associated_types_problem_Contains_i32_i32_for_generics_asso ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_tuple_field (| - M.read (| self |), - "generics_associated_types_problem::Container", - 1 + M.call_closure (| + M.get_struct_tuple_field "generics_associated_types_problem::Container" 1, + [ M.read (| self |) ] |) |))) | _, _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/rust_book/generics/generics_associated_types_solution.v b/CoqOfRust/examples/default/examples/rust_book/generics/generics_associated_types_solution.v index 4c3584533..6b062150c 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_associated_types_solution.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_associated_types_solution.v @@ -44,10 +44,9 @@ Module Impl_generics_associated_types_solution_Contains_for_generics_associated_ |), [ M.alloc (| - M.get_struct_tuple_field (| - M.read (| self |), - "generics_associated_types_solution::Container", - 0 + M.call_closure (| + M.get_struct_tuple_field "generics_associated_types_solution::Container" 0, + [ M.read (| self |) ] |) |); number_1 @@ -64,10 +63,9 @@ Module Impl_generics_associated_types_solution_Contains_for_generics_associated_ |), [ M.alloc (| - M.get_struct_tuple_field (| - M.read (| self |), - "generics_associated_types_solution::Container", - 1 + M.call_closure (| + M.get_struct_tuple_field "generics_associated_types_solution::Container" 1, + [ M.read (| self |) ] |) |); number_2 @@ -88,10 +86,9 @@ Module Impl_generics_associated_types_solution_Contains_for_generics_associated_ ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_tuple_field (| - M.read (| self |), - "generics_associated_types_solution::Container", - 0 + M.call_closure (| + M.get_struct_tuple_field "generics_associated_types_solution::Container" 0, + [ M.read (| self |) ] |) |))) | _, _ => M.impossible @@ -108,10 +105,9 @@ Module Impl_generics_associated_types_solution_Contains_for_generics_associated_ ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_tuple_field (| - M.read (| self |), - "generics_associated_types_solution::Container", - 1 + M.call_closure (| + M.get_struct_tuple_field "generics_associated_types_solution::Container" 1, + [ M.read (| self |) ] |) |))) | _, _ => M.impossible @@ -128,10 +124,9 @@ Module Impl_generics_associated_types_solution_Contains_for_generics_associated_ ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_tuple_field (| - M.read (| self |), - "generics_associated_types_solution::Container", - 0 + M.call_closure (| + M.get_struct_tuple_field "generics_associated_types_solution::Container" 0, + [ M.read (| self |) ] |) |))) | _, _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/rust_book/generics/generics_bounds.v b/CoqOfRust/examples/default/examples/rust_book/generics/generics_bounds.v index f674dd3a1..1d0789aeb 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_bounds.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_bounds.v @@ -34,19 +34,17 @@ Module Impl_core_fmt_Debug_for_generics_bounds_Rectangle. M.read (| Value.String "length" |); (* Unsize *) M.pointer_coercion - (M.get_struct_record_field (| - M.read (| self |), - "generics_bounds::Rectangle", - "length" + (M.call_closure (| + M.get_struct_record_field "generics_bounds::Rectangle" "length", + [ M.read (| self |) ] |)); M.read (| Value.String "height" |); (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_record_field (| - M.read (| self |), - "generics_bounds::Rectangle", - "height" + M.call_closure (| + M.get_struct_record_field "generics_bounds::Rectangle" "height", + [ M.read (| self |) ] |) |)) ] @@ -84,17 +82,15 @@ Module Impl_generics_bounds_HasArea_for_generics_bounds_Rectangle. (let self := M.alloc (| self |) in BinOp.Panic.mul (| M.read (| - M.get_struct_record_field (| - M.read (| self |), - "generics_bounds::Rectangle", - "length" + M.call_closure (| + M.get_struct_record_field "generics_bounds::Rectangle" "length", + [ M.read (| self |) ] |) |), M.read (| - M.get_struct_record_field (| - M.read (| self |), - "generics_bounds::Rectangle", - "height" + M.call_closure (| + M.get_struct_record_field "generics_bounds::Rectangle" "height", + [ M.read (| self |) ] |) |) |))) diff --git a/CoqOfRust/examples/default/examples/rust_book/generics/generics_implementation.v b/CoqOfRust/examples/default/examples/rust_book/generics/generics_implementation.v index 8f4754305..56de6c931 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_implementation.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_implementation.v @@ -29,7 +29,10 @@ Module Impl_generics_implementation_Val. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.get_struct_record_field (| M.read (| self |), "generics_implementation::Val", "val" |))) + M.call_closure (| + M.get_struct_record_field "generics_implementation::Val" "val", + [ M.read (| self |) ] + |))) | _, _ => M.impossible end. @@ -50,10 +53,9 @@ Module Impl_generics_implementation_GenVal_T. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.get_struct_record_field (| - M.read (| self |), - "generics_implementation::GenVal", - "gen_val" + M.call_closure (| + M.get_struct_record_field "generics_implementation::GenVal" "gen_val", + [ M.read (| self |) ] |))) | _, _ => M.impossible end. diff --git a/CoqOfRust/examples/default/examples/rust_book/generics/generics_new_type_idiom.v b/CoqOfRust/examples/default/examples/rust_book/generics/generics_new_type_idiom.v index 157a630f0..065ff0448 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_new_type_idiom.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_new_type_idiom.v @@ -34,10 +34,9 @@ Module Impl_generics_new_type_idiom_Years. [ BinOp.Panic.mul (| M.read (| - M.get_struct_tuple_field (| - M.read (| self |), - "generics_new_type_idiom::Years", - 0 + M.call_closure (| + M.get_struct_tuple_field "generics_new_type_idiom::Years" 0, + [ M.read (| self |) ] |) |), Value.Integer Integer.I64 365 @@ -67,7 +66,10 @@ Module Impl_generics_new_type_idiom_Days. [ BinOp.Panic.div (| M.read (| - M.get_struct_tuple_field (| M.read (| self |), "generics_new_type_idiom::Days", 0 |) + M.call_closure (| + M.get_struct_tuple_field "generics_new_type_idiom::Days" 0, + [ M.read (| self |) ] + |) |), Value.Integer Integer.I64 365 |) @@ -90,7 +92,10 @@ Definition old_enough (τ : list Ty.t) (α : list Value.t) : M := (let age := M.alloc (| age |) in BinOp.Pure.ge (M.read (| - M.get_struct_tuple_field (| M.read (| age |), "generics_new_type_idiom::Years", 0 |) + M.call_closure (| + M.get_struct_tuple_field "generics_new_type_idiom::Years" 0, + [ M.read (| age |) ] + |) |)) (Value.Integer Integer.I64 18))) | _, _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/rust_book/generics/generics_new_type_idiom_as_base_type.v b/CoqOfRust/examples/default/examples/rust_book/generics/generics_new_type_idiom_as_base_type.v index 0300ffd70..a5b6c79ee 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_new_type_idiom_as_base_type.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_new_type_idiom_as_base_type.v @@ -29,7 +29,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := |) in let years_as_primitive_1 := M.copy (| - M.get_struct_tuple_field (| years, "generics_new_type_idiom_as_base_type::Years", 0 |) + M.call_closure (| + M.get_struct_tuple_field "generics_new_type_idiom_as_base_type::Years" 0, + [ years ] + |) |) in M.match_operator (| years, diff --git a/CoqOfRust/examples/default/examples/rust_book/generics/generics_phantom_type.v b/CoqOfRust/examples/default/examples/rust_book/generics/generics_phantom_type.v index 031d6958e..4b6694a57 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_phantom_type.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_phantom_type.v @@ -38,15 +38,13 @@ Module Impl_core_cmp_PartialEq_where_core_cmp_PartialEq_A_where_core_cmp_Partial M.call_closure (| M.get_trait_method (| "core::cmp::PartialEq", A, [ A ], "eq", [] |), [ - M.get_struct_tuple_field (| - M.read (| self |), - "generics_phantom_type::PhantomTuple", - 0 + M.call_closure (| + M.get_struct_tuple_field "generics_phantom_type::PhantomTuple" 0, + [ M.read (| self |) ] |); - M.get_struct_tuple_field (| - M.read (| other |), - "generics_phantom_type::PhantomTuple", - 0 + M.call_closure (| + M.get_struct_tuple_field "generics_phantom_type::PhantomTuple" 0, + [ M.read (| other |) ] |) ] |), @@ -60,15 +58,13 @@ Module Impl_core_cmp_PartialEq_where_core_cmp_PartialEq_A_where_core_cmp_Partial [] |), [ - M.get_struct_tuple_field (| - M.read (| self |), - "generics_phantom_type::PhantomTuple", - 1 + M.call_closure (| + M.get_struct_tuple_field "generics_phantom_type::PhantomTuple" 1, + [ M.read (| self |) ] |); - M.get_struct_tuple_field (| - M.read (| other |), - "generics_phantom_type::PhantomTuple", - 1 + M.call_closure (| + M.get_struct_tuple_field "generics_phantom_type::PhantomTuple" 1, + [ M.read (| other |) ] |) ] |))) @@ -121,15 +117,13 @@ Module Impl_core_cmp_PartialEq_where_core_cmp_PartialEq_A_where_core_cmp_Partial M.call_closure (| M.get_trait_method (| "core::cmp::PartialEq", A, [ A ], "eq", [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "generics_phantom_type::PhantomStruct", - "first" + M.call_closure (| + M.get_struct_record_field "generics_phantom_type::PhantomStruct" "first", + [ M.read (| self |) ] |); - M.get_struct_record_field (| - M.read (| other |), - "generics_phantom_type::PhantomStruct", - "first" + M.call_closure (| + M.get_struct_record_field "generics_phantom_type::PhantomStruct" "first", + [ M.read (| other |) ] |) ] |), @@ -143,15 +137,13 @@ Module Impl_core_cmp_PartialEq_where_core_cmp_PartialEq_A_where_core_cmp_Partial [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "generics_phantom_type::PhantomStruct", - "phantom" + M.call_closure (| + M.get_struct_record_field "generics_phantom_type::PhantomStruct" "phantom", + [ M.read (| self |) ] |); - M.get_struct_record_field (| - M.read (| other |), - "generics_phantom_type::PhantomStruct", - "phantom" + M.call_closure (| + M.get_struct_record_field "generics_phantom_type::PhantomStruct" "phantom", + [ M.read (| other |) ] |) ] |))) diff --git a/CoqOfRust/examples/default/examples/rust_book/generics/generics_phantom_type_test_case_unit_clarification.v b/CoqOfRust/examples/default/examples/rust_book/generics/generics_phantom_type_test_case_unit_clarification.v index 432a3a1da..339ed0cd0 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_phantom_type_test_case_unit_clarification.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_phantom_type_test_case_unit_clarification.v @@ -148,18 +148,20 @@ Module Impl_core_fmt_Debug_where_core_fmt_Debug_Unit_for_generics_phantom_type_t M.read (| Value.String "Length" |); (* Unsize *) M.pointer_coercion - (M.get_struct_tuple_field (| - M.read (| self |), - "generics_phantom_type_test_case_unit_clarification::Length", - 0 + (M.call_closure (| + M.get_struct_tuple_field + "generics_phantom_type_test_case_unit_clarification::Length" + 0, + [ M.read (| self |) ] |)); (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_tuple_field (| - M.read (| self |), - "generics_phantom_type_test_case_unit_clarification::Length", - 1 + M.call_closure (| + M.get_struct_tuple_field + "generics_phantom_type_test_case_unit_clarification::Length" + 1, + [ M.read (| self |) ] |) |)) ] @@ -193,10 +195,11 @@ Module Impl_core_clone_Clone_where_core_clone_Clone_Unit_for_generics_phantom_ty M.call_closure (| M.get_trait_method (| "core::clone::Clone", Ty.path "f64", [], "clone", [] |), [ - M.get_struct_tuple_field (| - M.read (| self |), - "generics_phantom_type_test_case_unit_clarification::Length", - 0 + M.call_closure (| + M.get_struct_tuple_field + "generics_phantom_type_test_case_unit_clarification::Length" + 0, + [ M.read (| self |) ] |) ] |); @@ -209,10 +212,11 @@ Module Impl_core_clone_Clone_where_core_clone_Clone_Unit_for_generics_phantom_ty [] |), [ - M.get_struct_tuple_field (| - M.read (| self |), - "generics_phantom_type_test_case_unit_clarification::Length", - 1 + M.call_closure (| + M.get_struct_tuple_field + "generics_phantom_type_test_case_unit_clarification::Length" + 1, + [ M.read (| self |) ] |) ] |) @@ -268,17 +272,19 @@ Module Impl_core_ops_arith_Add_for_generics_phantom_type_test_case_unit_clarific [ BinOp.Panic.add (| M.read (| - M.get_struct_tuple_field (| - self, - "generics_phantom_type_test_case_unit_clarification::Length", - 0 + M.call_closure (| + M.get_struct_tuple_field + "generics_phantom_type_test_case_unit_clarification::Length" + 0, + [ self ] |) |), M.read (| - M.get_struct_tuple_field (| - rhs, - "generics_phantom_type_test_case_unit_clarification::Length", - 0 + M.call_closure (| + M.get_struct_tuple_field + "generics_phantom_type_test_case_unit_clarification::Length" + 0, + [ rhs ] |) |) |); @@ -406,10 +412,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "f64" ] |), [ - M.get_struct_tuple_field (| - two_feet, - "generics_phantom_type_test_case_unit_clarification::Length", - 0 + M.call_closure (| + M.get_struct_tuple_field + "generics_phantom_type_test_case_unit_clarification::Length" + 0, + [ two_feet ] |) ] |) @@ -452,10 +459,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "f64" ] |), [ - M.get_struct_tuple_field (| - two_meters, - "generics_phantom_type_test_case_unit_clarification::Length", - 0 + M.call_closure (| + M.get_struct_tuple_field + "generics_phantom_type_test_case_unit_clarification::Length" + 0, + [ two_meters ] |) ] |) diff --git a/CoqOfRust/examples/default/examples/rust_book/modules/struct_visibility.v b/CoqOfRust/examples/default/examples/rust_book/modules/struct_visibility.v index 9403c0085..2b688f8bf 100644 --- a/CoqOfRust/examples/default/examples/rust_book/modules/struct_visibility.v +++ b/CoqOfRust/examples/default/examples/rust_book/modules/struct_visibility.v @@ -109,10 +109,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] |), [ - M.get_struct_record_field (| - open_box, - "struct_visibility::my::OpenBox", - "contents" + M.call_closure (| + M.get_struct_record_field + "struct_visibility::my::OpenBox" + "contents", + [ open_box ] |) ] |) diff --git a/CoqOfRust/examples/default/examples/rust_book/primitives/tuples.v b/CoqOfRust/examples/default/examples/rust_book/primitives/tuples.v index 09081b727..51246f9ba 100644 --- a/CoqOfRust/examples/default/examples/rust_book/primitives/tuples.v +++ b/CoqOfRust/examples/default/examples/rust_book/primitives/tuples.v @@ -60,16 +60,30 @@ Module Impl_core_fmt_Debug_for_tuples_Matrix. M.read (| Value.String "Matrix" |); (* Unsize *) M.pointer_coercion - (M.get_struct_tuple_field (| M.read (| self |), "tuples::Matrix", 0 |)); + (M.call_closure (| + M.get_struct_tuple_field "tuples::Matrix" 0, + [ M.read (| self |) ] + |)); (* Unsize *) M.pointer_coercion - (M.get_struct_tuple_field (| M.read (| self |), "tuples::Matrix", 1 |)); + (M.call_closure (| + M.get_struct_tuple_field "tuples::Matrix" 1, + [ M.read (| self |) ] + |)); (* Unsize *) M.pointer_coercion - (M.get_struct_tuple_field (| M.read (| self |), "tuples::Matrix", 2 |)); + (M.call_closure (| + M.get_struct_tuple_field "tuples::Matrix" 2, + [ M.read (| self |) ] + |)); (* Unsize *) M.pointer_coercion - (M.alloc (| M.get_struct_tuple_field (| M.read (| self |), "tuples::Matrix", 3 |) |)) + (M.alloc (| + M.call_closure (| + M.get_struct_tuple_field "tuples::Matrix" 3, + [ M.read (| self |) ] + |) + |)) ] |))) | _, _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_aliasing.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_aliasing.v index c5c0f71a5..a878061db 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_aliasing.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_aliasing.v @@ -116,10 +116,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field (| - M.read (| borrowed_point |), - "scoping_rules_borrowing_aliasing::Point", - "x" + M.call_closure (| + M.get_struct_record_field + "scoping_rules_borrowing_aliasing::Point" + "x", + [ M.read (| borrowed_point |) ] |) ] |); @@ -130,10 +131,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field (| - M.read (| another_borrow |), - "scoping_rules_borrowing_aliasing::Point", - "y" + M.call_closure (| + M.get_struct_record_field + "scoping_rules_borrowing_aliasing::Point" + "y", + [ M.read (| another_borrow |) ] |) ] |); @@ -144,10 +146,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field (| - point, - "scoping_rules_borrowing_aliasing::Point", - "z" + M.call_closure (| + M.get_struct_record_field + "scoping_rules_borrowing_aliasing::Point" + "z", + [ point ] |) ] |) @@ -192,10 +195,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field (| - M.read (| borrowed_point |), - "scoping_rules_borrowing_aliasing::Point", - "x" + M.call_closure (| + M.get_struct_record_field + "scoping_rules_borrowing_aliasing::Point" + "x", + [ M.read (| borrowed_point |) ] |) ] |); @@ -206,10 +210,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field (| - M.read (| another_borrow |), - "scoping_rules_borrowing_aliasing::Point", - "y" + M.call_closure (| + M.get_struct_record_field + "scoping_rules_borrowing_aliasing::Point" + "y", + [ M.read (| another_borrow |) ] |) ] |); @@ -220,10 +225,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field (| - point, - "scoping_rules_borrowing_aliasing::Point", - "z" + M.call_closure (| + M.get_struct_record_field + "scoping_rules_borrowing_aliasing::Point" + "z", + [ point ] |) ] |) @@ -238,28 +244,25 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let mutable_borrow := M.alloc (| point |) in let _ := M.write (| - M.get_struct_record_field (| - M.read (| mutable_borrow |), - "scoping_rules_borrowing_aliasing::Point", - "x" + M.call_closure (| + M.get_struct_record_field "scoping_rules_borrowing_aliasing::Point" "x", + [ M.read (| mutable_borrow |) ] |), Value.Integer Integer.I32 5 |) in let _ := M.write (| - M.get_struct_record_field (| - M.read (| mutable_borrow |), - "scoping_rules_borrowing_aliasing::Point", - "y" + M.call_closure (| + M.get_struct_record_field "scoping_rules_borrowing_aliasing::Point" "y", + [ M.read (| mutable_borrow |) ] |), Value.Integer Integer.I32 2 |) in let _ := M.write (| - M.get_struct_record_field (| - M.read (| mutable_borrow |), - "scoping_rules_borrowing_aliasing::Point", - "z" + M.call_closure (| + M.get_struct_record_field "scoping_rules_borrowing_aliasing::Point" "z", + [ M.read (| mutable_borrow |) ] |), Value.Integer Integer.I32 1 |) in @@ -296,10 +299,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field (| - M.read (| mutable_borrow |), - "scoping_rules_borrowing_aliasing::Point", - "x" + M.call_closure (| + M.get_struct_record_field + "scoping_rules_borrowing_aliasing::Point" + "x", + [ M.read (| mutable_borrow |) ] |) ] |); @@ -310,10 +314,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field (| - M.read (| mutable_borrow |), - "scoping_rules_borrowing_aliasing::Point", - "y" + M.call_closure (| + M.get_struct_record_field + "scoping_rules_borrowing_aliasing::Point" + "y", + [ M.read (| mutable_borrow |) ] |) ] |); @@ -324,10 +329,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field (| - M.read (| mutable_borrow |), - "scoping_rules_borrowing_aliasing::Point", - "z" + M.call_closure (| + M.get_struct_record_field + "scoping_rules_borrowing_aliasing::Point" + "z", + [ M.read (| mutable_borrow |) ] |) ] |) @@ -373,10 +379,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field (| - M.read (| new_borrowed_point |), - "scoping_rules_borrowing_aliasing::Point", - "x" + M.call_closure (| + M.get_struct_record_field + "scoping_rules_borrowing_aliasing::Point" + "x", + [ M.read (| new_borrowed_point |) ] |) ] |); @@ -387,10 +394,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field (| - M.read (| new_borrowed_point |), - "scoping_rules_borrowing_aliasing::Point", - "y" + M.call_closure (| + M.get_struct_record_field + "scoping_rules_borrowing_aliasing::Point" + "y", + [ M.read (| new_borrowed_point |) ] |) ] |); @@ -401,10 +409,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field (| - M.read (| new_borrowed_point |), - "scoping_rules_borrowing_aliasing::Point", - "z" + M.call_closure (| + M.get_struct_record_field + "scoping_rules_borrowing_aliasing::Point" + "z", + [ M.read (| new_borrowed_point |) ] |) ] |) diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_mutablity.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_mutablity.v index 5a0f37ad9..e7cd00044 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_mutablity.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_mutablity.v @@ -107,10 +107,11 @@ Definition borrow_book (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] |), [ - M.get_struct_record_field (| - M.read (| book |), - "scoping_rules_borrowing_mutablity::Book", - "title" + M.call_closure (| + M.get_struct_record_field + "scoping_rules_borrowing_mutablity::Book" + "title", + [ M.read (| book |) ] |) ] |); @@ -121,10 +122,11 @@ Definition borrow_book (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "u32" ] |), [ - M.get_struct_record_field (| - M.read (| book |), - "scoping_rules_borrowing_mutablity::Book", - "year" + M.call_closure (| + M.get_struct_record_field + "scoping_rules_borrowing_mutablity::Book" + "year", + [ M.read (| book |) ] |) ] |) @@ -155,10 +157,9 @@ Definition new_edition (τ : list Ty.t) (α : list Value.t) : M := M.read (| let _ := M.write (| - M.get_struct_record_field (| - M.read (| book |), - "scoping_rules_borrowing_mutablity::Book", - "year" + M.call_closure (| + M.get_struct_record_field "scoping_rules_borrowing_mutablity::Book" "year", + [ M.read (| book |) ] |), Value.Integer Integer.U32 2014 |) in @@ -194,10 +195,11 @@ Definition new_edition (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] |), [ - M.get_struct_record_field (| - M.read (| book |), - "scoping_rules_borrowing_mutablity::Book", - "title" + M.call_closure (| + M.get_struct_record_field + "scoping_rules_borrowing_mutablity::Book" + "title", + [ M.read (| book |) ] |) ] |); @@ -208,10 +210,11 @@ Definition new_edition (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "u32" ] |), [ - M.get_struct_record_field (| - M.read (| book |), - "scoping_rules_borrowing_mutablity::Book", - "year" + M.call_closure (| + M.get_struct_record_field + "scoping_rules_borrowing_mutablity::Book" + "year", + [ M.read (| book |) ] |) ] |) diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_the_ref_pattern.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_the_ref_pattern.v index e3c7e7fbf..49e228ed3 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_the_ref_pattern.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_borrowing_the_ref_pattern.v @@ -253,10 +253,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field (| - point, - "scoping_rules_borrowing_the_ref_pattern::Point", - "x" + M.call_closure (| + M.get_struct_record_field + "scoping_rules_borrowing_the_ref_pattern::Point" + "x", + [ point ] |) ] |); @@ -267,10 +268,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field (| - point, - "scoping_rules_borrowing_the_ref_pattern::Point", - "y" + M.call_closure (| + M.get_struct_record_field + "scoping_rules_borrowing_the_ref_pattern::Point" + "y", + [ point ] |) ] |) @@ -318,10 +320,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field (| - mutable_point, - "scoping_rules_borrowing_the_ref_pattern::Point", - "x" + M.call_closure (| + M.get_struct_record_field + "scoping_rules_borrowing_the_ref_pattern::Point" + "x", + [ mutable_point ] |) ] |); @@ -332,10 +335,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "i32" ] |), [ - M.get_struct_record_field (| - mutable_point, - "scoping_rules_borrowing_the_ref_pattern::Point", - "y" + M.call_closure (| + M.get_struct_record_field + "scoping_rules_borrowing_the_ref_pattern::Point" + "y", + [ mutable_point ] |) ] |) diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_bounds.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_bounds.v index 9b14b4d66..4e228e0f8 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_bounds.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_bounds.v @@ -33,10 +33,9 @@ Module Impl_core_fmt_Debug_where_core_fmt_Debug_T_for_scoping_rules_lifetimes_bo (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_tuple_field (| - M.read (| self |), - "scoping_rules_lifetimes_bounds::Ref", - 0 + M.call_closure (| + M.get_struct_tuple_field "scoping_rules_lifetimes_bounds::Ref" 0, + [ M.read (| self |) ] |) |)) ] diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_methods.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_methods.v index 069532dab..4ff6ab085 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_methods.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_methods.v @@ -25,10 +25,9 @@ Module Impl_scoping_rules_lifetimes_methods_Owner. M.read (| let _ := let β := - M.get_struct_tuple_field (| - M.read (| self |), - "scoping_rules_lifetimes_methods::Owner", - 0 + M.call_closure (| + M.get_struct_tuple_field "scoping_rules_lifetimes_methods::Owner" 0, + [ M.read (| self |) ] |) in M.write (| β, BinOp.Panic.add (| M.read (| β |), Value.Integer Integer.I32 1 |) |) in M.alloc (| Value.Tuple [] |) @@ -78,10 +77,11 @@ Module Impl_scoping_rules_lifetimes_methods_Owner. [ Ty.path "i32" ] |), [ - M.get_struct_tuple_field (| - M.read (| self |), - "scoping_rules_lifetimes_methods::Owner", - 0 + M.call_closure (| + M.get_struct_tuple_field + "scoping_rules_lifetimes_methods::Owner" + 0, + [ M.read (| self |) ] |) ] |) diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_structs.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_structs.v index 1db0c7f7c..9f392271f 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_structs.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_structs.v @@ -31,10 +31,9 @@ Module Impl_core_fmt_Debug_for_scoping_rules_lifetimes_structs_Borrowed. (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_tuple_field (| - M.read (| self |), - "scoping_rules_lifetimes_structs::Borrowed", - 0 + M.call_closure (| + M.get_struct_tuple_field "scoping_rules_lifetimes_structs::Borrowed" 0, + [ M.read (| self |) ] |) |)) ] @@ -83,19 +82,17 @@ Module Impl_core_fmt_Debug_for_scoping_rules_lifetimes_structs_NamedBorrowed. M.read (| Value.String "x" |); (* Unsize *) M.pointer_coercion - (M.get_struct_record_field (| - M.read (| self |), - "scoping_rules_lifetimes_structs::NamedBorrowed", - "x" + (M.call_closure (| + M.get_struct_record_field "scoping_rules_lifetimes_structs::NamedBorrowed" "x", + [ M.read (| self |) ] |)); M.read (| Value.String "y" |); (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_record_field (| - M.read (| self |), - "scoping_rules_lifetimes_structs::NamedBorrowed", - "y" + M.call_closure (| + M.get_struct_record_field "scoping_rules_lifetimes_structs::NamedBorrowed" "y", + [ M.read (| self |) ] |) |)) ] diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_traits.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_traits.v index 7a1575590..13a5ce60e 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_traits.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_lifetimes_traits.v @@ -32,10 +32,9 @@ Module Impl_core_fmt_Debug_for_scoping_rules_lifetimes_traits_Borrowed. (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_record_field (| - M.read (| self |), - "scoping_rules_lifetimes_traits::Borrowed", - "x" + M.call_closure (| + M.get_struct_record_field "scoping_rules_lifetimes_traits::Borrowed" "x", + [ M.read (| self |) ] |) |)) ] diff --git a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules_partial_moves.v b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules_partial_moves.v index 763450853..83616528d 100644 --- a/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules_partial_moves.v +++ b/CoqOfRust/examples/default/examples/rust_book/scoping_rules/scoping_rules_ownership_and_rules_partial_moves.v @@ -219,10 +219,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ] |), [ - M.get_struct_record_field (| - person, - "scoping_rules_ownership_and_rules_partial_moves::main::Person", - "age" + M.call_closure (| + M.get_struct_record_field + "scoping_rules_ownership_and_rules_partial_moves::main::Person" + "age", + [ person ] |) ] |) @@ -277,19 +278,21 @@ Module main. M.read (| Value.String "name" |); (* Unsize *) M.pointer_coercion - (M.get_struct_record_field (| - M.read (| self |), - "scoping_rules_ownership_and_rules_partial_moves::main::Person", - "name" + (M.call_closure (| + M.get_struct_record_field + "scoping_rules_ownership_and_rules_partial_moves::main::Person" + "name", + [ M.read (| self |) ] |)); M.read (| Value.String "age" |); (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_record_field (| - M.read (| self |), - "scoping_rules_ownership_and_rules_partial_moves::main::Person", - "age" + M.call_closure (| + M.get_struct_record_field + "scoping_rules_ownership_and_rules_partial_moves::main::Person" + "age", + [ M.read (| self |) ] |) |)) ] diff --git a/CoqOfRust/examples/default/examples/rust_book/std_library_types/box_stack_heap.v b/CoqOfRust/examples/default/examples/rust_book/std_library_types/box_stack_heap.v index d927f0dc1..5ffbc8361 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_library_types/box_stack_heap.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_library_types/box_stack_heap.v @@ -31,12 +31,18 @@ Module Impl_core_fmt_Debug_for_box_stack_heap_Point. M.read (| Value.String "x" |); (* Unsize *) M.pointer_coercion - (M.get_struct_record_field (| M.read (| self |), "box_stack_heap::Point", "x" |)); + (M.call_closure (| + M.get_struct_record_field "box_stack_heap::Point" "x", + [ M.read (| self |) ] + |)); M.read (| Value.String "y" |); (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_record_field (| M.read (| self |), "box_stack_heap::Point", "y" |) + M.call_closure (| + M.get_struct_record_field "box_stack_heap::Point" "y", + [ M.read (| self |) ] + |) |)) ] |))) diff --git a/CoqOfRust/examples/default/examples/rust_book/std_library_types/hash_map_alternate_or_custom_key_types.v b/CoqOfRust/examples/default/examples/rust_book/std_library_types/hash_map_alternate_or_custom_key_types.v index c3c3d4335..80533d85d 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_library_types/hash_map_alternate_or_custom_key_types.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_library_types/hash_map_alternate_or_custom_key_types.v @@ -44,15 +44,17 @@ Module Impl_core_cmp_PartialEq_for_hash_map_alternate_or_custom_key_types_Accoun [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "hash_map_alternate_or_custom_key_types::Account", - "username" + M.call_closure (| + M.get_struct_record_field + "hash_map_alternate_or_custom_key_types::Account" + "username", + [ M.read (| self |) ] |); - M.get_struct_record_field (| - M.read (| other |), - "hash_map_alternate_or_custom_key_types::Account", - "username" + M.call_closure (| + M.get_struct_record_field + "hash_map_alternate_or_custom_key_types::Account" + "username", + [ M.read (| other |) ] |) ] |), @@ -66,15 +68,17 @@ Module Impl_core_cmp_PartialEq_for_hash_map_alternate_or_custom_key_types_Accoun [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "hash_map_alternate_or_custom_key_types::Account", - "password" + M.call_closure (| + M.get_struct_record_field + "hash_map_alternate_or_custom_key_types::Account" + "password", + [ M.read (| self |) ] |); - M.get_struct_record_field (| - M.read (| other |), - "hash_map_alternate_or_custom_key_types::Account", - "password" + M.call_closure (| + M.get_struct_record_field + "hash_map_alternate_or_custom_key_types::Account" + "password", + [ M.read (| other |) ] |) ] |))) @@ -157,10 +161,11 @@ Module Impl_core_hash_Hash_for_hash_map_alternate_or_custom_key_types_Account. [ __H ] |), [ - M.get_struct_record_field (| - M.read (| self |), - "hash_map_alternate_or_custom_key_types::Account", - "username" + M.call_closure (| + M.get_struct_record_field + "hash_map_alternate_or_custom_key_types::Account" + "username", + [ M.read (| self |) ] |); M.read (| state |) ] @@ -176,10 +181,11 @@ Module Impl_core_hash_Hash_for_hash_map_alternate_or_custom_key_types_Account. [ __H ] |), [ - M.get_struct_record_field (| - M.read (| self |), - "hash_map_alternate_or_custom_key_types::Account", - "password" + M.call_closure (| + M.get_struct_record_field + "hash_map_alternate_or_custom_key_types::Account" + "password", + [ M.read (| self |) ] |); M.read (| state |) ] @@ -434,10 +440,11 @@ Definition try_logon (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] |), [ - M.get_struct_record_field (| - M.read (| account_info |), - "hash_map_alternate_or_custom_key_types::AccountInfo", - "name" + M.call_closure (| + M.get_struct_record_field + "hash_map_alternate_or_custom_key_types::AccountInfo" + "name", + [ M.read (| account_info |) ] |) ] |) @@ -484,10 +491,11 @@ Definition try_logon (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] |), [ - M.get_struct_record_field (| - M.read (| account_info |), - "hash_map_alternate_or_custom_key_types::AccountInfo", - "email" + M.call_closure (| + M.get_struct_record_field + "hash_map_alternate_or_custom_key_types::AccountInfo" + "email", + [ M.read (| account_info |) ] |) ] |) diff --git a/CoqOfRust/examples/default/examples/rust_book/std_misc/child_processes.v b/CoqOfRust/examples/default/examples/rust_book/std_misc/child_processes.v index 9a19e6cef..5763a0d15 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_misc/child_processes.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_misc/child_processes.v @@ -138,7 +138,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "success", [] |), - [ M.get_struct_record_field (| output, "std::process::Output", "status" |) ] + [ + M.call_closure (| + M.get_struct_record_field "std::process::Output" "status", + [ output ] + |) + ] |) |)) in let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in @@ -161,7 +166,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "deref", [] |), - [ M.get_struct_record_field (| output, "std::process::Output", "stdout" |) + [ + M.call_closure (| + M.get_struct_record_field "std::process::Output" "stdout", + [ output ] + |) ] |) ] @@ -234,7 +243,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "deref", [] |), - [ M.get_struct_record_field (| output, "std::process::Output", "stderr" |) + [ + M.call_closure (| + M.get_struct_record_field "std::process::Output" "stderr", + [ output ] + |) ] |) ] diff --git a/CoqOfRust/examples/default/examples/rust_book/std_misc/child_processes_pipes.v b/CoqOfRust/examples/default/examples/rust_book/std_misc/child_processes_pipes.v index 1c1410307..388f008be 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_misc/child_processes_pipes.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_misc/child_processes_pipes.v @@ -185,7 +185,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := |), [ M.read (| - M.get_struct_record_field (| process, "std::process::Child", "stdin" |) + M.call_closure (| + M.get_struct_record_field "std::process::Child" "stdin", + [ process ] + |) |) ] |) @@ -313,7 +316,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := |), [ M.read (| - M.get_struct_record_field (| process, "std::process::Child", "stdout" |) + M.call_closure (| + M.get_struct_record_field "std::process::Child" "stdout", + [ process ] + |) |) ] |) diff --git a/CoqOfRust/examples/default/examples/rust_book/std_misc/foreign_function_interface.v b/CoqOfRust/examples/default/examples/rust_book/std_misc/foreign_function_interface.v index 0d45fa27f..ca8e9073d 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_misc/foreign_function_interface.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_misc/foreign_function_interface.v @@ -232,10 +232,9 @@ Module Impl_core_fmt_Debug_for_foreign_function_interface_Complex. (M.alloc (| BinOp.Pure.lt (M.read (| - M.get_struct_record_field (| - M.read (| self |), - "foreign_function_interface::Complex", - "im" + M.call_closure (| + M.get_struct_record_field "foreign_function_interface::Complex" "im", + [ M.read (| self |) ] |) |)) (M.read (| UnsupportedLiteral |)) @@ -279,10 +278,11 @@ Module Impl_core_fmt_Debug_for_foreign_function_interface_Complex. [ Ty.path "f32" ] |), [ - M.get_struct_record_field (| - M.read (| self |), - "foreign_function_interface::Complex", - "re" + M.call_closure (| + M.get_struct_record_field + "foreign_function_interface::Complex" + "re", + [ M.read (| self |) ] |) ] |); @@ -296,10 +296,11 @@ Module Impl_core_fmt_Debug_for_foreign_function_interface_Complex. M.alloc (| UnOp.Panic.neg (| M.read (| - M.get_struct_record_field (| - M.read (| self |), - "foreign_function_interface::Complex", - "im" + M.call_closure (| + M.get_struct_record_field + "foreign_function_interface::Complex" + "im", + [ M.read (| self |) ] |) |) |) @@ -353,10 +354,11 @@ Module Impl_core_fmt_Debug_for_foreign_function_interface_Complex. [ Ty.path "f32" ] |), [ - M.get_struct_record_field (| - M.read (| self |), - "foreign_function_interface::Complex", - "re" + M.call_closure (| + M.get_struct_record_field + "foreign_function_interface::Complex" + "re", + [ M.read (| self |) ] |) ] |); @@ -367,10 +369,11 @@ Module Impl_core_fmt_Debug_for_foreign_function_interface_Complex. [ Ty.path "f32" ] |), [ - M.get_struct_record_field (| - M.read (| self |), - "foreign_function_interface::Complex", - "im" + M.call_closure (| + M.get_struct_record_field + "foreign_function_interface::Complex" + "im", + [ M.read (| self |) ] |) ] |) diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/clone.v b/CoqOfRust/examples/default/examples/rust_book/traits/clone.v index 3005e47cf..c7615bae5 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/clone.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/clone.v @@ -95,7 +95,8 @@ Module Impl_core_clone_Clone_for_clone_Pair. "clone", [] |), - [ M.get_struct_tuple_field (| M.read (| self |), "clone::Pair", 0 |) ] + [ M.call_closure (| M.get_struct_tuple_field "clone::Pair" 0, [ M.read (| self |) ] |) + ] |); M.call_closure (| M.get_trait_method (| @@ -107,7 +108,8 @@ Module Impl_core_clone_Clone_for_clone_Pair. "clone", [] |), - [ M.get_struct_tuple_field (| M.read (| self |), "clone::Pair", 1 |) ] + [ M.call_closure (| M.get_struct_tuple_field "clone::Pair" 1, [ M.read (| self |) ] |) + ] |) ])) | _, _ => M.impossible @@ -141,10 +143,16 @@ Module Impl_core_fmt_Debug_for_clone_Pair. M.read (| f |); M.read (| Value.String "Pair" |); (* Unsize *) - M.pointer_coercion (M.get_struct_tuple_field (| M.read (| self |), "clone::Pair", 0 |)); + M.pointer_coercion + (M.call_closure (| + M.get_struct_tuple_field "clone::Pair" 0, + [ M.read (| self |) ] + |)); (* Unsize *) M.pointer_coercion - (M.alloc (| M.get_struct_tuple_field (| M.read (| self |), "clone::Pair", 1 |) |)) + (M.alloc (| + M.call_closure (| M.get_struct_tuple_field "clone::Pair" 1, [ M.read (| self |) ] |) + |)) ] |))) | _, _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/derive.v b/CoqOfRust/examples/default/examples/rust_book/traits/derive.v index b16c959ae..3a402b537 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/derive.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/derive.v @@ -31,9 +31,17 @@ Module Impl_core_cmp_PartialEq_for_derive_Centimeters. (let self := M.alloc (| self |) in let other := M.alloc (| other |) in BinOp.Pure.eq - (M.read (| M.get_struct_tuple_field (| M.read (| self |), "derive::Centimeters", 0 |) |)) (M.read (| - M.get_struct_tuple_field (| M.read (| other |), "derive::Centimeters", 0 |) + M.call_closure (| + M.get_struct_tuple_field "derive::Centimeters" 0, + [ M.read (| self |) ] + |) + |)) + (M.read (| + M.call_closure (| + M.get_struct_tuple_field "derive::Centimeters" 0, + [ M.read (| other |) ] + |) |)))) | _, _ => M.impossible end. @@ -65,8 +73,14 @@ Module Impl_core_cmp_PartialOrd_for_derive_Centimeters. [] |), [ - M.get_struct_tuple_field (| M.read (| self |), "derive::Centimeters", 0 |); - M.get_struct_tuple_field (| M.read (| other |), "derive::Centimeters", 0 |) + M.call_closure (| + M.get_struct_tuple_field "derive::Centimeters" 0, + [ M.read (| self |) ] + |); + M.call_closure (| + M.get_struct_tuple_field "derive::Centimeters" 0, + [ M.read (| other |) ] + |) ] |))) | _, _ => M.impossible @@ -108,7 +122,12 @@ Module Impl_core_fmt_Debug_for_derive_Inches. M.read (| Value.String "Inches" |); (* Unsize *) M.pointer_coercion - (M.alloc (| M.get_struct_tuple_field (| M.read (| self |), "derive::Inches", 0 |) |)) + (M.alloc (| + M.call_closure (| + M.get_struct_tuple_field "derive::Inches" 0, + [ M.read (| self |) ] + |) + |)) ] |))) | _, _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/disambiguating_overlapping_traits.v b/CoqOfRust/examples/default/examples/rust_book/traits/disambiguating_overlapping_traits.v index 853ebd793..c597f4a64 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/disambiguating_overlapping_traits.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/disambiguating_overlapping_traits.v @@ -37,10 +37,9 @@ Module Impl_disambiguating_overlapping_traits_UsernameWidget_for_disambiguating_ [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "disambiguating_overlapping_traits::Form", - "username" + M.call_closure (| + M.get_struct_record_field "disambiguating_overlapping_traits::Form" "username", + [ M.read (| self |) ] |) ] |))) @@ -69,10 +68,9 @@ Module Impl_disambiguating_overlapping_traits_AgeWidget_for_disambiguating_overl ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| - M.read (| self |), - "disambiguating_overlapping_traits::Form", - "age" + M.call_closure (| + M.get_struct_record_field "disambiguating_overlapping_traits::Form" "age", + [ M.read (| self |) ] |) |))) | _, _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/drop.v b/CoqOfRust/examples/default/examples/rust_book/traits/drop.v index a3c0dc794..40f2b717b 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/drop.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/drop.v @@ -54,10 +54,9 @@ Module Impl_core_ops_drop_Drop_for_drop_Droppable. [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] |), [ - M.get_struct_record_field (| - M.read (| self |), - "drop::Droppable", - "name" + M.call_closure (| + M.get_struct_record_field "drop::Droppable" "name", + [ M.read (| self |) ] |) ] |) diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/hash.v b/CoqOfRust/examples/default/examples/rust_book/traits/hash.v index 16bd8f914..2f8a72480 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/hash.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/hash.v @@ -27,7 +27,10 @@ Module Impl_core_hash_Hash_for_hash_Person. M.call_closure (| M.get_trait_method (| "core::hash::Hash", Ty.path "u32", [], "hash", [ __H ] |), [ - M.get_struct_record_field (| M.read (| self |), "hash::Person", "id" |); + M.call_closure (| + M.get_struct_record_field "hash::Person" "id", + [ M.read (| self |) ] + |); M.read (| state |) ] |) @@ -43,7 +46,10 @@ Module Impl_core_hash_Hash_for_hash_Person. [ __H ] |), [ - M.get_struct_record_field (| M.read (| self |), "hash::Person", "name" |); + M.call_closure (| + M.get_struct_record_field "hash::Person" "name", + [ M.read (| self |) ] + |); M.read (| state |) ] |) @@ -52,7 +58,10 @@ Module Impl_core_hash_Hash_for_hash_Person. M.call_closure (| M.get_trait_method (| "core::hash::Hash", Ty.path "u64", [], "hash", [ __H ] |), [ - M.get_struct_record_field (| M.read (| self |), "hash::Person", "phone" |); + M.call_closure (| + M.get_struct_record_field "hash::Person" "phone", + [ M.read (| self |) ] + |); M.read (| state |) ] |) diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/iterators.v b/CoqOfRust/examples/default/examples/rust_book/traits/iterators.v index 38fba6b4f..17e00ea13 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/iterators.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/iterators.v @@ -35,22 +35,37 @@ Module Impl_core_iter_traits_iterator_Iterator_for_iterators_Fibonacci. M.read (| let current := M.copy (| - M.get_struct_record_field (| M.read (| self |), "iterators::Fibonacci", "curr" |) + M.call_closure (| + M.get_struct_record_field "iterators::Fibonacci" "curr", + [ M.read (| self |) ] + |) |) in let _ := M.write (| - M.get_struct_record_field (| M.read (| self |), "iterators::Fibonacci", "curr" |), + M.call_closure (| + M.get_struct_record_field "iterators::Fibonacci" "curr", + [ M.read (| self |) ] + |), M.read (| - M.get_struct_record_field (| M.read (| self |), "iterators::Fibonacci", "next" |) + M.call_closure (| + M.get_struct_record_field "iterators::Fibonacci" "next", + [ M.read (| self |) ] + |) |) |) in let _ := M.write (| - M.get_struct_record_field (| M.read (| self |), "iterators::Fibonacci", "next" |), + M.call_closure (| + M.get_struct_record_field "iterators::Fibonacci" "next", + [ M.read (| self |) ] + |), BinOp.Panic.add (| M.read (| current |), M.read (| - M.get_struct_record_field (| M.read (| self |), "iterators::Fibonacci", "next" |) + M.call_closure (| + M.get_struct_record_field "iterators::Fibonacci" "next", + [ M.read (| self |) ] + |) |) |) |) in diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/traits.v b/CoqOfRust/examples/default/examples/rust_book/traits/traits.v index 4bc0d292a..694304674 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/traits.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/traits.v @@ -113,7 +113,12 @@ Module Impl_traits_Sheep. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_record_field (| M.read (| self |), "traits::Sheep", "naked" |) |))) + M.read (| + M.call_closure (| + M.get_struct_record_field "traits::Sheep" "naked", + [ M.read (| self |) ] + |) + |))) | _, _ => M.impossible end. @@ -245,10 +250,9 @@ Module Impl_traits_Sheep. [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] |), [ - M.get_struct_record_field (| - M.read (| self |), - "traits::Sheep", - "name" + M.call_closure (| + M.get_struct_record_field "traits::Sheep" "name", + [ M.read (| self |) ] |) ] |) @@ -262,7 +266,10 @@ Module Impl_traits_Sheep. M.alloc (| Value.Tuple [] |) in let _ := M.write (| - M.get_struct_record_field (| M.read (| self |), "traits::Sheep", "naked" |), + M.call_closure (| + M.get_struct_record_field "traits::Sheep" "naked", + [ M.read (| self |) ] + |), Value.Bool true |) in M.alloc (| Value.Tuple [] |))) @@ -307,7 +314,12 @@ Module Impl_traits_Animal_for_traits_Sheep. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_record_field (| M.read (| self |), "traits::Sheep", "name" |) |))) + M.read (| + M.call_closure (| + M.get_struct_record_field "traits::Sheep" "name", + [ M.read (| self |) ] + |) + |))) | _, _ => M.impossible end. @@ -392,10 +404,9 @@ Module Impl_traits_Animal_for_traits_Sheep. [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] |), [ - M.get_struct_record_field (| - M.read (| self |), - "traits::Sheep", - "name" + M.call_closure (| + M.get_struct_record_field "traits::Sheep" "name", + [ M.read (| self |) ] |) ] |); diff --git a/CoqOfRust/examples/default/examples/subtle.v b/CoqOfRust/examples/default/examples/subtle.v index 6a4545311..7e4a9d372 100644 --- a/CoqOfRust/examples/default/examples/subtle.v +++ b/CoqOfRust/examples/default/examples/subtle.v @@ -63,7 +63,12 @@ Module Impl_core_fmt_Debug_for_subtle_Choice. M.read (| Value.String "Choice" |); (* Unsize *) M.pointer_coercion - (M.alloc (| M.get_struct_tuple_field (| M.read (| self |), "subtle::Choice", 0 |) |)) + (M.alloc (| + M.call_closure (| + M.get_struct_tuple_field "subtle::Choice" 0, + [ M.read (| self |) ] + |) + |)) ] |))) | _, _ => M.impossible @@ -90,7 +95,9 @@ Module Impl_subtle_Choice. | [], [ self ] => ltac:(M.monadic (let self := M.alloc (| self |) in - M.read (| M.get_struct_tuple_field (| M.read (| self |), "subtle::Choice", 0 |) |))) + M.read (| + M.call_closure (| M.get_struct_tuple_field "subtle::Choice" 0, [ M.read (| self |) ] |) + |))) | _, _ => M.impossible end. @@ -133,19 +140,17 @@ Module Impl_core_convert_From_subtle_Choice_for_bool. (BinOp.Pure.bit_or (BinOp.Pure.eq (M.read (| - M.get_struct_tuple_field (| - source, - "subtle::Choice", - 0 + M.call_closure (| + M.get_struct_tuple_field "subtle::Choice" 0, + [ source ] |) |)) (Value.Integer Integer.U8 0)) (BinOp.Pure.eq (M.read (| - M.get_struct_tuple_field (| - source, - "subtle::Choice", - 0 + M.call_closure (| + M.get_struct_tuple_field "subtle::Choice" 0, + [ source ] |) |)) (Value.Integer Integer.U8 1))) @@ -177,7 +182,9 @@ Module Impl_core_convert_From_subtle_Choice_for_bool. |) in M.alloc (| BinOp.Pure.ne - (M.read (| M.get_struct_tuple_field (| source, "subtle::Choice", 0 |) |)) + (M.read (| + M.call_closure (| M.get_struct_tuple_field "subtle::Choice" 0, [ source ] |) + |)) (Value.Integer Integer.U8 0) |) |))) @@ -219,8 +226,12 @@ Module Impl_core_ops_bit_BitAnd_for_subtle_Choice. |), [ BinOp.Pure.bit_and - (M.read (| M.get_struct_tuple_field (| self, "subtle::Choice", 0 |) |)) - (M.read (| M.get_struct_tuple_field (| rhs, "subtle::Choice", 0 |) |)) + (M.read (| + M.call_closure (| M.get_struct_tuple_field "subtle::Choice" 0, [ self ] |) + |)) + (M.read (| + M.call_closure (| M.get_struct_tuple_field "subtle::Choice" 0, [ rhs ] |) + |)) ] |))) | _, _ => M.impossible @@ -304,8 +315,12 @@ Module Impl_core_ops_bit_BitOr_for_subtle_Choice. |), [ BinOp.Pure.bit_or - (M.read (| M.get_struct_tuple_field (| self, "subtle::Choice", 0 |) |)) - (M.read (| M.get_struct_tuple_field (| rhs, "subtle::Choice", 0 |) |)) + (M.read (| + M.call_closure (| M.get_struct_tuple_field "subtle::Choice" 0, [ self ] |) + |)) + (M.read (| + M.call_closure (| M.get_struct_tuple_field "subtle::Choice" 0, [ rhs ] |) + |)) ] |))) | _, _ => M.impossible @@ -389,8 +404,12 @@ Module Impl_core_ops_bit_BitXor_for_subtle_Choice. |), [ BinOp.Pure.bit_xor - (M.read (| M.get_struct_tuple_field (| self, "subtle::Choice", 0 |) |)) - (M.read (| M.get_struct_tuple_field (| rhs, "subtle::Choice", 0 |) |)) + (M.read (| + M.call_closure (| M.get_struct_tuple_field "subtle::Choice" 0, [ self ] |) + |)) + (M.read (| + M.call_closure (| M.get_struct_tuple_field "subtle::Choice" 0, [ rhs ] |) + |)) ] |))) | _, _ => M.impossible @@ -475,7 +494,9 @@ Module Impl_core_ops_bit_Not_for_subtle_Choice. BinOp.Pure.bit_and (Value.Integer Integer.U8 1) (UnOp.Pure.not - (M.read (| M.get_struct_tuple_field (| self, "subtle::Choice", 0 |) |))) + (M.read (| + M.call_closure (| M.get_struct_tuple_field "subtle::Choice" 0, [ self ] |) + |))) ] |))) | _, _ => M.impossible @@ -2897,8 +2918,14 @@ Module Impl_subtle_ConditionallySelectable_for_subtle_Choice. [] |), [ - M.get_struct_tuple_field (| M.read (| a |), "subtle::Choice", 0 |); - M.get_struct_tuple_field (| M.read (| b |), "subtle::Choice", 0 |); + M.call_closure (| + M.get_struct_tuple_field "subtle::Choice" 0, + [ M.read (| a |) ] + |); + M.call_closure (| + M.get_struct_tuple_field "subtle::Choice" 0, + [ M.read (| b |) ] + |); M.read (| choice |) ] |) @@ -2998,7 +3025,12 @@ Module Impl_core_clone_Clone_where_core_clone_Clone_T_for_subtle_CtOption_T. ("value", M.call_closure (| M.get_trait_method (| "core::clone::Clone", T, [], "clone", [] |), - [ M.get_struct_record_field (| M.read (| self |), "subtle::CtOption", "value" |) ] + [ + M.call_closure (| + M.get_struct_record_field "subtle::CtOption" "value", + [ M.read (| self |) ] + |) + ] |)); ("is_some", M.call_closure (| @@ -3009,7 +3041,12 @@ Module Impl_core_clone_Clone_where_core_clone_Clone_T_for_subtle_CtOption_T. "clone", [] |), - [ M.get_struct_record_field (| M.read (| self |), "subtle::CtOption", "is_some" |) ] + [ + M.call_closure (| + M.get_struct_record_field "subtle::CtOption" "is_some", + [ M.read (| self |) ] + |) + ] |)) ])) | _, _ => M.impossible @@ -3059,12 +3096,18 @@ Module Impl_core_fmt_Debug_where_core_fmt_Debug_T_for_subtle_CtOption_T. M.read (| Value.String "value" |); (* Unsize *) M.pointer_coercion - (M.get_struct_record_field (| M.read (| self |), "subtle::CtOption", "value" |)); + (M.call_closure (| + M.get_struct_record_field "subtle::CtOption" "value", + [ M.read (| self |) ] + |)); M.read (| Value.String "is_some" |); (* Unsize *) M.pointer_coercion (M.alloc (| - M.get_struct_record_field (| M.read (| self |), "subtle::CtOption", "is_some" |) + M.call_closure (| + M.get_struct_record_field "subtle::CtOption" "is_some", + [ M.read (| self |) ] + |) |)) ] |))) @@ -3135,7 +3178,10 @@ Module Impl_core_convert_From_subtle_CtOption_T_for_core_option_Option_T. "core::option::Option::Some" [ M.read (| - M.get_struct_record_field (| source, "subtle::CtOption", "value" |) + M.call_closure (| + M.get_struct_record_field "subtle::CtOption" "value", + [ source ] + |) |) ] |))); @@ -3205,7 +3251,12 @@ Module Impl_subtle_CtOption_T. M.alloc (| M.call_closure (| M.get_associated_function (| Ty.path "subtle::Choice", "unwrap_u8", [] |), - [ M.get_struct_record_field (| self, "subtle::CtOption", "is_some" |) ] + [ + M.call_closure (| + M.get_struct_record_field "subtle::CtOption" "is_some", + [ self ] + |) + ] |) |); M.alloc (| Value.Integer Integer.U8 1 |) @@ -3298,7 +3349,7 @@ Module Impl_subtle_CtOption_T. |))) ] |) in - M.get_struct_record_field (| self, "subtle::CtOption", "value" |) + M.call_closure (| M.get_struct_record_field "subtle::CtOption" "value", [ self ] |) |))) | _, _ => M.impossible end. @@ -3329,7 +3380,12 @@ Module Impl_subtle_CtOption_T. M.alloc (| M.call_closure (| M.get_associated_function (| Ty.path "subtle::Choice", "unwrap_u8", [] |), - [ M.get_struct_record_field (| self, "subtle::CtOption", "is_some" |) ] + [ + M.call_closure (| + M.get_struct_record_field "subtle::CtOption" "is_some", + [ self ] + |) + ] |) |); M.alloc (| Value.Integer Integer.U8 1 |) @@ -3386,7 +3442,7 @@ Module Impl_subtle_CtOption_T. |))) ] |) in - M.get_struct_record_field (| self, "subtle::CtOption", "value" |) + M.call_closure (| M.get_struct_record_field "subtle::CtOption" "value", [ self ] |) |))) | _, _ => M.impossible end. @@ -3420,8 +3476,10 @@ Module Impl_subtle_CtOption_T. |), [ def; - M.get_struct_record_field (| self, "subtle::CtOption", "value" |); - M.read (| M.get_struct_record_field (| self, "subtle::CtOption", "is_some" |) |) + M.call_closure (| M.get_struct_record_field "subtle::CtOption" "value", [ self ] |); + M.read (| + M.call_closure (| M.get_struct_record_field "subtle::CtOption" "is_some", [ self ] |) + |) ] |))) | _, _ => M.impossible @@ -3468,8 +3526,10 @@ Module Impl_subtle_CtOption_T. [ M.read (| f |); Value.Tuple [] ] |) |); - M.get_struct_record_field (| self, "subtle::CtOption", "value" |); - M.read (| M.get_struct_record_field (| self, "subtle::CtOption", "is_some" |) |) + M.call_closure (| M.get_struct_record_field "subtle::CtOption" "value", [ self ] |); + M.read (| + M.call_closure (| M.get_struct_record_field "subtle::CtOption" "is_some", [ self ] |) + |) ] |))) | _, _ => M.impossible @@ -3491,7 +3551,10 @@ Module Impl_subtle_CtOption_T. ltac:(M.monadic (let self := M.alloc (| self |) in M.read (| - M.get_struct_record_field (| M.read (| self |), "subtle::CtOption", "is_some" |) + M.call_closure (| + M.get_struct_record_field "subtle::CtOption" "is_some", + [ M.read (| self |) ] + |) |))) | _, _ => M.impossible end. @@ -3515,7 +3578,10 @@ Module Impl_subtle_CtOption_T. M.get_trait_method (| "core::ops::bit::Not", Ty.path "subtle::Choice", [], "not", [] |), [ M.read (| - M.get_struct_record_field (| M.read (| self |), "subtle::CtOption", "is_some" |) + M.call_closure (| + M.get_struct_record_field "subtle::CtOption" "is_some", + [ M.read (| self |) ] + |) |) ] |))) @@ -3579,16 +3645,24 @@ Module Impl_subtle_CtOption_T. [] |) |); - M.get_struct_record_field (| self, "subtle::CtOption", "value" |); + M.call_closure (| + M.get_struct_record_field "subtle::CtOption" "value", + [ self ] + |); M.read (| - M.get_struct_record_field (| self, "subtle::CtOption", "is_some" |) + M.call_closure (| + M.get_struct_record_field "subtle::CtOption" "is_some", + [ self ] + |) |) ] |) ] ] |); - M.read (| M.get_struct_record_field (| self, "subtle::CtOption", "is_some" |) |) + M.read (| + M.call_closure (| M.get_struct_record_field "subtle::CtOption" "is_some", [ self ] |) + |) ] |))) | _, _ => M.impossible @@ -3655,9 +3729,15 @@ Module Impl_subtle_CtOption_T. [] |) |); - M.get_struct_record_field (| self, "subtle::CtOption", "value" |); + M.call_closure (| + M.get_struct_record_field "subtle::CtOption" "value", + [ self ] + |); M.read (| - M.get_struct_record_field (| self, "subtle::CtOption", "is_some" |) + M.call_closure (| + M.get_struct_record_field "subtle::CtOption" "is_some", + [ self ] + |) |) ] |) @@ -3676,8 +3756,16 @@ Module Impl_subtle_CtOption_T. [] |), [ - M.get_struct_record_field (| tmp, "subtle::CtOption", "is_some" |); - M.read (| M.get_struct_record_field (| self, "subtle::CtOption", "is_some" |) |) + M.call_closure (| + M.get_struct_record_field "subtle::CtOption" "is_some", + [ tmp ] + |); + M.read (| + M.call_closure (| + M.get_struct_record_field "subtle::CtOption" "is_some", + [ self ] + |) + |) ] |) |) in @@ -3786,8 +3874,14 @@ Module Impl_subtle_ConditionallySelectable_where_subtle_ConditionallySelectable_ [] |), [ - M.get_struct_record_field (| M.read (| a |), "subtle::CtOption", "value" |); - M.get_struct_record_field (| M.read (| b |), "subtle::CtOption", "value" |); + M.call_closure (| + M.get_struct_record_field "subtle::CtOption" "value", + [ M.read (| a |) ] + |); + M.call_closure (| + M.get_struct_record_field "subtle::CtOption" "value", + [ M.read (| b |) ] + |); M.read (| choice |) ] |); @@ -3800,8 +3894,14 @@ Module Impl_subtle_ConditionallySelectable_where_subtle_ConditionallySelectable_ [] |), [ - M.get_struct_record_field (| M.read (| a |), "subtle::CtOption", "is_some" |); - M.get_struct_record_field (| M.read (| b |), "subtle::CtOption", "is_some" |); + M.call_closure (| + M.get_struct_record_field "subtle::CtOption" "is_some", + [ M.read (| a |) ] + |); + M.call_closure (| + M.get_struct_record_field "subtle::CtOption" "is_some", + [ M.read (| b |) ] + |); M.read (| choice |) ] |) @@ -3892,15 +3992,13 @@ Module Impl_subtle_ConstantTimeEq_where_subtle_ConstantTimeEq_T_for_subtle_CtOpt M.call_closure (| M.get_trait_method (| "subtle::ConstantTimeEq", T, [], "ct_eq", [] |), [ - M.get_struct_record_field (| - M.read (| self |), - "subtle::CtOption", - "value" + M.call_closure (| + M.get_struct_record_field "subtle::CtOption" "value", + [ M.read (| self |) ] |); - M.get_struct_record_field (| - M.read (| rhs |), - "subtle::CtOption", - "value" + M.call_closure (| + M.get_struct_record_field "subtle::CtOption" "value", + [ M.read (| rhs |) ] |) ] |) diff --git a/CoqOfRust/typed/M.v b/CoqOfRust/typed/M.v index d3498e04b..9054db5a4 100644 --- a/CoqOfRust/typed/M.v +++ b/CoqOfRust/typed/M.v @@ -257,18 +257,17 @@ Module ClosureParams. | Empty | Cons {A : Set} `{ToValue A} (param : A) (params : t). - Notation "<[ ]>" := Empty. - Notation "<[ x ; .. ; y ]>" := (Cons x .. (Cons y Empty) ..). - Fixpoint to_value (params : t) : list Value.t := match params with - | <[]> => [] + | Empty => [] | Cons param params => φ param :: to_value params end. Module HasSetValue. Inductive t : ClosureParams.t -> forall {A : Set}, A -> Prop := | Empty : t ClosureParams.Empty tt + | Single {A : Set} `{ToValue A} (value : A) : + t (ClosureParams.Cons value ClosureParams.Empty) value | Cons {A As : Set} `{ToValue A} (value : A) (params : ClosureParams.t) (values : As) : t params values -> t (ClosureParams.Cons value params) (value, values). @@ -279,15 +278,14 @@ Module LowM. Inductive t (A : Set) : Set := | Pure (value : A) | CallPrimitive {B : Set} (primitive : Primitive.t B) (k : B -> t A) - | CallClosure {B : Set} - (to_value : B -> Value.t) - (body : t (B + Exception.t Empty_set)) + | CallClosure {B Params : Set} `{ToValue B} + (closure : Params -> t (B + Exception.t Empty_set)) (params : ClosureParams.t) (k : (B + Exception.t Empty_set) -> t A) | Impossible. Arguments Pure {_}. Arguments CallPrimitive {_ _}. - Arguments CallClosure {_ _}. + Arguments CallClosure {_ _ _ _}. Arguments Impossible {_}. Fixpoint let_ {A B : Set} (e1 : t A) (e2 : A -> t B) : t B := @@ -295,8 +293,8 @@ Module LowM. | Pure v => e2 v | CallPrimitive primitive k => CallPrimitive primitive (fun v => let_ (k v) e2) - | CallClosure to_value params body k => - CallClosure to_value params body (fun v => let_ (k v) e2) + | CallClosure params body k => + CallClosure params body (fun v => let_ (k v) e2) | Impossible => Impossible end. End LowM. @@ -361,6 +359,10 @@ Module Notations. Notation "e (||)" := (run e) (at level 100). + + Notation "<[ ]>" := ClosureParams.Empty. + Notation "<[ x ; .. ; y ]>" := + (ClosureParams.Cons x .. (ClosureParams.Cons y ClosureParams.Empty) ..). End Notations. Import Notations. @@ -491,9 +493,11 @@ Definition catch_break {R : Set} (body : MBody (Pointer.t unit) R) : MBody (Poin end ). -Definition call_closure {A R : Set} {H : ToValue A} (body : M A) (params : ClosureParams.t) : +Definition call_closure {Params A R : Set} `{ToValue A} + (body : Params -> M A) + (params : ClosureParams.t) : MBody A R := - catch (LowM.CallClosure φ body params LowM.Pure) (fun exception => + catch (LowM.CallClosure body params LowM.Pure) (fun exception => match exception with | Exception.Return r => match r with end | Exception.Continue => raise Exception.Continue @@ -577,58 +581,60 @@ Module Run. k' ~ LowM.CallPrimitive (Primitive.StateWrite pointer update) k }} - | CallPrimitiveMakeSubPointer {Big_B B B' : Set} `{ToValue B} `{ToValue B'} + | CallPrimitiveMakeSubPointer {Big_B B Sub_B : Set} `{ToValue B} `{ToValue Sub_B} (big_to_value : Big_B -> Value.t) projection injection address path - index projection' injection' + index sub_projection sub_injection + pointer' (k' : Value.t -> CoqOfRust.M.M) - (k : Pointer.t B' -> MBody A R) : + (k : Pointer.t Sub_B -> MBody A R) : let origin : Pointer.Origin.t B := Pointer.Origin.Make big_to_value projection injection in let pointer : Pointer.t B := Pointer.Make origin address path in - let origin' : Pointer.Origin.t B' := + let sub_origin : Pointer.Origin.t Sub_B := Pointer.Origin.Make big_to_value (fun big_b => match projection big_b with - | Some b => projection' b + | Some b => sub_projection b | None => None end) - (fun big_b new_b' => + (fun big_b new_sub_b => match projection big_b with | Some b => - match injection' b new_b' with + match sub_injection b new_sub_b with | Some new_b => injection big_b new_b | None => None end | None => None end) in - let pointer' : Pointer.t B' := + let sub_pointer : Pointer.t Sub_B := Pointer.Make - origin' - (Pointer.Address.map projection' address) + sub_origin + (Pointer.Address.map sub_projection address) (path ++ [index]) in + pointer' = Pointer.to_pointer pointer -> (* Communtativity of the read *) (forall (b : B), - Option.map (projection' b) φ = + Option.map (sub_projection b) φ = Value.read_path (φ b) [index] ) -> (* Communtativity of the write *) - (forall (b : B) (b' : B'), - Option.map (injection' b b') φ = - Value.write_value (φ b) [index] (φ b') + (forall (b : B) (sub_b : Sub_B), + Option.map (sub_injection b sub_b) φ = + Value.write_value (φ b) [index] (φ sub_b) ) -> {{ Address, env_to_value | - k' (Value.Pointer (Pointer.to_pointer pointer')) ~ - k pointer' + k' (Value.Pointer (Pointer.to_pointer sub_pointer)) ~ + k sub_pointer }} -> {{ Address, env_to_value | CoqOfRust.M.LowM.CallPrimitive (CoqOfRust.M.Primitive.MakeSubPointer - (Pointer.to_pointer pointer) + pointer' index ) k' ~ - LowM.CallPrimitive (Primitive.MakeSubPointer pointer index projection' injection') k + LowM.CallPrimitive (Primitive.MakeSubPointer pointer index sub_projection sub_injection) k }} | CallPrimitiveEnvRead (k' : Value.t -> CoqOfRust.M.M) @@ -643,22 +649,31 @@ Module Run. CoqOfRust.M.LowM.CallPrimitive CoqOfRust.M.Primitive.EnvRead k' ~ LowM.CallPrimitive Primitive.EnvRead k }} - | CallClosure {B : Set} - (to_value : B -> Value.t) - (body : M B) + | CallClosure {B Params : Set} `{ToValue B} + (closure : Params -> M B) (params : ClosureParams.t) - (body' : Value.t) + (params_set_value : Params) + (closure' : Value.t) + (closure_content' : list Value.t -> CoqOfRust.M.M) + params' (k' : Value.t + CoqOfRust.M.Exception.t -> CoqOfRust.M.M) (k : B + Exception.t Empty_set -> MBody A R) : + closure' = M.closure closure_content' -> + params' = ClosureParams.to_value params -> + ClosureParams.HasSetValue.t params params_set_value -> + {{ Address, env_to_value | + closure_content' params' ~ + closure params_set_value + }} -> (forall (result : B + Exception.t Empty_set), {{ Address, env_to_value | - k' (result_to_value to_value result) ~ + k' (result_to_value φ result) ~ k result }} ) -> {{ Address, env_to_value | - CoqOfRust.M.LowM.CallClosure body' (ClosureParams.to_value params) k' ~ - LowM.CallClosure to_value body params k + CoqOfRust.M.LowM.CallClosure closure' params' k' ~ + LowM.CallClosure closure params k }} where "{{ Address , env_to_value | untyped ~ typed }}" := diff --git a/lib/src/thir_expression.rs b/lib/src/thir_expression.rs index b1ff0a693..196fcfbc2 100644 --- a/lib/src/thir_expression.rs +++ b/lib/src/thir_expression.rs @@ -691,9 +691,13 @@ pub(crate) fn compile_expr<'a>( }; Rc::new(Expr::Call { - func: Expr::local_var(getter_name), - args: vec![base, constructor, index], - kind: CallKind::Effectful, + func: Rc::new(Expr::Call { + func: Expr::local_var(getter_name), + args: vec![constructor, index], + kind: CallKind::Pure, + }), + args: vec![base], + kind: CallKind::Closure, }) } None => {