diff --git a/CoqOfRust/examples/axiomatized/examples/custom/polymorphic_associated_function.v b/CoqOfRust/examples/axiomatized/examples/custom/polymorphic_associated_function.v index 62b3f0f0c..7a1fd076c 100644 --- a/CoqOfRust/examples/axiomatized/examples/custom/polymorphic_associated_function.v +++ b/CoqOfRust/examples/axiomatized/examples/custom/polymorphic_associated_function.v @@ -10,7 +10,7 @@ Require Import CoqOfRust.CoqOfRust. Module Impl_polymorphic_associated_function_Foo_A. Definition Self (A : Ty.t) : Ty.t := - Ty.apply (Ty.path "polymorphic_associated_function::Foo") [ A ]. + Ty.apply (Ty.path "polymorphic_associated_function::Foo") [ A ] []. Parameter convert : forall (A : Ty.t), (list Ty.t) -> (list Value.t) -> M. 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 e20505a84..f63c0d046 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/basic_contract_caller.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/basic_contract_caller.v @@ -42,7 +42,8 @@ Module Impl_core_marker_Copy_for_basic_contract_caller_AccountId. End Impl_core_marker_Copy_for_basic_contract_caller_AccountId. Axiom Hash : - (Ty.path "basic_contract_caller::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u8" ]). + (Ty.path "basic_contract_caller::Hash") = + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]). (* Enum Error *) (* { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/call_runtime.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/call_runtime.v index 075e78b5c..9f5a078ab 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/call_runtime.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/call_runtime.v @@ -60,7 +60,8 @@ Module Impl_core_convert_From_call_runtime_AccountId_for_call_runtime_MultiAddre Definition Self : Ty.t := Ty.apply (Ty.path "call_runtime::MultiAddress") - [ Ty.path "call_runtime::AccountId"; Ty.tuple [] ]. + [ Ty.path "call_runtime::AccountId"; Ty.tuple [] ] + []. Parameter from : (list Ty.t) -> (list Value.t) -> M. @@ -85,7 +86,8 @@ End Impl_core_convert_From_call_runtime_AccountId_for_call_runtime_MultiAddress_ ("dest", Ty.apply (Ty.path "call_runtime::MultiAddress") - [ Ty.path "call_runtime::AccountId"; Ty.tuple [] ]); + [ Ty.path "call_runtime::AccountId"; Ty.tuple [] ] + []); ("value", Ty.path "u128") ]; discriminant := None; diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/custom_allocator.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/custom_allocator.v index a3556d5c5..29073c5a5 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/custom_allocator.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/custom_allocator.v @@ -8,7 +8,10 @@ Require Import CoqOfRust.CoqOfRust. fields := [ ("value", - Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "bool"; Ty.path "alloc::alloc::Global" ]) + Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "bool"; Ty.path "alloc::alloc::Global" ] + []) ]; } *) diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/dns.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/dns.v index 896d71215..8598d6ffe 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/dns.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/dns.v @@ -7,13 +7,13 @@ Require Import CoqOfRust.CoqOfRust. ty_params := [ "K"; "V" ]; fields := [ - ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ]); - ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []); + ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) ]; } *) Module Impl_core_default_Default_for_dns_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "dns::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "dns::Mapping") [ K; V ] []. Parameter default : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -27,7 +27,7 @@ Module Impl_core_default_Default_for_dns_Mapping_K_V. End Impl_core_default_Default_for_dns_Mapping_K_V. Module Impl_dns_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "dns::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "dns::Mapping") [ K; V ] []. Parameter contains : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -136,7 +136,7 @@ Module Impl_core_cmp_PartialEq_for_dns_AccountId. (* Instance *) [ ("eq", InstanceField.Method eq) ]. End Impl_core_cmp_PartialEq_for_dns_AccountId. -Module Impl_core_convert_From_array_u8_for_dns_AccountId. +Module Impl_core_convert_From_array_u8_32_for_dns_AccountId. Definition Self : Ty.t := Ty.path "dns::AccountId". Parameter from : (list Ty.t) -> (list Value.t) -> M. @@ -145,13 +145,16 @@ Module Impl_core_convert_From_array_u8_for_dns_AccountId. M.IsTraitInstance "core::convert::From" Self - (* Trait polymorphic types *) [ (* T *) Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] + (* Trait polymorphic types *) + [ (* T *) Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ] ] (* Instance *) [ ("from", InstanceField.Method from) ]. -End Impl_core_convert_From_array_u8_for_dns_AccountId. +End Impl_core_convert_From_array_u8_32_for_dns_AccountId. Axiom Balance : (Ty.path "dns::Balance") = (Ty.path "u128"). -Axiom Hash : (Ty.path "dns::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u8" ]). +Axiom Hash : + (Ty.path "dns::Hash") = + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]). (* StructRecord { @@ -165,7 +168,10 @@ Axiom Hash : (Ty.path "dns::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u8" name := "Register"; ty_params := []; fields := - [ ("name", Ty.apply (Ty.path "array") [ Ty.path "u8" ]); ("from", Ty.path "dns::AccountId") ]; + [ + ("name", Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]); + ("from", Ty.path "dns::AccountId") + ]; } *) (* StructRecord @@ -174,9 +180,9 @@ Axiom Hash : (Ty.path "dns::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u8" ty_params := []; fields := [ - ("name", Ty.apply (Ty.path "array") [ Ty.path "u8" ]); + ("name", Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]); ("from", Ty.path "dns::AccountId"); - ("old_address", Ty.apply (Ty.path "core::option::Option") [ Ty.path "dns::AccountId" ]); + ("old_address", Ty.apply (Ty.path "core::option::Option") [ Ty.path "dns::AccountId" ] []); ("new_address", Ty.path "dns::AccountId") ]; } *) @@ -187,9 +193,9 @@ Axiom Hash : (Ty.path "dns::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u8" ty_params := []; fields := [ - ("name", Ty.apply (Ty.path "array") [ Ty.path "u8" ]); + ("name", Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]); ("from", Ty.path "dns::AccountId"); - ("old_owner", Ty.apply (Ty.path "core::option::Option") [ Ty.path "dns::AccountId" ]); + ("old_owner", Ty.apply (Ty.path "core::option::Option") [ Ty.path "dns::AccountId" ] []); ("new_owner", Ty.path "dns::AccountId") ]; } *) @@ -238,11 +244,19 @@ End Impl_dns_Env. ("name_to_address", Ty.apply (Ty.path "dns::Mapping") - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ]; Ty.path "dns::AccountId" ]); + [ + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]; + Ty.path "dns::AccountId" + ] + []); ("name_to_owner", Ty.apply (Ty.path "dns::Mapping") - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ]; Ty.path "dns::AccountId" ]); + [ + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]; + Ty.path "dns::AccountId" + ] + []); ("default_address", Ty.path "dns::AccountId") ]; } *) @@ -331,8 +345,8 @@ End Impl_core_cmp_Eq_for_dns_Error. Axiom Result : forall (T : Ty.t), - (Ty.apply (Ty.path "dns::Result") [ T ]) = - (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "dns::Error" ]). + (Ty.apply (Ty.path "dns::Result") [ T ] []) = + (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "dns::Error" ] []). Module Impl_dns_DomainNameService. Definition Self : Ty.t := Ty.path "dns::DomainNameService". diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc1155.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc1155.v index ef9a72f05..db774835b 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc1155.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc1155.v @@ -7,13 +7,13 @@ Require Import CoqOfRust.CoqOfRust. ty_params := [ "K"; "V" ]; fields := [ - ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ]); - ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []); + ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) ]; } *) Module Impl_core_default_Default_for_erc1155_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc1155::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc1155::Mapping") [ K; V ] []. Parameter default : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -27,7 +27,7 @@ Module Impl_core_default_Default_for_erc1155_Mapping_K_V. End Impl_core_default_Default_for_erc1155_Mapping_K_V. Module Impl_erc1155_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc1155::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc1155::Mapping") [ K; V ] []. Parameter contains : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -130,7 +130,7 @@ Module Impl_core_cmp_PartialEq_for_erc1155_AccountId. (* Instance *) [ ("eq", InstanceField.Method eq) ]. End Impl_core_cmp_PartialEq_for_erc1155_AccountId. -Module Impl_core_convert_From_array_u8_for_erc1155_AccountId. +Module Impl_core_convert_From_array_u8_32_for_erc1155_AccountId. Definition Self : Ty.t := Ty.path "erc1155::AccountId". Parameter from : (list Ty.t) -> (list Value.t) -> M. @@ -139,9 +139,10 @@ Module Impl_core_convert_From_array_u8_for_erc1155_AccountId. M.IsTraitInstance "core::convert::From" Self - (* Trait polymorphic types *) [ (* T *) Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] + (* Trait polymorphic types *) + [ (* T *) Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ] ] (* Instance *) [ ("from", InstanceField.Method from) ]. -End Impl_core_convert_From_array_u8_for_erc1155_AccountId. +End Impl_core_convert_From_array_u8_32_for_erc1155_AccountId. Axiom Balance : (Ty.path "erc1155::Balance") = (Ty.path "u128"). @@ -249,8 +250,8 @@ End Impl_core_cmp_Eq_for_erc1155_Error. Axiom Result : forall (T : Ty.t), - (Ty.apply (Ty.path "erc1155::Result") [ T ]) = - (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "erc1155::Error" ]). + (Ty.apply (Ty.path "erc1155::Result") [ T ] []) = + (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "erc1155::Error" ] []). (* Trait *) (* Empty module 'Erc1155' *) @@ -268,9 +269,9 @@ Axiom Operator : (Ty.path "erc1155::Operator") = (Ty.path "erc1155::AccountId"). ty_params := []; fields := [ - ("operator", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc1155::AccountId" ]); - ("from", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc1155::AccountId" ]); - ("to", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc1155::AccountId" ]); + ("operator", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc1155::AccountId" ] []); + ("from", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc1155::AccountId" ] []); + ("to", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc1155::AccountId" ] []); ("token_id", Ty.path "u128"); ("value", Ty.path "u128") ]; @@ -339,12 +340,13 @@ End Impl_erc1155_Env. ("balances", Ty.apply (Ty.path "erc1155::Mapping") - [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "u128" ]; Ty.path "u128" ]); + [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "u128" ]; Ty.path "u128" ] + []); ("approvals", Ty.apply (Ty.path "erc1155::Mapping") - [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "erc1155::AccountId" ]; Ty.tuple [] - ]); + [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "erc1155::AccountId" ]; Ty.tuple [] ] + []); ("token_id_nonce", Ty.path "u128") ]; } *) diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc20.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc20.v index 8c65085eb..08d89cbb9 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc20.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc20.v @@ -7,13 +7,13 @@ Require Import CoqOfRust.CoqOfRust. ty_params := [ "K"; "V" ]; fields := [ - ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ]); - ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []); + ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) ]; } *) Module Impl_core_default_Default_for_erc20_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc20::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc20::Mapping") [ K; V ] []. Parameter default : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -27,7 +27,7 @@ Module Impl_core_default_Default_for_erc20_Mapping_K_V. End Impl_core_default_Default_for_erc20_Mapping_K_V. Module Impl_erc20_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc20::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc20::Mapping") [ K; V ] []. Parameter get : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -99,11 +99,12 @@ Axiom Balance : (Ty.path "erc20::Balance") = (Ty.path "u128"). [ ("total_supply", Ty.path "u128"); ("balances", - Ty.apply (Ty.path "erc20::Mapping") [ Ty.path "erc20::AccountId"; Ty.path "u128" ]); + Ty.apply (Ty.path "erc20::Mapping") [ Ty.path "erc20::AccountId"; Ty.path "u128" ] []); ("allowances", Ty.apply (Ty.path "erc20::Mapping") - [ Ty.tuple [ Ty.path "erc20::AccountId"; Ty.path "erc20::AccountId" ]; Ty.path "u128" ]) + [ Ty.tuple [ Ty.path "erc20::AccountId"; Ty.path "erc20::AccountId" ]; Ty.path "u128" ] + []) ]; } *) @@ -126,8 +127,8 @@ End Impl_core_default_Default_for_erc20_Erc20. ty_params := []; fields := [ - ("from", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc20::AccountId" ]); - ("to", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc20::AccountId" ]); + ("from", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc20::AccountId" ] []); + ("to", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc20::AccountId" ] []); ("value", Ty.path "u128") ]; } *) @@ -182,8 +183,8 @@ End Impl_core_default_Default_for_erc20_Erc20. Axiom Result : forall (T : Ty.t), - (Ty.apply (Ty.path "erc20::Result") [ T ]) = - (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "erc20::Error" ]). + (Ty.apply (Ty.path "erc20::Result") [ T ] []) = + (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "erc20::Error" ] []). Module Impl_erc20_Env. Definition Self : Ty.t := Ty.path "erc20::Env". diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc721.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc721.v index a5743bef5..45716e463 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc721.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/erc721.v @@ -7,13 +7,13 @@ Require Import CoqOfRust.CoqOfRust. ty_params := [ "K"; "V" ]; fields := [ - ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ]); - ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []); + ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) ]; } *) Module Impl_core_default_Default_for_erc721_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc721::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc721::Mapping") [ K; V ] []. Parameter default : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -27,7 +27,7 @@ Module Impl_core_default_Default_for_erc721_Mapping_K_V. End Impl_core_default_Default_for_erc721_Mapping_K_V. Module Impl_erc721_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc721::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc721::Mapping") [ K; V ] []. Parameter contains : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -130,7 +130,7 @@ Module Impl_core_cmp_PartialEq_for_erc721_AccountId. (* Instance *) [ ("eq", InstanceField.Method eq) ]. End Impl_core_cmp_PartialEq_for_erc721_AccountId. -Module Impl_core_convert_From_array_u8_for_erc721_AccountId. +Module Impl_core_convert_From_array_u8_32_for_erc721_AccountId. Definition Self : Ty.t := Ty.path "erc721::AccountId". Parameter from : (list Ty.t) -> (list Value.t) -> M. @@ -139,9 +139,10 @@ Module Impl_core_convert_From_array_u8_for_erc721_AccountId. M.IsTraitInstance "core::convert::From" Self - (* Trait polymorphic types *) [ (* T *) Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] + (* Trait polymorphic types *) + [ (* T *) Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ] ] (* Instance *) [ ("from", InstanceField.Method from) ]. -End Impl_core_convert_From_array_u8_for_erc721_AccountId. +End Impl_core_convert_From_array_u8_32_for_erc721_AccountId. Axiom Balance : (Ty.path "erc721::Balance") = (Ty.path "u128"). @@ -161,15 +162,16 @@ Axiom TokenId : (Ty.path "erc721::TokenId") = (Ty.path "u32"). fields := [ ("token_owner", - Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "u32"; Ty.path "erc721::AccountId" ]); + Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "u32"; Ty.path "erc721::AccountId" ] []); ("token_approvals", - Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "u32"; Ty.path "erc721::AccountId" ]); + Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "u32"; Ty.path "erc721::AccountId" ] []); ("owned_tokens_count", - Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "erc721::AccountId"; Ty.path "u32" ]); + Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "erc721::AccountId"; Ty.path "u32" ] []); ("operator_approvals", Ty.apply (Ty.path "erc721::Mapping") - [ Ty.tuple [ Ty.path "erc721::AccountId"; Ty.path "erc721::AccountId" ]; Ty.tuple [] ]) + [ Ty.tuple [ Ty.path "erc721::AccountId"; Ty.path "erc721::AccountId" ]; Ty.tuple [] ] + []) ]; } *) @@ -304,8 +306,8 @@ End Impl_core_marker_Copy_for_erc721_Error. ty_params := []; fields := [ - ("from", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ]); - ("to", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ]); + ("from", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ] []); + ("to", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ] []); ("id", Ty.path "u32") ]; } *) 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 f4d343b3a..69d94b472 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 @@ -43,7 +43,9 @@ End Impl_core_marker_Copy_for_call_builder_AccountId. Axiom Balance : (Ty.path "call_builder::Balance") = (Ty.path "u128"). -Axiom Hash : (Ty.path "call_builder::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u8" ]). +Axiom Hash : + (Ty.path "call_builder::Hash") = + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]). (* Enum LangError *) (* { 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 4727bdfbd..06294b608 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 @@ -2,7 +2,8 @@ Require Import CoqOfRust.CoqOfRust. Axiom Hash : - (Ty.path "call_builder_delegate::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u8" ]). + (Ty.path "call_builder_delegate::Hash") = + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]). (* Enum LangError *) (* { 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 9746973de..246c2aa5a 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 @@ -41,7 +41,7 @@ Module Impl_core_marker_Copy_for_constructors_return_value_AccountId. M.IsTraitInstance "core::marker::Copy" Self (* Trait polymorphic types *) [] (* Instance *) []. End Impl_core_marker_Copy_for_constructors_return_value_AccountId. -Module Impl_core_convert_From_array_u8_for_constructors_return_value_AccountId. +Module Impl_core_convert_From_array_u8_32_for_constructors_return_value_AccountId. Definition Self : Ty.t := Ty.path "constructors_return_value::AccountId". Parameter from : (list Ty.t) -> (list Value.t) -> M. @@ -50,9 +50,10 @@ Module Impl_core_convert_From_array_u8_for_constructors_return_value_AccountId. M.IsTraitInstance "core::convert::From" Self - (* Trait polymorphic types *) [ (* T *) Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] + (* Trait polymorphic types *) + [ (* T *) Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ] ] (* Instance *) [ ("from", InstanceField.Method from) ]. -End Impl_core_convert_From_array_u8_for_constructors_return_value_AccountId. +End Impl_core_convert_From_array_u8_32_for_constructors_return_value_AccountId. Axiom Balance : (Ty.path "constructors_return_value::Balance") = (Ty.path "u128"). @@ -78,10 +79,11 @@ Axiom Balance : (Ty.path "constructors_return_value::Balance") = (Ty.path "u128" Axiom ConstructorResult : forall (T : Ty.t), - (Ty.apply (Ty.path "constructors_return_value::ConstructorResult") [ T ]) = + (Ty.apply (Ty.path "constructors_return_value::ConstructorResult") [ T ] []) = (Ty.apply (Ty.path "core::result::Result") - [ T; Ty.path "constructors_return_value::LangError" ]). + [ T; Ty.path "constructors_return_value::LangError" ] + []). (* 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 7dadcf6a6..e4467f4fb 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 @@ -43,7 +43,9 @@ End Impl_core_marker_Copy_for_contract_ref_AccountId. Axiom Balance : (Ty.path "contract_ref::Balance") = (Ty.path "u128"). -Axiom Hash : (Ty.path "contract_ref::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u8" ]). +Axiom Hash : + (Ty.path "contract_ref::Hash") = + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]). (* 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 b1b434da1..71e2143dc 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/mapping_integration_tests.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/mapping_integration_tests.v @@ -7,14 +7,14 @@ Require Import CoqOfRust.CoqOfRust. ty_params := [ "K"; "V" ]; fields := [ - ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ]); - ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []); + ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) ]; } *) Module Impl_core_default_Default_for_mapping_integration_tests_Mapping_K_V. Definition Self (K V : Ty.t) : Ty.t := - Ty.apply (Ty.path "mapping_integration_tests::Mapping") [ K; V ]. + Ty.apply (Ty.path "mapping_integration_tests::Mapping") [ K; V ] []. Parameter default : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -29,7 +29,7 @@ End Impl_core_default_Default_for_mapping_integration_tests_Mapping_K_V. Module Impl_mapping_integration_tests_Mapping_K_V. Definition Self (K V : Ty.t) : Ty.t := - Ty.apply (Ty.path "mapping_integration_tests::Mapping") [ K; V ]. + Ty.apply (Ty.path "mapping_integration_tests::Mapping") [ K; V ] []. Parameter contains : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -140,7 +140,8 @@ End Impl_mapping_integration_tests_Env. ("balances", Ty.apply (Ty.path "mapping_integration_tests::Mapping") - [ Ty.path "mapping_integration_tests::AccountId"; Ty.path "u128" ]) + [ Ty.path "mapping_integration_tests::AccountId"; Ty.path "u128" ] + []) ]; } *) diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/mother.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/mother.v index f59bcb905..3edd1f417 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/mother.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/mother.v @@ -7,13 +7,13 @@ Require Import CoqOfRust.CoqOfRust. ty_params := [ "K"; "V" ]; fields := [ - ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ]); - ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []); + ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) ]; } *) Module Impl_core_default_Default_for_mother_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "mother::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "mother::Mapping") [ K; V ] []. Parameter default : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -27,7 +27,7 @@ Module Impl_core_default_Default_for_mother_Mapping_K_V. End Impl_core_default_Default_for_mother_Mapping_K_V. Module Impl_mother_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "mother::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "mother::Mapping") [ K; V ] []. Parameter get : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -135,7 +135,9 @@ Axiom Balance : (Ty.path "mother::Balance") = (Ty.path "u128"). Axiom BlockNumber : (Ty.path "mother::BlockNumber") = (Ty.path "u32"). -Axiom Hash : (Ty.path "mother::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u8" ]). +Axiom Hash : + (Ty.path "mother::Hash") = + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]). (* StructRecord { @@ -158,11 +160,14 @@ Axiom Hash : (Ty.path "mother::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u [ Ty.apply (Ty.path "core::option::Option") - [ Ty.tuple [ Ty.path "mother::AccountId"; Ty.path "u128" ] ]; + [ Ty.tuple [ Ty.path "mother::AccountId"; Ty.path "u128" ] ] + []; Ty.path "alloc::alloc::Global" - ]; + ] + []; Ty.path "alloc::alloc::Global" ] + [] ]; } *) @@ -428,13 +433,13 @@ End Impl_core_clone_Clone_for_mother_Status. fields := [ ("name", Ty.path "alloc::string::String"); - ("subject", Ty.apply (Ty.path "array") [ Ty.path "u8" ]); + ("subject", Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]); ("bids", Ty.path "mother::Bids"); - ("terms", Ty.apply (Ty.path "array") [ Ty.path "u32" ]); + ("terms", Ty.apply (Ty.path "array") [ Ty.path "u32" ] [ Value.Integer Integer.Usize 3 ]); ("status", Ty.path "mother::Status"); ("finalized", Ty.path "bool"); ("vector", - Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ]) + Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] []) ]; } *) @@ -620,7 +625,7 @@ End Impl_mother_Env. [ ("auction", Ty.path "mother::Auction"); ("balances", - Ty.apply (Ty.path "mother::Mapping") [ Ty.path "mother::AccountId"; Ty.path "u128" ]) + Ty.apply (Ty.path "mother::Mapping") [ Ty.path "mother::AccountId"; Ty.path "u128" ] []) ]; } *) diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/multisig.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/multisig.v index 2c4d6f534..405a8f903 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/multisig.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/multisig.v @@ -7,13 +7,13 @@ Require Import CoqOfRust.CoqOfRust. ty_params := [ "K"; "V" ]; fields := [ - ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ]); - ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []); + ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) ]; } *) Module Impl_core_default_Default_for_multisig_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "multisig::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "multisig::Mapping") [ K; V ] []. Parameter default : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -27,7 +27,7 @@ Module Impl_core_default_Default_for_multisig_Mapping_K_V. End Impl_core_default_Default_for_multisig_Mapping_K_V. Module Impl_multisig_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "multisig::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "multisig::Mapping") [ K; V ] []. Parameter contains : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -213,7 +213,7 @@ Parameter value_WRONG_TRANSACTION_ID : Value.t. { name := "CallInput"; ty_params := []; - fields := [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "slice") [ Ty.path "u8" ] ] ]; + fields := [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "slice") [ Ty.path "u8" ] [] ] [] ]; } *) (* Enum ConfirmationStatus *) @@ -261,9 +261,9 @@ End Impl_core_marker_Copy_for_multisig_ConfirmationStatus. fields := [ ("callee", Ty.path "multisig::AccountId"); - ("selector", Ty.apply (Ty.path "array") [ Ty.path "u8" ]); + ("selector", Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 4 ]); ("input", - Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ]); + Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] []); ("transferred_value", Ty.path "u128"); ("gas_limit", Ty.path "u64"); ("allow_reentry", Ty.path "bool") @@ -372,7 +372,10 @@ End Impl_core_cmp_Eq_for_multisig_Error. fields := [ ("transactions", - Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ]); + Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ] + []); ("next_id", Ty.path "u32") ]; } *) @@ -440,9 +443,12 @@ End Impl_core_default_Default_for_multisig_Transactions. Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] - ]; + [] + ] + []; Ty.path "multisig::Error" - ]) + ] + []) ]; } *) @@ -545,20 +551,23 @@ End Impl_multisig_Env. ("confirmations", Ty.apply (Ty.path "multisig::Mapping") - [ Ty.tuple [ Ty.path "u32"; Ty.path "multisig::AccountId" ]; Ty.tuple [] ]); + [ Ty.tuple [ Ty.path "u32"; Ty.path "multisig::AccountId" ]; Ty.tuple [] ] + []); ("confirmation_count", - Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "u32"; Ty.path "u32" ]); + Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "u32"; Ty.path "u32" ] []); ("transactions", Ty.apply (Ty.path "multisig::Mapping") - [ Ty.path "u32"; Ty.path "multisig::Transaction" ]); + [ Ty.path "u32"; Ty.path "multisig::Transaction" ] + []); ("transaction_list", Ty.path "multisig::Transactions"); ("owners", Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ]); + [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ] + []); ("is_owner", - Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "multisig::AccountId"; Ty.tuple [] ]); + Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "multisig::AccountId"; Ty.tuple [] ] []); ("requirement", Ty.path "u32") ]; } *) diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/payment_channel.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/payment_channel.v index e442efaf1..756304e6e 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/payment_channel.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/payment_channel.v @@ -90,7 +90,7 @@ Module Impl_core_cmp_Eq_for_payment_channel_AccountId. [ ("assert_receiver_is_total_eq", InstanceField.Method assert_receiver_is_total_eq) ]. End Impl_core_cmp_Eq_for_payment_channel_AccountId. -Module Impl_core_convert_From_array_u8_for_payment_channel_AccountId. +Module Impl_core_convert_From_array_u8_32_for_payment_channel_AccountId. Definition Self : Ty.t := Ty.path "payment_channel::AccountId". Parameter from : (list Ty.t) -> (list Value.t) -> M. @@ -99,9 +99,10 @@ Module Impl_core_convert_From_array_u8_for_payment_channel_AccountId. M.IsTraitInstance "core::convert::From" Self - (* Trait polymorphic types *) [ (* T *) Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] + (* Trait polymorphic types *) + [ (* T *) Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ] ] (* Instance *) [ ("from", InstanceField.Method from) ]. -End Impl_core_convert_From_array_u8_for_payment_channel_AccountId. +End Impl_core_convert_From_array_u8_32_for_payment_channel_AccountId. Axiom Balance : (Ty.path "payment_channel::Balance") = (Ty.path "u128"). @@ -122,7 +123,7 @@ Axiom Timestamp : (Ty.path "payment_channel::Timestamp") = (Ty.path "u64"). [ ("sender", Ty.path "payment_channel::AccountId"); ("recipient", Ty.path "payment_channel::AccountId"); - ("expiration", Ty.apply (Ty.path "core::option::Option") [ Ty.path "u64" ]); + ("expiration", Ty.apply (Ty.path "core::option::Option") [ Ty.path "u64" ] []); ("withdrawn", Ty.path "u128"); ("close_duration", Ty.path "u64") ]; @@ -217,8 +218,8 @@ End Impl_core_cmp_Eq_for_payment_channel_Error. Axiom Result : forall (T : Ty.t), - (Ty.apply (Ty.path "payment_channel::Result") [ T ]) = - (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "payment_channel::Error" ]). + (Ty.apply (Ty.path "payment_channel::Result") [ T ] []) = + (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "payment_channel::Error" ] []). (* StructRecord { @@ -311,7 +312,8 @@ Parameter ecdsa_recover : (list Ty.t) -> (list Value.t) -> M. Module Impl_payment_channel_HashOutput_for_payment_channel_Sha2x256. Definition Self : Ty.t := Ty.path "payment_channel::Sha2x256". - Definition _Type_ : Ty.t := Ty.apply (Ty.path "array") [ Ty.path "u8" ]. + Definition _Type_ : Ty.t := + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]. Axiom Implements : M.IsTraitInstance @@ -324,7 +326,8 @@ End Impl_payment_channel_HashOutput_for_payment_channel_Sha2x256. Module Impl_payment_channel_HashOutput_for_payment_channel_Keccak256. Definition Self : Ty.t := Ty.path "payment_channel::Keccak256". - Definition _Type_ : Ty.t := Ty.apply (Ty.path "array") [ Ty.path "u8" ]. + Definition _Type_ : Ty.t := + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]. Axiom Implements : M.IsTraitInstance @@ -337,7 +340,8 @@ End Impl_payment_channel_HashOutput_for_payment_channel_Keccak256. Module Impl_payment_channel_HashOutput_for_payment_channel_Blake2x256. Definition Self : Ty.t := Ty.path "payment_channel::Blake2x256". - Definition _Type_ : Ty.t := Ty.apply (Ty.path "array") [ Ty.path "u8" ]. + Definition _Type_ : Ty.t := + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]. Axiom Implements : M.IsTraitInstance @@ -350,7 +354,8 @@ End Impl_payment_channel_HashOutput_for_payment_channel_Blake2x256. Module Impl_payment_channel_HashOutput_for_payment_channel_Blake2x128. Definition Self : Ty.t := Ty.path "payment_channel::Blake2x128". - Definition _Type_ : Ty.t := Ty.apply (Ty.path "array") [ Ty.path "u8" ]. + Definition _Type_ : Ty.t := + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 16 ]. Axiom Implements : M.IsTraitInstance 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 8102e601f..d2733f42b 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 @@ -41,7 +41,9 @@ Module Impl_core_marker_Copy_for_updated_incrementer_AccountId. M.IsTraitInstance "core::marker::Copy" Self (* Trait polymorphic types *) [] (* Instance *) []. End Impl_core_marker_Copy_for_updated_incrementer_AccountId. -Axiom Hash : (Ty.path "updated_incrementer::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u8" ]). +Axiom Hash : + (Ty.path "updated_incrementer::Hash") = + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]). (* Enum Error *) (* { diff --git a/CoqOfRust/examples/axiomatized/examples/ink_contracts/trait_erc20.v b/CoqOfRust/examples/axiomatized/examples/ink_contracts/trait_erc20.v index ea9094e99..87996732a 100644 --- a/CoqOfRust/examples/axiomatized/examples/ink_contracts/trait_erc20.v +++ b/CoqOfRust/examples/axiomatized/examples/ink_contracts/trait_erc20.v @@ -7,13 +7,13 @@ Require Import CoqOfRust.CoqOfRust. ty_params := [ "K"; "V" ]; fields := [ - ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ]); - ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []); + ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) ]; } *) Module Impl_core_default_Default_for_trait_erc20_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "trait_erc20::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "trait_erc20::Mapping") [ K; V ] []. Parameter default : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -27,7 +27,7 @@ Module Impl_core_default_Default_for_trait_erc20_Mapping_K_V. End Impl_core_default_Default_for_trait_erc20_Mapping_K_V. Module Impl_trait_erc20_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "trait_erc20::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "trait_erc20::Mapping") [ K; V ] []. Parameter get : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -173,8 +173,8 @@ End Impl_core_cmp_Eq_for_trait_erc20_Error. Axiom Result : forall (T : Ty.t), - (Ty.apply (Ty.path "trait_erc20::Result") [ T ]) = - (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "trait_erc20::Error" ]). + (Ty.apply (Ty.path "trait_erc20::Result") [ T ] []) = + (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "trait_erc20::Error" ] []). (* Trait *) (* Empty module 'BaseErc20' *) @@ -189,14 +189,16 @@ Axiom Result : ("balances", Ty.apply (Ty.path "trait_erc20::Mapping") - [ Ty.path "trait_erc20::AccountId"; Ty.path "u128" ]); + [ Ty.path "trait_erc20::AccountId"; Ty.path "u128" ] + []); ("allowances", Ty.apply (Ty.path "trait_erc20::Mapping") [ Ty.tuple [ Ty.path "trait_erc20::AccountId"; Ty.path "trait_erc20::AccountId" ]; Ty.path "u128" - ]) + ] + []) ]; } *) @@ -219,8 +221,8 @@ End Impl_core_default_Default_for_trait_erc20_Erc20. ty_params := []; fields := [ - ("from", Ty.apply (Ty.path "core::option::Option") [ Ty.path "trait_erc20::AccountId" ]); - ("to", Ty.apply (Ty.path "core::option::Option") [ Ty.path "trait_erc20::AccountId" ]); + ("from", Ty.apply (Ty.path "core::option::Option") [ Ty.path "trait_erc20::AccountId" ] []); + ("to", Ty.apply (Ty.path "core::option::Option") [ Ty.path "trait_erc20::AccountId" ] []); ("value", Ty.path "u128") ]; } *) 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 05c83d5cd..3c458df6f 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 @@ -15,6 +15,7 @@ Require Import CoqOfRust.CoqOfRust. Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "enums_testcase_linked_list::List"; Ty.path "alloc::alloc::Global" ] + [] ]; discriminant := None; }; 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..35e9b1afd 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 @@ -3,8 +3,8 @@ Require Import CoqOfRust.CoqOfRust. Axiom AliasedResult : forall (T : Ty.t), - (Ty.apply (Ty.path "aliases_for_result::AliasedResult") [ T ]) = - (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "core::num::error::ParseIntError" ]). + (Ty.apply (Ty.path "aliases_for_result::AliasedResult") [ T ] []) = + (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "core::num::error::ParseIntError" ] []). Parameter multiply : (list Ty.t) -> (list Value.t) -> M. 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 43b766cd9..584601b8f 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 @@ -3,7 +3,7 @@ Require Import CoqOfRust.CoqOfRust. Axiom Result : forall (T : Ty.t), - (Ty.apply (Ty.path "boxing_errors::Result") [ T ]) = + (Ty.apply (Ty.path "boxing_errors::Result") [ T ] []) = (Ty.apply (Ty.path "core::result::Result") [ @@ -11,7 +11,9 @@ Axiom Result : Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.dyn [ ("core::error::Error::Trait", []) ]; Ty.path "alloc::alloc::Global" ] - ]). + [] + ] + []). (* StructTuple { 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 8edd89d41..9d4a8e5c7 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 @@ -35,10 +35,11 @@ End Impl_core_clone_Clone_for_defining_an_error_type_DoubleError. Axiom Result : forall (T : Ty.t), - (Ty.apply (Ty.path "defining_an_error_type::Result") [ T ]) = + (Ty.apply (Ty.path "defining_an_error_type::Result") [ T ] []) = (Ty.apply (Ty.path "core::result::Result") - [ T; Ty.path "defining_an_error_type::DoubleError" ]). + [ T; Ty.path "defining_an_error_type::DoubleError" ] + []). Module Impl_core_fmt_Display_for_defining_an_error_type_DoubleError. Definition Self : Ty.t := Ty.path "defining_an_error_type::DoubleError". 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 8d5aa44c3..68d07f94a 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 @@ -3,7 +3,7 @@ Require Import CoqOfRust.CoqOfRust. Axiom Result : forall (T : Ty.t), - (Ty.apply (Ty.path "other_uses_of_question_mark::Result") [ T ]) = + (Ty.apply (Ty.path "other_uses_of_question_mark::Result") [ T ] []) = (Ty.apply (Ty.path "core::result::Result") [ @@ -11,7 +11,9 @@ Axiom Result : Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.dyn [ ("core::error::Error::Trait", []) ]; Ty.path "alloc::alloc::Global" ] - ]). + [] + ] + []). (* StructTuple { 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..41b433f4b 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 @@ -7,7 +7,7 @@ Require Import CoqOfRust.CoqOfRust. ty_params := []; fields := [ - ("area_code", Ty.apply (Ty.path "core::option::Option") [ Ty.path "u8" ]); + ("area_code", Ty.apply (Ty.path "core::option::Option") [ Ty.path "u8" ] []); ("number", Ty.path "u32") ]; } *) @@ -41,7 +41,8 @@ End Impl_core_marker_Copy_for_unpacking_options_via_question_mark_PhoneNumber. ("phone_number", Ty.apply (Ty.path "core::option::Option") - [ Ty.path "unpacking_options_via_question_mark::PhoneNumber" ]) + [ Ty.path "unpacking_options_via_question_mark::PhoneNumber" ] + []) ]; } *) @@ -74,7 +75,8 @@ End Impl_core_marker_Copy_for_unpacking_options_via_question_mark_Job. ("job", Ty.apply (Ty.path "core::option::Option") - [ Ty.path "unpacking_options_via_question_mark::Job" ]) + [ Ty.path "unpacking_options_via_question_mark::Job" ] + []) ]; } *) 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 b410b770d..4231ec14e 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 @@ -34,8 +34,8 @@ End Impl_core_fmt_Debug_for_wrapping_errors_DoubleError. Axiom Result : forall (T : Ty.t), - (Ty.apply (Ty.path "wrapping_errors::Result") [ T ]) = - (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "wrapping_errors::DoubleError" ]). + (Ty.apply (Ty.path "wrapping_errors::Result") [ T ] []) = + (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "wrapping_errors::DoubleError" ] []). Module Impl_core_fmt_Display_for_wrapping_errors_DoubleError. Definition Self : Ty.t := Ty.path "wrapping_errors::DoubleError". 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..78b26778b 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 @@ -57,8 +57,8 @@ End Impl_associated_functions_and_methods_Rectangle. ty_params := []; fields := [ - Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]; - Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] []; + Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] [] ]; } *) 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..b85a02125 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_implementation.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/generics/generics_implementation.v @@ -24,7 +24,8 @@ Module Impl_generics_implementation_Val. End Impl_generics_implementation_Val. Module Impl_generics_implementation_GenVal_T. - Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "generics_implementation::GenVal") [ T ]. + Definition Self (T : Ty.t) : Ty.t := + Ty.apply (Ty.path "generics_implementation::GenVal") [ T ] []. Parameter value : forall (T : Ty.t), (list Ty.t) -> (list Value.t) -> M. 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 b9bd49d6a..6913803c4 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 @@ -5,12 +5,12 @@ Require Import CoqOfRust.CoqOfRust. { name := "PhantomTuple"; ty_params := [ "A"; "B" ]; - fields := [ A; Ty.apply (Ty.path "core::marker::PhantomData") [ B ] ]; + fields := [ A; Ty.apply (Ty.path "core::marker::PhantomData") [ B ] [] ]; } *) Module Impl_core_marker_StructuralPartialEq_for_generics_phantom_type_PhantomTuple_A_B. Definition Self (A B : Ty.t) : Ty.t := - Ty.apply (Ty.path "generics_phantom_type::PhantomTuple") [ A; B ]. + Ty.apply (Ty.path "generics_phantom_type::PhantomTuple") [ A; B ] []. Axiom Implements : forall (A B : Ty.t), @@ -23,7 +23,7 @@ End Impl_core_marker_StructuralPartialEq_for_generics_phantom_type_PhantomTuple_ Module Impl_core_cmp_PartialEq_for_generics_phantom_type_PhantomTuple_A_B. Definition Self (A B : Ty.t) : Ty.t := - Ty.apply (Ty.path "generics_phantom_type::PhantomTuple") [ A; B ]. + Ty.apply (Ty.path "generics_phantom_type::PhantomTuple") [ A; B ] []. Parameter eq : forall (A B : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -40,12 +40,13 @@ End Impl_core_cmp_PartialEq_for_generics_phantom_type_PhantomTuple_A_B. { name := "PhantomStruct"; ty_params := [ "A"; "B" ]; - fields := [ ("first", A); ("phantom", Ty.apply (Ty.path "core::marker::PhantomData") [ B ]) ]; + fields := + [ ("first", A); ("phantom", Ty.apply (Ty.path "core::marker::PhantomData") [ B ] []) ]; } *) Module Impl_core_marker_StructuralPartialEq_for_generics_phantom_type_PhantomStruct_A_B. Definition Self (A B : Ty.t) : Ty.t := - Ty.apply (Ty.path "generics_phantom_type::PhantomStruct") [ A; B ]. + Ty.apply (Ty.path "generics_phantom_type::PhantomStruct") [ A; B ] []. Axiom Implements : forall (A B : Ty.t), @@ -58,7 +59,7 @@ End Impl_core_marker_StructuralPartialEq_for_generics_phantom_type_PhantomStruct Module Impl_core_cmp_PartialEq_for_generics_phantom_type_PhantomStruct_A_B. Definition Self (A B : Ty.t) : Ty.t := - Ty.apply (Ty.path "generics_phantom_type::PhantomStruct") [ A; B ]. + Ty.apply (Ty.path "generics_phantom_type::PhantomStruct") [ A; B ] []. Parameter eq : forall (A B : Ty.t), (list Ty.t) -> (list Value.t) -> M. 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 e6b584e7b..9a61e7eab 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 @@ -83,12 +83,12 @@ End Impl_core_marker_Copy_for_generics_phantom_type_test_case_unit_clarification { name := "Length"; ty_params := [ "Unit" ]; - fields := [ Ty.path "f64"; Ty.apply (Ty.path "core::marker::PhantomData") [ Unit ] ]; + fields := [ Ty.path "f64"; Ty.apply (Ty.path "core::marker::PhantomData") [ Unit ] [] ]; } *) Module Impl_core_fmt_Debug_for_generics_phantom_type_test_case_unit_clarification_Length_Unit. Definition Self (Unit : Ty.t) : Ty.t := - Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") [ Unit ]. + Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") [ Unit ] []. Parameter fmt : forall (Unit : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -103,7 +103,7 @@ End Impl_core_fmt_Debug_for_generics_phantom_type_test_case_unit_clarification_L Module Impl_core_clone_Clone_for_generics_phantom_type_test_case_unit_clarification_Length_Unit. Definition Self (Unit : Ty.t) : Ty.t := - Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") [ Unit ]. + Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") [ Unit ] []. Parameter clone : forall (Unit : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -118,7 +118,7 @@ End Impl_core_clone_Clone_for_generics_phantom_type_test_case_unit_clarification Module Impl_core_marker_Copy_for_generics_phantom_type_test_case_unit_clarification_Length_Unit. Definition Self (Unit : Ty.t) : Ty.t := - Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") [ Unit ]. + Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") [ Unit ] []. Axiom Implements : forall (Unit : Ty.t), @@ -131,10 +131,10 @@ End Impl_core_marker_Copy_for_generics_phantom_type_test_case_unit_clarification Module Impl_core_ops_arith_Add_for_generics_phantom_type_test_case_unit_clarification_Length_Unit. Definition Self (Unit : Ty.t) : Ty.t := - Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") [ Unit ]. + Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") [ Unit ] []. Definition _Output (Unit : Ty.t) : Ty.t := - Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") [ Unit ]. + Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") [ Unit ] []. Parameter add : forall (Unit : Ty.t), (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..f7b9798cd 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/modules/struct_visibility.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/modules/struct_visibility.v @@ -18,7 +18,7 @@ Module my. Module Impl_struct_visibility_my_ClosedBox_T. Definition Self (T : Ty.t) : Ty.t := - Ty.apply (Ty.path "struct_visibility::my::ClosedBox") [ T ]. + Ty.apply (Ty.path "struct_visibility::my::ClosedBox") [ T ] []. Parameter new : forall (T : Ty.t), (list Ty.t) -> (list Value.t) -> M. 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..2eb78b011 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 @@ -7,8 +7,8 @@ Require Import CoqOfRust.CoqOfRust. ty_params := []; fields := [ - ("author", Ty.apply (Ty.path "&") [ Ty.path "str" ]); - ("title", Ty.apply (Ty.path "&") [ Ty.path "str" ]); + ("author", Ty.apply (Ty.path "&") [ Ty.path "str" ] []); + ("title", Ty.apply (Ty.path "&") [ Ty.path "str" ] []); ("year", Ty.path "u32") ]; } *) 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 72c334be1..8e552f938 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 @@ -5,12 +5,12 @@ Require Import CoqOfRust.CoqOfRust. { name := "Ref"; ty_params := [ "T" ]; - fields := [ Ty.apply (Ty.path "&") [ T ] ]; + fields := [ Ty.apply (Ty.path "&") [ T ] [] ]; } *) Module Impl_core_fmt_Debug_for_scoping_rules_lifetimes_bounds_Ref_T. Definition Self (T : Ty.t) : Ty.t := - Ty.apply (Ty.path "scoping_rules_lifetimes_bounds::Ref") [ T ]. + Ty.apply (Ty.path "scoping_rules_lifetimes_bounds::Ref") [ T ] []. Parameter fmt : forall (T : Ty.t), (list Ty.t) -> (list Value.t) -> M. 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 04edc4a03..2cc51ba94 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 @@ -5,7 +5,7 @@ Require Import CoqOfRust.CoqOfRust. { name := "Borrowed"; ty_params := []; - fields := [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ]; + fields := [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ]; } *) Module Impl_core_fmt_Debug_for_scoping_rules_lifetimes_structs_Borrowed. @@ -27,8 +27,8 @@ End Impl_core_fmt_Debug_for_scoping_rules_lifetimes_structs_Borrowed. ty_params := []; fields := [ - ("x", Ty.apply (Ty.path "&") [ Ty.path "i32" ]); - ("y", Ty.apply (Ty.path "&") [ Ty.path "i32" ]) + ("x", Ty.apply (Ty.path "&") [ Ty.path "i32" ] []); + ("y", Ty.apply (Ty.path "&") [ Ty.path "i32" ] []) ]; } *) @@ -57,7 +57,7 @@ End Impl_core_fmt_Debug_for_scoping_rules_lifetimes_structs_NamedBorrowed. }; { name := "Ref"; - item := StructTuple [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ]; + item := StructTuple [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ]; discriminant := None; } ]; 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..0758ce1a0 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 @@ -5,7 +5,7 @@ Require Import CoqOfRust.CoqOfRust. { name := "Borrowed"; ty_params := []; - fields := [ ("x", Ty.apply (Ty.path "&") [ Ty.path "i32" ]) ]; + fields := [ ("x", Ty.apply (Ty.path "&") [ Ty.path "i32" ] []) ]; } *) Module Impl_core_fmt_Debug_for_scoping_rules_lifetimes_traits_Borrowed. 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..cf70da0a3 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 @@ -12,7 +12,10 @@ Module main. [ ("name", Ty.path "alloc::string::String"); ("age", - Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ]) + Ty.apply + (Ty.path "alloc::boxed::Box") + [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] + []) ]; } *) 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 2c88c9523..aefad75c3 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 @@ -7,8 +7,8 @@ Require Import CoqOfRust.CoqOfRust. ty_params := []; fields := [ - ("username", Ty.apply (Ty.path "&") [ Ty.path "str" ]); - ("password", Ty.apply (Ty.path "&") [ Ty.path "str" ]) + ("username", Ty.apply (Ty.path "&") [ Ty.path "str" ] []); + ("password", Ty.apply (Ty.path "&") [ Ty.path "str" ] []) ]; } *) @@ -80,8 +80,8 @@ End Impl_core_hash_Hash_for_hash_map_alternate_or_custom_key_types_Account. ty_params := []; fields := [ - ("name", Ty.apply (Ty.path "&") [ Ty.path "str" ]); - ("email", Ty.apply (Ty.path "&") [ Ty.path "str" ]) + ("name", Ty.apply (Ty.path "&") [ Ty.path "str" ] []); + ("email", Ty.apply (Ty.path "&") [ Ty.path "str" ] []) ]; } *) @@ -93,7 +93,8 @@ Axiom Accounts : Ty.path "hash_map_alternate_or_custom_key_types::Account"; Ty.path "hash_map_alternate_or_custom_key_types::AccountInfo"; Ty.path "std::hash::random::RandomState" - ]). + ] + []). Parameter try_logon : (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 e8e2405d3..84116b651 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 @@ -42,7 +42,8 @@ Module checked. (Ty.path "result::checked::MathResult") = (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "f64"; Ty.path "result::checked::MathError" ]). + [ Ty.path "f64"; Ty.path "result::checked::MathError" ] + []). Parameter div : (list Ty.t) -> (list Value.t) -> M. 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 45ad3daac..9bf21530b 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 @@ -42,7 +42,8 @@ Module checked. (Ty.path "result_chaining_with_question_mark::checked::MathResult") = (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "f64"; Ty.path "result_chaining_with_question_mark::checked::MathError" ]). + [ Ty.path "f64"; Ty.path "result_chaining_with_question_mark::checked::MathError" ] + []). Parameter div : (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 d0f4dd301..cfe0414a4 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/clone.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/clone.v @@ -46,8 +46,8 @@ End Impl_core_marker_Copy_for_clone_Unit. ty_params := []; fields := [ - Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]; - Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] []; + Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] [] ]; } *) diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/drop.v b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/drop.v index 75fc1f013..9962b5579 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/drop.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/drop.v @@ -5,7 +5,7 @@ Require Import CoqOfRust.CoqOfRust. { name := "Droppable"; ty_params := []; - fields := [ ("name", Ty.apply (Ty.path "&") [ Ty.path "str" ]) ]; + fields := [ ("name", Ty.apply (Ty.path "&") [ Ty.path "str" ] []) ]; } *) Module Impl_core_ops_drop_Drop_for_drop_Droppable. diff --git a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/traits.v b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/traits.v index 3bbab20f3..41eacbea1 100644 --- a/CoqOfRust/examples/axiomatized/examples/rust_book/traits/traits.v +++ b/CoqOfRust/examples/axiomatized/examples/rust_book/traits/traits.v @@ -5,7 +5,7 @@ Require Import CoqOfRust.CoqOfRust. { name := "Sheep"; ty_params := []; - fields := [ ("naked", Ty.path "bool"); ("name", Ty.apply (Ty.path "&") [ Ty.path "str" ]) ]; + fields := [ ("naked", Ty.path "bool"); ("name", Ty.apply (Ty.path "&") [ Ty.path "str" ] []) ]; } *) (* Trait *) diff --git a/CoqOfRust/examples/axiomatized/examples/subtle.v b/CoqOfRust/examples/axiomatized/examples/subtle.v index ba7d972b9..2887b5f5d 100644 --- a/CoqOfRust/examples/axiomatized/examples/subtle.v +++ b/CoqOfRust/examples/axiomatized/examples/subtle.v @@ -187,7 +187,7 @@ Module ConstantTimeEq. End ConstantTimeEq. Module Impl_subtle_ConstantTimeEq_for_slice_T. - Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "slice") [ T ]. + Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "slice") [ T ] []. Parameter ct_eq : forall (T : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -569,7 +569,7 @@ End Impl_subtle_ConditionallyNegatable_for_T. } *) Module Impl_core_clone_Clone_for_subtle_CtOption_T. - Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ]. + Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ] []. Parameter clone : forall (T : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -583,7 +583,7 @@ Module Impl_core_clone_Clone_for_subtle_CtOption_T. End Impl_core_clone_Clone_for_subtle_CtOption_T. Module Impl_core_marker_Copy_for_subtle_CtOption_T. - Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ]. + Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ] []. Axiom Implements : forall (T : Ty.t), @@ -595,7 +595,7 @@ Module Impl_core_marker_Copy_for_subtle_CtOption_T. End Impl_core_marker_Copy_for_subtle_CtOption_T. Module Impl_core_fmt_Debug_for_subtle_CtOption_T. - Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ]. + Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ] []. Parameter fmt : forall (T : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -609,7 +609,7 @@ Module Impl_core_fmt_Debug_for_subtle_CtOption_T. End Impl_core_fmt_Debug_for_subtle_CtOption_T. Module Impl_core_convert_From_subtle_CtOption_T_for_core_option_Option_T. - Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "core::option::Option") [ T ]. + Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "core::option::Option") [ T ] []. Parameter from : forall (T : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -618,12 +618,12 @@ Module Impl_core_convert_From_subtle_CtOption_T_for_core_option_Option_T. M.IsTraitInstance "core::convert::From" (Self T) - (* Trait polymorphic types *) [ (* T *) Ty.apply (Ty.path "subtle::CtOption") [ T ] ] + (* Trait polymorphic types *) [ (* T *) Ty.apply (Ty.path "subtle::CtOption") [ T ] [] ] (* Instance *) [ ("from", InstanceField.Method (from T)) ]. End Impl_core_convert_From_subtle_CtOption_T_for_core_option_Option_T. Module Impl_subtle_CtOption_T. - Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ]. + Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ] []. Parameter new : forall (T : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -683,7 +683,7 @@ Module Impl_subtle_CtOption_T. End Impl_subtle_CtOption_T. Module Impl_subtle_ConditionallySelectable_for_subtle_CtOption_T. - Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ]. + Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ] []. Parameter conditional_select : forall (T : Ty.t), (list Ty.t) -> (list Value.t) -> M. @@ -697,7 +697,7 @@ Module Impl_subtle_ConditionallySelectable_for_subtle_CtOption_T. End Impl_subtle_ConditionallySelectable_for_subtle_CtOption_T. Module Impl_subtle_ConstantTimeEq_for_subtle_CtOption_T. - Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ]. + Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ] []. Parameter ct_eq : forall (T : Ty.t), (list Ty.t) -> (list Value.t) -> M. diff --git a/CoqOfRust/examples/default/examples/custom/constructor_as_function.v b/CoqOfRust/examples/default/examples/custom/constructor_as_function.v index b9e5f68e7..e6e1700e4 100644 --- a/CoqOfRust/examples/default/examples/custom/constructor_as_function.v +++ b/CoqOfRust/examples/default/examples/custom/constructor_as_function.v @@ -55,7 +55,11 @@ Module Impl_core_fmt_Debug_for_constructor_as_function_Constructor. let* self := M.alloc self in let* f := M.alloc f in let* α0 := - M.get_associated_function (Ty.path "core::fmt::Formatter") "debug_tuple_field1_finish" [] in + M.get_associated_function + (Ty.path "core::fmt::Formatter") + "debug_tuple_field1_finish" + [] + [] in let* α1 := M.read f in let* α2 := M.read (mk_str "Constructor") in let* α5 := @@ -95,48 +99,67 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]; + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []; Ty.function [ Ty.path "i32" ] (Ty.path "constructor_as_function::Constructor") - ]) + ] + []) + [] [] "collect" [ Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "constructor_as_function::Constructor"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α1 := M.get_trait_method "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "map" [ Ty.path "constructor_as_function::Constructor"; Ty.function [ Ty.path "i32" ] (Ty.path "constructor_as_function::Constructor") - ] in + ] + [] in let* α2 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "into_iter" + [] [] in let* α3 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α8 := (* Unsize *) let* α4 := M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.apply (Ty.path "array") [ Ty.path "i32" ]; Ty.path "alloc::alloc::Global" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "i32" ] [ Value.Integer Integer.Usize 3 ]; + Ty.path "alloc::alloc::Global" + ] + []) "new" + [] [] in let* α5 := M.alloc @@ -159,8 +182,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α12 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -179,7 +202,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.path "alloc::vec::Vec") [ Ty.path "constructor_as_function::Constructor"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ v ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in diff --git a/CoqOfRust/examples/default/examples/custom/hello_world.v b/CoqOfRust/examples/default/examples/custom/hello_world.v index db605996e..9b9bfefc5 100644 --- a/CoqOfRust/examples/default/examples/custom/hello_world.v +++ b/CoqOfRust/examples/default/examples/custom/hello_world.v @@ -47,8 +47,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -62,7 +62,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.get_constant "hello_world::message" in let* α8 := M.call_closure α6 [ α7 ] in let* α9 := M.alloc (Value.Array [ α8 ]) in @@ -86,8 +87,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* i := M.copy γ0_0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Matched ") in @@ -101,7 +103,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ i ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -123,8 +126,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* j := M.copy γ0_0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Matched ") in @@ -138,7 +142,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ j ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -150,9 +155,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Didn't match a number. Let's go with a letter! @@ -177,8 +186,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* i := M.copy γ0_0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Matched ") in @@ -192,7 +202,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ i ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -213,9 +224,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := @@ -231,9 +246,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := diff --git a/CoqOfRust/examples/default/examples/custom/if_let.v b/CoqOfRust/examples/default/examples/custom/if_let.v index 682a5772a..2daf878ac 100644 --- a/CoqOfRust/examples/default/examples/custom/if_let.v +++ b/CoqOfRust/examples/default/examples/custom/if_let.v @@ -130,8 +130,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* y := M.copy γ0_0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "if: ") in @@ -145,7 +146,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ y ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -166,8 +168,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::option::Option::Some" 0 in let* y := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "match: ") in @@ -181,7 +184,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ y ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -212,8 +216,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* z := M.copy γ0_0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "if and: ") in @@ -228,13 +233,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α8 := M.call_closure α7 [ y ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α10 := M.call_closure α9 [ z ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in M.pure (M.pointer_coercion α11) in @@ -264,8 +271,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::option::Option::Some" 0 in let* z := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "match and: ") in @@ -280,13 +288,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α8 := M.call_closure α7 [ y ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α10 := M.call_closure α9 [ z ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in M.pure (M.pointer_coercion α11) in diff --git a/CoqOfRust/examples/default/examples/custom/impl_param.v b/CoqOfRust/examples/default/examples/custom/impl_param.v index 45ed4a874..24e674cff 100644 --- a/CoqOfRust/examples/default/examples/custom/impl_param.v +++ b/CoqOfRust/examples/default/examples/custom/impl_param.v @@ -22,12 +22,12 @@ Definition with_impls (τ : list Ty.t) (α : list Value.t) : M := let* foo := M.alloc foo in let* x := M.copy func in let* _ := - let* α0 := M.get_trait_method "core::default::Default" impl_Default [] "default" [] in + let* α0 := M.get_trait_method "core::default::Default" impl_Default [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.assign x α1 in let* y := M.copy func2 in let* _ := - let* α0 := M.get_trait_method "core::default::Default" impl_Default'1 [] "default" [] in + let* α0 := M.get_trait_method "core::default::Default" impl_Default'1 [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.assign y α1 in let* z := M.copy foo in @@ -36,8 +36,10 @@ Definition with_impls (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.tuple [ impl_Default; impl_Default'1; A ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.tuple [ impl_Default; impl_Default'1; A ]; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.read x in let* α2 := M.read y in diff --git a/CoqOfRust/examples/default/examples/custom/module_duplicate.v b/CoqOfRust/examples/default/examples/custom/module_duplicate.v index 499d36b8f..9c61cabf6 100644 --- a/CoqOfRust/examples/default/examples/custom/module_duplicate.v +++ b/CoqOfRust/examples/default/examples/custom/module_duplicate.v @@ -13,8 +13,13 @@ Module foo. | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "foo::gre::bar @@ -42,8 +47,13 @@ Module foo. | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "foo::bar @@ -55,7 +65,7 @@ Module foo. M.alloc α6 in M.alloc (Value.Tuple []) in let* _ := - let* α0 := M.get_function "module_duplicate::foo::gre::f_foo_gre" [] in + let* α0 := M.get_function "module_duplicate::foo::gre::f_foo_gre" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* α0 := M.alloc (Value.Tuple []) in @@ -73,7 +83,7 @@ Definition f (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* _ := - let* α0 := M.get_function "module_duplicate::foo::f_foo" [] in + let* α0 := M.get_function "module_duplicate::foo::f_foo" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* α0 := M.alloc (Value.Tuple []) in 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 20d2309ec..06c673a9a 100644 --- a/CoqOfRust/examples/default/examples/custom/pattern_in_function_parameters.v +++ b/CoqOfRust/examples/default/examples/custom/pattern_in_function_parameters.v @@ -104,16 +104,19 @@ Definition steps_between (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "usize"; Ty.path "core::num::error::TryFromIntError" - ]) + [ Ty.path "usize"; Ty.path "core::num::error::TryFromIntError" ] + []) "ok" + [] [] in let* α1 := M.get_trait_method "core::convert::TryFrom" (Ty.path "usize") [ Ty.path "u32" ] + [] "try_from" + [] [] in let* α2 := M.read count in let* α3 := BinOp.Panic.sub α2 (Value.Integer Integer.U32 2048) in @@ -125,16 +128,19 @@ Definition steps_between (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "usize"; Ty.path "core::num::error::TryFromIntError" - ]) + [ Ty.path "usize"; Ty.path "core::num::error::TryFromIntError" ] + []) "ok" + [] [] in let* α1 := M.get_trait_method "core::convert::TryFrom" (Ty.path "usize") [ Ty.path "u32" ] + [] "try_from" + [] [] in let* α2 := M.read count in let* α3 := M.call_closure α1 [ α2 ] in diff --git a/CoqOfRust/examples/default/examples/custom/polymorphic_associated_function.v b/CoqOfRust/examples/default/examples/custom/polymorphic_associated_function.v index 03f431429..f06b791e5 100644 --- a/CoqOfRust/examples/default/examples/custom/polymorphic_associated_function.v +++ b/CoqOfRust/examples/default/examples/custom/polymorphic_associated_function.v @@ -10,7 +10,7 @@ Require Import CoqOfRust.CoqOfRust. Module Impl_polymorphic_associated_function_Foo_A. Definition Self (A : Ty.t) : Ty.t := - Ty.apply (Ty.path "polymorphic_associated_function::Foo") [ A ]. + Ty.apply (Ty.path "polymorphic_associated_function::Foo") [ A ] []. (* fn convert>(self) -> Foo { @@ -24,7 +24,7 @@ Module Impl_polymorphic_associated_function_Foo_A. match τ, α with | [ B ], [ self ] => let* self := M.alloc self in - let* α0 := M.get_trait_method "core::convert::Into" A [ B ] "into" [] in + let* α0 := M.get_trait_method "core::convert::Into" A [ B ] [] "into" [] [] in let* α1 := M.read (M.get_struct_record_field self "polymorphic_associated_function::Foo" "data") in let* α2 := M.call_closure α0 [ α1 ] in @@ -56,9 +56,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* bar := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "polymorphic_associated_function::Foo") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "polymorphic_associated_function::Foo") [ Ty.path "i32" ] []) "convert" - [ Ty.path "f64" ] in + [ Ty.path "f64" ] + [] in let* α1 := M.read foo in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -97,7 +98,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "core::panicking::assert_failed" - [ Ty.path "f64"; Ty.path "f64" ] in + [ Ty.path "f64"; Ty.path "f64" ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in diff --git a/CoqOfRust/examples/default/examples/custom/provided_method.v b/CoqOfRust/examples/default/examples/custom/provided_method.v index b2561c9e3..d5d028188 100644 --- a/CoqOfRust/examples/default/examples/custom/provided_method.v +++ b/CoqOfRust/examples/default/examples/custom/provided_method.v @@ -7,7 +7,8 @@ Module ProvidedAndRequired. match τ, α with | [], [ self ] => let* self := M.alloc self in - let* α0 := M.get_trait_method "provided_method::ProvidedAndRequired" Self [] "required" [] in + let* α0 := + M.get_trait_method "provided_method::ProvidedAndRequired" Self [] [] "required" [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1 ] in BinOp.Panic.add (Value.Integer Integer.I32 42) α2 @@ -102,7 +103,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "provided_method::ProvidedAndRequired" (Ty.path "i32") [] + [] "provided" + [] [] in let* α1 := M.call_closure α0 [ x ] in let* α2 := M.alloc α1 in @@ -135,7 +138,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "core::panicking::assert_failed" - [ Ty.path "i32"; Ty.path "i32" ] in + [ Ty.path "i32"; Ty.path "i32" ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in @@ -157,7 +161,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "provided_method::ProvidedAndRequired" (Ty.path "u32") [] + [] "provided" + [] [] in let* α1 := M.call_closure α0 [ y ] in let* α2 := M.alloc α1 in @@ -190,7 +196,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "core::panicking::assert_failed" - [ Ty.path "i32"; Ty.path "i32" ] in + [ Ty.path "i32"; Ty.path "i32" ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in 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 bacd1b15f..8327a9e03 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/basic_contract_caller.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/basic_contract_caller.v @@ -17,7 +17,8 @@ Module Impl_core_default_Default_for_basic_contract_caller_AccountId. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructTuple "basic_contract_caller::AccountId" [ α1 ]) | _, _ => M.impossible @@ -62,7 +63,8 @@ Module Impl_core_marker_Copy_for_basic_contract_caller_AccountId. End Impl_core_marker_Copy_for_basic_contract_caller_AccountId. Axiom Hash : - (Ty.path "basic_contract_caller::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u8" ]). + (Ty.path "basic_contract_caller::Hash") = + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]). (* Enum Error *) (* { @@ -164,7 +166,7 @@ Module Impl_basic_contract_caller_BasicContractCaller. | [], [ other_contract_code_hash ] => let* other_contract_code_hash := M.alloc other_contract_code_hash in let* other_contract := - let* α0 := M.get_function "core::panicking::panic" [] in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in let* α1 := M.read (mk_str "not yet implemented") in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.never_to_any α2 in @@ -193,7 +195,7 @@ Module Impl_basic_contract_caller_BasicContractCaller. let* self := M.alloc self in let* _ := let* α0 := - M.get_associated_function (Ty.path "basic_contract_caller::OtherContract") "flip" [] in + M.get_associated_function (Ty.path "basic_contract_caller::OtherContract") "flip" [] [] in let* α1 := M.read self in let* α2 := M.call_closure @@ -206,7 +208,7 @@ Module Impl_basic_contract_caller_BasicContractCaller. ] in M.alloc α2 in let* α0 := - M.get_associated_function (Ty.path "basic_contract_caller::OtherContract") "get" [] in + M.get_associated_function (Ty.path "basic_contract_caller::OtherContract") "get" [] [] in let* α1 := M.read self in let* α2 := M.call_closure diff --git a/CoqOfRust/examples/default/examples/ink_contracts/call_runtime.v b/CoqOfRust/examples/default/examples/ink_contracts/call_runtime.v index a54cfec10..009721b99 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/call_runtime.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/call_runtime.v @@ -17,7 +17,8 @@ Module Impl_core_default_Default_for_call_runtime_AccountId. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructTuple "call_runtime::AccountId" [ α1 ]) | _, _ => M.impossible @@ -80,14 +81,24 @@ Module Impl_core_convert_From_call_runtime_AccountId_for_call_runtime_MultiAddre Definition Self : Ty.t := Ty.apply (Ty.path "call_runtime::MultiAddress") - [ Ty.path "call_runtime::AccountId"; Ty.tuple [] ]. + [ Ty.path "call_runtime::AccountId"; Ty.tuple [] ] + []. (* fn from(_value: AccountId) -> Self { unimplemented!() } *) - Parameter from : (list Ty.t) -> (list Value.t) -> M. + Definition from (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ _value ] => + let* _value := M.alloc _value in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom Implements : M.IsTraitInstance @@ -110,7 +121,8 @@ End Impl_core_convert_From_call_runtime_AccountId_for_call_runtime_MultiAddress_ ("dest", Ty.apply (Ty.path "call_runtime::MultiAddress") - [ Ty.path "call_runtime::AccountId"; Ty.tuple [] ]); + [ Ty.path "call_runtime::AccountId"; Ty.tuple [] ] + []); ("value", Ty.path "u128") ]; discriminant := None; @@ -181,7 +193,7 @@ Module Impl_core_fmt_Debug_for_call_runtime_RuntimeError. | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] [] in let* α1 := M.read f in let* α2 := M.read (mk_str "CallRuntimeFailed") in M.call_closure α0 [ α1; α2 ] @@ -306,7 +318,8 @@ Module Impl_core_convert_From_call_runtime_EnvError_for_call_runtime_RuntimeErro let* α0 := M.get_function "std::panicking::begin_panic" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.read (mk_str "Unexpected error from `pallet-contracts`.") in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.never_to_any α2 in @@ -332,7 +345,17 @@ Module Impl_call_runtime_Env. unimplemented!() } *) - Parameter call_runtime : (list Ty.t) -> (list Value.t) -> M. + Definition call_runtime (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [ Call ], [ self; _call ] => + let* self := M.alloc self in + let* _call := M.alloc _call in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_call_runtime : M.IsAssociatedFunction Self "call_runtime" call_runtime. End Impl_call_runtime_Env. @@ -345,7 +368,15 @@ Module Impl_call_runtime_RuntimeCaller. unimplemented!() } *) - Parameter init_env : (list Ty.t) -> (list Value.t) -> M. + Definition init_env (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [] => + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_init_env : M.IsAssociatedFunction Self "init_env" init_env. @@ -358,7 +389,8 @@ Module Impl_call_runtime_RuntimeCaller. match τ, α with | [], [ self ] => let* self := M.alloc self in - let* α0 := M.get_associated_function (Ty.path "call_runtime::RuntimeCaller") "init_env" [] in + let* α0 := + M.get_associated_function (Ty.path "call_runtime::RuntimeCaller") "init_env" [] [] in M.call_closure α0 [] | _, _ => M.impossible end. @@ -378,7 +410,9 @@ Module Impl_call_runtime_RuntimeCaller. "core::default::Default" (Ty.path "call_runtime::RuntimeCaller") [] + [] "default" + [] [] in M.call_closure α0 [] | _, _ => M.impossible @@ -410,18 +444,21 @@ Module Impl_call_runtime_RuntimeCaller. M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "call_runtime::EnvError" ]) + [ Ty.tuple []; Ty.path "call_runtime::EnvError" ] + []) "map_err" [ Ty.path "call_runtime::RuntimeError"; Ty.function [ Ty.path "call_runtime::EnvError" ] (Ty.path "call_runtime::RuntimeError") - ] in + ] + [] in let* α1 := M.get_associated_function (Ty.path "call_runtime::Env") "call_runtime" - [ Ty.path "call_runtime::RuntimeCall" ] in - let* α2 := M.get_associated_function (Ty.path "call_runtime::RuntimeCaller") "env" [] in + [ Ty.path "call_runtime::RuntimeCall" ] + [] in + let* α2 := M.get_associated_function (Ty.path "call_runtime::RuntimeCaller") "env" [] [] in let* α3 := M.read self in let* α4 := M.call_closure α2 [ α3 ] in let* α5 := M.alloc α4 in @@ -433,8 +470,11 @@ Module Impl_call_runtime_RuntimeCaller. Ty.apply (Ty.path "call_runtime::MultiAddress") [ Ty.path "call_runtime::AccountId"; Ty.tuple [] ] + [] ] + [] "into" + [] [] in let* α7 := M.read receiver in let* α8 := M.call_closure α6 [ α7 ] in @@ -454,7 +494,9 @@ Module Impl_call_runtime_RuntimeCaller. "core::convert::Into" (Ty.path "call_runtime::EnvError") [ Ty.path "call_runtime::RuntimeError" ] + [] "into" + [] [] in M.call_closure α0 [ α11; α12 ] | _, _ => M.impossible @@ -476,15 +518,17 @@ Module Impl_call_runtime_RuntimeCaller. M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "call_runtime::EnvError" ]) + [ Ty.tuple []; Ty.path "call_runtime::EnvError" ] + []) "map_err" [ Ty.path "call_runtime::RuntimeError"; Ty.function [ Ty.path "call_runtime::EnvError" ] (Ty.path "call_runtime::RuntimeError") - ] in + ] + [] in let* α1 := - M.get_associated_function (Ty.path "call_runtime::Env") "call_runtime" [ Ty.tuple [] ] in - let* α2 := M.get_associated_function (Ty.path "call_runtime::RuntimeCaller") "env" [] in + M.get_associated_function (Ty.path "call_runtime::Env") "call_runtime" [ Ty.tuple [] ] [] in + let* α2 := M.get_associated_function (Ty.path "call_runtime::RuntimeCaller") "env" [] [] in let* α3 := M.read self in let* α4 := M.call_closure α2 [ α3 ] in let* α5 := M.alloc α4 in @@ -495,7 +539,9 @@ Module Impl_call_runtime_RuntimeCaller. "core::convert::Into" (Ty.path "call_runtime::EnvError") [ Ty.path "call_runtime::RuntimeError" ] + [] "into" + [] [] in M.call_closure α0 [ α7; α8 ] | _, _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/ink_contracts/conditional_compilation.v b/CoqOfRust/examples/default/examples/ink_contracts/conditional_compilation.v index db4019502..80519a7f0 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/conditional_compilation.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/conditional_compilation.v @@ -17,7 +17,8 @@ Module Impl_core_default_Default_for_conditional_compilation_AccountId. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructTuple "conditional_compilation::AccountId" [ α1 ]) | _, _ => M.impossible @@ -137,7 +138,17 @@ Module Impl_conditional_compilation_Env. unimplemented!() } *) - Parameter emit_event : (list Ty.t) -> (list Value.t) -> M. + Definition emit_event (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ self; _event ] => + let* self := M.alloc self in + let* _event := M.alloc _event in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_emit_event : M.IsAssociatedFunction Self "emit_event" emit_event. @@ -146,7 +157,16 @@ Module Impl_conditional_compilation_Env. unimplemented!() } *) - Parameter block_number : (list Ty.t) -> (list Value.t) -> M. + Definition block_number (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ self ] => + let* self := M.alloc self in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_block_number : M.IsAssociatedFunction Self "block_number" block_number. End Impl_conditional_compilation_Env. @@ -166,7 +186,15 @@ Module Impl_conditional_compilation_ConditionalCompilation. unimplemented!() } *) - Parameter init_env : (list Ty.t) -> (list Value.t) -> M. + Definition init_env (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [] => + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_init_env : M.IsAssociatedFunction Self "init_env" init_env. @@ -183,6 +211,7 @@ Module Impl_conditional_compilation_ConditionalCompilation. M.get_associated_function (Ty.path "conditional_compilation::ConditionalCompilation") "init_env" + [] [] in M.call_closure α0 [] | _, _ => M.impossible @@ -200,7 +229,8 @@ Module Impl_conditional_compilation_ConditionalCompilation. Definition new (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "bool") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "bool") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructRecord "conditional_compilation::ConditionalCompilation" [ ("value", α1) ]) @@ -287,11 +317,13 @@ Module Impl_conditional_compilation_ConditionalCompilation. (M.get_struct_record_field α0 "conditional_compilation::ConditionalCompilation" "value") (UnOp.Pure.not α2) in let* caller := - let* α0 := M.get_associated_function (Ty.path "conditional_compilation::Env") "caller" [] in + let* α0 := + M.get_associated_function (Ty.path "conditional_compilation::Env") "caller" [] [] in let* α1 := M.get_associated_function (Ty.path "conditional_compilation::ConditionalCompilation") "init_env" + [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.alloc α2 in @@ -299,11 +331,12 @@ Module Impl_conditional_compilation_ConditionalCompilation. M.alloc α4 in let* _ := let* α0 := - M.get_associated_function (Ty.path "conditional_compilation::Env") "emit_event" [] in + M.get_associated_function (Ty.path "conditional_compilation::Env") "emit_event" [] [] in let* α1 := M.get_associated_function (Ty.path "conditional_compilation::ConditionalCompilation") "init_env" + [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.alloc α2 in @@ -354,11 +387,13 @@ Module Impl_conditional_compilation_ConditionalCompilation. | [], [ self ] => let* self := M.alloc self in let* caller := - let* α0 := M.get_associated_function (Ty.path "conditional_compilation::Env") "caller" [] in + let* α0 := + M.get_associated_function (Ty.path "conditional_compilation::Env") "caller" [] [] in let* α1 := M.get_associated_function (Ty.path "conditional_compilation::ConditionalCompilation") "init_env" + [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.alloc α2 in @@ -366,11 +401,12 @@ Module Impl_conditional_compilation_ConditionalCompilation. M.alloc α4 in let* block_number := let* α0 := - M.get_associated_function (Ty.path "conditional_compilation::Env") "block_number" [] in + M.get_associated_function (Ty.path "conditional_compilation::Env") "block_number" [] [] in let* α1 := M.get_associated_function (Ty.path "conditional_compilation::ConditionalCompilation") "init_env" + [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.alloc α2 in @@ -390,11 +426,12 @@ Module Impl_conditional_compilation_ConditionalCompilation. (UnOp.Pure.not α2) in let* _ := let* α0 := - M.get_associated_function (Ty.path "conditional_compilation::Env") "emit_event" [] in + M.get_associated_function (Ty.path "conditional_compilation::Env") "emit_event" [] [] in let* α1 := M.get_associated_function (Ty.path "conditional_compilation::ConditionalCompilation") "init_env" + [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.alloc α2 in @@ -490,11 +527,13 @@ Module Impl_conditional_compilation_Flip_for_conditional_compilation_Conditional let* self := M.alloc self in let* value := M.alloc value in let* caller := - let* α0 := M.get_associated_function (Ty.path "conditional_compilation::Env") "caller" [] in + let* α0 := + M.get_associated_function (Ty.path "conditional_compilation::Env") "caller" [] [] in let* α1 := M.get_associated_function (Ty.path "conditional_compilation::ConditionalCompilation") "init_env" + [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.alloc α2 in @@ -502,11 +541,12 @@ Module Impl_conditional_compilation_Flip_for_conditional_compilation_Conditional M.alloc α4 in let* _ := let* α0 := - M.get_associated_function (Ty.path "conditional_compilation::Env") "emit_event" [] in + M.get_associated_function (Ty.path "conditional_compilation::Env") "emit_event" [] [] in let* α1 := M.get_associated_function (Ty.path "conditional_compilation::ConditionalCompilation") "init_env" + [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.alloc α2 in diff --git a/CoqOfRust/examples/default/examples/ink_contracts/contract_terminate.v b/CoqOfRust/examples/default/examples/ink_contracts/contract_terminate.v index 526f0e05b..8fa00604f 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/contract_terminate.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/contract_terminate.v @@ -17,7 +17,8 @@ Module Impl_core_default_Default_for_contract_terminate_AccountId. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructTuple "contract_terminate::AccountId" [ α1 ]) | _, _ => M.impossible @@ -92,7 +93,17 @@ Module Impl_contract_terminate_Env. unimplemented!() } *) - Parameter terminate_contract : (list Ty.t) -> (list Value.t) -> M. + Definition terminate_contract (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ self; _account ] => + let* self := M.alloc self in + let* _account := M.alloc _account in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_terminate_contract : M.IsAssociatedFunction Self "terminate_contract" terminate_contract. @@ -112,7 +123,15 @@ Module Impl_contract_terminate_JustTerminate. unimplemented!() } *) - Parameter init_env : (list Ty.t) -> (list Value.t) -> M. + Definition init_env (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [] => + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_init_env : M.IsAssociatedFunction Self "init_env" init_env. @@ -126,7 +145,7 @@ Module Impl_contract_terminate_JustTerminate. | [], [ self ] => let* self := M.alloc self in let* α0 := - M.get_associated_function (Ty.path "contract_terminate::JustTerminate") "init_env" [] in + M.get_associated_function (Ty.path "contract_terminate::JustTerminate") "init_env" [] [] in M.call_closure α0 [] | _, _ => M.impossible end. @@ -157,15 +176,19 @@ Module Impl_contract_terminate_JustTerminate. let* self := M.alloc self in let* _ := let* α0 := - M.get_associated_function (Ty.path "contract_terminate::Env") "terminate_contract" [] in + M.get_associated_function + (Ty.path "contract_terminate::Env") + "terminate_contract" + [] + [] in let* α1 := - M.get_associated_function (Ty.path "contract_terminate::JustTerminate") "env" [] in + M.get_associated_function (Ty.path "contract_terminate::JustTerminate") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in - let* α5 := M.get_associated_function (Ty.path "contract_terminate::Env") "caller" [] in + let* α5 := M.get_associated_function (Ty.path "contract_terminate::Env") "caller" [] [] in let* α6 := - M.get_associated_function (Ty.path "contract_terminate::JustTerminate") "env" [] in + M.get_associated_function (Ty.path "contract_terminate::JustTerminate") "env" [] [] in let* α7 := M.read self in let* α8 := M.call_closure α6 [ α7 ] in let* α9 := M.alloc α8 in diff --git a/CoqOfRust/examples/default/examples/ink_contracts/contract_transfer.v b/CoqOfRust/examples/default/examples/ink_contracts/contract_transfer.v index 7612a98bc..2b3c048da 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/contract_transfer.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/contract_transfer.v @@ -17,7 +17,8 @@ Module Impl_core_default_Default_for_contract_transfer_AccountId. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructTuple "contract_transfer::AccountId" [ α1 ]) | _, _ => M.impossible @@ -94,7 +95,16 @@ Module Impl_contract_transfer_Env. unimplemented!() } *) - Parameter balance : (list Ty.t) -> (list Value.t) -> M. + Definition balance (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ self ] => + let* self := M.alloc self in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_balance : M.IsAssociatedFunction Self "balance" balance. @@ -103,7 +113,18 @@ Module Impl_contract_transfer_Env. unimplemented!() } *) - Parameter transfer : (list Ty.t) -> (list Value.t) -> M. + Definition transfer (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ self; _to; _value ] => + let* self := M.alloc self in + let* _to := M.alloc _to in + let* _value := M.alloc _value in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_transfer : M.IsAssociatedFunction Self "transfer" transfer. @@ -112,7 +133,16 @@ Module Impl_contract_transfer_Env. unimplemented!() } *) - Parameter transferred_value : (list Ty.t) -> (list Value.t) -> M. + Definition transferred_value (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ self ] => + let* self := M.alloc self in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_transferred_value : M.IsAssociatedFunction Self "transferred_value" transferred_value. @@ -132,7 +162,15 @@ Module Impl_contract_transfer_GiveMe. unimplemented!() } *) - Parameter init_env : (list Ty.t) -> (list Value.t) -> M. + Definition init_env (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [] => + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_init_env : M.IsAssociatedFunction Self "init_env" init_env. @@ -145,7 +183,7 @@ Module Impl_contract_transfer_GiveMe. match τ, α with | [], [ self ] => let* self := M.alloc self in - let* α0 := M.get_associated_function (Ty.path "contract_transfer::GiveMe") "init_env" [] in + let* α0 := M.get_associated_function (Ty.path "contract_transfer::GiveMe") "init_env" [] [] in M.call_closure α0 [] | _, _ => M.impossible end. @@ -188,8 +226,8 @@ Module Impl_contract_transfer_GiveMe. let* value := M.alloc value in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "requested value: ") in @@ -203,7 +241,8 @@ Module Impl_contract_transfer_GiveMe. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u128" ] in + [ Ty.path "u128" ] + [] in let* α7 := M.call_closure α6 [ value ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -213,8 +252,8 @@ Module Impl_contract_transfer_GiveMe. M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "contract balance: ") in @@ -228,10 +267,12 @@ Module Impl_contract_transfer_GiveMe. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u128" ] in + [ Ty.path "u128" ] + [] in let* α7 := - M.get_associated_function (Ty.path "contract_transfer::Env") "balance" [] in - let* α8 := M.get_associated_function (Ty.path "contract_transfer::GiveMe") "env" [] in + M.get_associated_function (Ty.path "contract_transfer::Env") "balance" [] [] in + let* α8 := + M.get_associated_function (Ty.path "contract_transfer::GiveMe") "env" [] [] in let* α9 := M.read self in let* α10 := M.call_closure α8 [ α9 ] in let* α11 := M.alloc α10 in @@ -253,9 +294,9 @@ Module Impl_contract_transfer_GiveMe. let* γ := let* α0 := M.read value in let* α1 := - M.get_associated_function (Ty.path "contract_transfer::Env") "balance" [] in + M.get_associated_function (Ty.path "contract_transfer::Env") "balance" [] [] in let* α2 := - M.get_associated_function (Ty.path "contract_transfer::GiveMe") "env" [] in + M.get_associated_function (Ty.path "contract_transfer::GiveMe") "env" [] [] in let* α3 := M.read self in let* α4 := M.call_closure α2 [ α3 ] in let* α5 := M.alloc α4 in @@ -268,7 +309,8 @@ Module Impl_contract_transfer_GiveMe. let* α0 := M.get_function "std::panicking::begin_panic" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.read (mk_str "insufficient funds!") in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.never_to_any α2 in @@ -284,20 +326,21 @@ Module Impl_contract_transfer_GiveMe. let* γ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::result::Result") [ Ty.tuple []; Ty.tuple [] ]) + (Ty.apply (Ty.path "core::result::Result") [ Ty.tuple []; Ty.tuple [] ] []) "is_err" - [] in + [] + [ Value.Bool true ] in let* α1 := - M.get_associated_function (Ty.path "contract_transfer::Env") "transfer" [] in + M.get_associated_function (Ty.path "contract_transfer::Env") "transfer" [] [] in let* α2 := - M.get_associated_function (Ty.path "contract_transfer::GiveMe") "env" [] in + M.get_associated_function (Ty.path "contract_transfer::GiveMe") "env" [] [] in let* α3 := M.read self in let* α4 := M.call_closure α2 [ α3 ] in let* α5 := M.alloc α4 in let* α6 := - M.get_associated_function (Ty.path "contract_transfer::Env") "caller" [] in + M.get_associated_function (Ty.path "contract_transfer::Env") "caller" [] [] in let* α7 := - M.get_associated_function (Ty.path "contract_transfer::GiveMe") "env" [] in + M.get_associated_function (Ty.path "contract_transfer::GiveMe") "env" [] [] in let* α8 := M.read self in let* α9 := M.call_closure α7 [ α8 ] in let* α10 := M.alloc α9 in @@ -314,7 +357,8 @@ Module Impl_contract_transfer_GiveMe. let* α0 := M.get_function "std::panicking::begin_panic" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.read (mk_str @@ -342,8 +386,8 @@ Module Impl_contract_transfer_GiveMe. let* self := M.alloc self in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "received payment: ") in @@ -357,13 +401,16 @@ Module Impl_contract_transfer_GiveMe. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u128" ] in + [ Ty.path "u128" ] + [] in let* α7 := M.get_associated_function (Ty.path "contract_transfer::Env") "transferred_value" + [] [] in - let* α8 := M.get_associated_function (Ty.path "contract_transfer::GiveMe") "env" [] in + let* α8 := + M.get_associated_function (Ty.path "contract_transfer::GiveMe") "env" [] [] in let* α9 := M.read self in let* α10 := M.call_closure α8 [ α9 ] in let* α11 := M.alloc α10 in @@ -387,9 +434,10 @@ Module Impl_contract_transfer_GiveMe. M.get_associated_function (Ty.path "contract_transfer::Env") "transferred_value" + [] [] in let* α1 := - M.get_associated_function (Ty.path "contract_transfer::GiveMe") "env" [] in + M.get_associated_function (Ty.path "contract_transfer::GiveMe") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -403,7 +451,8 @@ Module Impl_contract_transfer_GiveMe. let* α0 := M.get_function "std::panicking::begin_panic" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.read (mk_str "payment was not ten") in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.never_to_any α2 in diff --git a/CoqOfRust/examples/default/examples/ink_contracts/custom_allocator.v b/CoqOfRust/examples/default/examples/ink_contracts/custom_allocator.v index 198dba633..37569f97b 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/custom_allocator.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/custom_allocator.v @@ -8,7 +8,10 @@ Require Import CoqOfRust.CoqOfRust. fields := [ ("value", - Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "bool"; Ty.path "alloc::alloc::Global" ]) + Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "bool"; Ty.path "alloc::alloc::Global" ] + []) ]; } *) @@ -28,17 +31,23 @@ Module Impl_custom_allocator_CustomAllocator. let* init_value := M.alloc init_value in let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.path "bool" ]) + (Ty.apply (Ty.path "slice") [ Ty.path "bool" ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α6 := (* Unsize *) let* α1 := M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.apply (Ty.path "array") [ Ty.path "bool" ]; Ty.path "alloc::alloc::Global" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "bool" ] [ Value.Integer Integer.Usize 1 ]; + Ty.path "alloc::alloc::Global" + ] + []) "new" + [] [] in let* α2 := M.read init_value in let* α3 := M.alloc (Value.Array [ α2 ]) in @@ -60,8 +69,10 @@ Module Impl_custom_allocator_CustomAllocator. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_associated_function (Ty.path "custom_allocator::CustomAllocator") "new" [] in - let* α1 := M.get_trait_method "core::default::Default" (Ty.path "bool") [] "default" [] in + let* α0 := + M.get_associated_function (Ty.path "custom_allocator::CustomAllocator") "new" [] [] in + let* α1 := + M.get_trait_method "core::default::Default" (Ty.path "bool") [] [] "default" [] [] in let* α2 := M.call_closure α1 [] in M.call_closure α0 [ α2 ] | _, _ => M.impossible @@ -84,9 +95,12 @@ Module Impl_custom_allocator_CustomAllocator. "core::ops::index::IndexMut" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "bool"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "bool"; Ty.path "alloc::alloc::Global" ] + []) [ Ty.path "usize" ] + [] "index_mut" + [] [] in let* α1 := M.read self in let* α2 := @@ -101,9 +115,12 @@ Module Impl_custom_allocator_CustomAllocator. "core::ops::index::Index" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "bool"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "bool"; Ty.path "alloc::alloc::Global" ] + []) [ Ty.path "usize" ] + [] "index" + [] [] in let* α4 := M.read self in let* α5 := @@ -134,9 +151,14 @@ Module Impl_custom_allocator_CustomAllocator. let* α0 := M.get_trait_method "core::ops::index::Index" - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "bool"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "bool"; Ty.path "alloc::alloc::Global" ] + []) [ Ty.path "usize" ] + [] "index" + [] [] in let* α1 := M.read self in let* α2 := diff --git a/CoqOfRust/examples/default/examples/ink_contracts/custom_environment.v b/CoqOfRust/examples/default/examples/ink_contracts/custom_environment.v index 3354365cd..01ba5a80a 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/custom_environment.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/custom_environment.v @@ -17,7 +17,8 @@ Module Impl_core_default_Default_for_custom_environment_AccountId. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructTuple "custom_environment::AccountId" [ α1 ]) | _, _ => M.impossible @@ -119,15 +120,20 @@ Module Impl_core_default_Default_for_custom_environment_EventWithTopics. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in - let* α2 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α2 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α3 := M.call_closure α2 [] in - let* α4 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α4 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α5 := M.call_closure α4 [] in - let* α6 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α6 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α7 := M.call_closure α6 [] in - let* α8 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α8 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α9 := M.call_closure α8 [] in M.pure (Value.StructRecord @@ -187,7 +193,17 @@ Module Impl_custom_environment_Env. unimplemented!() } *) - Parameter emit_event : (list Ty.t) -> (list Value.t) -> M. + Definition emit_event (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ self; _event ] => + let* self := M.alloc self in + let* _event := M.alloc _event in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_emit_event : M.IsAssociatedFunction Self "emit_event" emit_event. End Impl_custom_environment_Env. @@ -200,7 +216,15 @@ Module Impl_custom_environment_Topics. unimplemented!() } *) - Parameter init_env : (list Ty.t) -> (list Value.t) -> M. + Definition init_env (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [] => + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_init_env : M.IsAssociatedFunction Self "init_env" init_env. @@ -213,7 +237,8 @@ Module Impl_custom_environment_Topics. match τ, α with | [], [ self ] => let* self := M.alloc self in - let* α0 := M.get_associated_function (Ty.path "custom_environment::Topics") "init_env" [] in + let* α0 := + M.get_associated_function (Ty.path "custom_environment::Topics") "init_env" [] [] in M.call_closure α0 [] | _, _ => M.impossible end. @@ -233,7 +258,9 @@ Module Impl_custom_environment_Topics. "core::default::Default" (Ty.path "custom_environment::Topics") [] + [] "default" + [] [] in M.call_closure α0 [] | _, _ => M.impossible @@ -252,8 +279,9 @@ Module Impl_custom_environment_Topics. | [], [ self ] => let* self := M.alloc self in let* _ := - let* α0 := M.get_associated_function (Ty.path "custom_environment::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "custom_environment::Topics") "env" [] in + let* α0 := + M.get_associated_function (Ty.path "custom_environment::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "custom_environment::Topics") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -262,7 +290,9 @@ Module Impl_custom_environment_Topics. "core::default::Default" (Ty.path "custom_environment::EventWithTopics") [] + [] "default" + [] [] in let* α6 := M.call_closure α5 [] in let* α7 := diff --git a/CoqOfRust/examples/default/examples/ink_contracts/dns.v b/CoqOfRust/examples/default/examples/ink_contracts/dns.v index 85d145eaf..68bac7451 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/dns.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/dns.v @@ -7,13 +7,13 @@ Require Import CoqOfRust.CoqOfRust. ty_params := [ "K"; "V" ]; fields := [ - ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ]); - ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []); + ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) ]; } *) Module Impl_core_default_Default_for_dns_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "dns::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "dns::Mapping") [ K; V ] []. (* Default @@ -25,17 +25,21 @@ Module Impl_core_default_Default_for_dns_Mapping_K_V. let* α0 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "core::marker::PhantomData") [ K ]) + (Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []) + [] [] "default" + [] [] in let* α1 := M.call_closure α0 [] in let* α2 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + (Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) + [] [] "default" + [] [] in let* α3 := M.call_closure α2 [] in M.pure (Value.StructRecord "dns::Mapping" [ ("_key", α1); ("_value", α3) ]) @@ -52,14 +56,25 @@ Module Impl_core_default_Default_for_dns_Mapping_K_V. End Impl_core_default_Default_for_dns_Mapping_K_V. Module Impl_dns_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "dns::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "dns::Mapping") [ K; V ] []. (* fn contains(&self, _key: &K) -> bool { unimplemented!() } *) - Parameter contains : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition contains (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_contains : forall (K V : Ty.t), @@ -70,7 +85,18 @@ Module Impl_dns_Mapping_K_V. unimplemented!() } *) - Parameter get : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition get (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_get : forall (K V : Ty.t), @@ -81,7 +107,19 @@ Module Impl_dns_Mapping_K_V. unimplemented!() } *) - Parameter insert : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition insert (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key; _value ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* _value := M.alloc _value in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_insert : forall (K V : Ty.t), @@ -92,7 +130,16 @@ Module Impl_dns_Mapping_K_V. unimplemented!() } *) - Parameter new : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition new (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [] => + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_new : forall (K V : Ty.t), @@ -103,7 +150,18 @@ Module Impl_dns_Mapping_K_V. unimplemented!() } *) - Parameter remove : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition remove (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_remove : forall (K V : Ty.t), @@ -114,7 +172,18 @@ Module Impl_dns_Mapping_K_V. unimplemented!() } *) - Parameter size : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition size (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_size : forall (K V : Ty.t), @@ -125,7 +194,18 @@ Module Impl_dns_Mapping_K_V. unimplemented!() } *) - Parameter take : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition take (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_take : forall (K V : Ty.t), @@ -148,7 +228,8 @@ Module Impl_core_default_Default_for_dns_AccountId. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructTuple "dns::AccountId" [ α1 ]) | _, _ => M.impossible @@ -230,7 +311,7 @@ Module Impl_core_cmp_PartialEq_for_dns_AccountId. (* Instance *) [ ("eq", InstanceField.Method eq) ]. End Impl_core_cmp_PartialEq_for_dns_AccountId. -Module Impl_core_convert_From_array_u8_for_dns_AccountId. +Module Impl_core_convert_From_array_u8_32_for_dns_AccountId. Definition Self : Ty.t := Ty.path "dns::AccountId". (* @@ -238,19 +319,31 @@ Module Impl_core_convert_From_array_u8_for_dns_AccountId. unimplemented!() } *) - Parameter from : (list Ty.t) -> (list Value.t) -> M. + Definition from (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ _value ] => + let* _value := M.alloc _value in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom Implements : M.IsTraitInstance "core::convert::From" Self - (* Trait polymorphic types *) [ (* T *) Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] + (* Trait polymorphic types *) + [ (* T *) Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ] ] (* Instance *) [ ("from", InstanceField.Method from) ]. -End Impl_core_convert_From_array_u8_for_dns_AccountId. +End Impl_core_convert_From_array_u8_32_for_dns_AccountId. Axiom Balance : (Ty.path "dns::Balance") = (Ty.path "u128"). -Axiom Hash : (Ty.path "dns::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u8" ]). +Axiom Hash : + (Ty.path "dns::Hash") = + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]). (* StructRecord { @@ -264,7 +357,10 @@ Axiom Hash : (Ty.path "dns::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u8" name := "Register"; ty_params := []; fields := - [ ("name", Ty.apply (Ty.path "array") [ Ty.path "u8" ]); ("from", Ty.path "dns::AccountId") ]; + [ + ("name", Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]); + ("from", Ty.path "dns::AccountId") + ]; } *) (* StructRecord @@ -273,9 +369,9 @@ Axiom Hash : (Ty.path "dns::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u8" ty_params := []; fields := [ - ("name", Ty.apply (Ty.path "array") [ Ty.path "u8" ]); + ("name", Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]); ("from", Ty.path "dns::AccountId"); - ("old_address", Ty.apply (Ty.path "core::option::Option") [ Ty.path "dns::AccountId" ]); + ("old_address", Ty.apply (Ty.path "core::option::Option") [ Ty.path "dns::AccountId" ] []); ("new_address", Ty.path "dns::AccountId") ]; } *) @@ -286,9 +382,9 @@ Axiom Hash : (Ty.path "dns::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u8" ty_params := []; fields := [ - ("name", Ty.apply (Ty.path "array") [ Ty.path "u8" ]); + ("name", Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]); ("from", Ty.path "dns::AccountId"); - ("old_owner", Ty.apply (Ty.path "core::option::Option") [ Ty.path "dns::AccountId" ]); + ("old_owner", Ty.apply (Ty.path "core::option::Option") [ Ty.path "dns::AccountId" ] []); ("new_owner", Ty.path "dns::AccountId") ]; } *) @@ -340,7 +436,17 @@ Module Impl_dns_Env. unimplemented!() } *) - Parameter emit_event : (list Ty.t) -> (list Value.t) -> M. + Definition emit_event (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ self; _event ] => + let* self := M.alloc self in + let* _event := M.alloc _event in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_emit_event : M.IsAssociatedFunction Self "emit_event" emit_event. End Impl_dns_Env. @@ -354,11 +460,19 @@ End Impl_dns_Env. ("name_to_address", Ty.apply (Ty.path "dns::Mapping") - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ]; Ty.path "dns::AccountId" ]); + [ + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]; + Ty.path "dns::AccountId" + ] + []); ("name_to_owner", Ty.apply (Ty.path "dns::Mapping") - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ]; Ty.path "dns::AccountId" ]); + [ + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]; + Ty.path "dns::AccountId" + ] + []); ("default_address", Ty.path "dns::AccountId") ]; } *) @@ -374,9 +488,11 @@ Definition zero_address (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::convert::Into" - (Ty.apply (Ty.path "array") [ Ty.path "u8" ]) + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]) [ Ty.path "dns::AccountId" ] + [] "into" + [] [] in M.call_closure α0 [ repeat (Value.Integer Integer.U8 0) 32 ] | _, _ => M.impossible @@ -407,8 +523,13 @@ Module Impl_core_default_Default_for_dns_DomainNameService. M.get_associated_function (Ty.apply (Ty.path "dns::Mapping") - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ]; Ty.path "dns::AccountId" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]; + Ty.path "dns::AccountId" + ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in @@ -417,18 +538,25 @@ Module Impl_core_default_Default_for_dns_DomainNameService. M.get_associated_function (Ty.apply (Ty.path "dns::Mapping") - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ]; Ty.path "dns::AccountId" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]; + Ty.path "dns::AccountId" + ] + []) "insert" + [] [] in let* α1 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "array") [ Ty.path "u8" ]) + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]) + [] [] "default" + [] [] in let* α2 := M.call_closure α1 [] in - let* α3 := M.get_function "dns::zero_address" [] in + let* α3 := M.get_function "dns::zero_address" [] [] in let* α4 := M.call_closure α3 [] in let* α5 := M.call_closure α0 [ name_to_address; α2; α4 ] in M.alloc α5 in @@ -437,8 +565,13 @@ Module Impl_core_default_Default_for_dns_DomainNameService. M.get_associated_function (Ty.apply (Ty.path "dns::Mapping") - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ]; Ty.path "dns::AccountId" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]; + Ty.path "dns::AccountId" + ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in @@ -447,24 +580,31 @@ Module Impl_core_default_Default_for_dns_DomainNameService. M.get_associated_function (Ty.apply (Ty.path "dns::Mapping") - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ]; Ty.path "dns::AccountId" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]; + Ty.path "dns::AccountId" + ] + []) "insert" + [] [] in let* α1 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "array") [ Ty.path "u8" ]) + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]) + [] [] "default" + [] [] in let* α2 := M.call_closure α1 [] in - let* α3 := M.get_function "dns::zero_address" [] in + let* α3 := M.get_function "dns::zero_address" [] [] in let* α4 := M.call_closure α3 [] in let* α5 := M.call_closure α0 [ name_to_owner; α2; α4 ] in M.alloc α5 in let* α0 := M.read name_to_address in let* α1 := M.read name_to_owner in - let* α2 := M.get_function "dns::zero_address" [] in + let* α2 := M.get_function "dns::zero_address" [] [] in let* α3 := M.call_closure α2 [] in let* α0 := M.alloc @@ -524,12 +664,14 @@ Module Impl_core_cmp_PartialEq_for_dns_Error. let* self := M.alloc self in let* other := M.alloc other in let* __self_tag := - let* α0 := M.get_function "core::intrinsics::discriminant_value" [ Ty.path "dns::Error" ] in + let* α0 := + M.get_function "core::intrinsics::discriminant_value" [ Ty.path "dns::Error" ] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* __arg1_tag := - let* α0 := M.get_function "core::intrinsics::discriminant_value" [ Ty.path "dns::Error" ] in + let* α0 := + M.get_function "core::intrinsics::discriminant_value" [ Ty.path "dns::Error" ] [] in let* α1 := M.read other in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -584,8 +726,8 @@ End Impl_core_cmp_Eq_for_dns_Error. Axiom Result : forall (T : Ty.t), - (Ty.apply (Ty.path "dns::Result") [ T ]) = - (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "dns::Error" ]). + (Ty.apply (Ty.path "dns::Result") [ T ] []) = + (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "dns::Error" ] []). Module Impl_dns_DomainNameService. Definition Self : Ty.t := Ty.path "dns::DomainNameService". @@ -595,7 +737,15 @@ Module Impl_dns_DomainNameService. unimplemented!() } *) - Parameter init_env : (list Ty.t) -> (list Value.t) -> M. + Definition init_env (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [] => + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_init_env : M.IsAssociatedFunction Self "init_env" init_env. @@ -608,7 +758,7 @@ Module Impl_dns_DomainNameService. match τ, α with | [], [ self ] => let* self := M.alloc self in - let* α0 := M.get_associated_function (Ty.path "dns::DomainNameService") "init_env" [] in + let* α0 := M.get_associated_function (Ty.path "dns::DomainNameService") "init_env" [] [] in M.call_closure α0 [] | _, _ => M.impossible end. @@ -628,7 +778,9 @@ Module Impl_dns_DomainNameService. "core::default::Default" (Ty.path "dns::DomainNameService") [] + [] "default" + [] [] in M.call_closure α0 [] | _, _ => M.impossible @@ -656,8 +808,8 @@ Module Impl_dns_DomainNameService. let* self := M.alloc self in let* name := M.alloc name in let* caller := - let* α0 := M.get_associated_function (Ty.path "dns::Env") "caller" [] in - let* α1 := M.get_associated_function (Ty.path "dns::DomainNameService") "env" [] in + let* α0 := M.get_associated_function (Ty.path "dns::Env") "caller" [] [] in + let* α1 := M.get_associated_function (Ty.path "dns::DomainNameService") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -674,8 +826,16 @@ Module Impl_dns_DomainNameService. M.get_associated_function (Ty.apply (Ty.path "dns::Mapping") - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ]; Ty.path "dns::AccountId" ]) + [ + Ty.apply + (Ty.path "array") + [ Ty.path "u8" ] + [ Value.Integer Integer.Usize 32 ]; + Ty.path "dns::AccountId" + ] + []) "contains" + [] [] in let* α1 := M.read self in let* α2 := @@ -703,8 +863,13 @@ Module Impl_dns_DomainNameService. M.get_associated_function (Ty.apply (Ty.path "dns::Mapping") - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ]; Ty.path "dns::AccountId" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]; + Ty.path "dns::AccountId" + ] + []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read name in @@ -715,8 +880,8 @@ Module Impl_dns_DomainNameService. [ M.get_struct_record_field α1 "dns::DomainNameService" "name_to_owner"; α2; α3 ] in M.alloc α4 in let* _ := - let* α0 := M.get_associated_function (Ty.path "dns::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "dns::DomainNameService") "env" [] in + let* α0 := M.get_associated_function (Ty.path "dns::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "dns::DomainNameService") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -753,15 +918,21 @@ Module Impl_dns_DomainNameService. let* name := M.alloc name in let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "dns::AccountId" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "dns::AccountId" ] []) "unwrap_or" + [] [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "dns::Mapping") - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ]; Ty.path "dns::AccountId" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]; + Ty.path "dns::AccountId" + ] + []) "get" + [] [] in let* α2 := M.read self in let* α3 := @@ -804,8 +975,8 @@ Module Impl_dns_DomainNameService. let* name := M.alloc name in let* new_address := M.alloc new_address in let* caller := - let* α0 := M.get_associated_function (Ty.path "dns::Env") "caller" [] in - let* α1 := M.get_associated_function (Ty.path "dns::DomainNameService") "env" [] in + let* α0 := M.get_associated_function (Ty.path "dns::Env") "caller" [] [] in + let* α1 := M.get_associated_function (Ty.path "dns::DomainNameService") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -813,7 +984,11 @@ Module Impl_dns_DomainNameService. M.alloc α5 in let* owner := let* α0 := - M.get_associated_function (Ty.path "dns::DomainNameService") "get_owner_or_default" [] in + M.get_associated_function + (Ty.path "dns::DomainNameService") + "get_owner_or_default" + [] + [] in let* α1 := M.read self in let* α2 := M.read name in let* α3 := M.call_closure α0 [ α1; α2 ] in @@ -830,7 +1005,9 @@ Module Impl_dns_DomainNameService. "core::cmp::PartialEq" (Ty.path "dns::AccountId") [ Ty.path "dns::AccountId" ] + [ Value.Bool true ] "ne" + [] [] in let* α1 := M.call_closure α0 [ caller; owner ] in let* α2 := M.alloc α1 in @@ -853,8 +1030,13 @@ Module Impl_dns_DomainNameService. M.get_associated_function (Ty.apply (Ty.path "dns::Mapping") - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ]; Ty.path "dns::AccountId" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]; + Ty.path "dns::AccountId" + ] + []) "get" + [] [] in let* α1 := M.read self in let* α2 := @@ -867,8 +1049,13 @@ Module Impl_dns_DomainNameService. M.get_associated_function (Ty.apply (Ty.path "dns::Mapping") - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ]; Ty.path "dns::AccountId" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]; + Ty.path "dns::AccountId" + ] + []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read name in @@ -879,8 +1066,8 @@ Module Impl_dns_DomainNameService. [ M.get_struct_record_field α1 "dns::DomainNameService" "name_to_address"; α2; α3 ] in M.alloc α4 in let* _ := - let* α0 := M.get_associated_function (Ty.path "dns::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "dns::DomainNameService") "env" [] in + let* α0 := M.get_associated_function (Ty.path "dns::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "dns::DomainNameService") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -937,8 +1124,8 @@ Module Impl_dns_DomainNameService. let* name := M.alloc name in let* to := M.alloc to in let* caller := - let* α0 := M.get_associated_function (Ty.path "dns::Env") "caller" [] in - let* α1 := M.get_associated_function (Ty.path "dns::DomainNameService") "env" [] in + let* α0 := M.get_associated_function (Ty.path "dns::Env") "caller" [] [] in + let* α1 := M.get_associated_function (Ty.path "dns::DomainNameService") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -946,7 +1133,11 @@ Module Impl_dns_DomainNameService. M.alloc α5 in let* owner := let* α0 := - M.get_associated_function (Ty.path "dns::DomainNameService") "get_owner_or_default" [] in + M.get_associated_function + (Ty.path "dns::DomainNameService") + "get_owner_or_default" + [] + [] in let* α1 := M.read self in let* α2 := M.read name in let* α3 := M.call_closure α0 [ α1; α2 ] in @@ -963,7 +1154,9 @@ Module Impl_dns_DomainNameService. "core::cmp::PartialEq" (Ty.path "dns::AccountId") [ Ty.path "dns::AccountId" ] + [ Value.Bool true ] "ne" + [] [] in let* α1 := M.call_closure α0 [ caller; owner ] in let* α2 := M.alloc α1 in @@ -986,8 +1179,13 @@ Module Impl_dns_DomainNameService. M.get_associated_function (Ty.apply (Ty.path "dns::Mapping") - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ]; Ty.path "dns::AccountId" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]; + Ty.path "dns::AccountId" + ] + []) "get" + [] [] in let* α1 := M.read self in let* α2 := @@ -1000,8 +1198,13 @@ Module Impl_dns_DomainNameService. M.get_associated_function (Ty.apply (Ty.path "dns::Mapping") - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ]; Ty.path "dns::AccountId" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]; + Ty.path "dns::AccountId" + ] + []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read name in @@ -1012,8 +1215,8 @@ Module Impl_dns_DomainNameService. [ M.get_struct_record_field α1 "dns::DomainNameService" "name_to_owner"; α2; α3 ] in M.alloc α4 in let* _ := - let* α0 := M.get_associated_function (Ty.path "dns::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "dns::DomainNameService") "env" [] in + let* α0 := M.get_associated_function (Ty.path "dns::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "dns::DomainNameService") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -1056,15 +1259,21 @@ Module Impl_dns_DomainNameService. let* name := M.alloc name in let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "dns::AccountId" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "dns::AccountId" ] []) "unwrap_or" + [] [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "dns::Mapping") - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ]; Ty.path "dns::AccountId" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]; + Ty.path "dns::AccountId" + ] + []) "get" + [] [] in let* α2 := M.read self in let* α3 := @@ -1091,7 +1300,11 @@ Module Impl_dns_DomainNameService. let* self := M.alloc self in let* name := M.alloc name in let* α0 := - M.get_associated_function (Ty.path "dns::DomainNameService") "get_address_or_default" [] in + M.get_associated_function + (Ty.path "dns::DomainNameService") + "get_address_or_default" + [] + [] in let* α1 := M.read self in let* α2 := M.read name in M.call_closure α0 [ α1; α2 ] @@ -1111,7 +1324,7 @@ Module Impl_dns_DomainNameService. let* self := M.alloc self in let* name := M.alloc name in let* α0 := - M.get_associated_function (Ty.path "dns::DomainNameService") "get_owner_or_default" [] in + M.get_associated_function (Ty.path "dns::DomainNameService") "get_owner_or_default" [] [] in let* α1 := M.read self in let* α2 := M.read name in M.call_closure α0 [ α1; α2 ] 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 38c0261c5..40571d0ec 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/e2e_call_runtime.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/e2e_call_runtime.v @@ -17,7 +17,8 @@ Module Impl_core_default_Default_for_e2e_call_runtime_AccountId. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructTuple "e2e_call_runtime::AccountId" [ α1 ]) | _, _ => M.impossible @@ -78,7 +79,16 @@ Module Impl_e2e_call_runtime_Env. unimplemented!() } *) - Parameter balance : (list Ty.t) -> (list Value.t) -> M. + Definition balance (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ self ] => + let* self := M.alloc self in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_balance : M.IsAssociatedFunction Self "balance" balance. End Impl_e2e_call_runtime_Env. @@ -117,7 +127,15 @@ Module Impl_e2e_call_runtime_Contract. unimplemented!() } *) - Parameter init_env : (list Ty.t) -> (list Value.t) -> M. + Definition init_env (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [] => + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_init_env : M.IsAssociatedFunction Self "init_env" init_env. @@ -130,7 +148,8 @@ Module Impl_e2e_call_runtime_Contract. match τ, α with | [], [ self ] => let* self := M.alloc self in - let* α0 := M.get_associated_function (Ty.path "e2e_call_runtime::Contract") "init_env" [] in + let* α0 := + M.get_associated_function (Ty.path "e2e_call_runtime::Contract") "init_env" [] [] in M.call_closure α0 [] | _, _ => M.impossible end. @@ -159,8 +178,8 @@ Module Impl_e2e_call_runtime_Contract. match τ, α with | [], [ self ] => let* self := M.alloc self in - let* α0 := M.get_associated_function (Ty.path "e2e_call_runtime::Env") "balance" [] in - let* α1 := M.get_associated_function (Ty.path "e2e_call_runtime::Contract") "env" [] in + let* α0 := M.get_associated_function (Ty.path "e2e_call_runtime::Env") "balance" [] [] in + let* α1 := M.get_associated_function (Ty.path "e2e_call_runtime::Contract") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in diff --git a/CoqOfRust/examples/default/examples/ink_contracts/erc1155.v b/CoqOfRust/examples/default/examples/ink_contracts/erc1155.v index e12828c15..3e7adb481 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/erc1155.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/erc1155.v @@ -7,13 +7,13 @@ Require Import CoqOfRust.CoqOfRust. ty_params := [ "K"; "V" ]; fields := [ - ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ]); - ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []); + ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) ]; } *) Module Impl_core_default_Default_for_erc1155_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc1155::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc1155::Mapping") [ K; V ] []. (* Default @@ -25,17 +25,21 @@ Module Impl_core_default_Default_for_erc1155_Mapping_K_V. let* α0 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "core::marker::PhantomData") [ K ]) + (Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []) + [] [] "default" + [] [] in let* α1 := M.call_closure α0 [] in let* α2 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + (Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) + [] [] "default" + [] [] in let* α3 := M.call_closure α2 [] in M.pure (Value.StructRecord "erc1155::Mapping" [ ("_key", α1); ("_value", α3) ]) @@ -52,14 +56,25 @@ Module Impl_core_default_Default_for_erc1155_Mapping_K_V. End Impl_core_default_Default_for_erc1155_Mapping_K_V. Module Impl_erc1155_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc1155::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc1155::Mapping") [ K; V ] []. (* fn contains(&self, _key: &K) -> bool { unimplemented!() } *) - Parameter contains : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition contains (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_contains : forall (K V : Ty.t), @@ -70,7 +85,18 @@ Module Impl_erc1155_Mapping_K_V. unimplemented!() } *) - Parameter get : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition get (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_get : forall (K V : Ty.t), @@ -81,7 +107,19 @@ Module Impl_erc1155_Mapping_K_V. unimplemented!() } *) - Parameter insert : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition insert (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key; _value ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* _value := M.alloc _value in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_insert : forall (K V : Ty.t), @@ -92,7 +130,18 @@ Module Impl_erc1155_Mapping_K_V. unimplemented!() } *) - Parameter remove : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition remove (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_remove : forall (K V : Ty.t), @@ -103,7 +152,18 @@ Module Impl_erc1155_Mapping_K_V. unimplemented!() } *) - Parameter size : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition size (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_size : forall (K V : Ty.t), @@ -114,7 +174,18 @@ Module Impl_erc1155_Mapping_K_V. unimplemented!() } *) - Parameter take : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition take (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_take : forall (K V : Ty.t), @@ -137,7 +208,8 @@ Module Impl_core_default_Default_for_erc1155_AccountId. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructTuple "erc1155::AccountId" [ α1 ]) | _, _ => M.impossible @@ -219,7 +291,7 @@ Module Impl_core_cmp_PartialEq_for_erc1155_AccountId. (* Instance *) [ ("eq", InstanceField.Method eq) ]. End Impl_core_cmp_PartialEq_for_erc1155_AccountId. -Module Impl_core_convert_From_array_u8_for_erc1155_AccountId. +Module Impl_core_convert_From_array_u8_32_for_erc1155_AccountId. Definition Self : Ty.t := Ty.path "erc1155::AccountId". (* @@ -227,15 +299,25 @@ Module Impl_core_convert_From_array_u8_for_erc1155_AccountId. unimplemented!() } *) - Parameter from : (list Ty.t) -> (list Value.t) -> M. + Definition from (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ _v ] => + let* _v := M.alloc _v in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom Implements : M.IsTraitInstance "core::convert::From" Self - (* Trait polymorphic types *) [ (* T *) Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] + (* Trait polymorphic types *) + [ (* T *) Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ] ] (* Instance *) [ ("from", InstanceField.Method from) ]. -End Impl_core_convert_From_array_u8_for_erc1155_AccountId. +End Impl_core_convert_From_array_u8_32_for_erc1155_AccountId. Axiom Balance : (Ty.path "erc1155::Balance") = (Ty.path "u128"). @@ -257,9 +339,11 @@ Definition zero_address (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::convert::Into" - (Ty.apply (Ty.path "array") [ Ty.path "u8" ]) + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]) [ Ty.path "erc1155::AccountId" ] + [] "into" + [] [] in M.call_closure α0 [ repeat (Value.Integer Integer.U8 0) 32 ] | _, _ => M.impossible @@ -351,13 +435,13 @@ Module Impl_core_cmp_PartialEq_for_erc1155_Error. let* other := M.alloc other in let* __self_tag := let* α0 := - M.get_function "core::intrinsics::discriminant_value" [ Ty.path "erc1155::Error" ] in + M.get_function "core::intrinsics::discriminant_value" [ Ty.path "erc1155::Error" ] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* __arg1_tag := let* α0 := - M.get_function "core::intrinsics::discriminant_value" [ Ty.path "erc1155::Error" ] in + M.get_function "core::intrinsics::discriminant_value" [ Ty.path "erc1155::Error" ] [] in let* α1 := M.read other in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -412,8 +496,8 @@ End Impl_core_cmp_Eq_for_erc1155_Error. Axiom Result : forall (T : Ty.t), - (Ty.apply (Ty.path "erc1155::Result") [ T ]) = - (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "erc1155::Error" ]). + (Ty.apply (Ty.path "erc1155::Result") [ T ] []) = + (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "erc1155::Error" ] []). (* Trait *) (* Empty module 'Erc1155' *) @@ -431,9 +515,9 @@ Axiom Operator : (Ty.path "erc1155::Operator") = (Ty.path "erc1155::AccountId"). ty_params := []; fields := [ - ("operator", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc1155::AccountId" ]); - ("from", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc1155::AccountId" ]); - ("to", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc1155::AccountId" ]); + ("operator", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc1155::AccountId" ] []); + ("from", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc1155::AccountId" ] []); + ("to", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc1155::AccountId" ] []); ("token_id", Ty.path "u128"); ("value", Ty.path "u128") ]; @@ -505,7 +589,17 @@ Module Impl_erc1155_Env. unimplemented!() } *) - Parameter emit_event : (list Ty.t) -> (list Value.t) -> M. + Definition emit_event (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ self; _event ] => + let* self := M.alloc self in + let* _event := M.alloc _event in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_emit_event : M.IsAssociatedFunction Self "emit_event" emit_event. End Impl_erc1155_Env. @@ -519,12 +613,13 @@ End Impl_erc1155_Env. ("balances", Ty.apply (Ty.path "erc1155::Mapping") - [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "u128" ]; Ty.path "u128" ]); + [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "u128" ]; Ty.path "u128" ] + []); ("approvals", Ty.apply (Ty.path "erc1155::Mapping") - [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "erc1155::AccountId" ]; Ty.tuple [] - ]); + [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "erc1155::AccountId" ]; Ty.tuple [] ] + []); ("token_id_nonce", Ty.path "u128") ]; } *) @@ -543,9 +638,12 @@ Module Impl_core_default_Default_for_erc1155_Contract. "core::default::Default" (Ty.apply (Ty.path "erc1155::Mapping") - [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "u128" ]; Ty.path "u128" ]) + [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "u128" ]; Ty.path "u128" ] + []) + [] [] "default" + [] [] in let* α1 := M.call_closure α0 [] in let* α2 := @@ -553,13 +651,16 @@ Module Impl_core_default_Default_for_erc1155_Contract. "core::default::Default" (Ty.apply (Ty.path "erc1155::Mapping") - [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "erc1155::AccountId" ]; Ty.tuple [] - ]) + [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "erc1155::AccountId" ]; Ty.tuple [] ] + []) + [] [] "default" + [] [] in let* α3 := M.call_closure α2 [] in - let* α4 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α4 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α5 := M.call_closure α4 [] in M.pure (Value.StructRecord @@ -584,7 +685,15 @@ Module Impl_erc1155_Contract. unimplemented!() } *) - Parameter init_env : (list Ty.t) -> (list Value.t) -> M. + Definition init_env (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [] => + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_init_env : M.IsAssociatedFunction Self "init_env" init_env. @@ -597,7 +706,7 @@ Module Impl_erc1155_Contract. match τ, α with | [], [ self ] => let* self := M.alloc self in - let* α0 := M.get_associated_function (Ty.path "erc1155::Contract") "init_env" [] in + let* α0 := M.get_associated_function (Ty.path "erc1155::Contract") "init_env" [] [] in M.call_closure α0 [] | _, _ => M.impossible end. @@ -613,7 +722,14 @@ Module Impl_erc1155_Contract. match τ, α with | [], [] => let* α0 := - M.get_trait_method "core::default::Default" (Ty.path "erc1155::Contract") [] "default" [] in + M.get_trait_method + "core::default::Default" + (Ty.path "erc1155::Contract") + [] + [] + "default" + [] + [] in M.call_closure α0 [] | _, _ => M.impossible end. @@ -647,8 +763,8 @@ Module Impl_erc1155_Contract. let* self := M.alloc self in let* value := M.alloc value in let* caller := - let* α0 := M.get_associated_function (Ty.path "erc1155::Env") "caller" [] in - let* α1 := M.get_associated_function (Ty.path "erc1155::Contract") "env" [] in + let* α0 := M.get_associated_function (Ty.path "erc1155::Env") "caller" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc1155::Contract") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -666,8 +782,10 @@ Module Impl_erc1155_Contract. M.get_associated_function (Ty.apply (Ty.path "erc1155::Mapping") - [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "u128" ]; Ty.path "u128" ]) + [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "u128" ]; Ty.path "u128" ] + []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read caller in @@ -684,8 +802,8 @@ Module Impl_erc1155_Contract. ] in M.alloc α6 in let* _ := - let* α0 := M.get_associated_function (Ty.path "erc1155::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "erc1155::Contract") "env" [] in + let* α0 := M.get_associated_function (Ty.path "erc1155::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc1155::Contract") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -785,7 +903,9 @@ Module Impl_erc1155_Contract. "core::convert::Into" (Ty.path "erc1155::Error") [ Ty.path "erc1155::Error" ] + [] "into" + [] [] in let* α1 := M.call_closure α0 [ Value.StructTuple "erc1155::Error::UnexistentToken" [] ] in @@ -796,8 +916,8 @@ Module Impl_erc1155_Contract. fun γ => M.alloc (Value.Tuple []) ] in let* caller := - let* α0 := M.get_associated_function (Ty.path "erc1155::Env") "caller" [] in - let* α1 := M.get_associated_function (Ty.path "erc1155::Contract") "env" [] in + let* α0 := M.get_associated_function (Ty.path "erc1155::Env") "caller" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc1155::Contract") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -808,8 +928,10 @@ Module Impl_erc1155_Contract. M.get_associated_function (Ty.apply (Ty.path "erc1155::Mapping") - [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "u128" ]; Ty.path "u128" ]) + [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "u128" ]; Ty.path "u128" ] + []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read caller in @@ -825,8 +947,8 @@ Module Impl_erc1155_Contract. ] in M.alloc α5 in let* _ := - let* α0 := M.get_associated_function (Ty.path "erc1155::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "erc1155::Contract") "env" [] in + let* α0 := M.get_associated_function (Ty.path "erc1155::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc1155::Contract") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -901,15 +1023,18 @@ Module Impl_erc1155_Contract. let* sender_balance := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u128" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u128" ] []) "expect" - [] in + [] + [ Value.Bool true ] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "erc1155::Mapping") - [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "u128" ]; Ty.path "u128" ]) + [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "u128" ]; Ty.path "u128" ] + []) "get" + [] [] in let* α2 := M.read self in let* α3 := M.read from in @@ -931,8 +1056,10 @@ Module Impl_erc1155_Contract. M.get_associated_function (Ty.apply (Ty.path "erc1155::Mapping") - [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "u128" ]; Ty.path "u128" ]) + [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "u128" ]; Ty.path "u128" ] + []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read from in @@ -950,15 +1077,18 @@ Module Impl_erc1155_Contract. let* recipient_balance := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u128" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u128" ] []) "unwrap_or" + [] [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "erc1155::Mapping") - [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "u128" ]; Ty.path "u128" ]) + [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "u128" ]; Ty.path "u128" ] + []) "get" + [] [] in let* α2 := M.read self in let* α3 := M.read to in @@ -981,8 +1111,10 @@ Module Impl_erc1155_Contract. M.get_associated_function (Ty.apply (Ty.path "erc1155::Mapping") - [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "u128" ]; Ty.path "u128" ]) + [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "u128" ]; Ty.path "u128" ] + []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read to in @@ -998,16 +1130,16 @@ Module Impl_erc1155_Contract. ] in M.alloc α5 in let* caller := - let* α0 := M.get_associated_function (Ty.path "erc1155::Env") "caller" [] in - let* α1 := M.get_associated_function (Ty.path "erc1155::Contract") "env" [] in + let* α0 := M.get_associated_function (Ty.path "erc1155::Env") "caller" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc1155::Contract") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in let* α5 := M.call_closure α0 [ α4 ] in M.alloc α5 in let* _ := - let* α0 := M.get_associated_function (Ty.path "erc1155::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "erc1155::Contract") "env" [] in + let* α0 := M.get_associated_function (Ty.path "erc1155::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc1155::Contract") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -1153,9 +1285,10 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. M.get_associated_function (Ty.apply (Ty.path "erc1155::Mapping") - [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "erc1155::AccountId" ]; Ty.tuple [] - ]) + [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "erc1155::AccountId" ]; Ty.tuple [] ] + []) "contains" + [] [] in let* α1 := M.read self in let* α2 := M.read owner in @@ -1178,15 +1311,18 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. let* token_id := M.alloc token_id in let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u128" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u128" ] []) "unwrap_or" + [] [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "erc1155::Mapping") - [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "u128" ]; Ty.path "u128" ]) + [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "u128" ]; Ty.path "u128" ] + []) "get" + [] [] in let* α2 := M.read self in let* α3 := M.read owner in @@ -1235,8 +1371,8 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. let* value := M.alloc value in let* data := M.alloc data in let* caller := - let* α0 := M.get_associated_function (Ty.path "erc1155::Env") "caller" [] in - let* α1 := M.get_associated_function (Ty.path "erc1155::Contract") "env" [] in + let* α0 := M.get_associated_function (Ty.path "erc1155::Env") "caller" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc1155::Contract") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -1254,7 +1390,9 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. "core::cmp::PartialEq" (Ty.path "erc1155::AccountId") [ Ty.path "erc1155::AccountId" ] + [ Value.Bool true ] "ne" + [] [] in let* α1 := M.call_closure α0 [ caller; from ] in let* α2 := M.alloc α1 in @@ -1274,7 +1412,9 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. "erc1155::Erc1155" (Ty.path "erc1155::Contract") [] + [] "is_approved_for_all" + [] [] in let* α1 := M.read self in let* α2 := M.read from in @@ -1290,7 +1430,9 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. "core::convert::Into" (Ty.path "erc1155::Error") [ Ty.path "erc1155::Error" ] + [] "into" + [] [] in let* α1 := M.call_closure α0 [ Value.StructTuple "erc1155::Error::NotApproved" [] ] in @@ -1315,9 +1457,11 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. "core::cmp::PartialEq" (Ty.path "erc1155::AccountId") [ Ty.path "erc1155::AccountId" ] + [ Value.Bool true ] "ne" + [] [] in - let* α1 := M.get_function "erc1155::zero_address" [] in + let* α1 := M.get_function "erc1155::zero_address" [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.alloc α2 in let* α4 := M.call_closure α0 [ to; α3 ] in @@ -1331,7 +1475,9 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. "core::convert::Into" (Ty.path "erc1155::Error") [ Ty.path "erc1155::Error" ] + [] "into" + [] [] in let* α1 := M.call_closure α0 [ Value.StructTuple "erc1155::Error::ZeroAddressTransfer" [] ] in @@ -1343,7 +1489,14 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. ] in let* balance := let* α0 := - M.get_trait_method "erc1155::Erc1155" (Ty.path "erc1155::Contract") [] "balance_of" [] in + M.get_trait_method + "erc1155::Erc1155" + (Ty.path "erc1155::Contract") + [] + [] + "balance_of" + [] + [] in let* α1 := M.read self in let* α2 := M.read from in let* α3 := M.read token_id in @@ -1368,7 +1521,9 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. "core::convert::Into" (Ty.path "erc1155::Error") [ Ty.path "erc1155::Error" ] + [] "into" + [] [] in let* α1 := M.call_closure α0 [ Value.StructTuple "erc1155::Error::InsufficientBalance" [] ] in @@ -1379,7 +1534,8 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. fun γ => M.alloc (Value.Tuple []) ] in let* _ := - let* α0 := M.get_associated_function (Ty.path "erc1155::Contract") "perform_transfer" [] in + let* α0 := + M.get_associated_function (Ty.path "erc1155::Contract") "perform_transfer" [] [] in let* α1 := M.read self in let* α2 := M.read from in let* α3 := M.read to in @@ -1389,7 +1545,11 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. M.alloc α6 in let* _ := let* α0 := - M.get_associated_function (Ty.path "erc1155::Contract") "transfer_acceptance_check" [] in + M.get_associated_function + (Ty.path "erc1155::Contract") + "transfer_acceptance_check" + [] + [] in let* α1 := M.read self in let* α2 := M.read caller in let* α3 := M.read from in @@ -1452,8 +1612,8 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. let* values := M.alloc values in let* data := M.alloc data in let* caller := - let* α0 := M.get_associated_function (Ty.path "erc1155::Env") "caller" [] in - let* α1 := M.get_associated_function (Ty.path "erc1155::Contract") "env" [] in + let* α0 := M.get_associated_function (Ty.path "erc1155::Env") "caller" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc1155::Contract") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -1471,7 +1631,9 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. "core::cmp::PartialEq" (Ty.path "erc1155::AccountId") [ Ty.path "erc1155::AccountId" ] + [ Value.Bool true ] "ne" + [] [] in let* α1 := M.call_closure α0 [ caller; from ] in let* α2 := M.alloc α1 in @@ -1491,7 +1653,9 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. "erc1155::Erc1155" (Ty.path "erc1155::Contract") [] + [] "is_approved_for_all" + [] [] in let* α1 := M.read self in let* α2 := M.read from in @@ -1507,7 +1671,9 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. "core::convert::Into" (Ty.path "erc1155::Error") [ Ty.path "erc1155::Error" ] + [] "into" + [] [] in let* α1 := M.call_closure α0 [ Value.StructTuple "erc1155::Error::NotApproved" [] ] in @@ -1532,9 +1698,11 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. "core::cmp::PartialEq" (Ty.path "erc1155::AccountId") [ Ty.path "erc1155::AccountId" ] + [ Value.Bool true ] "ne" + [] [] in - let* α1 := M.get_function "erc1155::zero_address" [] in + let* α1 := M.get_function "erc1155::zero_address" [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.alloc α2 in let* α4 := M.call_closure α0 [ to; α3 ] in @@ -1548,7 +1716,9 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. "core::convert::Into" (Ty.path "erc1155::Error") [ Ty.path "erc1155::Error" ] + [] "into" + [] [] in let* α1 := M.call_closure α0 [ Value.StructTuple "erc1155::Error::ZeroAddressTransfer" [] ] in @@ -1569,8 +1739,10 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "u128"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "u128"; Ty.path "alloc::alloc::Global" ] + []) "is_empty" + [] [] in let* α1 := M.call_closure α0 [ token_ids ] in let* α2 := M.alloc (UnOp.Pure.not (UnOp.Pure.not α1)) in @@ -1583,7 +1755,9 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. "core::convert::Into" (Ty.path "erc1155::Error") [ Ty.path "erc1155::Error" ] + [] "into" + [] [] in let* α1 := M.call_closure @@ -1606,16 +1780,20 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "u128"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "u128"; Ty.path "alloc::alloc::Global" ] + []) "len" + [] [] in let* α1 := M.call_closure α0 [ token_ids ] in let* α2 := M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "u128"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "u128"; Ty.path "alloc::alloc::Global" ] + []) "len" + [] [] in let* α3 := M.call_closure α2 [ values ] in let* α4 := M.alloc (UnOp.Pure.not (BinOp.Pure.eq α1 α3)) in @@ -1628,7 +1806,9 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. "core::convert::Into" (Ty.path "erc1155::Error") [ Ty.path "erc1155::Error" ] + [] "into" + [] [] in let* α1 := M.call_closure @@ -1644,33 +1824,49 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. let* α0 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ]) + (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ] []) + [] [] "zip" - [ Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ] ] in + [ Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ] [] ] + [] in let* α1 := - M.get_associated_function (Ty.apply (Ty.path "slice") [ Ty.path "u128" ]) "iter" [] in + M.get_associated_function + (Ty.apply (Ty.path "slice") [ Ty.path "u128" ] []) + "iter" + [] + [] in let* α2 := M.get_trait_method "core::ops::deref::Deref" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "u128"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "u128"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref" + [] [] in let* α3 := M.call_closure α2 [ token_ids ] in let* α4 := M.call_closure α1 [ α3 ] in let* α5 := - M.get_associated_function (Ty.apply (Ty.path "slice") [ Ty.path "u128" ]) "iter" [] in + M.get_associated_function + (Ty.apply (Ty.path "slice") [ Ty.path "u128" ] []) + "iter" + [] + [] in let* α6 := M.get_trait_method "core::ops::deref::Deref" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "u128"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "u128"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref" + [] [] in let* α7 := M.call_closure α6 [ values ] in let* α8 := M.call_closure α5 [ α7 ] in @@ -1683,11 +1879,14 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. (Ty.apply (Ty.path "core::iter::adapters::zip::Zip") [ - Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ]; - Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ] - ]) + Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ] []; + Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ] [] + ] + []) + [] [] "into_iter" + [] [] in let* α1 := M.get_trait_method @@ -1695,11 +1894,14 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. (Ty.apply (Ty.path "core::iter::adapters::zip::Zip") [ - Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ]; - Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ] - ]) + Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ] []; + Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ] [] + ] + []) + [] [] "clone" + [] [] in let* α2 := M.call_closure α1 [ transfers ] in let* α3 := M.call_closure α0 [ α2 ] in @@ -1718,11 +1920,14 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. (Ty.apply (Ty.path "core::iter::adapters::zip::Zip") [ - Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ]; - Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ] - ]) + Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ] []; + Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ] [] + ] + []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -1752,7 +1957,9 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. "erc1155::Erc1155" (Ty.path "erc1155::Contract") [] + [] "balance_of" + [] [] in let* α1 := M.read self in let* α2 := M.read from in @@ -1778,7 +1985,9 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. "core::convert::Into" (Ty.path "erc1155::Error") [ Ty.path "erc1155::Error" ] + [] "into" + [] [] in let* α1 := M.call_closure @@ -1805,11 +2014,14 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. (Ty.apply (Ty.path "core::iter::adapters::zip::Zip") [ - Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ]; - Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ] - ]) + Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ] []; + Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ] [] + ] + []) + [] [] "into_iter" + [] [] in let* α1 := M.read transfers in let* α2 := M.call_closure α0 [ α1 ] in @@ -1828,11 +2040,14 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. (Ty.apply (Ty.path "core::iter::adapters::zip::Zip") [ - Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ]; - Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ] - ]) + Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ] []; + Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u128" ] [] + ] + []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -1861,6 +2076,7 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. M.get_associated_function (Ty.path "erc1155::Contract") "perform_transfer" + [] [] in let* α1 := M.read self in let* α2 := M.read from in @@ -1876,7 +2092,11 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. M.pure (M.use α4) in let* _ := let* α0 := - M.get_associated_function (Ty.path "erc1155::Contract") "transfer_acceptance_check" [] in + M.get_associated_function + (Ty.path "erc1155::Contract") + "transfer_acceptance_check" + [] + [] in let* α1 := M.read self in let* α2 := M.read caller in let* α3 := M.read from in @@ -1886,9 +2106,12 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. "core::ops::index::Index" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "u128"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "u128"; Ty.path "alloc::alloc::Global" ] + []) [ Ty.path "usize" ] + [] "index" + [] [] in let* α6 := M.call_closure α5 [ token_ids; Value.Integer Integer.Usize 0 ] in let* α7 := M.read α6 in @@ -1897,9 +2120,12 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. "core::ops::index::Index" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "u128"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "u128"; Ty.path "alloc::alloc::Global" ] + []) [ Ty.path "usize" ] + [] "index" + [] [] in let* α9 := M.call_closure α8 [ values; Value.Integer Integer.Usize 0 ] in let* α10 := M.read α9 in @@ -1934,8 +2160,10 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "u128"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "u128"; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in @@ -1949,9 +2177,13 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "erc1155::AccountId"; Ty.path "alloc::alloc::Global" ] - ]) + [] + ] + []) + [] [] "into_iter" + [] [] in let* α1 := M.call_closure α0 [ owners ] in let* α2 := M.alloc α1 in @@ -1968,9 +2200,12 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "core::slice::iter::Iter") - [ Ty.path "erc1155::AccountId" ]) + [ Ty.path "erc1155::AccountId" ] + []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -1998,9 +2233,13 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u128"; Ty.path "alloc::alloc::Global" ] - ]) + [] + ] + []) + [] [] "into_iter" + [] [] in let* α1 := M.call_closure α0 [ token_ids ] in let* α2 := M.alloc α1 in @@ -2017,9 +2256,12 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "core::slice::iter::Iter") - [ Ty.path "u128" ]) + [ Ty.path "u128" ] + []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -2044,7 +2286,9 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. "erc1155::Erc1155" (Ty.path "erc1155::Contract") [] + [] "balance_of" + [] [] in let* α1 := M.read self in let* α2 := M.read o in @@ -2059,8 +2303,10 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u128"; Ty.path "alloc::alloc::Global" - ]) + ] + []) "push" + [] [] in let* α1 := M.read amount in let* α2 := M.call_closure α0 [ output; α1 ] in @@ -2105,8 +2351,8 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. let* operator := M.alloc operator in let* approved := M.alloc approved in let* caller := - let* α0 := M.get_associated_function (Ty.path "erc1155::Env") "caller" [] in - let* α1 := M.get_associated_function (Ty.path "erc1155::Contract") "env" [] in + let* α0 := M.get_associated_function (Ty.path "erc1155::Env") "caller" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc1155::Contract") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -2124,7 +2370,9 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. "core::cmp::PartialEq" (Ty.path "erc1155::AccountId") [ Ty.path "erc1155::AccountId" ] + [ Value.Bool true ] "ne" + [] [] in let* α1 := M.call_closure α0 [ operator; caller ] in let* α2 := M.alloc (UnOp.Pure.not α1) in @@ -2137,7 +2385,9 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. "core::convert::Into" (Ty.path "erc1155::Error") [ Ty.path "erc1155::Error" ] + [] "into" + [] [] in let* α1 := M.call_closure α0 [ Value.StructTuple "erc1155::Error::SelfApproval" [] ] in @@ -2165,8 +2415,10 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "erc1155::AccountId" ]; Ty.tuple [] - ]) + ] + []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read caller in @@ -2190,8 +2442,10 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. [ Ty.tuple [ Ty.path "erc1155::AccountId"; Ty.path "erc1155::AccountId" ]; Ty.tuple [] - ]) + ] + []) "remove" + [] [] in let* α1 := M.read self in let* α2 := M.read caller in @@ -2207,8 +2461,8 @@ Module Impl_erc1155_Erc1155_for_erc1155_Contract. M.alloc (Value.Tuple []) ] in let* _ := - let* α0 := M.get_associated_function (Ty.path "erc1155::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "erc1155::Contract") "env" [] in + let* α0 := M.get_associated_function (Ty.path "erc1155::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc1155::Contract") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -2285,8 +2539,8 @@ Module Impl_erc1155_Erc1155TokenReceiver_for_erc1155_Contract. let* _token_id := M.alloc _token_id in let* _value := M.alloc _value in let* _data := M.alloc _data in - let* α0 := M.get_function "core::panicking::panic_fmt" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "core::panicking::panic_fmt" [] [ Value.Bool true ] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α4 := (* Unsize *) let* α2 := @@ -2296,7 +2550,7 @@ Module Impl_erc1155_Erc1155TokenReceiver_for_erc1155_Contract. M.pure (M.pointer_coercion α3) in let* α8 := (* Unsize *) - let* α5 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "none" [] in + let* α5 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "none" [] [] in let* α6 := M.call_closure α5 [] in let* α7 := M.alloc α6 in M.pure (M.pointer_coercion α7) in @@ -2338,8 +2592,8 @@ Module Impl_erc1155_Erc1155TokenReceiver_for_erc1155_Contract. let* _token_ids := M.alloc _token_ids in let* _values := M.alloc _values in let* _data := M.alloc _data in - let* α0 := M.get_function "core::panicking::panic_fmt" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "core::panicking::panic_fmt" [] [ Value.Bool true ] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α4 := (* Unsize *) let* α2 := @@ -2350,7 +2604,7 @@ Module Impl_erc1155_Erc1155TokenReceiver_for_erc1155_Contract. M.pure (M.pointer_coercion α3) in let* α8 := (* Unsize *) - let* α5 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "none" [] in + let* α5 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "none" [] [] in let* α6 := M.call_closure α5 [] in let* α7 := M.alloc α6 in M.pure (M.pointer_coercion α7) in diff --git a/CoqOfRust/examples/default/examples/ink_contracts/erc20.v b/CoqOfRust/examples/default/examples/ink_contracts/erc20.v index f8004af05..1e259086c 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/erc20.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/erc20.v @@ -7,13 +7,13 @@ Require Import CoqOfRust.CoqOfRust. ty_params := [ "K"; "V" ]; fields := [ - ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ]); - ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []); + ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) ]; } *) Module Impl_core_default_Default_for_erc20_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc20::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc20::Mapping") [ K; V ] []. (* Default @@ -25,17 +25,21 @@ Module Impl_core_default_Default_for_erc20_Mapping_K_V. let* α0 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "core::marker::PhantomData") [ K ]) + (Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []) + [] [] "default" + [] [] in let* α1 := M.call_closure α0 [] in let* α2 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + (Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) + [] [] "default" + [] [] in let* α3 := M.call_closure α2 [] in M.pure (Value.StructRecord "erc20::Mapping" [ ("_key", α1); ("_value", α3) ]) @@ -52,14 +56,25 @@ Module Impl_core_default_Default_for_erc20_Mapping_K_V. End Impl_core_default_Default_for_erc20_Mapping_K_V. Module Impl_erc20_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc20::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc20::Mapping") [ K; V ] []. (* fn get(&self, _key: &K) -> Option { unimplemented!() } *) - Parameter get : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition get (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_get : forall (K V : Ty.t), @@ -70,7 +85,19 @@ Module Impl_erc20_Mapping_K_V. unimplemented!() } *) - Parameter insert : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition insert (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key; _value ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* _value := M.alloc _value in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_insert : forall (K V : Ty.t), @@ -93,7 +120,8 @@ Module Impl_core_default_Default_for_erc20_AccountId. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructTuple "erc20::AccountId" [ α1 ]) | _, _ => M.impossible @@ -154,11 +182,12 @@ Axiom Balance : (Ty.path "erc20::Balance") = (Ty.path "u128"). [ ("total_supply", Ty.path "u128"); ("balances", - Ty.apply (Ty.path "erc20::Mapping") [ Ty.path "erc20::AccountId"; Ty.path "u128" ]); + Ty.apply (Ty.path "erc20::Mapping") [ Ty.path "erc20::AccountId"; Ty.path "u128" ] []); ("allowances", Ty.apply (Ty.path "erc20::Mapping") - [ Ty.tuple [ Ty.path "erc20::AccountId"; Ty.path "erc20::AccountId" ]; Ty.path "u128" ]) + [ Ty.tuple [ Ty.path "erc20::AccountId"; Ty.path "erc20::AccountId" ]; Ty.path "u128" ] + []) ]; } *) @@ -171,14 +200,17 @@ Module Impl_core_default_Default_for_erc20_Erc20. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in let* α2 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "erc20::Mapping") [ Ty.path "erc20::AccountId"; Ty.path "u128" ]) + (Ty.apply (Ty.path "erc20::Mapping") [ Ty.path "erc20::AccountId"; Ty.path "u128" ] []) + [] [] "default" + [] [] in let* α3 := M.call_closure α2 [] in let* α4 := @@ -186,9 +218,12 @@ Module Impl_core_default_Default_for_erc20_Erc20. "core::default::Default" (Ty.apply (Ty.path "erc20::Mapping") - [ Ty.tuple [ Ty.path "erc20::AccountId"; Ty.path "erc20::AccountId" ]; Ty.path "u128" ]) + [ Ty.tuple [ Ty.path "erc20::AccountId"; Ty.path "erc20::AccountId" ]; Ty.path "u128" ] + []) + [] [] "default" + [] [] in let* α5 := M.call_closure α4 [] in M.pure @@ -212,8 +247,8 @@ End Impl_core_default_Default_for_erc20_Erc20. ty_params := []; fields := [ - ("from", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc20::AccountId" ]); - ("to", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc20::AccountId" ]); + ("from", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc20::AccountId" ] []); + ("to", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc20::AccountId" ] []); ("value", Ty.path "u128") ]; } *) @@ -268,8 +303,8 @@ End Impl_core_default_Default_for_erc20_Erc20. Axiom Result : forall (T : Ty.t), - (Ty.apply (Ty.path "erc20::Result") [ T ]) = - (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "erc20::Error" ]). + (Ty.apply (Ty.path "erc20::Result") [ T ] []) = + (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "erc20::Error" ] []). Module Impl_erc20_Env. Definition Self : Ty.t := Ty.path "erc20::Env". @@ -295,7 +330,17 @@ Module Impl_erc20_Env. unimplemented!() } *) - Parameter emit_event : (list Ty.t) -> (list Value.t) -> M. + Definition emit_event (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ self; _event ] => + let* self := M.alloc self in + let* _event := M.alloc _event in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_emit_event : M.IsAssociatedFunction Self "emit_event" emit_event. End Impl_erc20_Env. @@ -308,7 +353,15 @@ Module Impl_erc20_Erc20. unimplemented!() } *) - Parameter init_env : (list Ty.t) -> (list Value.t) -> M. + Definition init_env (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [] => + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_init_env : M.IsAssociatedFunction Self "init_env" init_env. @@ -321,7 +374,7 @@ Module Impl_erc20_Erc20. match τ, α with | [], [ self ] => let* self := M.alloc self in - let* α0 := M.get_associated_function (Ty.path "erc20::Erc20") "init_env" [] in + let* α0 := M.get_associated_function (Ty.path "erc20::Erc20") "init_env" [] [] in M.call_closure α0 [] | _, _ => M.impossible end. @@ -358,15 +411,17 @@ Module Impl_erc20_Erc20. let* α0 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "erc20::Mapping") [ Ty.path "erc20::AccountId"; Ty.path "u128" ]) + (Ty.apply (Ty.path "erc20::Mapping") [ Ty.path "erc20::AccountId"; Ty.path "u128" ] []) + [] [] "default" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* caller := - let* α0 := M.get_associated_function (Ty.path "erc20::Env") "caller" [] in - let* α1 := M.get_associated_function (Ty.path "erc20::Erc20") "init_env" [] in + let* α0 := M.get_associated_function (Ty.path "erc20::Env") "caller" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc20::Erc20") "init_env" [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.alloc α2 in let* α4 := M.call_closure α0 [ α3 ] in @@ -374,16 +429,17 @@ Module Impl_erc20_Erc20. let* _ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "erc20::Mapping") [ Ty.path "erc20::AccountId"; Ty.path "u128" ]) + (Ty.apply (Ty.path "erc20::Mapping") [ Ty.path "erc20::AccountId"; Ty.path "u128" ] []) "insert" + [] [] in let* α1 := M.read caller in let* α2 := M.read total_supply in let* α3 := M.call_closure α0 [ balances; α1; α2 ] in M.alloc α3 in let* _ := - let* α0 := M.get_associated_function (Ty.path "erc20::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "erc20::Erc20") "init_env" [] in + let* α0 := M.get_associated_function (Ty.path "erc20::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc20::Erc20") "init_env" [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.alloc α2 in let* α4 := M.read caller in @@ -413,9 +469,12 @@ Module Impl_erc20_Erc20. "core::default::Default" (Ty.apply (Ty.path "erc20::Mapping") - [ Ty.tuple [ Ty.path "erc20::AccountId"; Ty.path "erc20::AccountId" ]; Ty.path "u128" ]) + [ Ty.tuple [ Ty.path "erc20::AccountId"; Ty.path "erc20::AccountId" ]; Ty.path "u128" ] + []) + [] [] "default" + [] [] in let* α3 := M.call_closure α2 [] in let* α0 := @@ -457,13 +516,15 @@ Module Impl_erc20_Erc20. let* owner := M.alloc owner in let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u128" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u128" ] []) "unwrap_or_default" + [] [] in let* α1 := M.get_associated_function - (Ty.apply (Ty.path "erc20::Mapping") [ Ty.path "erc20::AccountId"; Ty.path "u128" ]) + (Ty.apply (Ty.path "erc20::Mapping") [ Ty.path "erc20::AccountId"; Ty.path "u128" ] []) "get" + [] [] in let* α2 := M.read self in let* α3 := M.read owner in @@ -485,7 +546,7 @@ Module Impl_erc20_Erc20. | [], [ self; owner ] => let* self := M.alloc self in let* owner := M.alloc owner in - let* α0 := M.get_associated_function (Ty.path "erc20::Erc20") "balance_of_impl" [] in + let* α0 := M.get_associated_function (Ty.path "erc20::Erc20") "balance_of_impl" [] [] in let* α1 := M.read self in M.call_closure α0 [ α1; owner ] | _, _ => M.impossible @@ -506,15 +567,18 @@ Module Impl_erc20_Erc20. let* spender := M.alloc spender in let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u128" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u128" ] []) "unwrap_or_default" + [] [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "erc20::Mapping") - [ Ty.tuple [ Ty.path "erc20::AccountId"; Ty.path "erc20::AccountId" ]; Ty.path "u128" ]) + [ Ty.tuple [ Ty.path "erc20::AccountId"; Ty.path "erc20::AccountId" ]; Ty.path "u128" ] + []) "get" + [] [] in let* α2 := M.read self in let* α3 := M.read owner in @@ -542,7 +606,7 @@ Module Impl_erc20_Erc20. let* self := M.alloc self in let* owner := M.alloc owner in let* spender := M.alloc spender in - let* α0 := M.get_associated_function (Ty.path "erc20::Erc20") "allowance_impl" [] in + let* α0 := M.get_associated_function (Ty.path "erc20::Erc20") "allowance_impl" [] [] in let* α1 := M.read self in M.call_closure α0 [ α1; owner; spender ] | _, _ => M.impossible @@ -576,7 +640,7 @@ Module Impl_erc20_Erc20. let* to := M.alloc to in let* value := M.alloc value in let* from_balance := - let* α0 := M.get_associated_function (Ty.path "erc20::Erc20") "balance_of_impl" [] in + let* α0 := M.get_associated_function (Ty.path "erc20::Erc20") "balance_of_impl" [] [] in let* α1 := M.read self in let* α2 := M.read from in let* α3 := M.call_closure α0 [ α1; α2 ] in @@ -608,8 +672,9 @@ Module Impl_erc20_Erc20. let* _ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "erc20::Mapping") [ Ty.path "erc20::AccountId"; Ty.path "u128" ]) + (Ty.apply (Ty.path "erc20::Mapping") [ Ty.path "erc20::AccountId"; Ty.path "u128" ] []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read from in @@ -621,7 +686,7 @@ Module Impl_erc20_Erc20. M.call_closure α0 [ M.get_struct_record_field α1 "erc20::Erc20" "balances"; α3; α6 ] in M.alloc α7 in let* to_balance := - let* α0 := M.get_associated_function (Ty.path "erc20::Erc20") "balance_of_impl" [] in + let* α0 := M.get_associated_function (Ty.path "erc20::Erc20") "balance_of_impl" [] [] in let* α1 := M.read self in let* α2 := M.read to in let* α3 := M.call_closure α0 [ α1; α2 ] in @@ -629,8 +694,9 @@ Module Impl_erc20_Erc20. let* _ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "erc20::Mapping") [ Ty.path "erc20::AccountId"; Ty.path "u128" ]) + (Ty.apply (Ty.path "erc20::Mapping") [ Ty.path "erc20::AccountId"; Ty.path "u128" ] []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read to in @@ -642,8 +708,8 @@ Module Impl_erc20_Erc20. M.call_closure α0 [ M.get_struct_record_field α1 "erc20::Erc20" "balances"; α3; α6 ] in M.alloc α7 in let* _ := - let* α0 := M.get_associated_function (Ty.path "erc20::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "erc20::Erc20") "env" [] in + let* α0 := M.get_associated_function (Ty.path "erc20::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc20::Erc20") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -691,14 +757,14 @@ Module Impl_erc20_Erc20. let* to := M.alloc to in let* value := M.alloc value in let* from := - let* α0 := M.get_associated_function (Ty.path "erc20::Env") "caller" [] in - let* α1 := M.get_associated_function (Ty.path "erc20::Erc20") "env" [] in + let* α0 := M.get_associated_function (Ty.path "erc20::Env") "caller" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc20::Erc20") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in let* α5 := M.call_closure α0 [ α4 ] in M.alloc α5 in - let* α0 := M.get_associated_function (Ty.path "erc20::Erc20") "transfer_from_to" [] in + let* α0 := M.get_associated_function (Ty.path "erc20::Erc20") "transfer_from_to" [] [] in let* α1 := M.read self in let* α2 := M.read value in let* α3 := M.call_closure α0 [ α1; from; to; α2 ] in @@ -728,8 +794,8 @@ Module Impl_erc20_Erc20. let* spender := M.alloc spender in let* value := M.alloc value in let* owner := - let* α0 := M.get_associated_function (Ty.path "erc20::Env") "caller" [] in - let* α1 := M.get_associated_function (Ty.path "erc20::Erc20") "env" [] in + let* α0 := M.get_associated_function (Ty.path "erc20::Env") "caller" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc20::Erc20") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -741,8 +807,10 @@ Module Impl_erc20_Erc20. (Ty.apply (Ty.path "erc20::Mapping") [ Ty.tuple [ Ty.path "erc20::AccountId"; Ty.path "erc20::AccountId" ]; Ty.path "u128" - ]) + ] + []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read owner in @@ -755,8 +823,8 @@ Module Impl_erc20_Erc20. ] in M.alloc α5 in let* _ := - let* α0 := M.get_associated_function (Ty.path "erc20::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "erc20::Erc20") "env" [] in + let* α0 := M.get_associated_function (Ty.path "erc20::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc20::Erc20") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -804,15 +872,15 @@ Module Impl_erc20_Erc20. let* to := M.alloc to in let* value := M.alloc value in let* caller := - let* α0 := M.get_associated_function (Ty.path "erc20::Env") "caller" [] in - let* α1 := M.get_associated_function (Ty.path "erc20::Erc20") "env" [] in + let* α0 := M.get_associated_function (Ty.path "erc20::Env") "caller" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc20::Erc20") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in let* α5 := M.call_closure α0 [ α4 ] in M.alloc α5 in let* allowance := - let* α0 := M.get_associated_function (Ty.path "erc20::Erc20") "allowance_impl" [] in + let* α0 := M.get_associated_function (Ty.path "erc20::Erc20") "allowance_impl" [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1; from; caller ] in M.alloc α2 in @@ -844,11 +912,13 @@ Module Impl_erc20_Erc20. let* α0 := M.get_trait_method "core::ops::try_trait::Try" - (Ty.apply (Ty.path "core::result::Result") [ Ty.tuple []; Ty.path "erc20::Error" ]) + (Ty.apply (Ty.path "core::result::Result") [ Ty.tuple []; Ty.path "erc20::Error" ] []) + [] [] "branch" + [] [] in - let* α1 := M.get_associated_function (Ty.path "erc20::Erc20") "transfer_from_to" [] in + let* α1 := M.get_associated_function (Ty.path "erc20::Erc20") "transfer_from_to" [] [] in let* α2 := M.read self in let* α3 := M.read value in let* α4 := M.call_closure α1 [ α2; from; to; α3 ] in @@ -869,13 +939,17 @@ Module Impl_erc20_Erc20. "core::ops::try_trait::FromResidual" (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "erc20::Error" ]) + [ Ty.tuple []; Ty.path "erc20::Error" ] + []) [ Ty.apply (Ty.path "core::result::Result") [ Ty.path "core::convert::Infallible"; Ty.path "erc20::Error" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -898,8 +972,10 @@ Module Impl_erc20_Erc20. (Ty.apply (Ty.path "erc20::Mapping") [ Ty.tuple [ Ty.path "erc20::AccountId"; Ty.path "erc20::AccountId" ]; Ty.path "u128" - ]) + ] + []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read from in diff --git a/CoqOfRust/examples/default/examples/ink_contracts/erc721.v b/CoqOfRust/examples/default/examples/ink_contracts/erc721.v index 62d83c375..1fbccc153 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/erc721.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/erc721.v @@ -7,13 +7,13 @@ Require Import CoqOfRust.CoqOfRust. ty_params := [ "K"; "V" ]; fields := [ - ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ]); - ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []); + ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) ]; } *) Module Impl_core_default_Default_for_erc721_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc721::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc721::Mapping") [ K; V ] []. (* Default @@ -25,17 +25,21 @@ Module Impl_core_default_Default_for_erc721_Mapping_K_V. let* α0 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "core::marker::PhantomData") [ K ]) + (Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []) + [] [] "default" + [] [] in let* α1 := M.call_closure α0 [] in let* α2 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + (Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) + [] [] "default" + [] [] in let* α3 := M.call_closure α2 [] in M.pure (Value.StructRecord "erc721::Mapping" [ ("_key", α1); ("_value", α3) ]) @@ -52,14 +56,25 @@ Module Impl_core_default_Default_for_erc721_Mapping_K_V. End Impl_core_default_Default_for_erc721_Mapping_K_V. Module Impl_erc721_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc721::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "erc721::Mapping") [ K; V ] []. (* fn contains(&self, _key: &K) -> bool { unimplemented!() } *) - Parameter contains : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition contains (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_contains : forall (K V : Ty.t), @@ -70,7 +85,18 @@ Module Impl_erc721_Mapping_K_V. unimplemented!() } *) - Parameter get : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition get (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_get : forall (K V : Ty.t), @@ -81,7 +107,19 @@ Module Impl_erc721_Mapping_K_V. unimplemented!() } *) - Parameter insert : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition insert (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key; _value ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* _value := M.alloc _value in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_insert : forall (K V : Ty.t), @@ -92,7 +130,18 @@ Module Impl_erc721_Mapping_K_V. unimplemented!() } *) - Parameter remove : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition remove (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_remove : forall (K V : Ty.t), @@ -103,7 +152,18 @@ Module Impl_erc721_Mapping_K_V. unimplemented!() } *) - Parameter size : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition size (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_size : forall (K V : Ty.t), @@ -114,7 +174,18 @@ Module Impl_erc721_Mapping_K_V. unimplemented!() } *) - Parameter take : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition take (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_take : forall (K V : Ty.t), @@ -137,7 +208,8 @@ Module Impl_core_default_Default_for_erc721_AccountId. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructTuple "erc721::AccountId" [ α1 ]) | _, _ => M.impossible @@ -219,7 +291,7 @@ Module Impl_core_cmp_PartialEq_for_erc721_AccountId. (* Instance *) [ ("eq", InstanceField.Method eq) ]. End Impl_core_cmp_PartialEq_for_erc721_AccountId. -Module Impl_core_convert_From_array_u8_for_erc721_AccountId. +Module Impl_core_convert_From_array_u8_32_for_erc721_AccountId. Definition Self : Ty.t := Ty.path "erc721::AccountId". (* @@ -227,15 +299,25 @@ Module Impl_core_convert_From_array_u8_for_erc721_AccountId. unimplemented!() } *) - Parameter from : (list Ty.t) -> (list Value.t) -> M. + Definition from (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ _value ] => + let* _value := M.alloc _value in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom Implements : M.IsTraitInstance "core::convert::From" Self - (* Trait polymorphic types *) [ (* T *) Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] + (* Trait polymorphic types *) + [ (* T *) Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ] ] (* Instance *) [ ("from", InstanceField.Method from) ]. -End Impl_core_convert_From_array_u8_for_erc721_AccountId. +End Impl_core_convert_From_array_u8_32_for_erc721_AccountId. Axiom Balance : (Ty.path "erc721::Balance") = (Ty.path "u128"). @@ -255,15 +337,16 @@ Axiom TokenId : (Ty.path "erc721::TokenId") = (Ty.path "u32"). fields := [ ("token_owner", - Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "u32"; Ty.path "erc721::AccountId" ]); + Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "u32"; Ty.path "erc721::AccountId" ] []); ("token_approvals", - Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "u32"; Ty.path "erc721::AccountId" ]); + Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "u32"; Ty.path "erc721::AccountId" ] []); ("owned_tokens_count", - Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "erc721::AccountId"; Ty.path "u32" ]); + Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "erc721::AccountId"; Ty.path "u32" ] []); ("operator_approvals", Ty.apply (Ty.path "erc721::Mapping") - [ Ty.tuple [ Ty.path "erc721::AccountId"; Ty.path "erc721::AccountId" ]; Ty.tuple [] ]) + [ Ty.tuple [ Ty.path "erc721::AccountId"; Ty.path "erc721::AccountId" ]; Ty.tuple [] ] + []) ]; } *) @@ -279,25 +362,31 @@ Module Impl_core_default_Default_for_erc721_Erc721. let* α0 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "u32"; Ty.path "erc721::AccountId" ]) + (Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "u32"; Ty.path "erc721::AccountId" ] []) + [] [] "default" + [] [] in let* α1 := M.call_closure α0 [] in let* α2 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "u32"; Ty.path "erc721::AccountId" ]) + (Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "u32"; Ty.path "erc721::AccountId" ] []) + [] [] "default" + [] [] in let* α3 := M.call_closure α2 [] in let* α4 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "erc721::AccountId"; Ty.path "u32" ]) + (Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "erc721::AccountId"; Ty.path "u32" ] []) + [] [] "default" + [] [] in let* α5 := M.call_closure α4 [] in let* α6 := @@ -305,9 +394,12 @@ Module Impl_core_default_Default_for_erc721_Erc721. "core::default::Default" (Ty.apply (Ty.path "erc721::Mapping") - [ Ty.tuple [ Ty.path "erc721::AccountId"; Ty.path "erc721::AccountId" ]; Ty.tuple [] ]) + [ Ty.tuple [ Ty.path "erc721::AccountId"; Ty.path "erc721::AccountId" ]; Ty.tuple [] ] + []) + [] [] "default" + [] [] in let* α7 := M.call_closure α6 [] in M.pure @@ -397,13 +489,13 @@ Module Impl_core_cmp_PartialEq_for_erc721_Error. let* other := M.alloc other in let* __self_tag := let* α0 := - M.get_function "core::intrinsics::discriminant_value" [ Ty.path "erc721::Error" ] in + M.get_function "core::intrinsics::discriminant_value" [ Ty.path "erc721::Error" ] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* __arg1_tag := let* α0 := - M.get_function "core::intrinsics::discriminant_value" [ Ty.path "erc721::Error" ] in + M.get_function "core::intrinsics::discriminant_value" [ Ty.path "erc721::Error" ] [] in let* α1 := M.read other in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -492,8 +584,8 @@ End Impl_core_marker_Copy_for_erc721_Error. ty_params := []; fields := [ - ("from", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ]); - ("to", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ]); + ("from", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ] []); + ("to", Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ] []); ("id", Ty.path "u32") ]; } *) @@ -569,7 +661,17 @@ Module Impl_erc721_Env. unimplemented!() } *) - Parameter emit_event : (list Ty.t) -> (list Value.t) -> M. + Definition emit_event (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ self; _event ] => + let* self := M.alloc self in + let* _event := M.alloc _event in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_emit_event : M.IsAssociatedFunction Self "emit_event" emit_event. End Impl_erc721_Env. @@ -582,7 +684,15 @@ Module Impl_erc721_Erc721. unimplemented!() } *) - Parameter init_env : (list Ty.t) -> (list Value.t) -> M. + Definition init_env (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [] => + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_init_env : M.IsAssociatedFunction Self "init_env" init_env. @@ -595,7 +705,7 @@ Module Impl_erc721_Erc721. match τ, α with | [], [ self ] => let* self := M.alloc self in - let* α0 := M.get_associated_function (Ty.path "erc721::Erc721") "init_env" [] in + let* α0 := M.get_associated_function (Ty.path "erc721::Erc721") "init_env" [] [] in M.call_closure α0 [] | _, _ => M.impossible end. @@ -611,7 +721,14 @@ Module Impl_erc721_Erc721. match τ, α with | [], [] => let* α0 := - M.get_trait_method "core::default::Default" (Ty.path "erc721::Erc721") [] "default" [] in + M.get_trait_method + "core::default::Default" + (Ty.path "erc721::Erc721") + [] + [] + "default" + [] + [] in M.call_closure α0 [] | _, _ => M.impossible end. @@ -630,13 +747,15 @@ Module Impl_erc721_Erc721. let* of := M.alloc of in let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u32" ] []) "unwrap_or" + [] [] in let* α1 := M.get_associated_function - (Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "erc721::AccountId"; Ty.path "u32" ]) + (Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "erc721::AccountId"; Ty.path "u32" ] []) "get" + [] [] in let* α2 := M.read self in let* α3 := M.read of in @@ -666,8 +785,9 @@ Module Impl_erc721_Erc721. let* _ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "u32"; Ty.path "erc721::AccountId" ]) + (Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "u32"; Ty.path "erc721::AccountId" ] []) "remove" + [] [] in let* α1 := M.read self in let* α2 := M.read id in @@ -699,8 +819,10 @@ Module Impl_erc721_Erc721. M.get_associated_function (Ty.apply (Ty.path "erc721::Mapping") - [ Ty.tuple [ Ty.path "erc721::AccountId"; Ty.path "erc721::AccountId" ]; Ty.tuple [] ]) + [ Ty.tuple [ Ty.path "erc721::AccountId"; Ty.path "erc721::AccountId" ]; Ty.tuple [] ] + []) "contains" + [] [] in let* α1 := M.read self in let* α2 := M.read owner in @@ -725,8 +847,9 @@ Module Impl_erc721_Erc721. let* id := M.alloc id in let* α0 := M.get_associated_function - (Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "u32"; Ty.path "erc721::AccountId" ]) + (Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "u32"; Ty.path "erc721::AccountId" ] []) "get" + [] [] in let* α1 := M.read self in M.call_closure α0 [ M.get_struct_record_field α1 "erc721::Erc721" "token_owner"; id ] @@ -754,7 +877,7 @@ Module Impl_erc721_Erc721. let* from := M.alloc from in let* id := M.alloc id in let* owner := - let* α0 := M.get_associated_function (Ty.path "erc721::Erc721") "owner_of" [] in + let* α0 := M.get_associated_function (Ty.path "erc721::Erc721") "owner_of" [] [] in let* α1 := M.read self in let* α2 := M.read id in let* α3 := M.call_closure α0 [ α1; α2 ] in @@ -762,16 +885,20 @@ Module Impl_erc721_Erc721. let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ]) - [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ] ] + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ] []) + [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ] [] ] + [ Value.Bool true ] "ne" + [] [] in let* α1 := M.get_trait_method "core::convert::From" (Ty.path "erc721::AccountId") - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] + [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ] ] + [] "from" + [] [] in let* α2 := M.call_closure α1 [ repeat (Value.Integer Integer.U8 0) 32 ] in let* α3 := M.alloc (Value.StructTuple "core::option::Option::Some" [ α2 ]) in @@ -782,9 +909,11 @@ Module Impl_erc721_Erc721. (let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ]) - [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ] ] + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ] []) + [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ] [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.call_closure α0 [ from; owner ] in let* α2 := @@ -793,16 +922,20 @@ Module Impl_erc721_Erc721. (let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ]) - [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ] ] + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ] []) + [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ] [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "erc721::Mapping") - [ Ty.path "u32"; Ty.path "erc721::AccountId" ]) + [ Ty.path "u32"; Ty.path "erc721::AccountId" ] + []) "get" + [] [] in let* α2 := M.read self in let* α3 := @@ -814,21 +947,23 @@ Module Impl_erc721_Erc721. LogicalOp.or α2 (let* α0 := - M.get_associated_function (Ty.path "erc721::Erc721") "approved_for_all" [] in + M.get_associated_function (Ty.path "erc721::Erc721") "approved_for_all" [] [] in let* α1 := M.read self in let* α2 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ] []) "expect" - [] in + [] + [ Value.Bool true ] in let* α3 := M.read owner in let* α4 := M.read (mk_str "Error with AccountId") in let* α5 := M.call_closure α2 [ α3; α4 ] in let* α6 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ] []) "expect" - [] in + [] + [ Value.Bool true ] in let* α7 := M.read from in let* α8 := M.read (mk_str "Error with AccountId") in let* α9 := M.call_closure α6 [ α7; α8 ] in @@ -853,8 +988,9 @@ Module Impl_erc721_Erc721. let* id := M.alloc id in let* α0 := M.get_associated_function - (Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "u32"; Ty.path "erc721::AccountId" ]) + (Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "u32"; Ty.path "erc721::AccountId" ] []) "contains" + [] [] in let* α1 := M.read self in M.call_closure α0 [ M.get_struct_record_field α1 "erc721::Erc721" "token_owner"; id ] @@ -873,7 +1009,7 @@ Module Impl_erc721_Erc721. | [], [ self; owner ] => let* self := M.alloc self in let* owner := M.alloc owner in - let* α0 := M.get_associated_function (Ty.path "erc721::Erc721") "balance_of_or_zero" [] in + let* α0 := M.get_associated_function (Ty.path "erc721::Erc721") "balance_of_or_zero" [] [] in let* α1 := M.read self in M.call_closure α0 [ α1; owner ] | _, _ => M.impossible @@ -893,8 +1029,9 @@ Module Impl_erc721_Erc721. let* id := M.alloc id in let* α0 := M.get_associated_function - (Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "u32"; Ty.path "erc721::AccountId" ]) + (Ty.apply (Ty.path "erc721::Mapping") [ Ty.path "u32"; Ty.path "erc721::AccountId" ] []) "get" + [] [] in let* α1 := M.read self in M.call_closure α0 [ M.get_struct_record_field α1 "erc721::Erc721" "token_approvals"; id ] @@ -914,7 +1051,7 @@ Module Impl_erc721_Erc721. let* self := M.alloc self in let* owner := M.alloc owner in let* operator := M.alloc operator in - let* α0 := M.get_associated_function (Ty.path "erc721::Erc721") "approved_for_all" [] in + let* α0 := M.get_associated_function (Ty.path "erc721::Erc721") "approved_for_all" [] [] in let* α1 := M.read self in let* α2 := M.read owner in let* α3 := M.read operator in @@ -953,8 +1090,8 @@ Module Impl_erc721_Erc721. let* to := M.alloc to in let* approved := M.alloc approved in let* caller := - let* α0 := M.get_associated_function (Ty.path "erc721::Env") "caller" [] in - let* α1 := M.get_associated_function (Ty.path "erc721::Erc721") "env" [] in + let* α0 := M.get_associated_function (Ty.path "erc721::Env") "caller" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc721::Erc721") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -972,7 +1109,9 @@ Module Impl_erc721_Erc721. "core::cmp::PartialEq" (Ty.path "erc721::AccountId") [ Ty.path "erc721::AccountId" ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.call_closure α0 [ to; caller ] in let* α2 := M.alloc α1 in @@ -991,8 +1130,8 @@ Module Impl_erc721_Erc721. fun γ => M.alloc (Value.Tuple []) ] in let* _ := - let* α0 := M.get_associated_function (Ty.path "erc721::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "erc721::Erc721") "env" [] in + let* α0 := M.get_associated_function (Ty.path "erc721::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc721::Erc721") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -1031,8 +1170,10 @@ Module Impl_erc721_Erc721. [ Ty.tuple [ Ty.path "erc721::AccountId"; Ty.path "erc721::AccountId" ]; Ty.tuple [] - ]) + ] + []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read caller in @@ -1056,8 +1197,10 @@ Module Impl_erc721_Erc721. [ Ty.tuple [ Ty.path "erc721::AccountId"; Ty.path "erc721::AccountId" ]; Ty.tuple [] - ]) + ] + []) "remove" + [] [] in let* α1 := M.read self in let* α2 := M.read caller in @@ -1096,11 +1239,13 @@ Module Impl_erc721_Erc721. let* α0 := M.get_trait_method "core::ops::try_trait::Try" - (Ty.apply (Ty.path "core::result::Result") [ Ty.tuple []; Ty.path "erc721::Error" ]) + (Ty.apply (Ty.path "core::result::Result") [ Ty.tuple []; Ty.path "erc721::Error" ] []) + [] [] "branch" + [] [] in - let* α1 := M.get_associated_function (Ty.path "erc721::Erc721") "approve_for_all" [] in + let* α1 := M.get_associated_function (Ty.path "erc721::Erc721") "approve_for_all" [] [] in let* α2 := M.read self in let* α3 := M.read to in let* α4 := M.read approved in @@ -1122,13 +1267,17 @@ Module Impl_erc721_Erc721. "core::ops::try_trait::FromResidual" (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "erc721::Error" ]) + [ Ty.tuple []; Ty.path "erc721::Error" ] + []) [ Ty.apply (Ty.path "core::result::Result") [ Ty.path "core::convert::Infallible"; Ty.path "erc721::Error" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -1189,15 +1338,15 @@ Module Impl_erc721_Erc721. let* to := M.alloc to in let* id := M.alloc id in let* caller := - let* α0 := M.get_associated_function (Ty.path "erc721::Env") "caller" [] in - let* α1 := M.get_associated_function (Ty.path "erc721::Erc721") "env" [] in + let* α0 := M.get_associated_function (Ty.path "erc721::Env") "caller" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc721::Erc721") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in let* α5 := M.call_closure α0 [ α4 ] in M.alloc α5 in let* owner := - let* α0 := M.get_associated_function (Ty.path "erc721::Erc721") "owner_of" [] in + let* α0 := M.get_associated_function (Ty.path "erc721::Erc721") "owner_of" [] [] in let* α1 := M.read self in let* α2 := M.read id in let* α3 := M.call_closure α0 [ α1; α2 ] in @@ -1212,9 +1361,11 @@ Module Impl_erc721_Erc721. let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ]) - [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ] ] + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ] []) + [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ] [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read caller in let* α2 := M.alloc (Value.StructTuple "core::option::Option::Some" [ α1 ]) in @@ -1223,13 +1374,21 @@ Module Impl_erc721_Erc721. LogicalOp.or α3 (let* α0 := - M.get_associated_function (Ty.path "erc721::Erc721") "approved_for_all" [] in + M.get_associated_function + (Ty.path "erc721::Erc721") + "approved_for_all" + [] + [] in let* α1 := M.read self in let* α2 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "erc721::AccountId" ]) + (Ty.apply + (Ty.path "core::option::Option") + [ Ty.path "erc721::AccountId" ] + []) "expect" - [] in + [] + [ Value.Bool true ] in let* α3 := M.read owner in let* α4 := M.read (mk_str "Error with AccountId") in let* α5 := M.call_closure α2 [ α3; α4 ] in @@ -1262,15 +1421,20 @@ Module Impl_erc721_Erc721. "core::cmp::PartialEq" (Ty.path "erc721::AccountId") [ Ty.path "erc721::AccountId" ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read to in let* α2 := M.get_trait_method "core::convert::From" (Ty.path "erc721::AccountId") - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] + [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ] + ] + [] "from" + [] [] in let* α3 := M.call_closure α2 [ repeat (Value.Integer Integer.U8 0) 32 ] in let* α4 := M.alloc α3 in @@ -1301,8 +1465,10 @@ Module Impl_erc721_Erc721. M.get_associated_function (Ty.apply (Ty.path "erc721::Mapping") - [ Ty.path "u32"; Ty.path "erc721::AccountId" ]) + [ Ty.path "u32"; Ty.path "erc721::AccountId" ] + []) "contains" + [] [] in let* α1 := M.read self in let* α2 := @@ -1328,8 +1494,10 @@ Module Impl_erc721_Erc721. M.get_associated_function (Ty.apply (Ty.path "erc721::Mapping") - [ Ty.path "u32"; Ty.path "erc721::AccountId" ]) + [ Ty.path "u32"; Ty.path "erc721::AccountId" ] + []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read id in @@ -1343,8 +1511,8 @@ Module Impl_erc721_Erc721. M.alloc (Value.Tuple []) ] in let* _ := - let* α0 := M.get_associated_function (Ty.path "erc721::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "erc721::Erc721") "env" [] in + let* α0 := M.get_associated_function (Ty.path "erc721::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc721::Erc721") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -1385,11 +1553,13 @@ Module Impl_erc721_Erc721. let* α0 := M.get_trait_method "core::ops::try_trait::Try" - (Ty.apply (Ty.path "core::result::Result") [ Ty.tuple []; Ty.path "erc721::Error" ]) + (Ty.apply (Ty.path "core::result::Result") [ Ty.tuple []; Ty.path "erc721::Error" ] []) + [] [] "branch" + [] [] in - let* α1 := M.get_associated_function (Ty.path "erc721::Erc721") "approve_for" [] in + let* α1 := M.get_associated_function (Ty.path "erc721::Erc721") "approve_for" [] [] in let* α2 := M.read self in let* α3 := M.read id in let* α4 := M.call_closure α1 [ α2; to; α3 ] in @@ -1410,13 +1580,17 @@ Module Impl_erc721_Erc721. "core::ops::try_trait::FromResidual" (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "erc721::Error" ]) + [ Ty.tuple []; Ty.path "erc721::Error" ] + []) [ Ty.apply (Ty.path "core::result::Result") [ Ty.path "core::convert::Infallible"; Ty.path "erc721::Error" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -1491,8 +1665,10 @@ Module Impl_erc721_Erc721. M.get_associated_function (Ty.apply (Ty.path "erc721::Mapping") - [ Ty.path "u32"; Ty.path "erc721::AccountId" ]) + [ Ty.path "u32"; Ty.path "erc721::AccountId" ] + []) "contains" + [] [] in let* α1 := M.read token_owner in let* α2 := M.call_closure α0 [ α1; id ] in @@ -1517,26 +1693,33 @@ Module Impl_erc721_Erc721. "core::ops::try_trait::Try" (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "u32"; Ty.path "erc721::Error" ]) + [ Ty.path "u32"; Ty.path "erc721::Error" ] + []) + [] [] "branch" + [] [] in let* α1 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u32" ] []) "ok_or" - [ Ty.path "erc721::Error" ] in + [ Ty.path "erc721::Error" ] + [] in let* α2 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u32" ] []) "map" - [ Ty.path "u32"; Ty.function [ Ty.tuple [ Ty.path "u32" ] ] (Ty.path "u32") ] in + [ Ty.path "u32"; Ty.function [ Ty.tuple [ Ty.path "u32" ] ] (Ty.path "u32") ] + [] in let* α3 := M.get_associated_function (Ty.apply (Ty.path "erc721::Mapping") - [ Ty.path "erc721::AccountId"; Ty.path "u32" ]) + [ Ty.path "erc721::AccountId"; Ty.path "u32" ] + []) "get" + [] [] in let* α4 := M.read owned_tokens_count in let* α5 := M.read from in @@ -1586,13 +1769,17 @@ Module Impl_erc721_Erc721. "core::ops::try_trait::FromResidual" (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "erc721::Error" ]) + [ Ty.tuple []; Ty.path "erc721::Error" ] + []) [ Ty.apply (Ty.path "core::result::Result") [ Ty.path "core::convert::Infallible"; Ty.path "erc721::Error" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -1615,8 +1802,10 @@ Module Impl_erc721_Erc721. M.get_associated_function (Ty.apply (Ty.path "erc721::Mapping") - [ Ty.path "erc721::AccountId"; Ty.path "u32" ]) + [ Ty.path "erc721::AccountId"; Ty.path "u32" ] + []) "insert" + [] [] in let* α1 := M.read owned_tokens_count in let* α2 := M.read from in @@ -1629,8 +1818,10 @@ Module Impl_erc721_Erc721. M.get_associated_function (Ty.apply (Ty.path "erc721::Mapping") - [ Ty.path "u32"; Ty.path "erc721::AccountId" ]) + [ Ty.path "u32"; Ty.path "erc721::AccountId" ] + []) "remove" + [] [] in let* α1 := M.read token_owner in let* α2 := M.read id in @@ -1720,8 +1911,8 @@ Module Impl_erc721_Erc721. let* destination := M.alloc destination in let* id := M.alloc id in let* caller := - let* α0 := M.get_associated_function (Ty.path "erc721::Env") "caller" [] in - let* α1 := M.get_associated_function (Ty.path "erc721::Erc721") "env" [] in + let* α0 := M.get_associated_function (Ty.path "erc721::Env") "caller" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc721::Erc721") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -1731,11 +1922,14 @@ Module Impl_erc721_Erc721. let* α0 := M.get_trait_method "core::ops::try_trait::Try" - (Ty.apply (Ty.path "core::result::Result") [ Ty.tuple []; Ty.path "erc721::Error" ]) + (Ty.apply (Ty.path "core::result::Result") [ Ty.tuple []; Ty.path "erc721::Error" ] []) + [] [] "branch" + [] [] in - let* α1 := M.get_associated_function (Ty.path "erc721::Erc721") "transfer_token_from" [] in + let* α1 := + M.get_associated_function (Ty.path "erc721::Erc721") "transfer_token_from" [] [] in let* α2 := M.read self in let* α3 := M.read id in let* α4 := M.call_closure α1 [ α2; caller; destination; α3 ] in @@ -1756,13 +1950,17 @@ Module Impl_erc721_Erc721. "core::ops::try_trait::FromResidual" (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "erc721::Error" ]) + [ Ty.tuple []; Ty.path "erc721::Error" ] + []) [ Ty.apply (Ty.path "core::result::Result") [ Ty.path "core::convert::Infallible"; Ty.path "erc721::Error" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -1808,11 +2006,14 @@ Module Impl_erc721_Erc721. let* α0 := M.get_trait_method "core::ops::try_trait::Try" - (Ty.apply (Ty.path "core::result::Result") [ Ty.tuple []; Ty.path "erc721::Error" ]) + (Ty.apply (Ty.path "core::result::Result") [ Ty.tuple []; Ty.path "erc721::Error" ] []) + [] [] "branch" + [] [] in - let* α1 := M.get_associated_function (Ty.path "erc721::Erc721") "transfer_token_from" [] in + let* α1 := + M.get_associated_function (Ty.path "erc721::Erc721") "transfer_token_from" [] [] in let* α2 := M.read self in let* α3 := M.read id in let* α4 := M.call_closure α1 [ α2; from; to; α3 ] in @@ -1833,13 +2034,17 @@ Module Impl_erc721_Erc721. "core::ops::try_trait::FromResidual" (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "erc721::Error" ]) + [ Ty.tuple []; Ty.path "erc721::Error" ] + []) [ Ty.apply (Ty.path "core::result::Result") [ Ty.path "core::convert::Infallible"; Ty.path "erc721::Error" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -1882,8 +2087,8 @@ Module Impl_erc721_Erc721. let* self := M.alloc self in let* id := M.alloc id in let* caller := - let* α0 := M.get_associated_function (Ty.path "erc721::Env") "caller" [] in - let* α1 := M.get_associated_function (Ty.path "erc721::Erc721") "env" [] in + let* α0 := M.get_associated_function (Ty.path "erc721::Env") "caller" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc721::Erc721") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -1893,11 +2098,13 @@ Module Impl_erc721_Erc721. let* α0 := M.get_trait_method "core::ops::try_trait::Try" - (Ty.apply (Ty.path "core::result::Result") [ Ty.tuple []; Ty.path "erc721::Error" ]) + (Ty.apply (Ty.path "core::result::Result") [ Ty.tuple []; Ty.path "erc721::Error" ] []) + [] [] "branch" + [] [] in - let* α1 := M.get_associated_function (Ty.path "erc721::Erc721") "add_token_to" [] in + let* α1 := M.get_associated_function (Ty.path "erc721::Erc721") "add_token_to" [] [] in let* α2 := M.read self in let* α3 := M.read id in let* α4 := M.call_closure α1 [ α2; caller; α3 ] in @@ -1918,13 +2125,17 @@ Module Impl_erc721_Erc721. "core::ops::try_trait::FromResidual" (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "erc721::Error" ]) + [ Ty.tuple []; Ty.path "erc721::Error" ] + []) [ Ty.apply (Ty.path "core::result::Result") [ Ty.path "core::convert::Infallible"; Ty.path "erc721::Error" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -1942,8 +2153,8 @@ Module Impl_erc721_Erc721. M.pure val ] in let* _ := - let* α0 := M.get_associated_function (Ty.path "erc721::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "erc721::Erc721") "env" [] in + let* α0 := M.get_associated_function (Ty.path "erc721::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "erc721::Erc721") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -1951,8 +2162,10 @@ Module Impl_erc721_Erc721. M.get_trait_method "core::convert::From" (Ty.path "erc721::AccountId") - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] + [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ] ] + [] "from" + [] [] in let* α6 := M.call_closure α5 [ repeat (Value.Integer Integer.U8 0) 32 ] in let* α7 := M.read caller in diff --git a/CoqOfRust/examples/default/examples/ink_contracts/flipper.v b/CoqOfRust/examples/default/examples/ink_contracts/flipper.v index 6e3056d22..ba97d55e2 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/flipper.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/flipper.v @@ -35,8 +35,9 @@ Module Impl_flipper_Flipper. Definition new_default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_associated_function (Ty.path "flipper::Flipper") "new" [] in - let* α1 := M.get_trait_method "core::default::Default" (Ty.path "bool") [] "default" [] in + let* α0 := M.get_associated_function (Ty.path "flipper::Flipper") "new" [] [] in + let* α1 := + M.get_trait_method "core::default::Default" (Ty.path "bool") [] [] "default" [] [] in let* α2 := M.call_closure α1 [] in M.call_closure α0 [ α2 ] | _, _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/ink_contracts/incrementer.v b/CoqOfRust/examples/default/examples/ink_contracts/incrementer.v index fdb6acaec..8ea6a7c54 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/incrementer.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/incrementer.v @@ -35,8 +35,9 @@ Module Impl_incrementer_Incrementer. Definition new_default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_associated_function (Ty.path "incrementer::Incrementer") "new" [] in - let* α1 := M.get_trait_method "core::default::Default" (Ty.path "i32") [] "default" [] in + let* α0 := M.get_associated_function (Ty.path "incrementer::Incrementer") "new" [] [] in + let* α1 := + M.get_trait_method "core::default::Default" (Ty.path "i32") [] [] "default" [] [] in let* α2 := M.call_closure α1 [] in M.call_closure α0 [ α2 ] | _, _ => M.impossible 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 0ddf4cc67..8aeae7595 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 @@ -17,7 +17,8 @@ Module Impl_core_default_Default_for_call_builder_AccountId. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructTuple "call_builder::AccountId" [ α1 ]) | _, _ => M.impossible @@ -63,7 +64,9 @@ End Impl_core_marker_Copy_for_call_builder_AccountId. Axiom Balance : (Ty.path "call_builder::Balance") = (Ty.path "u128"). -Axiom Hash : (Ty.path "call_builder::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u8" ]). +Axiom Hash : + (Ty.path "call_builder::Hash") = + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]). (* Enum LangError *) (* { @@ -97,7 +100,16 @@ Module Impl_call_builder_Selector. unimplemented!() } *) - Parameter new : (list Ty.t) -> (list Value.t) -> M. + Definition new (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ bytes ] => + let* bytes := M.alloc bytes in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_new : M.IsAssociatedFunction Self "new" new. End Impl_call_builder_Selector. @@ -144,7 +156,9 @@ Module Impl_call_builder_CallBuilderTest. "core::default::Default" (Ty.path "call_builder::CallBuilderTest") [] + [] "default" + [] [] in M.call_closure α0 [] | _, _ => M.impossible @@ -178,7 +192,7 @@ Module Impl_call_builder_CallBuilderTest. let* address := M.alloc address in let* selector := M.alloc selector in let* result := - let* α0 := M.get_function "core::panicking::panic" [] in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in let* α1 := M.read (mk_str "not yet implemented") in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.never_to_any α2 in @@ -199,8 +213,9 @@ Module Impl_call_builder_CallBuilderTest. fun γ => let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in - let* α0 := M.get_function "core::panicking::panic_fmt" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "core::panicking::panic_fmt" [] [ Value.Bool true ] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α4 := (* Unsize *) let* α2 := @@ -212,7 +227,7 @@ Module Impl_call_builder_CallBuilderTest. let* α8 := (* Unsize *) let* α5 := - M.get_associated_function (Ty.path "core::fmt::rt::Argument") "none" [] in + M.get_associated_function (Ty.path "core::fmt::rt::Argument") "none" [] [] in let* α6 := M.call_closure α5 [] in let* α7 := M.alloc α6 in M.pure (M.pointer_coercion α7) in 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 ad36897de..8dfab10de 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 @@ -2,7 +2,8 @@ Require Import CoqOfRust.CoqOfRust. Axiom Hash : - (Ty.path "call_builder_delegate::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u8" ]). + (Ty.path "call_builder_delegate::Hash") = + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]). (* Enum LangError *) (* { @@ -33,7 +34,8 @@ Module Impl_core_default_Default_for_call_builder_delegate_CallBuilderDelegateTe Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "i32") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "i32") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructRecord "call_builder_delegate::CallBuilderDelegateTest" [ ("value", α1) ]) | _, _ => M.impossible 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 40482a96f..1128e0825 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 @@ -17,7 +17,8 @@ Module Impl_core_default_Default_for_constructors_return_value_AccountId. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructTuple "constructors_return_value::AccountId" [ α1 ]) | _, _ => M.impossible @@ -61,7 +62,7 @@ Module Impl_core_marker_Copy_for_constructors_return_value_AccountId. M.IsTraitInstance "core::marker::Copy" Self (* Trait polymorphic types *) [] (* Instance *) []. End Impl_core_marker_Copy_for_constructors_return_value_AccountId. -Module Impl_core_convert_From_array_u8_for_constructors_return_value_AccountId. +Module Impl_core_convert_From_array_u8_32_for_constructors_return_value_AccountId. Definition Self : Ty.t := Ty.path "constructors_return_value::AccountId". (* @@ -69,15 +70,25 @@ Module Impl_core_convert_From_array_u8_for_constructors_return_value_AccountId. unimplemented!() } *) - Parameter from : (list Ty.t) -> (list Value.t) -> M. + Definition from (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ _value ] => + let* _value := M.alloc _value in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom Implements : M.IsTraitInstance "core::convert::From" Self - (* Trait polymorphic types *) [ (* T *) Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] + (* Trait polymorphic types *) + [ (* T *) Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ] ] (* Instance *) [ ("from", InstanceField.Method from) ]. -End Impl_core_convert_From_array_u8_for_constructors_return_value_AccountId. +End Impl_core_convert_From_array_u8_32_for_constructors_return_value_AccountId. Axiom Balance : (Ty.path "constructors_return_value::Balance") = (Ty.path "u128"). @@ -103,10 +114,11 @@ Axiom Balance : (Ty.path "constructors_return_value::Balance") = (Ty.path "u128" Axiom ConstructorResult : forall (T : Ty.t), - (Ty.apply (Ty.path "constructors_return_value::ConstructorResult") [ T ]) = + (Ty.apply (Ty.path "constructors_return_value::ConstructorResult") [ T ] []) = (Ty.apply (Ty.path "core::result::Result") - [ T; Ty.path "constructors_return_value::LangError" ]). + [ T; Ty.path "constructors_return_value::LangError" ] + []). (* StructTuple { @@ -125,7 +137,7 @@ Module Impl_core_fmt_Debug_for_constructors_return_value_ConstructorError. | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] [] in let* α1 := M.read f in let* α2 := M.read (mk_str "ConstructorError") in M.call_closure α0 [ α1; α2 ] @@ -154,7 +166,16 @@ Module Impl_constructors_return_value_ReturnFlags. unimplemented!() } *) - Parameter new_with_reverted : (list Ty.t) -> (list Value.t) -> M. + Definition new_with_reverted (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ has_reverted ] => + let* has_reverted := M.alloc has_reverted in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_new_with_reverted : M.IsAssociatedFunction Self "new_with_reverted" new_with_reverted. @@ -170,7 +191,7 @@ Definition return_value (τ : list Ty.t) (α : list Value.t) : M := | [ R ], [ return_flags; return_value ] => let* return_flags := M.alloc return_flags in let* return_value := M.alloc return_value in - let* α0 := M.get_function "core::panicking::panic" [] in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in let* α1 := M.read (mk_str "not implemented") in M.call_closure α0 [ α1 ] | _, _ => M.impossible @@ -223,6 +244,7 @@ Module Impl_constructors_return_value_ConstructorsReturnValue. M.get_associated_function (Ty.path "constructors_return_value::ConstructorsReturnValue") "new" + [] [] in let* α1 := M.call_closure α0 [ Value.Bool true ] in M.alloc (Value.StructTuple "core::result::Result::Ok" [ α1 ]); @@ -260,19 +282,24 @@ Module Impl_constructors_return_value_ConstructorsReturnValue. Ty.path "constructors_return_value::AccountId"; Ty.path "constructors_return_value::LangError" ] - ] in + [] + ] + [] in let* α1 := M.get_associated_function (Ty.path "constructors_return_value::ReturnFlags") "new_with_reverted" + [] [] in let* α2 := M.call_closure α1 [ Value.Bool true ] in let* α3 := M.get_trait_method "core::convert::From" (Ty.path "constructors_return_value::AccountId") - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] + [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ] ] + [] "from" + [] [] in let* α4 := M.call_closure α3 [ repeat (Value.Integer Integer.U8 0) 32 ] in let* α5 := M.alloc (Value.StructTuple "core::result::Result::Ok" [ α4 ]) in @@ -316,8 +343,11 @@ Module Impl_constructors_return_value_ConstructorsReturnValue. M.get_trait_method "core::convert::From" (Ty.path "constructors_return_value::AccountId") - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] + [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ] + ] + [] "from" + [] [] in let* α1 := M.call_closure α0 [ repeat (Value.Integer Integer.U8 0) 32 ] in M.alloc @@ -344,14 +374,18 @@ Module Impl_constructors_return_value_ConstructorsReturnValue. [ Ty.path "constructors_return_value::AccountId"; Ty.path "constructors_return_value::ConstructorError" - ]; + ] + []; Ty.path "constructors_return_value::LangError" ] - ] in + [] + ] + [] in let* α1 := M.get_associated_function (Ty.path "constructors_return_value::ReturnFlags") "new_with_reverted" + [] [] in let* α2 := M.call_closure α1 [ Value.Bool true ] in let* α3 := M.call_closure α0 [ α2; value ] in 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 1721e3bde..318170448 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 @@ -17,7 +17,8 @@ Module Impl_core_default_Default_for_contract_ref_AccountId. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructTuple "contract_ref::AccountId" [ α1 ]) | _, _ => M.impossible @@ -63,7 +64,9 @@ End Impl_core_marker_Copy_for_contract_ref_AccountId. Axiom Balance : (Ty.path "contract_ref::Balance") = (Ty.path "u128"). -Axiom Hash : (Ty.path "contract_ref::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u8" ]). +Axiom Hash : + (Ty.path "contract_ref::Hash") = + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]). (* StructRecord { @@ -96,7 +99,7 @@ Module Impl_core_fmt_Debug_for_contract_ref_FlipperError. | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] [] in let* α1 := M.read f in let* α2 := M.read (mk_str "FlipperError") in M.call_closure α0 [ α1; α2 ] @@ -119,7 +122,15 @@ Module Impl_contract_ref_FlipperRef. unimplemented!() } *) - Parameter init_env : (list Ty.t) -> (list Value.t) -> M. + Definition init_env (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [] => + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_init_env : M.IsAssociatedFunction Self "init_env" init_env. @@ -132,7 +143,7 @@ Module Impl_contract_ref_FlipperRef. match τ, α with | [], [ self ] => let* self := M.alloc self in - let* α0 := M.get_associated_function (Ty.path "contract_ref::FlipperRef") "init_env" [] in + let* α0 := M.get_associated_function (Ty.path "contract_ref::FlipperRef") "init_env" [] [] in M.call_closure α0 [] | _, _ => M.impossible end. @@ -163,8 +174,9 @@ Module Impl_contract_ref_FlipperRef. Definition new_default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_associated_function (Ty.path "contract_ref::FlipperRef") "new" [] in - let* α1 := M.get_trait_method "core::default::Default" (Ty.path "bool") [] "default" [] in + let* α0 := M.get_associated_function (Ty.path "contract_ref::FlipperRef") "new" [] [] in + let* α1 := + M.get_trait_method "core::default::Default" (Ty.path "bool") [] [] "default" [] [] in let* α2 := M.call_closure α1 [] in M.call_closure α0 [ α2 ] | _, _ => M.impossible @@ -195,7 +207,8 @@ Module Impl_contract_ref_FlipperRef. let* _ := let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Bool true) in - let* α0 := M.get_associated_function (Ty.path "contract_ref::FlipperRef") "new" [] in + let* α0 := + M.get_associated_function (Ty.path "contract_ref::FlipperRef") "new" [] [] in let* α1 := M.call_closure α0 [ Value.Bool true ] in M.alloc (Value.StructTuple "core::result::Result::Ok" [ α1 ]); fun γ => @@ -278,13 +291,13 @@ Module Impl_contract_ref_ContractRef. let* version := M.alloc version in let* flipper_code_hash := M.alloc flipper_code_hash in let* salt := - let* α0 := M.get_associated_function (Ty.path "u32") "to_le_bytes" [] in + let* α0 := M.get_associated_function (Ty.path "u32") "to_le_bytes" [] [ Value.Bool true ] in let* α1 := M.read version in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* flipper := let* α0 := - M.get_associated_function (Ty.path "contract_ref::FlipperRef") "new_default" [] in + M.get_associated_function (Ty.path "contract_ref::FlipperRef") "new_default" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* α0 := M.read flipper in @@ -320,7 +333,7 @@ Module Impl_contract_ref_ContractRef. let* flipper_code_hash := M.alloc flipper_code_hash in let* succeed := M.alloc succeed in let* salt := - let* α0 := M.get_associated_function (Ty.path "u32") "to_le_bytes" [] in + let* α0 := M.get_associated_function (Ty.path "u32") "to_le_bytes" [] [ Value.Bool true ] in let* α1 := M.read version in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -329,10 +342,12 @@ Module Impl_contract_ref_ContractRef. M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "contract_ref::FlipperRef"; Ty.path "contract_ref::FlipperError" ]) + [ Ty.path "contract_ref::FlipperRef"; Ty.path "contract_ref::FlipperError" ] + []) "unwrap" + [] [] in - let* α1 := M.get_associated_function (Ty.path "contract_ref::FlipperRef") "try_new" [] in + let* α1 := M.get_associated_function (Ty.path "contract_ref::FlipperRef") "try_new" [] [] in let* α2 := M.read succeed in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in @@ -355,7 +370,7 @@ Module Impl_contract_ref_ContractRef. | [], [ self ] => let* self := M.alloc self in let* _ := - let* α0 := M.get_associated_function (Ty.path "contract_ref::FlipperRef") "flip" [] in + let* α0 := M.get_associated_function (Ty.path "contract_ref::FlipperRef") "flip" [] [] in let* α1 := M.read self in let* α2 := M.call_closure @@ -378,7 +393,7 @@ Module Impl_contract_ref_ContractRef. match τ, α with | [], [ self ] => let* self := M.alloc self in - let* α0 := M.get_associated_function (Ty.path "contract_ref::FlipperRef") "get" [] in + let* α0 := M.get_associated_function (Ty.path "contract_ref::FlipperRef") "get" [] [] in let* α1 := M.read self in M.call_closure α0 [ M.get_struct_record_field α1 "contract_ref::ContractRef" "flipper" ] | _, _ => M.impossible 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 fffcf217e..c73da6af8 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 @@ -25,7 +25,7 @@ Module Impl_core_fmt_Debug_for_integration_flipper_FlipperError. | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] [] in let* α1 := M.read f in let* α2 := M.read (mk_str "FlipperError") in M.call_closure α0 [ α1; α2 ] @@ -67,8 +67,9 @@ Module Impl_integration_flipper_Flipper. Definition new_default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_associated_function (Ty.path "integration_flipper::Flipper") "new" [] in - let* α1 := M.get_trait_method "core::default::Default" (Ty.path "bool") [] "default" [] in + let* α0 := M.get_associated_function (Ty.path "integration_flipper::Flipper") "new" [] [] in + let* α1 := + M.get_trait_method "core::default::Default" (Ty.path "bool") [] [] "default" [] [] in let* α2 := M.call_closure α1 [] in M.call_closure α0 [ α2 ] | _, _ => M.impossible @@ -100,7 +101,7 @@ Module Impl_integration_flipper_Flipper. let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Bool true) in let* α0 := - M.get_associated_function (Ty.path "integration_flipper::Flipper") "new" [] in + M.get_associated_function (Ty.path "integration_flipper::Flipper") "new" [] [] in let* α1 := M.call_closure α0 [ Value.Bool true ] in M.alloc (Value.StructTuple "core::result::Result::Ok" [ α1 ]); fun γ => @@ -165,7 +166,8 @@ Module Impl_integration_flipper_Flipper. | [], [ self ] => let* self := M.alloc self in let* _ := - let* α0 := M.get_associated_function (Ty.path "integration_flipper::Flipper") "flip" [] in + let* α0 := + M.get_associated_function (Ty.path "integration_flipper::Flipper") "flip" [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in 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 82e4e19e3..dc14601d7 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/mapping_integration_tests.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/mapping_integration_tests.v @@ -7,14 +7,14 @@ Require Import CoqOfRust.CoqOfRust. ty_params := [ "K"; "V" ]; fields := [ - ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ]); - ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []); + ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) ]; } *) Module Impl_core_default_Default_for_mapping_integration_tests_Mapping_K_V. Definition Self (K V : Ty.t) : Ty.t := - Ty.apply (Ty.path "mapping_integration_tests::Mapping") [ K; V ]. + Ty.apply (Ty.path "mapping_integration_tests::Mapping") [ K; V ] []. (* Default @@ -26,17 +26,21 @@ Module Impl_core_default_Default_for_mapping_integration_tests_Mapping_K_V. let* α0 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "core::marker::PhantomData") [ K ]) + (Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []) + [] [] "default" + [] [] in let* α1 := M.call_closure α0 [] in let* α2 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + (Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) + [] [] "default" + [] [] in let* α3 := M.call_closure α2 [] in M.pure @@ -55,14 +59,25 @@ End Impl_core_default_Default_for_mapping_integration_tests_Mapping_K_V. Module Impl_mapping_integration_tests_Mapping_K_V. Definition Self (K V : Ty.t) : Ty.t := - Ty.apply (Ty.path "mapping_integration_tests::Mapping") [ K; V ]. + Ty.apply (Ty.path "mapping_integration_tests::Mapping") [ K; V ] []. (* fn contains(&self, _key: &K) -> bool { unimplemented!() } *) - Parameter contains : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition contains (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_contains : forall (K V : Ty.t), @@ -73,7 +88,18 @@ Module Impl_mapping_integration_tests_Mapping_K_V. unimplemented!() } *) - Parameter get : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition get (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_get : forall (K V : Ty.t), @@ -84,7 +110,19 @@ Module Impl_mapping_integration_tests_Mapping_K_V. unimplemented!() } *) - Parameter insert : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition insert (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key; _value ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* _value := M.alloc _value in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_insert : forall (K V : Ty.t), @@ -95,7 +133,16 @@ Module Impl_mapping_integration_tests_Mapping_K_V. unimplemented!() } *) - Parameter new : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition new (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [] => + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_new : forall (K V : Ty.t), @@ -106,7 +153,18 @@ Module Impl_mapping_integration_tests_Mapping_K_V. unimplemented!() } *) - Parameter remove : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition remove (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_remove : forall (K V : Ty.t), @@ -117,7 +175,18 @@ Module Impl_mapping_integration_tests_Mapping_K_V. unimplemented!() } *) - Parameter size : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition size (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_size : forall (K V : Ty.t), @@ -128,7 +197,18 @@ Module Impl_mapping_integration_tests_Mapping_K_V. unimplemented!() } *) - Parameter take : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition take (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_take : forall (K V : Ty.t), @@ -151,7 +231,8 @@ Module Impl_core_default_Default_for_mapping_integration_tests_AccountId. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructTuple "mapping_integration_tests::AccountId" [ α1 ]) | _, _ => M.impossible @@ -233,7 +314,8 @@ End Impl_mapping_integration_tests_Env. ("balances", Ty.apply (Ty.path "mapping_integration_tests::Mapping") - [ Ty.path "mapping_integration_tests::AccountId"; Ty.path "u128" ]) + [ Ty.path "mapping_integration_tests::AccountId"; Ty.path "u128" ] + []) ]; } *) @@ -251,9 +333,12 @@ Module Impl_core_default_Default_for_mapping_integration_tests_Mappings. "core::default::Default" (Ty.apply (Ty.path "mapping_integration_tests::Mapping") - [ Ty.path "mapping_integration_tests::AccountId"; Ty.path "u128" ]) + [ Ty.path "mapping_integration_tests::AccountId"; Ty.path "u128" ] + []) + [] [] "default" + [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructRecord "mapping_integration_tests::Mappings" [ ("balances", α1) ]) @@ -276,7 +361,15 @@ Module Impl_mapping_integration_tests_Mappings. unimplemented!() } *) - Parameter init_env : (list Ty.t) -> (list Value.t) -> M. + Definition init_env (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [] => + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_init_env : M.IsAssociatedFunction Self "init_env" init_env. @@ -285,7 +378,15 @@ Module Impl_mapping_integration_tests_Mappings. unimplemented!() } *) - Parameter env : (list Ty.t) -> (list Value.t) -> M. + Definition env (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [] => + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_env : M.IsAssociatedFunction Self "env" env. @@ -304,9 +405,12 @@ Module Impl_mapping_integration_tests_Mappings. "core::default::Default" (Ty.apply (Ty.path "mapping_integration_tests::Mapping") - [ Ty.path "mapping_integration_tests::AccountId"; Ty.path "u128" ]) + [ Ty.path "mapping_integration_tests::AccountId"; Ty.path "u128" ] + []) + [] [] "default" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in @@ -331,9 +435,9 @@ Module Impl_mapping_integration_tests_Mappings. let* self := M.alloc self in let* caller := let* α0 := - M.get_associated_function (Ty.path "mapping_integration_tests::Env") "caller" [] in + M.get_associated_function (Ty.path "mapping_integration_tests::Env") "caller" [] [] in let* α1 := - M.get_associated_function (Ty.path "mapping_integration_tests::Mappings") "env" [] in + M.get_associated_function (Ty.path "mapping_integration_tests::Mappings") "env" [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.alloc α2 in let* α4 := M.call_closure α0 [ α3 ] in @@ -342,8 +446,10 @@ Module Impl_mapping_integration_tests_Mappings. M.get_associated_function (Ty.apply (Ty.path "mapping_integration_tests::Mapping") - [ Ty.path "mapping_integration_tests::AccountId"; Ty.path "u128" ]) + [ Ty.path "mapping_integration_tests::AccountId"; Ty.path "u128" ] + []) "get" + [] [] in let* α1 := M.read self in let* α2 := @@ -371,9 +477,9 @@ Module Impl_mapping_integration_tests_Mappings. let* value := M.alloc value in let* caller := let* α0 := - M.get_associated_function (Ty.path "mapping_integration_tests::Env") "caller" [] in + M.get_associated_function (Ty.path "mapping_integration_tests::Env") "caller" [] [] in let* α1 := - M.get_associated_function (Ty.path "mapping_integration_tests::Mappings") "env" [] in + M.get_associated_function (Ty.path "mapping_integration_tests::Mappings") "env" [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.alloc α2 in let* α4 := M.call_closure α0 [ α3 ] in @@ -382,8 +488,10 @@ Module Impl_mapping_integration_tests_Mappings. M.get_associated_function (Ty.apply (Ty.path "mapping_integration_tests::Mapping") - [ Ty.path "mapping_integration_tests::AccountId"; Ty.path "u128" ]) + [ Ty.path "mapping_integration_tests::AccountId"; Ty.path "u128" ] + []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read caller in @@ -413,9 +521,9 @@ Module Impl_mapping_integration_tests_Mappings. let* self := M.alloc self in let* caller := let* α0 := - M.get_associated_function (Ty.path "mapping_integration_tests::Env") "caller" [] in + M.get_associated_function (Ty.path "mapping_integration_tests::Env") "caller" [] [] in let* α1 := - M.get_associated_function (Ty.path "mapping_integration_tests::Mappings") "env" [] in + M.get_associated_function (Ty.path "mapping_integration_tests::Mappings") "env" [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.alloc α2 in let* α4 := M.call_closure α0 [ α3 ] in @@ -424,8 +532,10 @@ Module Impl_mapping_integration_tests_Mappings. M.get_associated_function (Ty.apply (Ty.path "mapping_integration_tests::Mapping") - [ Ty.path "mapping_integration_tests::AccountId"; Ty.path "u128" ]) + [ Ty.path "mapping_integration_tests::AccountId"; Ty.path "u128" ] + []) "size" + [] [] in let* α1 := M.read self in let* α2 := M.read caller in @@ -452,9 +562,9 @@ Module Impl_mapping_integration_tests_Mappings. let* self := M.alloc self in let* caller := let* α0 := - M.get_associated_function (Ty.path "mapping_integration_tests::Env") "caller" [] in + M.get_associated_function (Ty.path "mapping_integration_tests::Env") "caller" [] [] in let* α1 := - M.get_associated_function (Ty.path "mapping_integration_tests::Mappings") "env" [] in + M.get_associated_function (Ty.path "mapping_integration_tests::Mappings") "env" [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.alloc α2 in let* α4 := M.call_closure α0 [ α3 ] in @@ -463,8 +573,10 @@ Module Impl_mapping_integration_tests_Mappings. M.get_associated_function (Ty.apply (Ty.path "mapping_integration_tests::Mapping") - [ Ty.path "mapping_integration_tests::AccountId"; Ty.path "u128" ]) + [ Ty.path "mapping_integration_tests::AccountId"; Ty.path "u128" ] + []) "contains" + [] [] in let* α1 := M.read self in let* α2 := @@ -492,9 +604,9 @@ Module Impl_mapping_integration_tests_Mappings. let* self := M.alloc self in let* caller := let* α0 := - M.get_associated_function (Ty.path "mapping_integration_tests::Env") "caller" [] in + M.get_associated_function (Ty.path "mapping_integration_tests::Env") "caller" [] [] in let* α1 := - M.get_associated_function (Ty.path "mapping_integration_tests::Mappings") "env" [] in + M.get_associated_function (Ty.path "mapping_integration_tests::Mappings") "env" [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.alloc α2 in let* α4 := M.call_closure α0 [ α3 ] in @@ -504,8 +616,10 @@ Module Impl_mapping_integration_tests_Mappings. M.get_associated_function (Ty.apply (Ty.path "mapping_integration_tests::Mapping") - [ Ty.path "mapping_integration_tests::AccountId"; Ty.path "u128" ]) + [ Ty.path "mapping_integration_tests::AccountId"; Ty.path "u128" ] + []) "remove" + [] [] in let* α1 := M.read self in let* α2 := M.read caller in @@ -534,9 +648,9 @@ Module Impl_mapping_integration_tests_Mappings. let* self := M.alloc self in let* caller := let* α0 := - M.get_associated_function (Ty.path "mapping_integration_tests::Env") "caller" [] in + M.get_associated_function (Ty.path "mapping_integration_tests::Env") "caller" [] [] in let* α1 := - M.get_associated_function (Ty.path "mapping_integration_tests::Mappings") "env" [] in + M.get_associated_function (Ty.path "mapping_integration_tests::Mappings") "env" [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.alloc α2 in let* α4 := M.call_closure α0 [ α3 ] in @@ -545,8 +659,10 @@ Module Impl_mapping_integration_tests_Mappings. M.get_associated_function (Ty.apply (Ty.path "mapping_integration_tests::Mapping") - [ Ty.path "mapping_integration_tests::AccountId"; Ty.path "u128" ]) + [ Ty.path "mapping_integration_tests::AccountId"; Ty.path "u128" ] + []) "take" + [] [] in let* α1 := M.read self in let* α2 := M.read caller in diff --git a/CoqOfRust/examples/default/examples/ink_contracts/mother.v b/CoqOfRust/examples/default/examples/ink_contracts/mother.v index 523e926a7..4828b55bf 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/mother.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/mother.v @@ -7,13 +7,13 @@ Require Import CoqOfRust.CoqOfRust. ty_params := [ "K"; "V" ]; fields := [ - ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ]); - ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []); + ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) ]; } *) Module Impl_core_default_Default_for_mother_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "mother::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "mother::Mapping") [ K; V ] []. (* Default @@ -25,17 +25,21 @@ Module Impl_core_default_Default_for_mother_Mapping_K_V. let* α0 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "core::marker::PhantomData") [ K ]) + (Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []) + [] [] "default" + [] [] in let* α1 := M.call_closure α0 [] in let* α2 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + (Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) + [] [] "default" + [] [] in let* α3 := M.call_closure α2 [] in M.pure (Value.StructRecord "mother::Mapping" [ ("_key", α1); ("_value", α3) ]) @@ -52,14 +56,25 @@ Module Impl_core_default_Default_for_mother_Mapping_K_V. End Impl_core_default_Default_for_mother_Mapping_K_V. Module Impl_mother_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "mother::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "mother::Mapping") [ K; V ] []. (* fn get(&self, _key: &K) -> Option { unimplemented!() } *) - Parameter get : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition get (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_get : forall (K V : Ty.t), @@ -70,7 +85,19 @@ Module Impl_mother_Mapping_K_V. unimplemented!() } *) - Parameter insert : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition insert (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key; _value ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* _value := M.alloc _value in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_insert : forall (K V : Ty.t), @@ -93,7 +120,8 @@ Module Impl_core_default_Default_for_mother_AccountId. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructTuple "mother::AccountId" [ α1 ]) | _, _ => M.impossible @@ -215,7 +243,9 @@ Axiom Balance : (Ty.path "mother::Balance") = (Ty.path "u128"). Axiom BlockNumber : (Ty.path "mother::BlockNumber") = (Ty.path "u32"). -Axiom Hash : (Ty.path "mother::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u8" ]). +Axiom Hash : + (Ty.path "mother::Hash") = + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]). (* StructRecord { @@ -238,11 +268,14 @@ Axiom Hash : (Ty.path "mother::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u [ Ty.apply (Ty.path "core::option::Option") - [ Ty.tuple [ Ty.path "mother::AccountId"; Ty.path "u128" ] ]; + [ Ty.tuple [ Ty.path "mother::AccountId"; Ty.path "u128" ] ] + []; Ty.path "alloc::alloc::Global" - ]; + ] + []; Ty.path "alloc::alloc::Global" ] + [] ]; } *) @@ -266,13 +299,18 @@ Module Impl_core_default_Default_for_mother_Bids. [ Ty.apply (Ty.path "core::option::Option") - [ Ty.tuple [ Ty.path "mother::AccountId"; Ty.path "u128" ] ]; + [ Ty.tuple [ Ty.path "mother::AccountId"; Ty.path "u128" ] ] + []; Ty.path "alloc::alloc::Global" - ]; + ] + []; Ty.path "alloc::alloc::Global" - ]) + ] + []) + [] [] "default" + [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructTuple "mother::Bids" [ α1 ]) @@ -320,11 +358,14 @@ Module Impl_core_cmp_PartialEq_for_mother_Bids. [ Ty.apply (Ty.path "core::option::Option") - [ Ty.tuple [ Ty.path "mother::AccountId"; Ty.path "u128" ] ]; + [ Ty.tuple [ Ty.path "mother::AccountId"; Ty.path "u128" ] ] + []; Ty.path "alloc::alloc::Global" - ]; + ] + []; Ty.path "alloc::alloc::Global" - ]) + ] + []) [ Ty.apply (Ty.path "alloc::vec::Vec") @@ -334,13 +375,18 @@ Module Impl_core_cmp_PartialEq_for_mother_Bids. [ Ty.apply (Ty.path "core::option::Option") - [ Ty.tuple [ Ty.path "mother::AccountId"; Ty.path "u128" ] ]; + [ Ty.tuple [ Ty.path "mother::AccountId"; Ty.path "u128" ] ] + []; Ty.path "alloc::alloc::Global" - ]; + ] + []; Ty.path "alloc::alloc::Global" ] + [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read self in let* α2 := M.read other in @@ -416,13 +462,18 @@ Module Impl_core_clone_Clone_for_mother_Bids. [ Ty.apply (Ty.path "core::option::Option") - [ Ty.tuple [ Ty.path "mother::AccountId"; Ty.path "u128" ] ]; + [ Ty.tuple [ Ty.path "mother::AccountId"; Ty.path "u128" ] ] + []; Ty.path "alloc::alloc::Global" - ]; + ] + []; Ty.path "alloc::alloc::Global" - ]) + ] + []) + [] [] "clone" + [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ M.get_struct_tuple_field α1 "mother::Bids" 0 ] in @@ -485,13 +536,13 @@ Module Impl_core_cmp_PartialEq_for_mother_Outline. let* other := M.alloc other in let* __self_tag := let* α0 := - M.get_function "core::intrinsics::discriminant_value" [ Ty.path "mother::Outline" ] in + M.get_function "core::intrinsics::discriminant_value" [ Ty.path "mother::Outline" ] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* __arg1_tag := let* α0 := - M.get_function "core::intrinsics::discriminant_value" [ Ty.path "mother::Outline" ] in + M.get_function "core::intrinsics::discriminant_value" [ Ty.path "mother::Outline" ] [] in let* α1 := M.read other in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -637,13 +688,13 @@ Module Impl_core_cmp_PartialEq_for_mother_Status. let* other := M.alloc other in let* __self_tag := let* α0 := - M.get_function "core::intrinsics::discriminant_value" [ Ty.path "mother::Status" ] in + M.get_function "core::intrinsics::discriminant_value" [ Ty.path "mother::Status" ] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* __arg1_tag := let* α0 := - M.get_function "core::intrinsics::discriminant_value" [ Ty.path "mother::Status" ] in + M.get_function "core::intrinsics::discriminant_value" [ Ty.path "mother::Status" ] [] in let* α1 := M.read other in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -691,7 +742,9 @@ Module Impl_core_cmp_PartialEq_for_mother_Status. "core::cmp::PartialEq" (Ty.path "mother::Outline") [ Ty.path "mother::Outline" ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read __self_0 in let* α2 := M.read __arg1_0 in @@ -795,7 +848,8 @@ Module Impl_core_clone_Clone_for_mother_Status. let* γ1_0 := M.get_struct_tuple_field_or_break_match γ "mother::Status::EndingPeriod" 0 in let* __self_0 := M.alloc γ1_0 in - let* α0 := M.get_trait_method "core::clone::Clone" (Ty.path "u32") [] "clone" [] in + let* α0 := + M.get_trait_method "core::clone::Clone" (Ty.path "u32") [] [] "clone" [] [] in let* α1 := M.read __self_0 in let* α2 := M.call_closure α0 [ α1 ] in M.alloc (Value.StructTuple "mother::Status::EndingPeriod" [ α2 ]); @@ -804,7 +858,14 @@ Module Impl_core_clone_Clone_for_mother_Status. let* γ1_0 := M.get_struct_tuple_field_or_break_match γ "mother::Status::Ended" 0 in let* __self_0 := M.alloc γ1_0 in let* α0 := - M.get_trait_method "core::clone::Clone" (Ty.path "mother::Outline") [] "clone" [] in + M.get_trait_method + "core::clone::Clone" + (Ty.path "mother::Outline") + [] + [] + "clone" + [] + [] in let* α1 := M.read __self_0 in let* α2 := M.call_closure α0 [ α1 ] in M.alloc (Value.StructTuple "mother::Status::Ended" [ α2 ]); @@ -812,7 +873,8 @@ Module Impl_core_clone_Clone_for_mother_Status. let* γ := M.read γ in let* γ1_0 := M.get_struct_tuple_field_or_break_match γ "mother::Status::RfDelay" 0 in let* __self_0 := M.alloc γ1_0 in - let* α0 := M.get_trait_method "core::clone::Clone" (Ty.path "u32") [] "clone" [] in + let* α0 := + M.get_trait_method "core::clone::Clone" (Ty.path "u32") [] [] "clone" [] [] in let* α1 := M.read __self_0 in let* α2 := M.call_closure α0 [ α1 ] in M.alloc (Value.StructTuple "mother::Status::RfDelay" [ α2 ]) @@ -836,13 +898,13 @@ End Impl_core_clone_Clone_for_mother_Status. fields := [ ("name", Ty.path "alloc::string::String"); - ("subject", Ty.apply (Ty.path "array") [ Ty.path "u8" ]); + ("subject", Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]); ("bids", Ty.path "mother::Bids"); - ("terms", Ty.apply (Ty.path "array") [ Ty.path "u32" ]); + ("terms", Ty.apply (Ty.path "array") [ Ty.path "u32" ] [ Value.Integer Integer.Usize 3 ]); ("status", Ty.path "mother::Status"); ("finalized", Ty.path "bool"); ("vector", - Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ]) + Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] []) ]; } *) @@ -873,7 +935,9 @@ Module Impl_core_cmp_PartialEq_for_mother_Auction. "core::cmp::PartialEq" (Ty.path "alloc::string::String") [ Ty.path "alloc::string::String" ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read self in let* α2 := M.read other in @@ -890,9 +954,11 @@ Module Impl_core_cmp_PartialEq_for_mother_Auction. (let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "array") [ Ty.path "u8" ]) - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]) + [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read self in let* α2 := M.read other in @@ -910,7 +976,9 @@ Module Impl_core_cmp_PartialEq_for_mother_Auction. "core::cmp::PartialEq" (Ty.path "mother::Bids") [ Ty.path "mother::Bids" ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read self in let* α2 := M.read other in @@ -926,9 +994,11 @@ Module Impl_core_cmp_PartialEq_for_mother_Auction. (let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "array") [ Ty.path "u32" ]) - [ Ty.apply (Ty.path "array") [ Ty.path "u32" ] ] + (Ty.apply (Ty.path "array") [ Ty.path "u32" ] [ Value.Integer Integer.Usize 3 ]) + [ Ty.apply (Ty.path "array") [ Ty.path "u32" ] [ Value.Integer Integer.Usize 3 ] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read self in let* α2 := M.read other in @@ -946,7 +1016,9 @@ Module Impl_core_cmp_PartialEq_for_mother_Auction. "core::cmp::PartialEq" (Ty.path "mother::Status") [ Ty.path "mother::Status" ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read self in let* α2 := M.read other in @@ -969,10 +1041,19 @@ Module Impl_core_cmp_PartialEq_for_mother_Auction. (let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ]) - [ Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] + (Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] + []) + [ + Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] + [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read self in let* α2 := M.read other in @@ -1072,44 +1153,58 @@ Module Impl_core_clone_Clone_for_mother_Auction. | [], [ self ] => let* self := M.alloc self in let* α0 := - M.get_trait_method "core::clone::Clone" (Ty.path "alloc::string::String") [] "clone" [] in + M.get_trait_method + "core::clone::Clone" + (Ty.path "alloc::string::String") + [] + [] + "clone" + [] + [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ M.get_struct_record_field α1 "mother::Auction" "name" ] in let* α3 := M.get_trait_method "core::clone::Clone" - (Ty.apply (Ty.path "array") [ Ty.path "u8" ]) + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]) + [] [] "clone" + [] [] in let* α4 := M.read self in let* α5 := M.call_closure α3 [ M.get_struct_record_field α4 "mother::Auction" "subject" ] in - let* α6 := M.get_trait_method "core::clone::Clone" (Ty.path "mother::Bids") [] "clone" [] in + let* α6 := + M.get_trait_method "core::clone::Clone" (Ty.path "mother::Bids") [] [] "clone" [] [] in let* α7 := M.read self in let* α8 := M.call_closure α6 [ M.get_struct_record_field α7 "mother::Auction" "bids" ] in let* α9 := M.get_trait_method "core::clone::Clone" - (Ty.apply (Ty.path "array") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "array") [ Ty.path "u32" ] [ Value.Integer Integer.Usize 3 ]) + [] [] "clone" + [] [] in let* α10 := M.read self in let* α11 := M.call_closure α9 [ M.get_struct_record_field α10 "mother::Auction" "terms" ] in let* α12 := - M.get_trait_method "core::clone::Clone" (Ty.path "mother::Status") [] "clone" [] in + M.get_trait_method "core::clone::Clone" (Ty.path "mother::Status") [] [] "clone" [] [] in let* α13 := M.read self in let* α14 := M.call_closure α12 [ M.get_struct_record_field α13 "mother::Auction" "status" ] in - let* α15 := M.get_trait_method "core::clone::Clone" (Ty.path "bool") [] "clone" [] in + let* α15 := M.get_trait_method "core::clone::Clone" (Ty.path "bool") [] [] "clone" [] [] in let* α16 := M.read self in let* α17 := M.call_closure α15 [ M.get_struct_record_field α16 "mother::Auction" "finalized" ] in let* α18 := M.get_trait_method "core::clone::Clone" - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] []) + [] [] "clone" + [] [] in let* α19 := M.read self in let* α20 := M.call_closure α18 [ M.get_struct_record_field α19 "mother::Auction" "vector" ] in @@ -1160,34 +1255,49 @@ Module Impl_core_default_Default_for_mother_Auction. "core::default::Default" (Ty.path "alloc::string::String") [] + [] "default" + [] [] in let* α1 := M.call_closure α0 [] in let* α2 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "array") [ Ty.path "u8" ]) + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]) + [] [] "default" + [] [] in let* α3 := M.call_closure α2 [] in let* α4 := - M.get_trait_method "core::default::Default" (Ty.path "mother::Bids") [] "default" [] in + M.get_trait_method + "core::default::Default" + (Ty.path "mother::Bids") + [] + [] + "default" + [] + [] in let* α5 := M.call_closure α4 [] in let* α6 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "array") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "array") [ Ty.path "u32" ] [ Value.Integer Integer.Usize 3 ]) + [] [] "default" + [] [] in let* α7 := M.call_closure α6 [] in let* α8 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] []) + [] [] "default" + [] [] in let* α9 := M.call_closure α8 [] in M.pure @@ -1255,13 +1365,13 @@ Module Impl_core_cmp_PartialEq_for_mother_Failure. let* other := M.alloc other in let* __self_tag := let* α0 := - M.get_function "core::intrinsics::discriminant_value" [ Ty.path "mother::Failure" ] in + M.get_function "core::intrinsics::discriminant_value" [ Ty.path "mother::Failure" ] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* __arg1_tag := let* α0 := - M.get_function "core::intrinsics::discriminant_value" [ Ty.path "mother::Failure" ] in + M.get_function "core::intrinsics::discriminant_value" [ Ty.path "mother::Failure" ] [] in let* α1 := M.read other in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -1293,7 +1403,9 @@ Module Impl_core_cmp_PartialEq_for_mother_Failure. "core::cmp::PartialEq" (Ty.path "alloc::string::String") [ Ty.path "alloc::string::String" ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read __self_0 in let* α2 := M.read __arg1_0 in @@ -1395,7 +1507,17 @@ Module Impl_mother_Env. unimplemented!() } *) - Parameter emit_event : (list Ty.t) -> (list Value.t) -> M. + Definition emit_event (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ self; _event ] => + let* self := M.alloc self in + let* _event := M.alloc _event in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_emit_event : M.IsAssociatedFunction Self "emit_event" emit_event. End Impl_mother_Env. @@ -1408,7 +1530,7 @@ End Impl_mother_Env. [ ("auction", Ty.path "mother::Auction"); ("balances", - Ty.apply (Ty.path "mother::Mapping") [ Ty.path "mother::AccountId"; Ty.path "u128" ]) + Ty.apply (Ty.path "mother::Mapping") [ Ty.path "mother::AccountId"; Ty.path "u128" ] []) ]; } *) @@ -1422,14 +1544,23 @@ Module Impl_core_default_Default_for_mother_Mother. match τ, α with | [], [] => let* α0 := - M.get_trait_method "core::default::Default" (Ty.path "mother::Auction") [] "default" [] in + M.get_trait_method + "core::default::Default" + (Ty.path "mother::Auction") + [] + [] + "default" + [] + [] in let* α1 := M.call_closure α0 [] in let* α2 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "mother::Mapping") [ Ty.path "mother::AccountId"; Ty.path "u128" ]) + (Ty.apply (Ty.path "mother::Mapping") [ Ty.path "mother::AccountId"; Ty.path "u128" ] []) + [] [] "default" + [] [] in let* α3 := M.call_closure α2 [] in M.pure (Value.StructRecord "mother::Mother" [ ("auction", α1); ("balances", α3) ]) @@ -1452,7 +1583,15 @@ Module Impl_mother_Mother. unimplemented!() } *) - Parameter init_env : (list Ty.t) -> (list Value.t) -> M. + Definition init_env (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [] => + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_init_env : M.IsAssociatedFunction Self "init_env" init_env. @@ -1465,7 +1604,7 @@ Module Impl_mother_Mother. match τ, α with | [], [ self ] => let* self := M.alloc self in - let* α0 := M.get_associated_function (Ty.path "mother::Mother") "init_env" [] in + let* α0 := M.get_associated_function (Ty.path "mother::Mother") "init_env" [] [] in M.call_closure α0 [] | _, _ => M.impossible end. @@ -1487,9 +1626,11 @@ Module Impl_mother_Mother. let* α0 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "mother::Mapping") [ Ty.path "mother::AccountId"; Ty.path "u128" ]) + (Ty.apply (Ty.path "mother::Mapping") [ Ty.path "mother::AccountId"; Ty.path "u128" ] []) + [] [] "default" + [] [] in let* α1 := M.call_closure α0 [] in let* α2 := M.read auction in @@ -1508,7 +1649,14 @@ Module Impl_mother_Mother. match τ, α with | [], [] => let* α0 := - M.get_trait_method "core::default::Default" (Ty.path "mother::Mother") [] "default" [] in + M.get_trait_method + "core::default::Default" + (Ty.path "mother::Mother") + [] + [] + "default" + [] + [] in M.call_closure α0 [] | _, _ => M.impossible end. @@ -1539,7 +1687,14 @@ Module Impl_mother_Mother. let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Bool true) in let* α0 := - M.get_trait_method "alloc::string::ToString" (Ty.path "str") [] "to_string" [] in + M.get_trait_method + "alloc::string::ToString" + (Ty.path "str") + [] + [] + "to_string" + [] + [] in let* α1 := M.read (mk_str "Reverting instantiation") in let* α2 := M.call_closure α0 [ α1 ] in M.alloc @@ -1552,7 +1707,9 @@ Module Impl_mother_Mother. "core::default::Default" (Ty.path "mother::Mother") [] + [] "default" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc (Value.StructTuple "core::result::Result::Ok" [ α1 ]) @@ -1577,13 +1734,13 @@ Module Impl_mother_Mother. let* self := M.alloc self in let* auction := M.alloc auction in let* _ := - let* α0 := M.get_associated_function (Ty.path "mother::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "mother::Mother") "env" [] in + let* α0 := M.get_associated_function (Ty.path "mother::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "mother::Mother") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in let* α5 := - M.get_trait_method "core::clone::Clone" (Ty.path "mother::Auction") [] "clone" [] in + M.get_trait_method "core::clone::Clone" (Ty.path "mother::Auction") [] [] "clone" [] [] in let* α6 := M.call_closure α5 [ auction ] in let* α7 := M.call_closure @@ -1629,7 +1786,14 @@ Module Impl_mother_Mother. let* γ1_0 := M.get_struct_tuple_field_or_break_match γ0_0 "mother::Failure::Revert" 0 in let* α0 := - M.get_trait_method "alloc::string::ToString" (Ty.path "str") [] "to_string" [] in + M.get_trait_method + "alloc::string::ToString" + (Ty.path "str") + [] + [] + "to_string" + [] + [] in let* α1 := M.read (mk_str "Reverting on user demand!") in let* α2 := M.call_closure α0 [ α1 ] in M.alloc @@ -1642,7 +1806,8 @@ Module Impl_mother_Mother. let* α0 := M.get_function "std::panicking::begin_panic" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.read (mk_str "Trapping on user demand!") in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.never_to_any α2 in @@ -1668,8 +1833,8 @@ Module Impl_mother_Mother. let* _message := M.alloc _message in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "debug_log: ") in @@ -1683,7 +1848,8 @@ Module Impl_mother_Mother. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α7 := M.call_closure α6 [ _message ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in diff --git a/CoqOfRust/examples/default/examples/ink_contracts/multisig.v b/CoqOfRust/examples/default/examples/ink_contracts/multisig.v index 1fe7729c0..197802d90 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/multisig.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/multisig.v @@ -7,13 +7,13 @@ Require Import CoqOfRust.CoqOfRust. ty_params := [ "K"; "V" ]; fields := [ - ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ]); - ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []); + ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) ]; } *) Module Impl_core_default_Default_for_multisig_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "multisig::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "multisig::Mapping") [ K; V ] []. (* Default @@ -25,17 +25,21 @@ Module Impl_core_default_Default_for_multisig_Mapping_K_V. let* α0 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "core::marker::PhantomData") [ K ]) + (Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []) + [] [] "default" + [] [] in let* α1 := M.call_closure α0 [] in let* α2 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + (Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) + [] [] "default" + [] [] in let* α3 := M.call_closure α2 [] in M.pure (Value.StructRecord "multisig::Mapping" [ ("_key", α1); ("_value", α3) ]) @@ -52,14 +56,25 @@ Module Impl_core_default_Default_for_multisig_Mapping_K_V. End Impl_core_default_Default_for_multisig_Mapping_K_V. Module Impl_multisig_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "multisig::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "multisig::Mapping") [ K; V ] []. (* fn contains(&self, _key: &K) -> bool { unimplemented!() } *) - Parameter contains : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition contains (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_contains : forall (K V : Ty.t), @@ -70,7 +85,18 @@ Module Impl_multisig_Mapping_K_V. unimplemented!() } *) - Parameter get : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition get (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_get : forall (K V : Ty.t), @@ -81,7 +107,19 @@ Module Impl_multisig_Mapping_K_V. unimplemented!() } *) - Parameter insert : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition insert (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key; _value ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* _value := M.alloc _value in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_insert : forall (K V : Ty.t), @@ -92,7 +130,18 @@ Module Impl_multisig_Mapping_K_V. unimplemented!() } *) - Parameter remove : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition remove (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_remove : forall (K V : Ty.t), @@ -103,7 +152,18 @@ Module Impl_multisig_Mapping_K_V. unimplemented!() } *) - Parameter size : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition size (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_size : forall (K V : Ty.t), @@ -114,7 +174,18 @@ Module Impl_multisig_Mapping_K_V. unimplemented!() } *) - Parameter take : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition take (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_take : forall (K V : Ty.t), @@ -137,7 +208,8 @@ Module Impl_core_default_Default_for_multisig_AccountId. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructTuple "multisig::AccountId" [ α1 ]) | _, _ => M.impossible @@ -163,7 +235,11 @@ Module Impl_core_fmt_Debug_for_multisig_AccountId. let* self := M.alloc self in let* f := M.alloc f in let* α0 := - M.get_associated_function (Ty.path "core::fmt::Formatter") "debug_tuple_field1_finish" [] in + M.get_associated_function + (Ty.path "core::fmt::Formatter") + "debug_tuple_field1_finish" + [] + [] in let* α1 := M.read f in let* α2 := M.read (mk_str "AccountId") in let* α5 := @@ -303,7 +379,9 @@ Module Impl_core_cmp_PartialOrd_for_multisig_AccountId. "core::cmp::PartialOrd" (Ty.path "u128") [ Ty.path "u128" ] + [] "partial_cmp" + [] [] in let* α1 := M.read self in let* α2 := M.read other in @@ -335,7 +413,7 @@ Module Impl_core_cmp_Ord_for_multisig_AccountId. | [], [ self; other ] => let* self := M.alloc self in let* other := M.alloc other in - let* α0 := M.get_trait_method "core::cmp::Ord" (Ty.path "u128") [] "cmp" [] in + let* α0 := M.get_trait_method "core::cmp::Ord" (Ty.path "u128") [] [] "cmp" [] [] in let* α1 := M.read self in let* α2 := M.read other in M.call_closure @@ -375,7 +453,7 @@ Definition value_WRONG_TRANSACTION_ID : Value.t := { name := "CallInput"; ty_params := []; - fields := [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "slice") [ Ty.path "u8" ] ] ]; + fields := [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "slice") [ Ty.path "u8" ] [] ] [] ]; } *) (* Enum ConfirmationStatus *) @@ -433,9 +511,9 @@ End Impl_core_marker_Copy_for_multisig_ConfirmationStatus. fields := [ ("callee", Ty.path "multisig::AccountId"); - ("selector", Ty.apply (Ty.path "array") [ Ty.path "u8" ]); + ("selector", Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 4 ]); ("input", - Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ]); + Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] []); ("transferred_value", Ty.path "u128"); ("gas_limit", Ty.path "u64"); ("allow_reentry", Ty.path "bool") @@ -456,30 +534,39 @@ Module Impl_core_default_Default_for_multisig_Transaction. "core::default::Default" (Ty.path "multisig::AccountId") [] + [] "default" + [] [] in let* α1 := M.call_closure α0 [] in let* α2 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "array") [ Ty.path "u8" ]) + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 4 ]) + [] [] "default" + [] [] in let* α3 := M.call_closure α2 [] in let* α4 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] []) + [] [] "default" + [] [] in let* α5 := M.call_closure α4 [] in - let* α6 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α6 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α7 := M.call_closure α6 [] in - let* α8 := M.get_trait_method "core::default::Default" (Ty.path "u64") [] "default" [] in + let* α8 := + M.get_trait_method "core::default::Default" (Ty.path "u64") [] [] "default" [] [] in let* α9 := M.call_closure α8 [] in - let* α10 := M.get_trait_method "core::default::Default" (Ty.path "bool") [] "default" [] in + let* α10 := + M.get_trait_method "core::default::Default" (Ty.path "bool") [] [] "default" [] [] in let* α11 := M.call_closure α10 [] in M.pure (Value.StructRecord @@ -621,7 +708,10 @@ End Impl_core_cmp_Eq_for_multisig_Error. fields := [ ("transactions", - Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ]); + Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ] + []); ("next_id", Ty.path "u32") ]; } *) @@ -638,12 +728,18 @@ Module Impl_core_default_Default_for_multisig_Transactions. let* α0 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "default" + [] [] in let* α1 := M.call_closure α0 [] in - let* α2 := M.get_trait_method "core::default::Default" (Ty.path "u32") [] "default" [] in + let* α2 := + M.get_trait_method "core::default::Default" (Ty.path "u32") [] [] "default" [] [] in let* α3 := M.call_closure α2 [] in M.pure (Value.StructRecord "multisig::Transactions" [ ("transactions", α1); ("next_id", α3) ]) | _, _ => M.impossible @@ -707,9 +803,12 @@ End Impl_core_default_Default_for_multisig_Transactions. Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] - ]; + [] + ] + []; Ty.path "multisig::Error" - ]) + ] + []) ]; } *) @@ -806,7 +905,17 @@ Module Impl_multisig_Env. unimplemented!() } *) - Parameter emit_event : (list Ty.t) -> (list Value.t) -> M. + Definition emit_event (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ self; _event ] => + let* self := M.alloc self in + let* _event := M.alloc _event in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_emit_event : M.IsAssociatedFunction Self "emit_event" emit_event. @@ -815,7 +924,16 @@ Module Impl_multisig_Env. unimplemented!() } *) - Parameter transferred_value : (list Ty.t) -> (list Value.t) -> M. + Definition transferred_value (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ self ] => + let* self := M.alloc self in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_transferred_value : M.IsAssociatedFunction Self "transferred_value" transferred_value. @@ -825,7 +943,16 @@ Module Impl_multisig_Env. unimplemented!() } *) - Parameter account_id : (list Ty.t) -> (list Value.t) -> M. + Definition account_id (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ self ] => + let* self := M.alloc self in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_account_id : M.IsAssociatedFunction Self "account_id" account_id. End Impl_multisig_Env. @@ -839,20 +966,23 @@ End Impl_multisig_Env. ("confirmations", Ty.apply (Ty.path "multisig::Mapping") - [ Ty.tuple [ Ty.path "u32"; Ty.path "multisig::AccountId" ]; Ty.tuple [] ]); + [ Ty.tuple [ Ty.path "u32"; Ty.path "multisig::AccountId" ]; Ty.tuple [] ] + []); ("confirmation_count", - Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "u32"; Ty.path "u32" ]); + Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "u32"; Ty.path "u32" ] []); ("transactions", Ty.apply (Ty.path "multisig::Mapping") - [ Ty.path "u32"; Ty.path "multisig::Transaction" ]); + [ Ty.path "u32"; Ty.path "multisig::Transaction" ] + []); ("transaction_list", Ty.path "multisig::Transactions"); ("owners", Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ]); + [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ] + []); ("is_owner", - Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "multisig::AccountId"; Ty.tuple [] ]); + Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "multisig::AccountId"; Ty.tuple [] ] []); ("requirement", Ty.path "u32") ]; } *) @@ -871,17 +1001,22 @@ Module Impl_core_default_Default_for_multisig_Multisig. "core::default::Default" (Ty.apply (Ty.path "multisig::Mapping") - [ Ty.tuple [ Ty.path "u32"; Ty.path "multisig::AccountId" ]; Ty.tuple [] ]) + [ Ty.tuple [ Ty.path "u32"; Ty.path "multisig::AccountId" ]; Ty.tuple [] ] + []) + [] [] "default" + [] [] in let* α1 := M.call_closure α0 [] in let* α2 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "u32"; Ty.path "u32" ]) + (Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "u32"; Ty.path "u32" ] []) + [] [] "default" + [] [] in let* α3 := M.call_closure α2 [] in let* α4 := @@ -889,9 +1024,12 @@ Module Impl_core_default_Default_for_multisig_Multisig. "core::default::Default" (Ty.apply (Ty.path "multisig::Mapping") - [ Ty.path "u32"; Ty.path "multisig::Transaction" ]) + [ Ty.path "u32"; Ty.path "multisig::Transaction" ] + []) + [] [] "default" + [] [] in let* α5 := M.call_closure α4 [] in let* α6 := @@ -899,7 +1037,9 @@ Module Impl_core_default_Default_for_multisig_Multisig. "core::default::Default" (Ty.path "multisig::Transactions") [] + [] "default" + [] [] in let* α7 := M.call_closure α6 [] in let* α8 := @@ -907,20 +1047,26 @@ Module Impl_core_default_Default_for_multisig_Multisig. "core::default::Default" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "default" + [] [] in let* α9 := M.call_closure α8 [] in let* α10 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "multisig::AccountId"; Ty.tuple [] ]) + (Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "multisig::AccountId"; Ty.tuple [] ] []) + [] [] "default" + [] [] in let* α11 := M.call_closure α10 [] in - let* α12 := M.get_trait_method "core::default::Default" (Ty.path "u32") [] "default" [] in + let* α12 := + M.get_trait_method "core::default::Default" (Ty.path "u32") [] [] "default" [] [] in let* α13 := M.call_closure α12 [] in M.pure (Value.StructRecord @@ -981,7 +1127,7 @@ Definition ensure_requirement_is_valid (τ : list Ty.t) (α : list Value.t) : M let* _ := let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Bool true) in - let* α0 := M.get_function "core::panicking::panic" [] in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in let* α1 := M.read (mk_str @@ -1004,7 +1150,15 @@ Module Impl_multisig_Multisig. unimplemented!() } *) - Parameter init_env : (list Ty.t) -> (list Value.t) -> M. + Definition init_env (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [] => + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_init_env : M.IsAssociatedFunction Self "init_env" init_env. @@ -1017,7 +1171,7 @@ Module Impl_multisig_Multisig. match τ, α with | [], [ self ] => let* self := M.alloc self in - let* α0 := M.get_associated_function (Ty.path "multisig::Multisig") "init_env" [] in + let* α0 := M.get_associated_function (Ty.path "multisig::Multisig") "init_env" [] [] in M.call_closure α0 [] | _, _ => M.impossible end. @@ -1052,24 +1206,30 @@ Module Impl_multisig_Multisig. "core::default::Default" (Ty.path "multisig::Multisig") [] + [] "default" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.path "multisig::AccountId" ]) + (Ty.apply (Ty.path "slice") [ Ty.path "multisig::AccountId" ] []) "sort_unstable" + [] [] in let* α1 := M.get_trait_method "core::ops::deref::DerefMut" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref_mut" + [] [] in let* α2 := M.call_closure α1 [ owners ] in let* α3 := M.call_closure α0 [ α2 ] in @@ -1079,19 +1239,23 @@ Module Impl_multisig_Multisig. M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ] + []) "dedup" + [] [] in let* α1 := M.call_closure α0 [ owners ] in M.alloc α1 in let* _ := - let* α0 := M.get_function "multisig::ensure_requirement_is_valid" [] in + let* α0 := M.get_function "multisig::ensure_requirement_is_valid" [] [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ] + []) "len" + [] [] in let* α2 := M.call_closure α1 [ owners ] in let* α3 := M.read requirement in @@ -1107,9 +1271,13 @@ Module Impl_multisig_Multisig. Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ] - ]) + [] + ] + []) + [] [] "into_iter" + [] [] in let* α1 := M.call_closure α0 [ owners ] in let* α2 := M.alloc α1 in @@ -1126,9 +1294,12 @@ Module Impl_multisig_Multisig. "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "core::slice::iter::Iter") - [ Ty.path "multisig::AccountId" ]) + [ Ty.path "multisig::AccountId" ] + []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -1152,8 +1323,10 @@ Module Impl_multisig_Multisig. M.get_associated_function (Ty.apply (Ty.path "multisig::Mapping") - [ Ty.path "multisig::AccountId"; Ty.tuple [] ]) + [ Ty.path "multisig::AccountId"; Ty.tuple [] ] + []) "insert" + [] [] in let* α1 := M.read owner in let* α2 := M.read α1 in @@ -1183,7 +1356,9 @@ Module Impl_multisig_Multisig. "core::default::Default" (Ty.path "multisig::Transactions") [] + [] "default" + [] [] in let* α1 := M.call_closure α0 [] in M.assign (M.get_struct_record_field contract "multisig::Multisig" "transaction_list") α1 in @@ -1220,13 +1395,15 @@ Module Impl_multisig_Multisig. let* γ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u32" ] []) "expect" - [] in + [] + [ Value.Bool true ] in let* α1 := M.get_associated_function - (Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "u32"; Ty.path "u32" ]) + (Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "u32"; Ty.path "u32" ] []) "get" + [] [] in let* α2 := M.read self in let* α3 := @@ -1247,7 +1424,7 @@ Module Impl_multisig_Multisig. let* _ := let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Bool true) in - let* α0 := M.get_function "core::panicking::panic" [] in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in let* α1 := M.read (mk_str @@ -1281,15 +1458,18 @@ Module Impl_multisig_Multisig. let* _ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "multisig::Transaction" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "multisig::Transaction" ] []) "expect" - [] in + [] + [ Value.Bool true ] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "multisig::Mapping") - [ Ty.path "u32"; Ty.path "multisig::Transaction" ]) + [ Ty.path "u32"; Ty.path "multisig::Transaction" ] + []) "get" + [] [] in let* α2 := M.read self in let* α3 := @@ -1329,8 +1509,10 @@ Module Impl_multisig_Multisig. M.get_associated_function (Ty.apply (Ty.path "multisig::Mapping") - [ Ty.path "multisig::AccountId"; Ty.tuple [] ]) + [ Ty.path "multisig::AccountId"; Ty.tuple [] ] + []) "contains" + [] [] in let* α1 := M.read self in let* α2 := M.read owner in @@ -1343,7 +1525,7 @@ Module Impl_multisig_Multisig. let* _ := let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Bool true) in - let* α0 := M.get_function "core::panicking::panic" [] in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in let* α1 := M.read (mk_str "assertion failed: self.is_owner.contains(owner)") in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.never_to_any α2 in @@ -1367,10 +1549,10 @@ Module Impl_multisig_Multisig. | [], [ self ] => let* self := M.alloc self in let* _ := - let* α0 := M.get_associated_function (Ty.path "multisig::Multisig") "ensure_owner" [] in + let* α0 := M.get_associated_function (Ty.path "multisig::Multisig") "ensure_owner" [] [] in let* α1 := M.read self in - let* α2 := M.get_associated_function (Ty.path "multisig::Env") "caller" [] in - let* α3 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] in + let* α2 := M.get_associated_function (Ty.path "multisig::Env") "caller" [] [] in + let* α3 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] [] in let* α4 := M.read self in let* α5 := M.call_closure α3 [ α4 ] in let* α6 := M.alloc α5 in @@ -1396,15 +1578,15 @@ Module Impl_multisig_Multisig. | [], [ self ] => let* self := M.alloc self in let* _ := - let* α0 := M.get_associated_function (Ty.path "multisig::Env") "caller" [] in - let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] in + let* α0 := M.get_associated_function (Ty.path "multisig::Env") "caller" [] [] in + let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in let* α5 := M.call_closure α0 [ α4 ] in let* α6 := M.alloc α5 in - let* α7 := M.get_associated_function (Ty.path "multisig::Env") "account_id" [] in - let* α8 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] in + let* α7 := M.get_associated_function (Ty.path "multisig::Env") "account_id" [] [] in + let* α8 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] [] in let* α9 := M.read self in let* α10 := M.call_closure α8 [ α9 ] in let* α11 := M.alloc α10 in @@ -1430,7 +1612,9 @@ Module Impl_multisig_Multisig. "core::cmp::PartialEq" (Ty.path "multisig::AccountId") [ Ty.path "multisig::AccountId" ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read left_val in let* α2 := M.read right_val in @@ -1444,7 +1628,8 @@ Module Impl_multisig_Multisig. let* α0 := M.get_function "core::panicking::assert_failed" - [ Ty.path "multisig::AccountId"; Ty.path "multisig::AccountId" ] in + [ Ty.path "multisig::AccountId"; Ty.path "multisig::AccountId" ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in @@ -1488,8 +1673,10 @@ Module Impl_multisig_Multisig. M.get_associated_function (Ty.apply (Ty.path "multisig::Mapping") - [ Ty.path "multisig::AccountId"; Ty.tuple [] ]) + [ Ty.path "multisig::AccountId"; Ty.tuple [] ] + []) "contains" + [] [] in let* α1 := M.read self in let* α2 := M.read owner in @@ -1502,7 +1689,7 @@ Module Impl_multisig_Multisig. let* _ := let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Bool true) in - let* α0 := M.get_function "core::panicking::panic" [] in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in let* α1 := M.read (mk_str "assertion failed: !self.is_owner.contains(owner)") in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.never_to_any α2 in @@ -1535,23 +1722,26 @@ Module Impl_multisig_Multisig. let* new_owner := M.alloc new_owner in let* _ := let* α0 := - M.get_associated_function (Ty.path "multisig::Multisig") "ensure_from_wallet" [] in + M.get_associated_function (Ty.path "multisig::Multisig") "ensure_from_wallet" [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := - let* α0 := M.get_associated_function (Ty.path "multisig::Multisig") "ensure_no_owner" [] in + let* α0 := + M.get_associated_function (Ty.path "multisig::Multisig") "ensure_no_owner" [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1; new_owner ] in M.alloc α2 in let* _ := - let* α0 := M.get_function "multisig::ensure_requirement_is_valid" [] in + let* α0 := M.get_function "multisig::ensure_requirement_is_valid" [] [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ] + []) "len" + [] [] in let* α2 := M.read self in let* α3 := @@ -1564,8 +1754,12 @@ Module Impl_multisig_Multisig. let* _ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "multisig::AccountId"; Ty.tuple [] ]) + (Ty.apply + (Ty.path "multisig::Mapping") + [ Ty.path "multisig::AccountId"; Ty.tuple [] ] + []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read new_owner in @@ -1579,8 +1773,10 @@ Module Impl_multisig_Multisig. M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ] + []) "push" + [] [] in let* α1 := M.read self in let* α2 := M.read new_owner in @@ -1588,8 +1784,8 @@ Module Impl_multisig_Multisig. M.call_closure α0 [ M.get_struct_record_field α1 "multisig::Multisig" "owners"; α2 ] in M.alloc α3 in let* _ := - let* α0 := M.get_associated_function (Ty.path "multisig::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] in + let* α0 := M.get_associated_function (Ty.path "multisig::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -1626,33 +1822,40 @@ Module Impl_multisig_Multisig. let* owner := M.alloc owner in let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "usize" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "usize" ] []) "expect" - [] in + [] + [ Value.Bool true ] in let* α1 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "multisig::AccountId" ]) + (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "multisig::AccountId" ] []) + [] [] "position" [ Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "multisig::AccountId" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "multisig::AccountId" ] [] ] ] (Ty.path "bool") - ] in + ] + [] in let* α2 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.path "multisig::AccountId" ]) + (Ty.apply (Ty.path "slice") [ Ty.path "multisig::AccountId" ] []) "iter" + [] [] in let* α3 := M.get_trait_method "core::ops::deref::Deref" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref" + [] [] in let* α4 := M.read self in let* α5 := M.call_closure α3 [ M.get_struct_record_field α4 "multisig::Multisig" "owners" ] in @@ -1678,7 +1881,9 @@ Module Impl_multisig_Multisig. "core::cmp::PartialEq" (Ty.path "multisig::AccountId") [ Ty.path "multisig::AccountId" ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read x in let* α2 := M.read owner in @@ -1722,10 +1927,17 @@ Module Impl_multisig_Multisig. "core::iter::traits::collect::IntoIterator" (Ty.apply (Ty.path "&") - [ Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ] - ]) + [ + Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ] + [] + ] + []) + [] [] "into_iter" + [] [] in let* α1 := M.read self in let* α2 := @@ -1749,9 +1961,11 @@ Module Impl_multisig_Multisig. let* α0 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u32" ] []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -1789,8 +2003,10 @@ Module Impl_multisig_Multisig. [ Ty.tuple [ Ty.path "u32"; Ty.path "multisig::AccountId" ]; Ty.tuple [] - ]) + ] + []) "contains" + [] [] in let* α1 := M.read self in let* α2 := @@ -1816,8 +2032,10 @@ Module Impl_multisig_Multisig. [ Ty.tuple [ Ty.path "u32"; Ty.path "multisig::AccountId" ]; Ty.tuple [] - ]) + ] + []) "remove" + [] [] in let* α1 := M.read self in let* α2 := M.read key in @@ -1835,15 +2053,18 @@ Module Impl_multisig_Multisig. let* count := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u32" ] []) "unwrap_or" + [] [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "multisig::Mapping") - [ Ty.path "u32"; Ty.path "u32" ]) + [ Ty.path "u32"; Ty.path "u32" ] + []) "get" + [] [] in let* α2 := M.read self in let* α3 := M.read trans_id in @@ -1871,8 +2092,10 @@ Module Impl_multisig_Multisig. M.get_associated_function (Ty.apply (Ty.path "multisig::Mapping") - [ Ty.path "u32"; Ty.path "u32" ]) + [ Ty.path "u32"; Ty.path "u32" ] + []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read trans_id in @@ -1926,12 +2149,12 @@ Module Impl_multisig_Multisig. let* owner := M.alloc owner in let* _ := let* α0 := - M.get_associated_function (Ty.path "multisig::Multisig") "ensure_from_wallet" [] in + M.get_associated_function (Ty.path "multisig::Multisig") "ensure_from_wallet" [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := - let* α0 := M.get_associated_function (Ty.path "multisig::Multisig") "ensure_owner" [] in + let* α0 := M.get_associated_function (Ty.path "multisig::Multisig") "ensure_owner" [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1; owner ] in M.alloc α2 in @@ -1940,8 +2163,10 @@ Module Impl_multisig_Multisig. M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ] + []) "len" + [] [] in let* α1 := M.read self in let* α2 := @@ -1949,20 +2174,20 @@ Module Impl_multisig_Multisig. let* α3 := BinOp.Panic.sub (M.rust_cast α2) (Value.Integer Integer.U32 1) in M.alloc α3 in let* requirement := - let* α0 := M.get_trait_method "core::cmp::Ord" (Ty.path "u32") [] "min" [] in + let* α0 := M.get_trait_method "core::cmp::Ord" (Ty.path "u32") [] [] "min" [] [] in let* α1 := M.read len in let* α2 := M.read self in let* α3 := M.read (M.get_struct_record_field α2 "multisig::Multisig" "requirement") in let* α4 := M.call_closure α0 [ α1; α3 ] in M.alloc α4 in let* _ := - let* α0 := M.get_function "multisig::ensure_requirement_is_valid" [] in + let* α0 := M.get_function "multisig::ensure_requirement_is_valid" [] [] in let* α1 := M.read len in let* α2 := M.read requirement in let* α3 := M.call_closure α0 [ α1; α2 ] in M.alloc α3 in let* owner_index := - let* α0 := M.get_associated_function (Ty.path "multisig::Multisig") "owner_index" [] in + let* α0 := M.get_associated_function (Ty.path "multisig::Multisig") "owner_index" [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1; owner ] in M.alloc (M.rust_cast α2) in @@ -1971,8 +2196,10 @@ Module Impl_multisig_Multisig. M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ] + []) "swap_remove" + [] [] in let* α1 := M.read self in let* α2 := M.read owner_index in @@ -1982,8 +2209,12 @@ Module Impl_multisig_Multisig. let* _ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "multisig::AccountId"; Ty.tuple [] ]) + (Ty.apply + (Ty.path "multisig::Mapping") + [ Ty.path "multisig::AccountId"; Ty.tuple [] ] + []) "remove" + [] [] in let* α1 := M.read self in let* α2 := M.read owner in @@ -1996,13 +2227,17 @@ Module Impl_multisig_Multisig. M.assign (M.get_struct_record_field α0 "multisig::Multisig" "requirement") α1 in let* _ := let* α0 := - M.get_associated_function (Ty.path "multisig::Multisig") "clean_owner_confirmations" [] in + M.get_associated_function + (Ty.path "multisig::Multisig") + "clean_owner_confirmations" + [] + [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1; owner ] in M.alloc α2 in let* _ := - let* α0 := M.get_associated_function (Ty.path "multisig::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] in + let* α0 := M.get_associated_function (Ty.path "multisig::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -2048,22 +2283,23 @@ Module Impl_multisig_Multisig. let* new_owner := M.alloc new_owner in let* _ := let* α0 := - M.get_associated_function (Ty.path "multisig::Multisig") "ensure_from_wallet" [] in + M.get_associated_function (Ty.path "multisig::Multisig") "ensure_from_wallet" [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := - let* α0 := M.get_associated_function (Ty.path "multisig::Multisig") "ensure_owner" [] in + let* α0 := M.get_associated_function (Ty.path "multisig::Multisig") "ensure_owner" [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1; old_owner ] in M.alloc α2 in let* _ := - let* α0 := M.get_associated_function (Ty.path "multisig::Multisig") "ensure_no_owner" [] in + let* α0 := + M.get_associated_function (Ty.path "multisig::Multisig") "ensure_no_owner" [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1; new_owner ] in M.alloc α2 in let* owner_index := - let* α0 := M.get_associated_function (Ty.path "multisig::Multisig") "owner_index" [] in + let* α0 := M.get_associated_function (Ty.path "multisig::Multisig") "owner_index" [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1; old_owner ] in M.alloc α2 in @@ -2073,9 +2309,12 @@ Module Impl_multisig_Multisig. "core::ops::index::IndexMut" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ] + []) [ Ty.path "usize" ] + [] "index_mut" + [] [] in let* α1 := M.read self in let* α2 := M.read owner_index in @@ -2088,8 +2327,12 @@ Module Impl_multisig_Multisig. let* _ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "multisig::AccountId"; Ty.tuple [] ]) + (Ty.apply + (Ty.path "multisig::Mapping") + [ Ty.path "multisig::AccountId"; Ty.tuple [] ] + []) "remove" + [] [] in let* α1 := M.read self in let* α2 := M.read old_owner in @@ -2099,8 +2342,12 @@ Module Impl_multisig_Multisig. let* _ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "multisig::AccountId"; Ty.tuple [] ]) + (Ty.apply + (Ty.path "multisig::Mapping") + [ Ty.path "multisig::AccountId"; Ty.tuple [] ] + []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read new_owner in @@ -2111,13 +2358,17 @@ Module Impl_multisig_Multisig. M.alloc α3 in let* _ := let* α0 := - M.get_associated_function (Ty.path "multisig::Multisig") "clean_owner_confirmations" [] in + M.get_associated_function + (Ty.path "multisig::Multisig") + "clean_owner_confirmations" + [] + [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1; old_owner ] in M.alloc α2 in let* _ := - let* α0 := M.get_associated_function (Ty.path "multisig::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] in + let* α0 := M.get_associated_function (Ty.path "multisig::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -2133,8 +2384,8 @@ Module Impl_multisig_Multisig. ] in M.alloc α6 in let* _ := - let* α0 := M.get_associated_function (Ty.path "multisig::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] in + let* α0 := M.get_associated_function (Ty.path "multisig::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -2175,18 +2426,20 @@ Module Impl_multisig_Multisig. let* new_requirement := M.alloc new_requirement in let* _ := let* α0 := - M.get_associated_function (Ty.path "multisig::Multisig") "ensure_from_wallet" [] in + M.get_associated_function (Ty.path "multisig::Multisig") "ensure_from_wallet" [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := - let* α0 := M.get_function "multisig::ensure_requirement_is_valid" [] in + let* α0 := M.get_function "multisig::ensure_requirement_is_valid" [] [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ] + []) "len" + [] [] in let* α2 := M.read self in let* α3 := @@ -2199,8 +2452,8 @@ Module Impl_multisig_Multisig. let* α1 := M.read new_requirement in M.assign (M.get_struct_record_field α0 "multisig::Multisig" "requirement") α1 in let* _ := - let* α0 := M.get_associated_function (Ty.path "multisig::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] in + let* α0 := M.get_associated_function (Ty.path "multisig::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -2266,13 +2519,15 @@ Module Impl_multisig_Multisig. let* count := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u32" ] []) "unwrap_or" + [] [] in let* α1 := M.get_associated_function - (Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "u32"; Ty.path "u32" ]) + (Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "u32"; Ty.path "u32" ] []) "get" + [] [] in let* α2 := M.read self in let* α3 := @@ -2293,8 +2548,10 @@ Module Impl_multisig_Multisig. M.get_associated_function (Ty.apply (Ty.path "multisig::Mapping") - [ Ty.tuple [ Ty.path "u32"; Ty.path "multisig::AccountId" ]; Ty.tuple [] ]) + [ Ty.tuple [ Ty.path "u32"; Ty.path "multisig::AccountId" ]; Ty.tuple [] ] + []) "contains" + [] [] in let* α1 := M.read self in let* α2 := @@ -2322,8 +2579,10 @@ Module Impl_multisig_Multisig. M.get_associated_function (Ty.apply (Ty.path "multisig::Mapping") - [ Ty.tuple [ Ty.path "u32"; Ty.path "multisig::AccountId" ]; Ty.tuple [] ]) + [ Ty.tuple [ Ty.path "u32"; Ty.path "multisig::AccountId" ]; Ty.tuple [] ] + []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read key in @@ -2339,8 +2598,9 @@ Module Impl_multisig_Multisig. let* _ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "u32"; Ty.path "u32" ]) + (Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "u32"; Ty.path "u32" ] []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read transaction in @@ -2393,8 +2653,8 @@ Module Impl_multisig_Multisig. let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := - let* α0 := M.get_associated_function (Ty.path "multisig::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] in + let* α0 := M.get_associated_function (Ty.path "multisig::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -2453,7 +2713,7 @@ Module Impl_multisig_Multisig. let* transaction := M.alloc transaction in let* _ := let* α0 := - M.get_associated_function (Ty.path "multisig::Multisig") "ensure_caller_is_owner" [] in + M.get_associated_function (Ty.path "multisig::Multisig") "ensure_caller_is_owner" [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -2468,10 +2728,11 @@ Module Impl_multisig_Multisig. let* α0 := M.read self in let* α1 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u32" ] []) "expect" - [] in - let* α2 := M.get_associated_function (Ty.path "u32") "checked_add" [] in + [] + [ Value.Bool true ] in + let* α2 := M.get_associated_function (Ty.path "u32") "checked_add" [] [ Value.Bool true ] in let* α3 := M.read trans_id in let* α4 := M.alloc (Value.Integer Integer.U32 1) in let* α5 := M.read (M.use α4) in @@ -2489,8 +2750,10 @@ Module Impl_multisig_Multisig. M.get_associated_function (Ty.apply (Ty.path "multisig::Mapping") - [ Ty.path "u32"; Ty.path "multisig::Transaction" ]) + [ Ty.path "u32"; Ty.path "multisig::Transaction" ] + []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read trans_id in @@ -2503,8 +2766,12 @@ Module Impl_multisig_Multisig. let* _ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ] + []) "push" + [] [] in let* α1 := M.read self in let* α2 := M.read trans_id in @@ -2520,8 +2787,8 @@ Module Impl_multisig_Multisig. ] in M.alloc α3 in let* _ := - let* α0 := M.get_associated_function (Ty.path "multisig::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] in + let* α0 := M.get_associated_function (Ty.path "multisig::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -2537,10 +2804,11 @@ Module Impl_multisig_Multisig. ] in M.alloc α6 in let* α0 := M.read trans_id in - let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "confirm_by_caller" [] in + let* α1 := + M.get_associated_function (Ty.path "multisig::Multisig") "confirm_by_caller" [] [] in let* α2 := M.read self in - let* α3 := M.get_associated_function (Ty.path "multisig::Env") "caller" [] in - let* α4 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] in + let* α3 := M.get_associated_function (Ty.path "multisig::Env") "caller" [] [] in + let* α4 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] [] in let* α5 := M.read self in let* α6 := M.call_closure α4 [ α5 ] in let* α7 := M.alloc α6 in @@ -2585,8 +2853,10 @@ Module Impl_multisig_Multisig. M.get_associated_function (Ty.apply (Ty.path "multisig::Mapping") - [ Ty.path "u32"; Ty.path "multisig::Transaction" ]) + [ Ty.path "u32"; Ty.path "multisig::Transaction" ] + []) "get" + [] [] in let* α1 := M.read self in let* α2 := @@ -2603,9 +2873,13 @@ Module Impl_multisig_Multisig. let* γ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "multisig::Transaction" ]) + (Ty.apply + (Ty.path "core::option::Option") + [ Ty.path "multisig::Transaction" ] + []) "is_some" - [] in + [] + [ Value.Bool true ] in let* α1 := M.call_closure α0 [ transaction ] in let* α2 := M.alloc α1 in M.pure (M.use α2) in @@ -2617,8 +2891,10 @@ Module Impl_multisig_Multisig. M.get_associated_function (Ty.apply (Ty.path "multisig::Mapping") - [ Ty.path "u32"; Ty.path "multisig::Transaction" ]) + [ Ty.path "u32"; Ty.path "multisig::Transaction" ] + []) "remove" + [] [] in let* α1 := M.read self in let* α2 := M.read trans_id in @@ -2630,33 +2906,40 @@ Module Impl_multisig_Multisig. let* pos := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "usize" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "usize" ] []) "expect" - [] in + [] + [ Value.Bool true ] in let* α1 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u32" ] []) + [] [] "position" [ Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "u32" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "u32" ] [] ] ] (Ty.path "bool") - ] in + ] + [] in let* α2 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "slice") [ Ty.path "u32" ] []) "iter" + [] [] in let* α3 := M.get_trait_method "core::ops::deref::Deref" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref" + [] [] in let* α4 := M.read self in let* α5 := @@ -2688,9 +2971,11 @@ Module Impl_multisig_Multisig. let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "&") [ Ty.path "u32" ]) - [ Ty.apply (Ty.path "&") [ Ty.path "u32" ] ] + (Ty.apply (Ty.path "&") [ Ty.path "u32" ] []) + [ Ty.apply (Ty.path "&") [ Ty.path "u32" ] [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.alloc trans_id in M.call_closure α0 [ t; α1 ] @@ -2707,8 +2992,10 @@ Module Impl_multisig_Multisig. M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ] + []) "swap_remove" + [] [] in let* α1 := M.read self in let* α2 := M.read pos in @@ -2727,23 +3014,32 @@ Module Impl_multisig_Multisig. let* α0 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "multisig::AccountId" ]) + (Ty.apply + (Ty.path "core::slice::iter::Iter") + [ Ty.path "multisig::AccountId" ] + []) + [] [] "into_iter" + [] [] in let* α1 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.path "multisig::AccountId" ]) + (Ty.apply (Ty.path "slice") [ Ty.path "multisig::AccountId" ] []) "iter" + [] [] in let* α2 := M.get_trait_method "core::ops::deref::Deref" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "multisig::AccountId"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref" + [] [] in let* α3 := M.read self in let* α4 := @@ -2766,9 +3062,12 @@ Module Impl_multisig_Multisig. "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "core::slice::iter::Iter") - [ Ty.path "multisig::AccountId" ]) + [ Ty.path "multisig::AccountId" ] + []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -2796,8 +3095,10 @@ Module Impl_multisig_Multisig. Ty.tuple [ Ty.path "u32"; Ty.path "multisig::AccountId" ]; Ty.tuple [] - ]) + ] + []) "remove" + [] [] in let* α1 := M.read self in let* α2 := M.read trans_id in @@ -2822,8 +3123,9 @@ Module Impl_multisig_Multisig. let* _ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "u32"; Ty.path "u32" ]) + (Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "u32"; Ty.path "u32" ] []) "remove" + [] [] in let* α1 := M.read self in let* α2 := M.read trans_id in @@ -2860,7 +3162,7 @@ Module Impl_multisig_Multisig. let* trans_id := M.alloc trans_id in let* _ := let* α0 := - M.get_associated_function (Ty.path "multisig::Multisig") "ensure_from_wallet" [] in + M.get_associated_function (Ty.path "multisig::Multisig") "ensure_from_wallet" [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -2873,11 +3175,19 @@ Module Impl_multisig_Multisig. let* γ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "multisig::Transaction" ]) + (Ty.apply + (Ty.path "core::option::Option") + [ Ty.path "multisig::Transaction" ] + []) "is_some" - [] in + [] + [ Value.Bool true ] in let* α1 := - M.get_associated_function (Ty.path "multisig::Multisig") "take_transaction" [] in + M.get_associated_function + (Ty.path "multisig::Multisig") + "take_transaction" + [] + [] in let* α2 := M.read self in let* α3 := M.read trans_id in let* α4 := M.call_closure α1 [ α2; α3 ] in @@ -2889,8 +3199,8 @@ Module Impl_multisig_Multisig. let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := - let* α0 := M.get_associated_function (Ty.path "multisig::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] in + let* α0 := M.get_associated_function (Ty.path "multisig::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -2929,21 +3239,26 @@ Module Impl_multisig_Multisig. let* trans_id := M.alloc trans_id in let* _ := let* α0 := - M.get_associated_function (Ty.path "multisig::Multisig") "ensure_caller_is_owner" [] in + M.get_associated_function (Ty.path "multisig::Multisig") "ensure_caller_is_owner" [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := let* α0 := - M.get_associated_function (Ty.path "multisig::Multisig") "ensure_transaction_exists" [] in + M.get_associated_function + (Ty.path "multisig::Multisig") + "ensure_transaction_exists" + [] + [] in let* α1 := M.read self in let* α2 := M.read trans_id in let* α3 := M.call_closure α0 [ α1; α2 ] in M.alloc α3 in - let* α0 := M.get_associated_function (Ty.path "multisig::Multisig") "confirm_by_caller" [] in + let* α0 := + M.get_associated_function (Ty.path "multisig::Multisig") "confirm_by_caller" [] [] in let* α1 := M.read self in - let* α2 := M.get_associated_function (Ty.path "multisig::Env") "caller" [] in - let* α3 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] in + let* α2 := M.get_associated_function (Ty.path "multisig::Env") "caller" [] [] in + let* α3 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] [] in let* α4 := M.read self in let* α5 := M.call_closure α3 [ α4 ] in let* α6 := M.alloc α5 in @@ -2985,13 +3300,13 @@ Module Impl_multisig_Multisig. let* trans_id := M.alloc trans_id in let* _ := let* α0 := - M.get_associated_function (Ty.path "multisig::Multisig") "ensure_caller_is_owner" [] in + M.get_associated_function (Ty.path "multisig::Multisig") "ensure_caller_is_owner" [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* caller := - let* α0 := M.get_associated_function (Ty.path "multisig::Env") "caller" [] in - let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] in + let* α0 := M.get_associated_function (Ty.path "multisig::Env") "caller" [] [] in + let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -3008,8 +3323,10 @@ Module Impl_multisig_Multisig. M.get_associated_function (Ty.apply (Ty.path "multisig::Mapping") - [ Ty.tuple [ Ty.path "u32"; Ty.path "multisig::AccountId" ]; Ty.tuple [] ]) + [ Ty.tuple [ Ty.path "u32"; Ty.path "multisig::AccountId" ]; Ty.tuple [] ] + []) "contains" + [] [] in let* α1 := M.read self in let* α2 := M.read trans_id in @@ -3029,8 +3346,10 @@ Module Impl_multisig_Multisig. M.get_associated_function (Ty.apply (Ty.path "multisig::Mapping") - [ Ty.tuple [ Ty.path "u32"; Ty.path "multisig::AccountId" ]; Ty.tuple [] ]) + [ Ty.tuple [ Ty.path "u32"; Ty.path "multisig::AccountId" ]; Ty.tuple [] ] + []) "remove" + [] [] in let* α1 := M.read self in let* α2 := M.read trans_id in @@ -3046,13 +3365,15 @@ Module Impl_multisig_Multisig. let* confirmation_count := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u32" ] []) "expect" - [] in + [] + [ Value.Bool true ] in let* α1 := M.get_associated_function - (Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "u32"; Ty.path "u32" ]) + (Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "u32"; Ty.path "u32" ] []) "get" + [] [] in let* α2 := M.read self in let* α3 := @@ -3075,8 +3396,9 @@ Module Impl_multisig_Multisig. let* _ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "u32"; Ty.path "u32" ]) + (Ty.apply (Ty.path "multisig::Mapping") [ Ty.path "u32"; Ty.path "u32" ] []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read trans_id in @@ -3088,8 +3410,8 @@ Module Impl_multisig_Multisig. ] in M.alloc α4 in let* _ := - let* α0 := M.get_associated_function (Ty.path "multisig::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] in + let* α0 := M.get_associated_function (Ty.path "multisig::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -3152,7 +3474,8 @@ Module Impl_multisig_Multisig. let* self := M.alloc self in let* trans_id := M.alloc trans_id in let* _ := - let* α0 := M.get_associated_function (Ty.path "multisig::Multisig") "ensure_confirmed" [] in + let* α0 := + M.get_associated_function (Ty.path "multisig::Multisig") "ensure_confirmed" [] [] in let* α1 := M.read self in let* α2 := M.read trans_id in let* α3 := M.call_closure α0 [ α1; α2 ] in @@ -3160,10 +3483,12 @@ Module Impl_multisig_Multisig. let* t := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "multisig::Transaction" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "multisig::Transaction" ] []) "expect" - [] in - let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "take_transaction" [] in + [] + [ Value.Bool true ] in + let* α1 := + M.get_associated_function (Ty.path "multisig::Multisig") "take_transaction" [] [] in let* α2 := M.read self in let* α3 := M.read trans_id in let* α4 := M.call_closure α1 [ α2; α3 ] in @@ -3179,8 +3504,8 @@ Module Impl_multisig_Multisig. fun γ => let* γ := let* α0 := - M.get_associated_function (Ty.path "multisig::Env") "transferred_value" [] in - let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] in + M.get_associated_function (Ty.path "multisig::Env") "transferred_value" [] [] in + let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -3193,7 +3518,7 @@ Module Impl_multisig_Multisig. let* _ := let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Bool true) in - let* α0 := M.get_function "core::panicking::panic" [] in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in let* α1 := M.read (mk_str @@ -3204,7 +3529,7 @@ Module Impl_multisig_Multisig. fun γ => M.alloc (Value.Tuple []) ] in let* result := - let* α0 := M.get_function "core::panicking::panic" [] in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in let* α1 := M.read (mk_str "not yet implemented") in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.never_to_any α2 in @@ -3228,15 +3553,18 @@ Module Impl_multisig_Multisig. ] in M.copy α0 in let* _ := - let* α0 := M.get_associated_function (Ty.path "multisig::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] in + let* α0 := M.get_associated_function (Ty.path "multisig::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "multisig::Multisig") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in let* α5 := M.read trans_id in let* α6 := M.get_associated_function - (Ty.apply (Ty.path "core::result::Result") [ Ty.tuple []; Ty.path "multisig::Error" ]) + (Ty.apply + (Ty.path "core::result::Result") + [ Ty.tuple []; Ty.path "multisig::Error" ] + []) "map" [ Ty.apply @@ -3245,7 +3573,9 @@ Module Impl_multisig_Multisig. Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] - ]; + [] + ] + []; Ty.function [ Ty.tuple [ Ty.tuple [] ] ] (Ty.apply @@ -3254,8 +3584,11 @@ Module Impl_multisig_Multisig. Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] - ]) - ] in + [] + ] + []) + ] + [] in let* α7 := M.read result in let* α8 := M.call_closure diff --git a/CoqOfRust/examples/default/examples/ink_contracts/payment_channel.v b/CoqOfRust/examples/default/examples/ink_contracts/payment_channel.v index 8c81f6148..07c603643 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/payment_channel.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/payment_channel.v @@ -17,7 +17,8 @@ Module Impl_core_default_Default_for_payment_channel_AccountId. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructTuple "payment_channel::AccountId" [ α1 ]) | _, _ => M.impossible @@ -135,7 +136,7 @@ Module Impl_core_cmp_Eq_for_payment_channel_AccountId. [ ("assert_receiver_is_total_eq", InstanceField.Method assert_receiver_is_total_eq) ]. End Impl_core_cmp_Eq_for_payment_channel_AccountId. -Module Impl_core_convert_From_array_u8_for_payment_channel_AccountId. +Module Impl_core_convert_From_array_u8_32_for_payment_channel_AccountId. Definition Self : Ty.t := Ty.path "payment_channel::AccountId". (* @@ -143,15 +144,25 @@ Module Impl_core_convert_From_array_u8_for_payment_channel_AccountId. unimplemented!() } *) - Parameter from : (list Ty.t) -> (list Value.t) -> M. + Definition from (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ value ] => + let* value := M.alloc value in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom Implements : M.IsTraitInstance "core::convert::From" Self - (* Trait polymorphic types *) [ (* T *) Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] + (* Trait polymorphic types *) + [ (* T *) Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ] ] (* Instance *) [ ("from", InstanceField.Method from) ]. -End Impl_core_convert_From_array_u8_for_payment_channel_AccountId. +End Impl_core_convert_From_array_u8_32_for_payment_channel_AccountId. Axiom Balance : (Ty.path "payment_channel::Balance") = (Ty.path "u128"). @@ -172,7 +183,7 @@ Axiom Timestamp : (Ty.path "payment_channel::Timestamp") = (Ty.path "u64"). [ ("sender", Ty.path "payment_channel::AccountId"); ("recipient", Ty.path "payment_channel::AccountId"); - ("expiration", Ty.apply (Ty.path "core::option::Option") [ Ty.path "u64" ]); + ("expiration", Ty.apply (Ty.path "core::option::Option") [ Ty.path "u64" ] []); ("withdrawn", Ty.path "u128"); ("close_duration", Ty.path "u64") ]; @@ -242,7 +253,8 @@ Module Impl_core_cmp_PartialEq_for_payment_channel_Error. let* α0 := M.get_function "core::intrinsics::discriminant_value" - [ Ty.path "payment_channel::Error" ] in + [ Ty.path "payment_channel::Error" ] + [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -250,7 +262,8 @@ Module Impl_core_cmp_PartialEq_for_payment_channel_Error. let* α0 := M.get_function "core::intrinsics::discriminant_value" - [ Ty.path "payment_channel::Error" ] in + [ Ty.path "payment_channel::Error" ] + [] in let* α1 := M.read other in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -305,8 +318,8 @@ End Impl_core_cmp_Eq_for_payment_channel_Error. Axiom Result : forall (T : Ty.t), - (Ty.apply (Ty.path "payment_channel::Result") [ T ]) = - (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "payment_channel::Error" ]). + (Ty.apply (Ty.path "payment_channel::Result") [ T ] []) = + (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "payment_channel::Error" ] []). (* StructRecord { @@ -352,7 +365,17 @@ Module Impl_payment_channel_Env. unimplemented!() } *) - Parameter emit_event : (list Ty.t) -> (list Value.t) -> M. + Definition emit_event (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ self; _event ] => + let* self := M.alloc self in + let* _event := M.alloc _event in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_emit_event : M.IsAssociatedFunction Self "emit_event" emit_event. @@ -361,7 +384,17 @@ Module Impl_payment_channel_Env. unimplemented!() } *) - Parameter terminate_contract : (list Ty.t) -> (list Value.t) -> M. + Definition terminate_contract (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ self; sender ] => + let* self := M.alloc self in + let* sender := M.alloc sender in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_terminate_contract : M.IsAssociatedFunction Self "terminate_contract" terminate_contract. @@ -371,7 +404,18 @@ Module Impl_payment_channel_Env. unimplemented!() } *) - Parameter transfer : (list Ty.t) -> (list Value.t) -> M. + Definition transfer (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ self; recipient; amount ] => + let* self := M.alloc self in + let* recipient := M.alloc recipient in + let* amount := M.alloc amount in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_transfer : M.IsAssociatedFunction Self "transfer" transfer. @@ -380,7 +424,16 @@ Module Impl_payment_channel_Env. unimplemented!() } *) - Parameter block_timestamp : (list Ty.t) -> (list Value.t) -> M. + Definition block_timestamp (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ self ] => + let* self := M.alloc self in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_block_timestamp : M.IsAssociatedFunction Self "block_timestamp" block_timestamp. @@ -390,7 +443,16 @@ Module Impl_payment_channel_Env. unimplemented!() } *) - Parameter balance : (list Ty.t) -> (list Value.t) -> M. + Definition balance (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ self ] => + let* self := M.alloc self in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_balance : M.IsAssociatedFunction Self "balance" balance. @@ -399,7 +461,16 @@ Module Impl_payment_channel_Env. unimplemented!() } *) - Parameter account_id : (list Ty.t) -> (list Value.t) -> M. + Definition account_id (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ self ] => + let* self := M.alloc self in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_account_id : M.IsAssociatedFunction Self "account_id" account_id. End Impl_payment_channel_Env. @@ -418,7 +489,17 @@ where unimplemented!() } *) -Parameter hash_encoded : (list Ty.t) -> (list Value.t) -> M. +Definition hash_encoded (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [ H; T ], [ input; output ] => + let* input := M.alloc input in + let* output := M.alloc output in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. (* pub fn ecdsa_recover( @@ -429,7 +510,18 @@ pub fn ecdsa_recover( unimplemented!() } *) -Parameter ecdsa_recover : (list Ty.t) -> (list Value.t) -> M. +Definition ecdsa_recover (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ signature; message_hash; output ] => + let* signature := M.alloc signature in + let* message_hash := M.alloc message_hash in + let* output := M.alloc output in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. (* Enum Sha2x256 *) (* { @@ -461,7 +553,8 @@ Module Impl_payment_channel_HashOutput_for_payment_channel_Sha2x256. (* type Type = [u8; 32]; *) - Definition _Type_ : Ty.t := Ty.apply (Ty.path "array") [ Ty.path "u8" ]. + Definition _Type_ : Ty.t := + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]. Axiom Implements : M.IsTraitInstance @@ -477,7 +570,8 @@ Module Impl_payment_channel_HashOutput_for_payment_channel_Keccak256. (* type Type = [u8; 32]; *) - Definition _Type_ : Ty.t := Ty.apply (Ty.path "array") [ Ty.path "u8" ]. + Definition _Type_ : Ty.t := + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]. Axiom Implements : M.IsTraitInstance @@ -493,7 +587,8 @@ Module Impl_payment_channel_HashOutput_for_payment_channel_Blake2x256. (* type Type = [u8; 32]; *) - Definition _Type_ : Ty.t := Ty.apply (Ty.path "array") [ Ty.path "u8" ]. + Definition _Type_ : Ty.t := + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]. Axiom Implements : M.IsTraitInstance @@ -509,7 +604,8 @@ Module Impl_payment_channel_HashOutput_for_payment_channel_Blake2x128. (* type Type = [u8; 16]; *) - Definition _Type_ : Ty.t := Ty.apply (Ty.path "array") [ Ty.path "u8" ]. + Definition _Type_ : Ty.t := + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 16 ]. Axiom Implements : M.IsTraitInstance @@ -527,7 +623,17 @@ Module Impl_payment_channel_CryptoHash_for_payment_channel_Sha2x256. unimplemented!() } *) - Parameter hash : (list Ty.t) -> (list Value.t) -> M. + Definition hash (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ input; output ] => + let* input := M.alloc input in + let* output := M.alloc output in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom Implements : M.IsTraitInstance @@ -545,7 +651,17 @@ Module Impl_payment_channel_CryptoHash_for_payment_channel_Keccak256. unimplemented!() } *) - Parameter hash : (list Ty.t) -> (list Value.t) -> M. + Definition hash (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ input; output ] => + let* input := M.alloc input in + let* output := M.alloc output in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom Implements : M.IsTraitInstance @@ -563,7 +679,17 @@ Module Impl_payment_channel_CryptoHash_for_payment_channel_Blake2x256. unimplemented!() } *) - Parameter hash : (list Ty.t) -> (list Value.t) -> M. + Definition hash (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ input; output ] => + let* input := M.alloc input in + let* output := M.alloc output in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom Implements : M.IsTraitInstance @@ -581,7 +707,17 @@ Module Impl_payment_channel_CryptoHash_for_payment_channel_Blake2x128. unimplemented!() } *) - Parameter hash : (list Ty.t) -> (list Value.t) -> M. + Definition hash (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ input; output ] => + let* input := M.alloc input in + let* output := M.alloc output in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom Implements : M.IsTraitInstance @@ -599,7 +735,15 @@ Module Impl_payment_channel_PaymentChannel. unimplemented!() } *) - Parameter init_env : (list Ty.t) -> (list Value.t) -> M. + Definition init_env (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [] => + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_init_env : M.IsAssociatedFunction Self "init_env" init_env. @@ -613,7 +757,7 @@ Module Impl_payment_channel_PaymentChannel. | [], [ self ] => let* self := M.alloc self in let* α0 := - M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "init_env" [] in + M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "init_env" [] [] in M.call_closure α0 [] | _, _ => M.impossible end. @@ -642,8 +786,9 @@ Module Impl_payment_channel_PaymentChannel. let* amount := M.alloc amount in let* signature := M.alloc signature in let* encodable := - let* α0 := M.get_associated_function (Ty.path "payment_channel::Env") "account_id" [] in - let* α1 := M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "env" [] in + let* α0 := M.get_associated_function (Ty.path "payment_channel::Env") "account_id" [] [] in + let* α1 := + M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -654,9 +799,11 @@ Module Impl_payment_channel_PaymentChannel. let* α0 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "array") [ Ty.path "u8" ]) + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]) + [] [] "default" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in @@ -667,7 +814,8 @@ Module Impl_payment_channel_PaymentChannel. [ Ty.path "payment_channel::Sha2x256"; Ty.tuple [ Ty.path "payment_channel::AccountId"; Ty.path "u128" ] - ] in + ] + [] in let* α1 := M.call_closure α0 [ encodable; message ] in M.alloc α1 in let* pub_key := M.alloc (repeat (Value.Integer Integer.U8 0) 33) in @@ -676,10 +824,12 @@ Module Impl_payment_channel_PaymentChannel. M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "payment_channel::Error" ]) + [ Ty.tuple []; Ty.path "payment_channel::Error" ] + []) "unwrap_or_else" - [ Ty.function [ Ty.tuple [ Ty.path "payment_channel::Error" ] ] (Ty.tuple []) ] in - let* α1 := M.get_function "payment_channel::ecdsa_recover" [] in + [ Ty.function [ Ty.tuple [ Ty.path "payment_channel::Error" ] ] (Ty.tuple []) ] + [] in + let* α1 := M.get_function "payment_channel::ecdsa_recover" [] [] in let* α2 := M.call_closure α1 [ signature; message; pub_key ] in let* α3 := M.call_closure @@ -699,7 +849,8 @@ Module Impl_payment_channel_PaymentChannel. let* α0 := M.get_function "std::panicking::begin_panic" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.read (mk_str "recover failed: {err:?}") in let* α2 := M.call_closure α0 [ α1 ] in M.never_to_any α2 @@ -715,7 +866,9 @@ Module Impl_payment_channel_PaymentChannel. "payment_channel::CryptoHash" (Ty.path "payment_channel::Blake2x256") [] + [] "hash" + [] [] in let* α1 := (* Unsize *) M.pure (M.pointer_coercion pub_key) in let* α2 := M.call_closure α0 [ α1; signature_account_id ] in @@ -725,15 +878,19 @@ Module Impl_payment_channel_PaymentChannel. "core::cmp::PartialEq" (Ty.path "payment_channel::AccountId") [ Ty.path "payment_channel::AccountId" ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read self in let* α2 := M.get_trait_method "core::convert::Into" - (Ty.apply (Ty.path "array") [ Ty.path "u8" ]) + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]) [ Ty.path "payment_channel::AccountId" ] + [] "into" + [] [] in let* α3 := M.read signature_account_id in let* α4 := M.call_closure α2 [ α3 ] in @@ -766,9 +923,9 @@ Module Impl_payment_channel_PaymentChannel. | [], [ recipient; close_duration ] => let* recipient := M.alloc recipient in let* close_duration := M.alloc close_duration in - let* α0 := M.get_associated_function (Ty.path "payment_channel::Env") "caller" [] in + let* α0 := M.get_associated_function (Ty.path "payment_channel::Env") "caller" [] [] in let* α1 := - M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "init_env" [] in + M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "init_env" [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.alloc α2 in let* α4 := M.call_closure α0 [ α3 ] in @@ -829,11 +986,18 @@ Module Impl_payment_channel_PaymentChannel. "core::cmp::PartialEq" (Ty.path "payment_channel::AccountId") [ Ty.path "payment_channel::AccountId" ] + [ Value.Bool true ] "ne" + [] [] in - let* α1 := M.get_associated_function (Ty.path "payment_channel::Env") "caller" [] in + let* α1 := + M.get_associated_function (Ty.path "payment_channel::Env") "caller" [] [] in let* α2 := - M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "env" [] in + M.get_associated_function + (Ty.path "payment_channel::PaymentChannel") + "env" + [] + [] in let* α3 := M.read self in let* α4 := M.call_closure α2 [ α3 ] in let* α5 := M.alloc α4 in @@ -898,6 +1062,7 @@ Module Impl_payment_channel_PaymentChannel. M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "is_signature_valid" + [] [] in let* α1 := M.read self in let* α2 := M.read amount in @@ -924,24 +1089,30 @@ Module Impl_payment_channel_PaymentChannel. "core::ops::try_trait::Try" (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "payment_channel::Error" ]) + [ Ty.tuple []; Ty.path "payment_channel::Error" ] + []) + [] [] "branch" + [] [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "payment_channel::Error" ]) + [ Ty.tuple []; Ty.path "payment_channel::Error" ] + []) "map_err" [ Ty.path "payment_channel::Error"; Ty.function [ Ty.tuple [ Ty.path "payment_channel::Error" ] ] (Ty.path "payment_channel::Error") - ] in - let* α2 := M.get_associated_function (Ty.path "payment_channel::Env") "transfer" [] in - let* α3 := M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "env" [] in + ] + [] in + let* α2 := M.get_associated_function (Ty.path "payment_channel::Env") "transfer" [] [] in + let* α3 := + M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "env" [] [] in let* α4 := M.read self in let* α5 := M.call_closure α3 [ α4 ] in let* α6 := M.alloc α5 in @@ -990,13 +1161,17 @@ Module Impl_payment_channel_PaymentChannel. "core::ops::try_trait::FromResidual" (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "payment_channel::Error" ]) + [ Ty.tuple []; Ty.path "payment_channel::Error" ] + []) [ Ty.apply (Ty.path "core::result::Result") [ Ty.path "core::convert::Infallible"; Ty.path "payment_channel::Error" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -1040,12 +1215,19 @@ Module Impl_payment_channel_PaymentChannel. "core::ops::try_trait::Try" (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "payment_channel::Error" ]) + [ Ty.tuple []; Ty.path "payment_channel::Error" ] + []) + [] [] "branch" + [] [] in let* α1 := - M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "close_inner" [] in + M.get_associated_function + (Ty.path "payment_channel::PaymentChannel") + "close_inner" + [] + [] in let* α2 := M.read self in let* α3 := M.read amount in let* α4 := M.read signature in @@ -1067,13 +1249,17 @@ Module Impl_payment_channel_PaymentChannel. "core::ops::try_trait::FromResidual" (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "payment_channel::Error" ]) + [ Ty.tuple []; Ty.path "payment_channel::Error" ] + []) [ Ty.apply (Ty.path "core::result::Result") [ Ty.path "core::convert::Infallible"; Ty.path "payment_channel::Error" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -1092,8 +1278,9 @@ Module Impl_payment_channel_PaymentChannel. ] in let* _ := let* α0 := - M.get_associated_function (Ty.path "payment_channel::Env") "terminate_contract" [] in - let* α1 := M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "env" [] in + M.get_associated_function (Ty.path "payment_channel::Env") "terminate_contract" [] [] in + let* α1 := + M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -1145,11 +1332,18 @@ Module Impl_payment_channel_PaymentChannel. "core::cmp::PartialEq" (Ty.path "payment_channel::AccountId") [ Ty.path "payment_channel::AccountId" ] + [ Value.Bool true ] "ne" + [] [] in - let* α1 := M.get_associated_function (Ty.path "payment_channel::Env") "caller" [] in + let* α1 := + M.get_associated_function (Ty.path "payment_channel::Env") "caller" [] [] in let* α2 := - M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "env" [] in + M.get_associated_function + (Ty.path "payment_channel::PaymentChannel") + "env" + [] + [] in let* α3 := M.read self in let* α4 := M.call_closure α2 [ α3 ] in let* α5 := M.alloc α4 in @@ -1178,8 +1372,9 @@ Module Impl_payment_channel_PaymentChannel. ] in let* now := let* α0 := - M.get_associated_function (Ty.path "payment_channel::Env") "block_timestamp" [] in - let* α1 := M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "env" [] in + M.get_associated_function (Ty.path "payment_channel::Env") "block_timestamp" [] [] in + let* α1 := + M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -1194,8 +1389,9 @@ Module Impl_payment_channel_PaymentChannel. let* α3 := BinOp.Panic.add α0 α2 in M.alloc α3 in let* _ := - let* α0 := M.get_associated_function (Ty.path "payment_channel::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "env" [] in + let* α0 := M.get_associated_function (Ty.path "payment_channel::Env") "emit_event" [] [] in + let* α1 := + M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -1267,9 +1463,17 @@ Module Impl_payment_channel_PaymentChannel. let* expiration := M.copy γ0_0 in let* now := let* α0 := - M.get_associated_function (Ty.path "payment_channel::Env") "block_timestamp" [] in + M.get_associated_function + (Ty.path "payment_channel::Env") + "block_timestamp" + [] + [] in let* α1 := - M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "env" [] in + M.get_associated_function + (Ty.path "payment_channel::PaymentChannel") + "env" + [] + [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -1304,9 +1508,14 @@ Module Impl_payment_channel_PaymentChannel. M.get_associated_function (Ty.path "payment_channel::Env") "terminate_contract" + [] [] in let* α1 := - M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "env" [] in + M.get_associated_function + (Ty.path "payment_channel::PaymentChannel") + "env" + [] + [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -1374,11 +1583,18 @@ Module Impl_payment_channel_PaymentChannel. "core::cmp::PartialEq" (Ty.path "payment_channel::AccountId") [ Ty.path "payment_channel::AccountId" ] + [ Value.Bool true ] "ne" + [] [] in - let* α1 := M.get_associated_function (Ty.path "payment_channel::Env") "caller" [] in + let* α1 := + M.get_associated_function (Ty.path "payment_channel::Env") "caller" [] [] in let* α2 := - M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "env" [] in + M.get_associated_function + (Ty.path "payment_channel::PaymentChannel") + "env" + [] + [] in let* α3 := M.read self in let* α4 := M.call_closure α2 [ α3 ] in let* α5 := M.alloc α4 in @@ -1416,6 +1632,7 @@ Module Impl_payment_channel_PaymentChannel. M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "is_signature_valid" + [] [] in let* α1 := M.read self in let* α2 := M.read amount in @@ -1484,24 +1701,30 @@ Module Impl_payment_channel_PaymentChannel. "core::ops::try_trait::Try" (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "payment_channel::Error" ]) + [ Ty.tuple []; Ty.path "payment_channel::Error" ] + []) + [] [] "branch" + [] [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "payment_channel::Error" ]) + [ Ty.tuple []; Ty.path "payment_channel::Error" ] + []) "map_err" [ Ty.path "payment_channel::Error"; Ty.function [ Ty.tuple [ Ty.path "payment_channel::Error" ] ] (Ty.path "payment_channel::Error") - ] in - let* α2 := M.get_associated_function (Ty.path "payment_channel::Env") "transfer" [] in - let* α3 := M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "env" [] in + ] + [] in + let* α2 := M.get_associated_function (Ty.path "payment_channel::Env") "transfer" [] [] in + let* α3 := + M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "env" [] [] in let* α4 := M.read self in let* α5 := M.call_closure α3 [ α4 ] in let* α6 := M.alloc α5 in @@ -1546,13 +1769,17 @@ Module Impl_payment_channel_PaymentChannel. "core::ops::try_trait::FromResidual" (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "payment_channel::Error" ]) + [ Ty.tuple []; Ty.path "payment_channel::Error" ] + []) [ Ty.apply (Ty.path "core::result::Result") [ Ty.path "core::convert::Infallible"; Ty.path "payment_channel::Error" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -1669,8 +1896,9 @@ Module Impl_payment_channel_PaymentChannel. match τ, α with | [], [ self ] => let* self := M.alloc self in - let* α0 := M.get_associated_function (Ty.path "payment_channel::Env") "balance" [] in - let* α1 := M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "env" [] in + let* α0 := M.get_associated_function (Ty.path "payment_channel::Env") "balance" [] [] in + let* α1 := + M.get_associated_function (Ty.path "payment_channel::PaymentChannel") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in 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 f3c4de799..c553c802e 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/set_code_hash.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/set_code_hash.v @@ -12,7 +12,16 @@ fn set_code_hash(code_hash: &E) -> Result<(), Error> { unimplemented!() } *) -Parameter set_code_hash : (list Ty.t) -> (list Value.t) -> M. +Definition set_code_hash (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [ E ], [ code_hash ] => + let* code_hash := M.alloc code_hash in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. (* StructRecord { @@ -30,7 +39,8 @@ Module Impl_core_default_Default_for_set_code_hash_Incrementer. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u32") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u32") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructRecord "set_code_hash::Incrementer" [ ("count", α1) ]) | _, _ => M.impossible @@ -60,7 +70,9 @@ Module Impl_set_code_hash_Incrementer. "core::default::Default" (Ty.path "set_code_hash::Incrementer") [] + [] "default" + [] [] in M.call_closure α0 [] | _, _ => M.impossible @@ -90,8 +102,8 @@ Module Impl_set_code_hash_Incrementer. M.assign β α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The new count is ") in @@ -105,7 +117,8 @@ Module Impl_set_code_hash_Incrementer. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.read self in let* α8 := M.call_closure @@ -158,13 +171,16 @@ Module Impl_set_code_hash_Incrementer. M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "set_code_hash::Error" ]) + [ Ty.tuple []; Ty.path "set_code_hash::Error" ] + []) "unwrap_or_else" - [ Ty.function [ Ty.tuple [ Ty.path "set_code_hash::Error" ] ] (Ty.tuple []) ] in + [ Ty.function [ Ty.tuple [ Ty.path "set_code_hash::Error" ] ] (Ty.tuple []) ] + [] in let* α1 := M.get_function "set_code_hash::set_code_hash" - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] in + [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ] ] + [] in let* α2 := M.call_closure α1 [ code_hash ] in let* α3 := M.call_closure @@ -184,7 +200,8 @@ Module Impl_set_code_hash_Incrementer. let* α0 := M.get_function "std::panicking::begin_panic" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.read (mk_str @@ -198,8 +215,8 @@ Module Impl_set_code_hash_Incrementer. M.alloc α3 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Switched code hash to ") in @@ -213,7 +230,8 @@ Module Impl_set_code_hash_Incrementer. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] in + [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ] ] + [] in let* α7 := M.call_closure α6 [ code_hash ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 fada31904..b6d9e2337 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 @@ -17,7 +17,8 @@ Module Impl_core_default_Default_for_updated_incrementer_AccountId. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructTuple "updated_incrementer::AccountId" [ α1 ]) | _, _ => M.impossible @@ -61,7 +62,9 @@ Module Impl_core_marker_Copy_for_updated_incrementer_AccountId. M.IsTraitInstance "core::marker::Copy" Self (* Trait polymorphic types *) [] (* Instance *) []. End Impl_core_marker_Copy_for_updated_incrementer_AccountId. -Axiom Hash : (Ty.path "updated_incrementer::Hash") = (Ty.apply (Ty.path "array") [ Ty.path "u8" ]). +Axiom Hash : + (Ty.path "updated_incrementer::Hash") = + (Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ]). (* Enum Error *) (* { @@ -84,7 +87,17 @@ Module Impl_updated_incrementer_Env. unimplemented!() } *) - Parameter set_code_hash : (list Ty.t) -> (list Value.t) -> M. + Definition set_code_hash (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [ E ], [ self; code_hash ] => + let* self := M.alloc self in + let* code_hash := M.alloc code_hash in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_set_code_hash : M.IsAssociatedFunction Self "set_code_hash" set_code_hash. @@ -105,7 +118,15 @@ Module Impl_updated_incrementer_Incrementer. unimplemented!() } *) - Parameter init_env : (list Ty.t) -> (list Value.t) -> M. + Definition init_env (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [] => + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_init_env : M.IsAssociatedFunction Self "init_env" init_env. @@ -119,7 +140,7 @@ Module Impl_updated_incrementer_Incrementer. | [], [ self ] => let* self := M.alloc self in let* α0 := - M.get_associated_function (Ty.path "updated_incrementer::Incrementer") "init_env" [] in + M.get_associated_function (Ty.path "updated_incrementer::Incrementer") "init_env" [] [] in M.call_closure α0 [] | _, _ => M.impossible end. @@ -137,7 +158,8 @@ Module Impl_updated_incrementer_Incrementer. let* α0 := M.get_function "core::panicking::unreachable_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.call_closure α0 @@ -170,8 +192,8 @@ Module Impl_updated_incrementer_Incrementer. M.assign β α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The new count is ") in @@ -186,7 +208,8 @@ Module Impl_updated_incrementer_Incrementer. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.read self in let* α8 := M.call_closure @@ -239,16 +262,19 @@ Module Impl_updated_incrementer_Incrementer. M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "updated_incrementer::Error" ]) + [ Ty.tuple []; Ty.path "updated_incrementer::Error" ] + []) "unwrap_or_else" - [ Ty.function [ Ty.tuple [ Ty.path "updated_incrementer::Error" ] ] (Ty.tuple []) ] in + [ Ty.function [ Ty.tuple [ Ty.path "updated_incrementer::Error" ] ] (Ty.tuple []) ] + [] in let* α1 := M.get_associated_function (Ty.path "updated_incrementer::Env") "set_code_hash" - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] in + [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ] ] + [] in let* α2 := - M.get_associated_function (Ty.path "updated_incrementer::Incrementer") "env" [] in + M.get_associated_function (Ty.path "updated_incrementer::Incrementer") "env" [] [] in let* α3 := M.read self in let* α4 := M.call_closure α2 [ α3 ] in let* α5 := M.alloc α4 in @@ -271,7 +297,8 @@ Module Impl_updated_incrementer_Incrementer. let* α0 := M.get_function "std::panicking::begin_panic" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.read (mk_str @@ -285,8 +312,8 @@ Module Impl_updated_incrementer_Incrementer. M.alloc α7 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Switched code hash to ") in @@ -300,7 +327,8 @@ Module Impl_updated_incrementer_Incrementer. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] in + [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 32 ] ] + [] in let* α7 := M.call_closure α6 [ code_hash ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in diff --git a/CoqOfRust/examples/default/examples/ink_contracts/trait_erc20.v b/CoqOfRust/examples/default/examples/ink_contracts/trait_erc20.v index 94b13e5f6..abb2280a3 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/trait_erc20.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/trait_erc20.v @@ -7,13 +7,13 @@ Require Import CoqOfRust.CoqOfRust. ty_params := [ "K"; "V" ]; fields := [ - ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ]); - ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + ("_key", Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []); + ("_value", Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) ]; } *) Module Impl_core_default_Default_for_trait_erc20_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "trait_erc20::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "trait_erc20::Mapping") [ K; V ] []. (* Default @@ -25,17 +25,21 @@ Module Impl_core_default_Default_for_trait_erc20_Mapping_K_V. let* α0 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "core::marker::PhantomData") [ K ]) + (Ty.apply (Ty.path "core::marker::PhantomData") [ K ] []) + [] [] "default" + [] [] in let* α1 := M.call_closure α0 [] in let* α2 := M.get_trait_method "core::default::Default" - (Ty.apply (Ty.path "core::marker::PhantomData") [ V ]) + (Ty.apply (Ty.path "core::marker::PhantomData") [ V ] []) + [] [] "default" + [] [] in let* α3 := M.call_closure α2 [] in M.pure (Value.StructRecord "trait_erc20::Mapping" [ ("_key", α1); ("_value", α3) ]) @@ -52,14 +56,25 @@ Module Impl_core_default_Default_for_trait_erc20_Mapping_K_V. End Impl_core_default_Default_for_trait_erc20_Mapping_K_V. Module Impl_trait_erc20_Mapping_K_V. - Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "trait_erc20::Mapping") [ K; V ]. + Definition Self (K V : Ty.t) : Ty.t := Ty.apply (Ty.path "trait_erc20::Mapping") [ K; V ] []. (* fn get(&self, _key: &K) -> Option { unimplemented!() } *) - Parameter get : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition get (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_get : forall (K V : Ty.t), @@ -70,7 +85,19 @@ Module Impl_trait_erc20_Mapping_K_V. unimplemented!() } *) - Parameter insert : forall (K V : Ty.t), (list Ty.t) -> (list Value.t) -> M. + Definition insert (K V : Ty.t) (τ : list Ty.t) (α : list Value.t) : M := + let Self : Ty.t := Self K V in + match τ, α with + | [], [ self; _key; _value ] => + let* self := M.alloc self in + let* _key := M.alloc _key in + let* _value := M.alloc _value in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_insert : forall (K V : Ty.t), @@ -93,7 +120,8 @@ Module Impl_core_default_Default_for_trait_erc20_AccountId. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructTuple "trait_erc20::AccountId" [ α1 ]) | _, _ => M.impossible @@ -175,7 +203,7 @@ Module Impl_core_fmt_Debug_for_trait_erc20_Error. | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] [] in let* α1 := M.read f in let* α2 := M.match_operator @@ -227,13 +255,19 @@ Module Impl_core_cmp_PartialEq_for_trait_erc20_Error. let* other := M.alloc other in let* __self_tag := let* α0 := - M.get_function "core::intrinsics::discriminant_value" [ Ty.path "trait_erc20::Error" ] in + M.get_function + "core::intrinsics::discriminant_value" + [ Ty.path "trait_erc20::Error" ] + [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* __arg1_tag := let* α0 := - M.get_function "core::intrinsics::discriminant_value" [ Ty.path "trait_erc20::Error" ] in + M.get_function + "core::intrinsics::discriminant_value" + [ Ty.path "trait_erc20::Error" ] + [] in let* α1 := M.read other in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -288,8 +322,8 @@ End Impl_core_cmp_Eq_for_trait_erc20_Error. Axiom Result : forall (T : Ty.t), - (Ty.apply (Ty.path "trait_erc20::Result") [ T ]) = - (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "trait_erc20::Error" ]). + (Ty.apply (Ty.path "trait_erc20::Result") [ T ] []) = + (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "trait_erc20::Error" ] []). (* Trait *) (* Empty module 'BaseErc20' *) @@ -304,14 +338,16 @@ Axiom Result : ("balances", Ty.apply (Ty.path "trait_erc20::Mapping") - [ Ty.path "trait_erc20::AccountId"; Ty.path "u128" ]); + [ Ty.path "trait_erc20::AccountId"; Ty.path "u128" ] + []); ("allowances", Ty.apply (Ty.path "trait_erc20::Mapping") [ Ty.tuple [ Ty.path "trait_erc20::AccountId"; Ty.path "trait_erc20::AccountId" ]; Ty.path "u128" - ]) + ] + []) ]; } *) @@ -324,16 +360,20 @@ Module Impl_core_default_Default_for_trait_erc20_Erc20. Definition default (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "u128") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "u128") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in let* α2 := M.get_trait_method "core::default::Default" (Ty.apply (Ty.path "trait_erc20::Mapping") - [ Ty.path "trait_erc20::AccountId"; Ty.path "u128" ]) + [ Ty.path "trait_erc20::AccountId"; Ty.path "u128" ] + []) + [] [] "default" + [] [] in let* α3 := M.call_closure α2 [] in let* α4 := @@ -344,9 +384,12 @@ Module Impl_core_default_Default_for_trait_erc20_Erc20. [ Ty.tuple [ Ty.path "trait_erc20::AccountId"; Ty.path "trait_erc20::AccountId" ]; Ty.path "u128" - ]) + ] + []) + [] [] "default" + [] [] in let* α5 := M.call_closure α4 [] in M.pure @@ -370,8 +413,8 @@ End Impl_core_default_Default_for_trait_erc20_Erc20. ty_params := []; fields := [ - ("from", Ty.apply (Ty.path "core::option::Option") [ Ty.path "trait_erc20::AccountId" ]); - ("to", Ty.apply (Ty.path "core::option::Option") [ Ty.path "trait_erc20::AccountId" ]); + ("from", Ty.apply (Ty.path "core::option::Option") [ Ty.path "trait_erc20::AccountId" ] []); + ("to", Ty.apply (Ty.path "core::option::Option") [ Ty.path "trait_erc20::AccountId" ] []); ("value", Ty.path "u128") ]; } *) @@ -430,7 +473,17 @@ Module Impl_trait_erc20_Env. unimplemented!() } *) - Parameter emit_event : (list Ty.t) -> (list Value.t) -> M. + Definition emit_event (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [ self; _event ] => + let* self := M.alloc self in + let* _event := M.alloc _event in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_emit_event : M.IsAssociatedFunction Self "emit_event" emit_event. End Impl_trait_erc20_Env. @@ -443,7 +496,15 @@ Module Impl_trait_erc20_Erc20. unimplemented!() } *) - Parameter init_env : (list Ty.t) -> (list Value.t) -> M. + Definition init_env (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [], [] => + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. Axiom AssociatedFunction_init_env : M.IsAssociatedFunction Self "init_env" init_env. @@ -456,7 +517,7 @@ Module Impl_trait_erc20_Erc20. match τ, α with | [], [ self ] => let* self := M.alloc self in - let* α0 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "init_env" [] in + let* α0 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "init_env" [] [] in M.call_closure α0 [] | _, _ => M.impossible end. @@ -490,15 +551,18 @@ Module Impl_trait_erc20_Erc20. "core::default::Default" (Ty.apply (Ty.path "trait_erc20::Mapping") - [ Ty.path "trait_erc20::AccountId"; Ty.path "u128" ]) + [ Ty.path "trait_erc20::AccountId"; Ty.path "u128" ] + []) + [] [] "default" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* caller := - let* α0 := M.get_associated_function (Ty.path "trait_erc20::Env") "caller" [] in - let* α1 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "init_env" [] in + let* α0 := M.get_associated_function (Ty.path "trait_erc20::Env") "caller" [] [] in + let* α1 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "init_env" [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.alloc α2 in let* α4 := M.call_closure α0 [ α3 ] in @@ -508,16 +572,18 @@ Module Impl_trait_erc20_Erc20. M.get_associated_function (Ty.apply (Ty.path "trait_erc20::Mapping") - [ Ty.path "trait_erc20::AccountId"; Ty.path "u128" ]) + [ Ty.path "trait_erc20::AccountId"; Ty.path "u128" ] + []) "insert" + [] [] in let* α1 := M.read caller in let* α2 := M.read total_supply in let* α3 := M.call_closure α0 [ balances; α1; α2 ] in M.alloc α3 in let* _ := - let* α0 := M.get_associated_function (Ty.path "trait_erc20::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "init_env" [] in + let* α0 := M.get_associated_function (Ty.path "trait_erc20::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "init_env" [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.alloc α2 in let* α4 := M.read caller in @@ -550,9 +616,12 @@ Module Impl_trait_erc20_Erc20. [ Ty.tuple [ Ty.path "trait_erc20::AccountId"; Ty.path "trait_erc20::AccountId" ]; Ty.path "u128" - ]) + ] + []) + [] [] "default" + [] [] in let* α3 := M.call_closure α2 [] in let* α0 := @@ -578,15 +647,18 @@ Module Impl_trait_erc20_Erc20. let* owner := M.alloc owner in let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u128" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u128" ] []) "unwrap_or_default" + [] [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "trait_erc20::Mapping") - [ Ty.path "trait_erc20::AccountId"; Ty.path "u128" ]) + [ Ty.path "trait_erc20::AccountId"; Ty.path "u128" ] + []) "get" + [] [] in let* α2 := M.read self in let* α3 := M.read owner in @@ -612,8 +684,9 @@ Module Impl_trait_erc20_Erc20. let* spender := M.alloc spender in let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u128" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u128" ] []) "unwrap_or_default" + [] [] in let* α1 := M.get_associated_function @@ -622,8 +695,10 @@ Module Impl_trait_erc20_Erc20. [ Ty.tuple [ Ty.path "trait_erc20::AccountId"; Ty.path "trait_erc20::AccountId" ]; Ty.path "u128" - ]) + ] + []) "get" + [] [] in let* α2 := M.read self in let* α3 := M.read owner in @@ -666,7 +741,8 @@ Module Impl_trait_erc20_Erc20. let* to := M.alloc to in let* value := M.alloc value in let* from_balance := - let* α0 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "balance_of_impl" [] in + let* α0 := + M.get_associated_function (Ty.path "trait_erc20::Erc20") "balance_of_impl" [] [] in let* α1 := M.read self in let* α2 := M.read from in let* α3 := M.call_closure α0 [ α1; α2 ] in @@ -700,8 +776,10 @@ Module Impl_trait_erc20_Erc20. M.get_associated_function (Ty.apply (Ty.path "trait_erc20::Mapping") - [ Ty.path "trait_erc20::AccountId"; Ty.path "u128" ]) + [ Ty.path "trait_erc20::AccountId"; Ty.path "u128" ] + []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read from in @@ -715,7 +793,8 @@ Module Impl_trait_erc20_Erc20. [ M.get_struct_record_field α1 "trait_erc20::Erc20" "balances"; α3; α6 ] in M.alloc α7 in let* to_balance := - let* α0 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "balance_of_impl" [] in + let* α0 := + M.get_associated_function (Ty.path "trait_erc20::Erc20") "balance_of_impl" [] [] in let* α1 := M.read self in let* α2 := M.read to in let* α3 := M.call_closure α0 [ α1; α2 ] in @@ -725,8 +804,10 @@ Module Impl_trait_erc20_Erc20. M.get_associated_function (Ty.apply (Ty.path "trait_erc20::Mapping") - [ Ty.path "trait_erc20::AccountId"; Ty.path "u128" ]) + [ Ty.path "trait_erc20::AccountId"; Ty.path "u128" ] + []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read to in @@ -740,8 +821,8 @@ Module Impl_trait_erc20_Erc20. [ M.get_struct_record_field α1 "trait_erc20::Erc20" "balances"; α3; α6 ] in M.alloc α7 in let* _ := - let* α0 := M.get_associated_function (Ty.path "trait_erc20::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "env" [] in + let* α0 := M.get_associated_function (Ty.path "trait_erc20::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -804,7 +885,7 @@ Module Impl_trait_erc20_BaseErc20_for_trait_erc20_Erc20. | [], [ self; owner ] => let* self := M.alloc self in let* owner := M.alloc owner in - let* α0 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "balance_of_impl" [] in + let* α0 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "balance_of_impl" [] [] in let* α1 := M.read self in M.call_closure α0 [ α1; owner ] | _, _ => M.impossible @@ -821,7 +902,7 @@ Module Impl_trait_erc20_BaseErc20_for_trait_erc20_Erc20. let* self := M.alloc self in let* owner := M.alloc owner in let* spender := M.alloc spender in - let* α0 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "allowance_impl" [] in + let* α0 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "allowance_impl" [] [] in let* α1 := M.read self in M.call_closure α0 [ α1; owner; spender ] | _, _ => M.impossible @@ -840,14 +921,15 @@ Module Impl_trait_erc20_BaseErc20_for_trait_erc20_Erc20. let* to := M.alloc to in let* value := M.alloc value in let* from := - let* α0 := M.get_associated_function (Ty.path "trait_erc20::Env") "caller" [] in - let* α1 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "env" [] in + let* α0 := M.get_associated_function (Ty.path "trait_erc20::Env") "caller" [] [] in + let* α1 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in let* α5 := M.call_closure α0 [ α4 ] in M.alloc α5 in - let* α0 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "transfer_from_to" [] in + let* α0 := + M.get_associated_function (Ty.path "trait_erc20::Erc20") "transfer_from_to" [] [] in let* α1 := M.read self in let* α2 := M.read value in let* α3 := M.call_closure α0 [ α1; from; to; α2 ] in @@ -875,8 +957,8 @@ Module Impl_trait_erc20_BaseErc20_for_trait_erc20_Erc20. let* spender := M.alloc spender in let* value := M.alloc value in let* owner := - let* α0 := M.get_associated_function (Ty.path "trait_erc20::Env") "caller" [] in - let* α1 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "env" [] in + let* α0 := M.get_associated_function (Ty.path "trait_erc20::Env") "caller" [] [] in + let* α1 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -890,8 +972,10 @@ Module Impl_trait_erc20_BaseErc20_for_trait_erc20_Erc20. [ Ty.tuple [ Ty.path "trait_erc20::AccountId"; Ty.path "trait_erc20::AccountId" ]; Ty.path "u128" - ]) + ] + []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read owner in @@ -907,8 +991,8 @@ Module Impl_trait_erc20_BaseErc20_for_trait_erc20_Erc20. ] in M.alloc α5 in let* _ := - let* α0 := M.get_associated_function (Ty.path "trait_erc20::Env") "emit_event" [] in - let* α1 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "env" [] in + let* α0 := M.get_associated_function (Ty.path "trait_erc20::Env") "emit_event" [] [] in + let* α1 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -954,15 +1038,16 @@ Module Impl_trait_erc20_BaseErc20_for_trait_erc20_Erc20. let* to := M.alloc to in let* value := M.alloc value in let* caller := - let* α0 := M.get_associated_function (Ty.path "trait_erc20::Env") "caller" [] in - let* α1 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "env" [] in + let* α0 := M.get_associated_function (Ty.path "trait_erc20::Env") "caller" [] [] in + let* α1 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "env" [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in let* α5 := M.call_closure α0 [ α4 ] in M.alloc α5 in let* allowance := - let* α0 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "allowance_impl" [] in + let* α0 := + M.get_associated_function (Ty.path "trait_erc20::Erc20") "allowance_impl" [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1; from; caller ] in M.alloc α2 in @@ -996,11 +1081,15 @@ Module Impl_trait_erc20_BaseErc20_for_trait_erc20_Erc20. "core::ops::try_trait::Try" (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "trait_erc20::Error" ]) + [ Ty.tuple []; Ty.path "trait_erc20::Error" ] + []) + [] [] "branch" + [] [] in - let* α1 := M.get_associated_function (Ty.path "trait_erc20::Erc20") "transfer_from_to" [] in + let* α1 := + M.get_associated_function (Ty.path "trait_erc20::Erc20") "transfer_from_to" [] [] in let* α2 := M.read self in let* α3 := M.read value in let* α4 := M.call_closure α1 [ α2; from; to; α3 ] in @@ -1021,13 +1110,17 @@ Module Impl_trait_erc20_BaseErc20_for_trait_erc20_Erc20. "core::ops::try_trait::FromResidual" (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "trait_erc20::Error" ]) + [ Ty.tuple []; Ty.path "trait_erc20::Error" ] + []) [ Ty.apply (Ty.path "core::result::Result") [ Ty.path "core::convert::Infallible"; Ty.path "trait_erc20::Error" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -1052,8 +1145,10 @@ Module Impl_trait_erc20_BaseErc20_for_trait_erc20_Erc20. [ Ty.tuple [ Ty.path "trait_erc20::AccountId"; Ty.path "trait_erc20::AccountId" ]; Ty.path "u128" - ]) + ] + []) "insert" + [] [] in let* α1 := M.read self in let* α2 := M.read from in diff --git a/CoqOfRust/examples/default/examples/ink_contracts/trait_flipper.v b/CoqOfRust/examples/default/examples/ink_contracts/trait_flipper.v index c9bbcdcb2..ceea58f66 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/trait_flipper.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/trait_flipper.v @@ -24,7 +24,8 @@ Module Impl_trait_flipper_Flipper. Definition new (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_trait_method "core::default::Default" (Ty.path "bool") [] "default" [] in + let* α0 := + M.get_trait_method "core::default::Default" (Ty.path "bool") [] [] "default" [] [] in let* α1 := M.call_closure α0 [] in M.pure (Value.StructRecord "trait_flipper::Flipper" [ ("value", α1) ]) | _, _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/ink_contracts/trait_incrementer.v b/CoqOfRust/examples/default/examples/ink_contracts/trait_incrementer.v index 6c33f6d7c..42cdc3e66 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/trait_incrementer.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/trait_incrementer.v @@ -71,7 +71,8 @@ Module Impl_trait_incrementer_Increment_for_trait_incrementer_Incrementer. match τ, α with | [], [ self ] => let* self := M.alloc self in - let* α0 := M.get_associated_function (Ty.path "trait_incrementer::Incrementer") "inc_by" [] in + let* α0 := + M.get_associated_function (Ty.path "trait_incrementer::Incrementer") "inc_by" [] [] in let* α1 := M.read self in M.call_closure α0 [ α1; Value.Integer Integer.U64 1 ] | _, _ => M.impossible diff --git a/CoqOfRust/examples/default/examples/ink_contracts/wildcard_selector.v b/CoqOfRust/examples/default/examples/ink_contracts/wildcard_selector.v index 6537c226e..48e48e857 100644 --- a/CoqOfRust/examples/default/examples/ink_contracts/wildcard_selector.v +++ b/CoqOfRust/examples/default/examples/ink_contracts/wildcard_selector.v @@ -6,7 +6,15 @@ fn decode_input() -> Result { unimplemented!() } *) -Parameter decode_input : (list Ty.t) -> (list Value.t) -> M. +Definition decode_input (τ : list Ty.t) (α : list Value.t) : M := + match τ, α with + | [ T ], [] => + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in + let* α1 := M.read (mk_str "not implemented") in + let* α2 := M.call_closure α0 [ α1 ] in + M.never_to_any α2 + | _, _ => M.impossible + end. (* StructTuple { @@ -46,18 +54,27 @@ Module Impl_wildcard_selector_WildcardSelector. (Ty.path "core::result::Result") [ Ty.tuple - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ]; Ty.path "alloc::string::String" ]; + [ + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 4 ]; + Ty.path "alloc::string::String" + ]; Ty.tuple [] - ]) + ] + []) "unwrap" + [] [] in let* α1 := M.get_function "wildcard_selector::decode_input" [ Ty.tuple - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ]; Ty.path "alloc::string::String" ] - ] in + [ + Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 4 ]; + Ty.path "alloc::string::String" + ] + ] + [] in let* α2 := M.call_closure α1 [] in let* α3 := M.call_closure α0 [ α2 ] in let* α4 := M.alloc α3 in @@ -72,9 +89,9 @@ Module Impl_wildcard_selector_WildcardSelector. let* _message := M.copy γ0_1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "Wildcard selector: ") in @@ -89,13 +106,20 @@ Module Impl_wildcard_selector_WildcardSelector. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] in + [ + Ty.apply + (Ty.path "array") + [ Ty.path "u8" ] + [ Value.Integer Integer.Usize 4 ] + ] + [] in let* α8 := M.call_closure α7 [ _selector ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α10 := M.call_closure α9 [ _message ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in M.pure (M.pointer_coercion α11) in @@ -123,8 +147,8 @@ Module Impl_wildcard_selector_WildcardSelector. let* _message := M.alloc _message in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Wildcard complement message: ") in @@ -138,7 +162,8 @@ Module Impl_wildcard_selector_WildcardSelector. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α7 := M.call_closure α6 [ _message ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in diff --git a/CoqOfRust/examples/default/examples/monadic_transformation/example01.v b/CoqOfRust/examples/default/examples/monadic_transformation/example01.v index fd1f59ff5..822d78fc4 100644 --- a/CoqOfRust/examples/default/examples/monadic_transformation/example01.v +++ b/CoqOfRust/examples/default/examples/monadic_transformation/example01.v @@ -40,38 +40,38 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* _ := - let* α0 := M.get_function "example01::id" [] in + let* α0 := M.get_function "example01::id" [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.U64 0 ] in M.alloc α1 in let* _ := - let* α0 := M.get_function "example01::id" [] in - let* α1 := M.get_function "example01::id" [] in + let* α0 := M.get_function "example01::id" [] [] in + let* α1 := M.get_function "example01::id" [] [] in let* α2 := M.call_closure α1 [ Value.Integer Integer.U64 0 ] in let* α3 := M.call_closure α0 [ α2 ] in M.alloc α3 in let* _ := - let* α0 := M.get_function "example01::id" [] in - let* α1 := M.get_function "example01::id" [] in - let* α2 := M.get_function "example01::id" [] in + let* α0 := M.get_function "example01::id" [] [] in + let* α1 := M.get_function "example01::id" [] [] in + let* α2 := M.get_function "example01::id" [] [] in let* α3 := M.call_closure α2 [ Value.Integer Integer.U64 0 ] in let* α4 := M.call_closure α1 [ α3 ] in let* α5 := M.call_closure α0 [ α4 ] in M.alloc α5 in let* _ := - let* α0 := M.get_function "example01::id" [] in - let* α1 := M.get_function "example01::id" [] in - let* α2 := M.get_function "example01::id" [] in - let* α3 := M.get_function "example01::id" [] in + let* α0 := M.get_function "example01::id" [] [] in + let* α1 := M.get_function "example01::id" [] [] in + let* α2 := M.get_function "example01::id" [] [] in + let* α3 := M.get_function "example01::id" [] [] in let* α4 := M.call_closure α3 [ Value.Integer Integer.U64 0 ] in let* α5 := M.call_closure α2 [ α4 ] in let* α6 := M.call_closure α1 [ α5 ] in let* α7 := M.call_closure α0 [ α6 ] in M.alloc α7 in let* _ := - let* α0 := M.get_function "example01::tri" [] in - let* α1 := M.get_function "example01::id" [] in + let* α0 := M.get_function "example01::tri" [] [] in + let* α1 := M.get_function "example01::id" [] [] in let* α2 := M.call_closure α1 [ Value.Integer Integer.U64 1 ] in - let* α3 := M.get_function "example01::id" [] in + let* α3 := M.get_function "example01::id" [] [] in let* α4 := M.call_closure α3 [ Value.Integer Integer.U64 2 ] in let* α5 := M.call_closure α0 [ α2; α4; Value.Integer Integer.U64 3 ] in M.alloc α5 in diff --git a/CoqOfRust/examples/default/examples/monadic_transformation/example03.v b/CoqOfRust/examples/default/examples/monadic_transformation/example03.v index 612b785ad..9114ae96a 100644 --- a/CoqOfRust/examples/default/examples/monadic_transformation/example03.v +++ b/CoqOfRust/examples/default/examples/monadic_transformation/example03.v @@ -22,17 +22,23 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* _ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α5 := (* Unsize *) let* α1 := M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.apply (Ty.path "array") [ Ty.path "i32" ]; Ty.path "alloc::alloc::Global" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "i32" ] [ Value.Integer Integer.Usize 4 ]; + Ty.path "alloc::alloc::Global" + ] + []) "new" + [] [] in let* α2 := M.alloc diff --git a/CoqOfRust/examples/default/examples/monadic_transformation/example05.v b/CoqOfRust/examples/default/examples/monadic_transformation/example05.v index a02edaa4b..534ebc0dc 100644 --- a/CoqOfRust/examples/default/examples/monadic_transformation/example05.v +++ b/CoqOfRust/examples/default/examples/monadic_transformation/example05.v @@ -39,7 +39,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* foo := M.alloc (Value.StructTuple "example05::Foo" [ Value.Integer Integer.U32 0 ]) in let* _ := - let* α0 := M.get_associated_function (Ty.path "example05::Foo") "plus1" [] in + let* α0 := M.get_associated_function (Ty.path "example05::Foo") "plus1" [] [] in let* α1 := M.read foo in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in 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 9d0ecec95..a5be79686 100644 --- a/CoqOfRust/examples/default/examples/rust_book/attributes/dead_code.v +++ b/CoqOfRust/examples/default/examples/rust_book/attributes/dead_code.v @@ -28,7 +28,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* _ := - let* α0 := M.get_function "dead_code::used_function" [] in + let* α0 := M.get_function "dead_code::used_function" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* α0 := M.alloc (Value.Tuple []) in 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 300a2ce3e..a9f1f935c 100644 --- a/CoqOfRust/examples/default/examples/rust_book/cargo/concurrent_tests.v +++ b/CoqOfRust/examples/default/examples/rust_book/cargo/concurrent_tests.v @@ -21,9 +21,13 @@ Definition foo (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::option::Option::Some" 0 in let* _a := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "some @@ -36,9 +40,13 @@ Definition foo (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []); fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "nothing @@ -79,17 +87,20 @@ Module tests. M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "std::fs::File"; Ty.path "std::io::error::Error" ]) + [ Ty.path "std::fs::File"; Ty.path "std::io::error::Error" ] + []) "expect" + [] [] in let* α1 := M.get_associated_function (Ty.path "std::fs::OpenOptions") "open" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in - let* α2 := M.get_associated_function (Ty.path "std::fs::OpenOptions") "create" [] in - let* α3 := M.get_associated_function (Ty.path "std::fs::OpenOptions") "append" [] in - let* α4 := M.get_associated_function (Ty.path "std::fs::OpenOptions") "new" [] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in + let* α2 := M.get_associated_function (Ty.path "std::fs::OpenOptions") "create" [] [] in + let* α3 := M.get_associated_function (Ty.path "std::fs::OpenOptions") "append" [] [] in + let* α4 := M.get_associated_function (Ty.path "std::fs::OpenOptions") "new" [] [] in let* α5 := M.call_closure α4 [] in let* α6 := M.alloc α5 in let* α7 := M.call_closure α3 [ α6; Value.Bool true ] in @@ -102,9 +113,11 @@ Module tests. let* α0 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ] []) + [] [] "into_iter" + [] [] in let* α1 := M.call_closure @@ -126,9 +139,11 @@ Module tests. let* α0 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ] []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -151,17 +166,26 @@ Module tests. M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "std::io::error::Error" ]) + [ Ty.tuple []; Ty.path "std::io::error::Error" ] + []) "expect" + [] [] in let* α1 := M.get_trait_method "std::io::Write" (Ty.path "std::fs::File") [] + [] "write_all" + [] [] in - let* α2 := M.get_associated_function (Ty.path "str") "as_bytes" [] in + let* α2 := + M.get_associated_function + (Ty.path "str") + "as_bytes" + [] + [ Value.Bool true ] in let* α3 := M.read (mk_str "Ferris ") in let* α4 := M.call_closure α2 [ α3 ] in @@ -201,17 +225,20 @@ Module tests. M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "std::fs::File"; Ty.path "std::io::error::Error" ]) + [ Ty.path "std::fs::File"; Ty.path "std::io::error::Error" ] + []) "expect" + [] [] in let* α1 := M.get_associated_function (Ty.path "std::fs::OpenOptions") "open" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in - let* α2 := M.get_associated_function (Ty.path "std::fs::OpenOptions") "create" [] in - let* α3 := M.get_associated_function (Ty.path "std::fs::OpenOptions") "append" [] in - let* α4 := M.get_associated_function (Ty.path "std::fs::OpenOptions") "new" [] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in + let* α2 := M.get_associated_function (Ty.path "std::fs::OpenOptions") "create" [] [] in + let* α3 := M.get_associated_function (Ty.path "std::fs::OpenOptions") "append" [] [] in + let* α4 := M.get_associated_function (Ty.path "std::fs::OpenOptions") "new" [] [] in let* α5 := M.call_closure α4 [] in let* α6 := M.alloc α5 in let* α7 := M.call_closure α3 [ α6; Value.Bool true ] in @@ -224,9 +251,11 @@ Module tests. let* α0 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ] []) + [] [] "into_iter" + [] [] in let* α1 := M.call_closure @@ -248,9 +277,11 @@ Module tests. let* α0 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ] []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -273,17 +304,26 @@ Module tests. M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "std::io::error::Error" ]) + [ Ty.tuple []; Ty.path "std::io::error::Error" ] + []) "expect" + [] [] in let* α1 := M.get_trait_method "std::io::Write" (Ty.path "std::fs::File") [] + [] "write_all" + [] [] in - let* α2 := M.get_associated_function (Ty.path "str") "as_bytes" [] in + let* α2 := + M.get_associated_function + (Ty.path "str") + "as_bytes" + [] + [ Value.Bool true ] in let* α3 := M.read (mk_str "Corro ") in let* α4 := M.call_closure α2 [ α3 ] in 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 aa790e46c..5ae7b3936 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 @@ -21,9 +21,9 @@ Module Impl_core_fmt_Display_for_converting_to_string_Circle. | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_fmt" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_fmt" [] [] in let* α1 := M.read f in - let* α2 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α2 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α3 := M.read (mk_str "Circle of radius ") in @@ -35,7 +35,8 @@ Module Impl_core_fmt_Display_for_converting_to_string_Circle. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.read self in let* α8 := M.call_closure @@ -76,7 +77,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "alloc::string::ToString" (Ty.path "converting_to_string::Circle") [] + [] "to_string" + [] [] in let* α1 := M.call_closure α0 [ circle ] in M.alloc α1 in diff --git a/CoqOfRust/examples/default/examples/rust_book/conversion/from.v b/CoqOfRust/examples/default/examples/rust_book/conversion/from.v index 80f321739..32db66784 100644 --- a/CoqOfRust/examples/default/examples/rust_book/conversion/from.v +++ b/CoqOfRust/examples/default/examples/rust_book/conversion/from.v @@ -47,7 +47,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::convert::From" (Ty.path "from::Number") [ Ty.path "i32" ] + [] "from" + [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.I32 30 ] in M.alloc α1 in diff --git a/CoqOfRust/examples/default/examples/rust_book/conversion/into.v b/CoqOfRust/examples/default/examples/rust_book/conversion/into.v index 5373f082c..312ea32b7 100644 --- a/CoqOfRust/examples/default/examples/rust_book/conversion/into.v +++ b/CoqOfRust/examples/default/examples/rust_book/conversion/into.v @@ -47,7 +47,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::convert::Into" (Ty.path "i32") [ Ty.path "into::Number" ] + [] "into" + [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.I32 5 ] in M.alloc α1 in 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 2b37a7ca7..e3d83a0d9 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 @@ -12,17 +12,17 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* _ := - let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α1 := M.read (mk_str "12") in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := - let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "bool" ] in + let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "bool" ] [] in let* α1 := M.read (mk_str "true") in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := - let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "u32" ] in + let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "u32" ] [] in let* α1 := M.read (mk_str "unparsable") in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in 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 b1ff64fa7..e8dc2478b 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 @@ -20,7 +20,11 @@ Module Impl_core_fmt_Debug_for_try_from_and_try_into_EvenNumber. let* self := M.alloc self in let* f := M.alloc f in let* α0 := - M.get_associated_function (Ty.path "core::fmt::Formatter") "debug_tuple_field1_finish" [] in + M.get_associated_function + (Ty.path "core::fmt::Formatter") + "debug_tuple_field1_finish" + [] + [] in let* α1 := M.read f in let* α2 := M.read (mk_str "EvenNumber") in let* α5 := @@ -157,7 +161,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::convert::TryFrom" (Ty.path "try_from_and_try_into::EvenNumber") [ Ty.path "i32" ] + [] "try_from" + [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.I32 8 ] in let* α2 := M.alloc α1 in @@ -187,13 +193,17 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::cmp::PartialEq" (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ]) + [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ] + []) [ Ty.apply (Ty.path "core::result::Result") [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ] + [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read left_val in let* α2 := M.read right_val in @@ -210,11 +220,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ]; + [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ] + []; Ty.apply (Ty.path "core::result::Result") [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ] - ] in + [] + ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in @@ -235,7 +248,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::convert::TryFrom" (Ty.path "try_from_and_try_into::EvenNumber") [ Ty.path "i32" ] + [] "try_from" + [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.I32 5 ] in let* α2 := M.alloc α1 in @@ -260,13 +275,17 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::cmp::PartialEq" (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ]) + [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ] + []) [ Ty.apply (Ty.path "core::result::Result") [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ] + [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read left_val in let* α2 := M.read right_val in @@ -283,11 +302,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ]; + [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ] + []; Ty.apply (Ty.path "core::result::Result") [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ] - ] in + [] + ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in @@ -308,7 +330,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::convert::TryInto" (Ty.path "i32") [ Ty.path "try_from_and_try_into::EvenNumber" ] + [] "try_into" + [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.I32 8 ] in M.alloc α1 in @@ -339,13 +363,17 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::cmp::PartialEq" (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ]) + [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ] + []) [ Ty.apply (Ty.path "core::result::Result") [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ] + [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read left_val in let* α2 := M.read right_val in @@ -362,11 +390,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ]; + [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ] + []; Ty.apply (Ty.path "core::result::Result") [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ] - ] in + [] + ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in @@ -387,7 +418,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::convert::TryInto" (Ty.path "i32") [ Ty.path "try_from_and_try_into::EvenNumber" ] + [] "try_into" + [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.I32 5 ] in M.alloc α1 in @@ -413,13 +446,17 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::cmp::PartialEq" (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ]) + [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ] + []) [ Ty.apply (Ty.path "core::result::Result") [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ] + [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read left_val in let* α2 := M.read right_val in @@ -436,11 +473,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ]; + [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ] + []; Ty.apply (Ty.path "core::result::Result") [ Ty.path "try_from_and_try_into::EvenNumber"; Ty.tuple [] ] - ] in + [] + ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in 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 348b122d0..6321f0b9c 100644 --- a/CoqOfRust/examples/default/examples/rust_book/custom_types/constants.v +++ b/CoqOfRust/examples/default/examples/rust_book/custom_types/constants.v @@ -42,8 +42,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* n := M.alloc (Value.Integer Integer.I32 16) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "This is ") in @@ -57,7 +57,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.get_constant "constants::LANGUAGE" in let* α8 := M.read α7 in let* α9 := M.call_closure α6 [ α8 ] in @@ -69,8 +70,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The threshold is ") in @@ -84,7 +85,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.get_constant "constants::THRESHOLD" in let* α8 := M.call_closure α6 [ α7 ] in let* α9 := M.alloc (Value.Array [ α8 ]) in @@ -95,8 +97,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -111,13 +113,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α8 := M.call_closure α7 [ n ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α10 := M.alloc (Value.Tuple []) in let* α11 := M.match_operator @@ -125,7 +129,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ fun γ => let* γ := - let* α0 := M.get_function "constants::is_big" [] in + let* α0 := M.get_function "constants::is_big" [] [] in let* α1 := M.read n in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.alloc α2 in 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 8ece2b304..6aace1374 100644 --- a/CoqOfRust/examples/default/examples/rust_book/custom_types/enums.v +++ b/CoqOfRust/examples/default/examples/rust_book/custom_types/enums.v @@ -59,9 +59,13 @@ Definition inspect (τ : list Ty.t) (α : list Value.t) : M := [ fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := @@ -79,9 +83,13 @@ Definition inspect (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []); fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "page unloaded @@ -96,8 +104,9 @@ Definition inspect (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "enums::WebEvent::KeyPress" 0 in let* c := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "pressed '") in @@ -111,7 +120,8 @@ Definition inspect (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "char" ] in + [ Ty.path "char" ] + [] in let* α7 := M.call_closure α6 [ c ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -123,8 +133,9 @@ Definition inspect (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "enums::WebEvent::Paste" 0 in let* s := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "pasted """) in @@ -138,7 +149,8 @@ Definition inspect (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α7 := M.call_closure α6 [ s ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -153,8 +165,9 @@ Definition inspect (τ : list Ty.t) (α : list Value.t) : M := let* y := M.copy γ0_1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "clicked at x=") in @@ -169,13 +182,15 @@ Definition inspect (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i64" ] in + [ Ty.path "i64" ] + [] in let* α8 := M.call_closure α7 [ x ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i64" ] in + [ Ty.path "i64" ] + [] in let* α10 := M.call_closure α9 [ y ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in M.pure (M.pointer_coercion α11) in @@ -211,7 +226,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* pressed := M.alloc (Value.StructTuple "enums::WebEvent::KeyPress" [ Value.UnicodeChar 120 ]) in let* pasted := - let* α0 := M.get_trait_method "alloc::borrow::ToOwned" (Ty.path "str") [] "to_owned" [] in + let* α0 := + M.get_trait_method "alloc::borrow::ToOwned" (Ty.path "str") [] [] "to_owned" [] [] in let* α1 := M.read (mk_str "my text") in let* α2 := M.call_closure α0 [ α1 ] in M.alloc (Value.StructTuple "enums::WebEvent::Paste" [ α2 ]) in @@ -223,27 +239,27 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* load := M.alloc (Value.StructTuple "enums::WebEvent::PageLoad" []) in let* unload := M.alloc (Value.StructTuple "enums::WebEvent::PageUnload" []) in let* _ := - let* α0 := M.get_function "enums::inspect" [] in + let* α0 := M.get_function "enums::inspect" [] [] in let* α1 := M.read pressed in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := - let* α0 := M.get_function "enums::inspect" [] in + let* α0 := M.get_function "enums::inspect" [] [] in let* α1 := M.read pasted in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := - let* α0 := M.get_function "enums::inspect" [] in + let* α0 := M.get_function "enums::inspect" [] [] in let* α1 := M.read click in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := - let* α0 := M.get_function "enums::inspect" [] in + let* α0 := M.get_function "enums::inspect" [] [] in let* α1 := M.read load in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := - let* α0 := M.get_function "enums::inspect" [] in + let* α0 := M.get_function "enums::inspect" [] [] in let* α1 := M.read unload in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in 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 9402dd4fb..d9dc0dd2b 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 @@ -62,8 +62,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "zero is ") in @@ -77,7 +77,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.alloc (M.rust_cast (Value.Integer Integer.Isize 0)) in let* α8 := M.call_closure α6 [ α7 ] in let* α9 := M.alloc (Value.Array [ α8 ]) in @@ -88,8 +89,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "one is ") in @@ -103,7 +104,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.alloc (M.rust_cast (Value.Integer Integer.Isize 1)) in let* α8 := M.call_closure α6 [ α7 ] in let* α9 := M.alloc (Value.Array [ α8 ]) in @@ -114,9 +116,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1_formatted" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1_formatted" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "roses are #") in @@ -130,7 +132,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_lower_hex" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.get_constant "enums_c_like::Color::Red_discriminant" in let* α8 := BinOp.Panic.add α7 (Value.Integer Integer.Isize 0) in let* α9 := M.alloc (M.rust_cast α8) in @@ -139,7 +142,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.pure (M.pointer_coercion α11) in let* α16 := (* Unsize *) - let* α13 := M.get_associated_function (Ty.path "core::fmt::rt::Placeholder") "new" [] in + let* α13 := + M.get_associated_function + (Ty.path "core::fmt::rt::Placeholder") + "new" + [] + [ Value.Bool true ] in let* α14 := M.call_closure α13 @@ -153,7 +161,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ] in let* α15 := M.alloc (Value.Array [ α14 ]) in M.pure (M.pointer_coercion α15) in - let* α17 := M.get_associated_function (Ty.path "core::fmt::rt::UnsafeArg") "new" [] in + let* α17 := M.get_associated_function (Ty.path "core::fmt::rt::UnsafeArg") "new" [] [] in let* α18 := M.call_closure α17 [] in let* α19 := M.call_closure α1 [ α5; α12; α16; α18 ] in let* α20 := M.call_closure α0 [ α19 ] in @@ -161,9 +169,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1_formatted" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1_formatted" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "violets are #") in @@ -177,7 +185,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_lower_hex" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.get_constant "enums_c_like::Color::Blue_discriminant" in let* α8 := BinOp.Panic.add α7 (Value.Integer Integer.Isize 0) in let* α9 := M.alloc (M.rust_cast α8) in @@ -186,7 +195,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.pure (M.pointer_coercion α11) in let* α16 := (* Unsize *) - let* α13 := M.get_associated_function (Ty.path "core::fmt::rt::Placeholder") "new" [] in + let* α13 := + M.get_associated_function + (Ty.path "core::fmt::rt::Placeholder") + "new" + [] + [ Value.Bool true ] in let* α14 := M.call_closure α13 @@ -200,7 +214,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ] in let* α15 := M.alloc (Value.Array [ α14 ]) in M.pure (M.pointer_coercion α15) in - let* α17 := M.get_associated_function (Ty.path "core::fmt::rt::UnsafeArg") "new" [] in + let* α17 := M.get_associated_function (Ty.path "core::fmt::rt::UnsafeArg") "new" [] [] in let* α18 := M.call_closure α17 [] in let* α19 := M.call_closure α1 [ α5; α12; α16; α18 ] in let* α20 := M.call_closure α0 [ α19 ] in 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 863d73c35..f0f539409 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 @@ -15,6 +15,7 @@ Require Import CoqOfRust.CoqOfRust. Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "enums_testcase_linked_list::List"; Ty.path "alloc::alloc::Global" ] + [] ]; discriminant := None; }; @@ -59,8 +60,10 @@ Module Impl_enums_testcase_linked_list_List. M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.path "enums_testcase_linked_list::List"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "enums_testcase_linked_list::List"; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in @@ -110,7 +113,11 @@ Module Impl_enums_testcase_linked_list_List. 1 in let* tail := M.alloc γ0_1 in let* α0 := - M.get_associated_function (Ty.path "enums_testcase_linked_list::List") "len" [] in + M.get_associated_function + (Ty.path "enums_testcase_linked_list::List") + "len" + [] + [] in let* α1 := M.read tail in let* α2 := M.read α1 in let* α3 := M.call_closure α0 [ α2 ] in @@ -161,8 +168,9 @@ Module Impl_enums_testcase_linked_list_List. let* head := M.copy γ0_0 in let* tail := M.alloc γ0_1 in let* res := - let* α0 := M.get_function "alloc::fmt::format" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "alloc::fmt::format" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -175,17 +183,20 @@ Module Impl_enums_testcase_linked_list_List. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.call_closure α6 [ head ] in let* α8 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α9 := M.get_associated_function (Ty.path "enums_testcase_linked_list::List") "stringify" + [] [] in let* α10 := M.read tail in let* α11 := M.read α10 in @@ -200,9 +211,13 @@ Module Impl_enums_testcase_linked_list_List. M.pure res; fun γ => let* res := - let* α0 := M.get_function "alloc::fmt::format" [] in + let* α0 := M.get_function "alloc::fmt::format" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Nil") in @@ -239,31 +254,32 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* list := - let* α0 := M.get_associated_function (Ty.path "enums_testcase_linked_list::List") "new" [] in + let* α0 := + M.get_associated_function (Ty.path "enums_testcase_linked_list::List") "new" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := let* α0 := - M.get_associated_function (Ty.path "enums_testcase_linked_list::List") "prepend" [] in + M.get_associated_function (Ty.path "enums_testcase_linked_list::List") "prepend" [] [] in let* α1 := M.read list in let* α2 := M.call_closure α0 [ α1; Value.Integer Integer.U32 1 ] in M.assign list α2 in let* _ := let* α0 := - M.get_associated_function (Ty.path "enums_testcase_linked_list::List") "prepend" [] in + M.get_associated_function (Ty.path "enums_testcase_linked_list::List") "prepend" [] [] in let* α1 := M.read list in let* α2 := M.call_closure α0 [ α1; Value.Integer Integer.U32 2 ] in M.assign list α2 in let* _ := let* α0 := - M.get_associated_function (Ty.path "enums_testcase_linked_list::List") "prepend" [] in + M.get_associated_function (Ty.path "enums_testcase_linked_list::List") "prepend" [] [] in let* α1 := M.read list in let* α2 := M.call_closure α0 [ α1; Value.Integer Integer.U32 3 ] in M.assign list α2 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "linked list has length: ") in @@ -277,9 +293,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := - M.get_associated_function (Ty.path "enums_testcase_linked_list::List") "len" [] in + M.get_associated_function (Ty.path "enums_testcase_linked_list::List") "len" [] [] in let* α8 := M.call_closure α7 [ list ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in @@ -291,8 +308,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -306,11 +323,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α7 := M.get_associated_function (Ty.path "enums_testcase_linked_list::List") "stringify" + [] [] in let* α8 := M.call_closure α7 [ list ] in let* α9 := M.alloc α8 in 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 c2251820d..a6c21b37e 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 @@ -68,9 +68,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "The rich have lots of money! @@ -83,9 +87,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []); fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "The poor have no money... @@ -103,9 +111,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Civilians work! @@ -118,9 +130,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []); fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Soldiers fight! 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 eb2755c36..953fea2b6 100644 --- a/CoqOfRust/examples/default/examples/rust_book/custom_types/structures.v +++ b/CoqOfRust/examples/default/examples/rust_book/custom_types/structures.v @@ -23,6 +23,7 @@ Module Impl_core_fmt_Debug_for_structures_Person. M.get_associated_function (Ty.path "core::fmt::Formatter") "debug_struct_field2_finish" + [] [] in let* α1 := M.read f in let* α2 := M.read (mk_str "Person") in @@ -139,8 +140,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_trait_method "core::convert::From" (Ty.path "alloc::string::String") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] "from" + [] [] in let* α1 := M.read (mk_str "Peter") in let* α2 := M.call_closure α0 [ α1 ] in @@ -152,8 +155,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.StructRecord "structures::Person" [ ("name", α0); ("age", α1) ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -167,7 +170,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "structures::Person" ] in + [ Ty.path "structures::Person" ] + [] in let* α7 := M.call_closure α6 [ peter ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -181,8 +185,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.StructRecord "structures::Point" [ ("x", α0); ("y", α1) ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "point coordinates: (") in @@ -197,14 +201,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "f32" ] in + [ Ty.path "f32" ] + [] in let* α8 := M.call_closure α7 [ M.get_struct_record_field point "structures::Point" "x" ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "f32" ] in + [ Ty.path "f32" ] + [] in let* α10 := M.call_closure α9 [ M.get_struct_record_field point "structures::Point" "y" ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in @@ -219,8 +225,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (M.struct_record_update α1 [ ("x", α0) ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "second point: (") in @@ -235,7 +241,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "f32" ] in + [ Ty.path "f32" ] + [] in let* α8 := M.call_closure α7 @@ -244,7 +251,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "f32" ] in + [ Ty.path "f32" ] + [] in let* α10 := M.call_closure α9 @@ -281,8 +289,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.StructTuple "structures::Pair" [ Value.Integer Integer.I32 1; α0 ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "pair contains ") in @@ -297,14 +306,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α8 := M.call_closure α7 [ M.get_struct_tuple_field pair_ "structures::Pair" 0 ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "f32" ] in + [ Ty.path "f32" ] + [] in let* α10 := M.call_closure α9 [ M.get_struct_tuple_field pair_ "structures::Pair" 1 ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in @@ -323,9 +334,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* decimal := M.copy γ0_1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "pair contains ") in @@ -340,13 +351,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α8 := M.call_closure α7 [ integer ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "f32" ] in + [ Ty.path "f32" ] + [] in let* α10 := M.call_closure α9 [ decimal ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in M.pure (M.pointer_coercion α11) in 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 2df3e6a06..8e6acb044 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 @@ -3,8 +3,8 @@ Require Import CoqOfRust.CoqOfRust. Axiom AliasedResult : forall (T : Ty.t), - (Ty.apply (Ty.path "aliases_for_result::AliasedResult") [ T ]) = - (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "core::num::error::ParseIntError" ]). + (Ty.apply (Ty.path "aliases_for_result::AliasedResult") [ T ] []) = + (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "core::num::error::ParseIntError" ] []). (* fn multiply(first_number_str: &str, second_number_str: &str) -> AliasedResult { @@ -24,7 +24,8 @@ Definition multiply (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) "and_then" [ Ty.path "i32"; @@ -32,9 +33,11 @@ Definition multiply (τ : list Ty.t) (α : list Value.t) : M := [ Ty.tuple [ Ty.path "i32" ] ] (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) - ] in - let* α1 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) + ] + [] in + let* α1 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α2 := M.read first_number_str in let* α3 := M.call_closure α1 [ α2 ] in M.call_closure @@ -55,12 +58,14 @@ Definition multiply (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) "map" [ Ty.path "i32"; Ty.function [ Ty.tuple [ Ty.path "i32" ] ] (Ty.path "i32") - ] in + ] + [] in let* α1 := - M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α2 := M.read second_number_str in let* α3 := M.call_closure α1 [ α2 ] in M.call_closure @@ -111,8 +116,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Ok" 0 in let* n := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "n is ") in @@ -126,7 +132,8 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ n ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -138,8 +145,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* e := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Error: ") in @@ -153,7 +161,8 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "core::num::error::ParseIntError" ] in + [ Ty.path "core::num::error::ParseIntError" ] + [] in let* α7 := M.call_closure α6 [ e ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -176,16 +185,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* _ := - let* α0 := M.get_function "aliases_for_result::print" [] in - let* α1 := M.get_function "aliases_for_result::multiply" [] in + let* α0 := M.get_function "aliases_for_result::print" [] [] in + let* α1 := M.get_function "aliases_for_result::multiply" [] [] in let* α2 := M.read (mk_str "10") in let* α3 := M.read (mk_str "2") in let* α4 := M.call_closure α1 [ α2; α3 ] in let* α5 := M.call_closure α0 [ α4 ] in M.alloc α5 in let* _ := - let* α0 := M.get_function "aliases_for_result::print" [] in - let* α1 := M.get_function "aliases_for_result::multiply" [] in + let* α0 := M.get_function "aliases_for_result::print" [] [] in + let* α1 := M.get_function "aliases_for_result::multiply" [] [] in let* α2 := M.read (mk_str "t") in let* α3 := M.read (mk_str "2") in let* α4 := M.call_closure α1 [ α2; α3 ] in 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 c17258305..39223ccdf 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 @@ -3,7 +3,7 @@ Require Import CoqOfRust.CoqOfRust. Axiom Result : forall (T : Ty.t), - (Ty.apply (Ty.path "boxing_errors::Result") [ T ]) = + (Ty.apply (Ty.path "boxing_errors::Result") [ T ] []) = (Ty.apply (Ty.path "core::result::Result") [ @@ -11,7 +11,9 @@ Axiom Result : Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.dyn [ ("core::error::Error::Trait", []) ]; Ty.path "alloc::alloc::Global" ] - ]). + [] + ] + []). (* StructTuple { @@ -30,7 +32,7 @@ Module Impl_core_fmt_Debug_for_boxing_errors_EmptyVec. | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] [] in let* α1 := M.read f in let* α2 := M.read (mk_str "EmptyVec") in M.call_closure α0 [ α1; α2 ] @@ -80,9 +82,14 @@ Module Impl_core_fmt_Display_for_boxing_errors_EmptyVec. | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_fmt" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_fmt" [] [] in let* α1 := M.read f in - let* α2 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α2 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α5 := (* Unsize *) let* α3 := M.read (mk_str "invalid first item to double") in @@ -128,16 +135,19 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "core::result::Result") [ - Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []; Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.dyn [ ("core::error::Error::Trait", []) ]; Ty.path "alloc::alloc::Global" ] - ]) + [] + ] + []) "and_then" [ Ty.path "i32"; Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] [] ] + ] (Ty.apply (Ty.path "core::result::Result") [ @@ -145,37 +155,48 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.dyn [ ("core::error::Error::Trait", []) ]; Ty.path "alloc::alloc::Global" ] - ]) - ] in + [] + ] + []) + ] + [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "core::option::Option") - [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ]) + [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] [] ] + []) "ok_or_else" [ Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.dyn [ ("core::error::Error::Trait", []) ]; Ty.path "alloc::alloc::Global" ]; + [ Ty.dyn [ ("core::error::Error::Trait", []) ]; Ty.path "alloc::alloc::Global" ] + []; Ty.function [ Ty.tuple [] ] (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.dyn [ ("core::error::Error::Trait", []) ]; Ty.path "alloc::alloc::Global" ]) - ] in + [ Ty.dyn [ ("core::error::Error::Trait", []) ]; Ty.path "alloc::alloc::Global" ] + []) + ] + [] in let* α2 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "first" - [] in + [] + [ Value.Bool true ] in let* α3 := M.get_trait_method "core::ops::deref::Deref" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref" + [] [] in let* α4 := M.call_closure α3 [ vec ] in let* α5 := M.call_closure α2 [ α4 ] in @@ -204,8 +225,11 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := Ty.dyn [ ("core::error::Error::Trait", []) ]; Ty.path "alloc::alloc::Global" ] + [] ] + [] "into" + [] [] in M.call_closure α0 [ Value.StructTuple "boxing_errors::EmptyVec" [] ] ] @@ -238,15 +262,19 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := Ty.dyn [ ("core::error::Error::Trait", []) ]; Ty.path "alloc::alloc::Global" ] - ]) + [] + ] + []) "map" [ Ty.path "i32"; Ty.function [ Ty.tuple [ Ty.path "i32" ] ] (Ty.path "i32") - ] in + ] + [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) "map_err" [ Ty.apply @@ -254,7 +282,8 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := [ Ty.dyn [ ("core::error::Error::Trait", []) ]; Ty.path "alloc::alloc::Global" - ]; + ] + []; Ty.function [ Ty.tuple [ Ty.path "core::num::error::ParseIntError" ] ] (Ty.apply @@ -262,10 +291,12 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := [ Ty.dyn [ ("core::error::Error::Trait", []) ]; Ty.path "alloc::alloc::Global" - ]) - ] in + ] + []) + ] + [] in let* α2 := - M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α3 := M.read s in let* α4 := M.read α3 in let* α5 := M.call_closure α2 [ α4 ] in @@ -295,8 +326,11 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := Ty.dyn [ ("core::error::Error::Trait", []) ]; Ty.path "alloc::alloc::Global" ] + [] ] + [] "into" + [] [] in let* α1 := M.read e in M.call_closure α0 [ α1 ] @@ -351,8 +385,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Ok" 0 in let* n := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The first doubled is ") in @@ -366,7 +401,8 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ n ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -378,8 +414,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* e := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Error: ") in @@ -400,7 +437,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := Ty.dyn [ ("core::error::Error::Trait", []) ]; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ e ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -430,9 +469,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* numbers := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α8 := (* Unsize *) let* α1 := @@ -440,10 +480,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::boxed::Box") [ - Ty.apply (Ty.path "array") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply + (Ty.path "array") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Integer Integer.Usize 3 ]; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α2 := M.read (mk_str "42") in let* α3 := M.read (mk_str "93") in @@ -459,17 +504,20 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* strings := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α8 := (* Unsize *) let* α1 := @@ -477,10 +525,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::boxed::Box") [ - Ty.apply (Ty.path "array") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply + (Ty.path "array") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Integer Integer.Usize 3 ]; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α2 := M.read (mk_str "tofu") in let* α3 := M.read (mk_str "93") in @@ -492,22 +545,22 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α9 := M.call_closure α0 [ α8 ] in M.alloc α9 in let* _ := - let* α0 := M.get_function "boxing_errors::print" [] in - let* α1 := M.get_function "boxing_errors::double_first" [] in + let* α0 := M.get_function "boxing_errors::print" [] [] in + let* α1 := M.get_function "boxing_errors::double_first" [] [] in let* α2 := M.read numbers in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in M.alloc α4 in let* _ := - let* α0 := M.get_function "boxing_errors::print" [] in - let* α1 := M.get_function "boxing_errors::double_first" [] in + let* α0 := M.get_function "boxing_errors::print" [] [] in + let* α1 := M.get_function "boxing_errors::double_first" [] [] in let* α2 := M.read empty in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in M.alloc α4 in let* _ := - let* α0 := M.get_function "boxing_errors::print" [] in - let* α1 := M.get_function "boxing_errors::double_first" [] in + let* α0 := M.get_function "boxing_errors::print" [] [] in + let* α1 := M.get_function "boxing_errors::double_first" [] [] in let* α2 := M.read strings in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in 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 8b458796f..ea7821e5f 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 @@ -35,7 +35,7 @@ Module Impl_core_fmt_Debug_for_combinators_and_then_Food. | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] [] in let* α1 := M.read f in let* α2 := M.match_operator @@ -101,7 +101,7 @@ Module Impl_core_fmt_Debug_for_combinators_and_then_Day. | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] [] in let* α1 := M.read f in let* α2 := M.match_operator @@ -198,7 +198,7 @@ Definition cookable_v1 (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [ food ] => let* food := M.alloc food in - let* α0 := M.get_function "combinators_and_then::have_recipe" [] in + let* α0 := M.get_function "combinators_and_then::have_recipe" [] [] in let* α1 := M.read food in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.alloc α2 in @@ -210,7 +210,7 @@ Definition cookable_v1 (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::option::Option::Some" 0 in let* food := M.copy γ0_0 in - let* α0 := M.get_function "combinators_and_then::have_ingredients" [] in + let* α0 := M.get_function "combinators_and_then::have_ingredients" [] [] in let* α1 := M.read food in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.alloc α2 in @@ -241,18 +241,19 @@ Definition cookable_v2 (τ : list Ty.t) (α : list Value.t) : M := let* food := M.alloc food in let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "combinators_and_then::Food" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "combinators_and_then::Food" ] []) "and_then" [ Ty.path "combinators_and_then::Food"; Ty.function [ Ty.path "combinators_and_then::Food" ] - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "combinators_and_then::Food" ]) - ] in - let* α1 := M.get_function "combinators_and_then::have_recipe" [] in + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "combinators_and_then::Food" ] []) + ] + [] in + let* α1 := M.get_function "combinators_and_then::have_recipe" [] [] in let* α2 := M.read food in let* α3 := M.call_closure α1 [ α2 ] in - let* α4 := M.get_function "combinators_and_then::have_ingredients" [] in + let* α4 := M.get_function "combinators_and_then::have_ingredients" [] [] in M.call_closure α0 [ α3; α4 ] | _, _ => M.impossible end. @@ -270,7 +271,7 @@ Definition eat (τ : list Ty.t) (α : list Value.t) : M := | [], [ food; day ] => let* food := M.alloc food in let* day := M.alloc day in - let* α0 := M.get_function "combinators_and_then::cookable_v2" [] in + let* α0 := M.get_function "combinators_and_then::cookable_v2" [] [] in let* α1 := M.read food in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.alloc α2 in @@ -282,8 +283,9 @@ Definition eat (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::option::Option::Some" 0 in let* food := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "Yay! On ") in @@ -298,13 +300,15 @@ Definition eat (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "combinators_and_then::Day" ] in + [ Ty.path "combinators_and_then::Day" ] + [] in let* α8 := M.call_closure α7 [ day ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "combinators_and_then::Food" ] in + [ Ty.path "combinators_and_then::Food" ] + [] in let* α10 := M.call_closure α9 [ food ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in M.pure (M.pointer_coercion α11) in @@ -314,8 +318,9 @@ Definition eat (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []); fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Oh no. We don't get to eat on ") in @@ -329,7 +334,8 @@ Definition eat (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "combinators_and_then::Day" ] in + [ Ty.path "combinators_and_then::Day" ] + [] in let* α7 := M.call_closure α6 [ day ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -374,7 +380,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* steak := M.copy γ0_1 in let* sushi := M.copy γ0_2 in let* _ := - let* α0 := M.get_function "combinators_and_then::eat" [] in + let* α0 := M.get_function "combinators_and_then::eat" [] [] in let* α1 := M.read cordon_bleu in let* α2 := M.call_closure @@ -382,7 +388,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ α1; Value.StructTuple "combinators_and_then::Day::Monday" [] ] in M.alloc α2 in let* _ := - let* α0 := M.get_function "combinators_and_then::eat" [] in + let* α0 := M.get_function "combinators_and_then::eat" [] [] in let* α1 := M.read steak in let* α2 := M.call_closure @@ -390,7 +396,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ α1; Value.StructTuple "combinators_and_then::Day::Tuesday" [] ] in M.alloc α2 in let* _ := - let* α0 := M.get_function "combinators_and_then::eat" [] in + let* α0 := M.get_function "combinators_and_then::eat" [] [] in let* α1 := M.read sushi in let* α2 := M.call_closure 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 e1250e815..8798467b8 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 @@ -35,7 +35,7 @@ Module Impl_core_fmt_Debug_for_combinators_map_Food. | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] [] in let* α1 := M.read f in let* α2 := M.match_operator @@ -86,7 +86,11 @@ Module Impl_core_fmt_Debug_for_combinators_map_Peeled. let* self := M.alloc self in let* f := M.alloc f in let* α0 := - M.get_associated_function (Ty.path "core::fmt::Formatter") "debug_tuple_field1_finish" [] in + M.get_associated_function + (Ty.path "core::fmt::Formatter") + "debug_tuple_field1_finish" + [] + [] in let* α1 := M.read f in let* α2 := M.read (mk_str "Peeled") in let* α5 := @@ -125,7 +129,11 @@ Module Impl_core_fmt_Debug_for_combinators_map_Chopped. let* self := M.alloc self in let* f := M.alloc f in let* α0 := - M.get_associated_function (Ty.path "core::fmt::Formatter") "debug_tuple_field1_finish" [] in + M.get_associated_function + (Ty.path "core::fmt::Formatter") + "debug_tuple_field1_finish" + [] + [] in let* α1 := M.read f in let* α2 := M.read (mk_str "Chopped") in let* α5 := @@ -164,7 +172,11 @@ Module Impl_core_fmt_Debug_for_combinators_map_Cooked. let* self := M.alloc self in let* f := M.alloc f in let* α0 := - M.get_associated_function (Ty.path "core::fmt::Formatter") "debug_tuple_field1_finish" [] in + M.get_associated_function + (Ty.path "core::fmt::Formatter") + "debug_tuple_field1_finish" + [] + [] in let* α1 := M.read f in let* α2 := M.read (mk_str "Cooked") in let* α5 := @@ -256,14 +268,15 @@ Definition cook (τ : list Ty.t) (α : list Value.t) : M := let* chopped := M.alloc chopped in let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "combinators_map::Chopped" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "combinators_map::Chopped" ] []) "map" [ Ty.path "combinators_map::Cooked"; Ty.function [ Ty.tuple [ Ty.path "combinators_map::Chopped" ] ] (Ty.path "combinators_map::Cooked") - ] in + ] + [] in let* α1 := M.read chopped in M.call_closure α0 @@ -303,34 +316,37 @@ Definition process (τ : list Ty.t) (α : list Value.t) : M := let* food := M.alloc food in let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "combinators_map::Chopped" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "combinators_map::Chopped" ] []) "map" [ Ty.path "combinators_map::Cooked"; Ty.function [ Ty.tuple [ Ty.path "combinators_map::Chopped" ] ] (Ty.path "combinators_map::Cooked") - ] in + ] + [] in let* α1 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "combinators_map::Peeled" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "combinators_map::Peeled" ] []) "map" [ Ty.path "combinators_map::Chopped"; Ty.function [ Ty.tuple [ Ty.path "combinators_map::Peeled" ] ] (Ty.path "combinators_map::Chopped") - ] in + ] + [] in let* α2 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "combinators_map::Food" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "combinators_map::Food" ] []) "map" [ Ty.path "combinators_map::Peeled"; Ty.function [ Ty.tuple [ Ty.path "combinators_map::Food" ] ] (Ty.path "combinators_map::Peeled") - ] in + ] + [] in let* α3 := M.read food in let* α4 := M.call_closure @@ -421,8 +437,9 @@ Definition eat (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::option::Option::Some" 0 in let* food := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Mmm. I love ") in @@ -436,7 +453,8 @@ Definition eat (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "combinators_map::Cooked" ] in + [ Ty.path "combinators_map::Cooked" ] + [] in let* α7 := M.call_closure α6 [ food ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -446,9 +464,13 @@ Definition eat (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []); fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Oh no! It wasn't edible. @@ -495,40 +517,40 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Value.StructTuple "combinators_map::Food::Carrot" [] ]) in let* potato := M.alloc (Value.StructTuple "core::option::Option::None" []) in let* cooked_apple := - let* α0 := M.get_function "combinators_map::cook" [] in - let* α1 := M.get_function "combinators_map::chop" [] in - let* α2 := M.get_function "combinators_map::peel" [] in + let* α0 := M.get_function "combinators_map::cook" [] [] in + let* α1 := M.get_function "combinators_map::chop" [] [] in + let* α2 := M.get_function "combinators_map::peel" [] [] in let* α3 := M.read apple in let* α4 := M.call_closure α2 [ α3 ] in let* α5 := M.call_closure α1 [ α4 ] in let* α6 := M.call_closure α0 [ α5 ] in M.alloc α6 in let* cooked_carrot := - let* α0 := M.get_function "combinators_map::cook" [] in - let* α1 := M.get_function "combinators_map::chop" [] in - let* α2 := M.get_function "combinators_map::peel" [] in + let* α0 := M.get_function "combinators_map::cook" [] [] in + let* α1 := M.get_function "combinators_map::chop" [] [] in + let* α2 := M.get_function "combinators_map::peel" [] [] in let* α3 := M.read carrot in let* α4 := M.call_closure α2 [ α3 ] in let* α5 := M.call_closure α1 [ α4 ] in let* α6 := M.call_closure α0 [ α5 ] in M.alloc α6 in let* cooked_potato := - let* α0 := M.get_function "combinators_map::process" [] in + let* α0 := M.get_function "combinators_map::process" [] [] in let* α1 := M.read potato in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := - let* α0 := M.get_function "combinators_map::eat" [] in + let* α0 := M.get_function "combinators_map::eat" [] [] in let* α1 := M.read cooked_apple in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := - let* α0 := M.get_function "combinators_map::eat" [] in + let* α0 := M.get_function "combinators_map::eat" [] [] in let* α1 := M.read cooked_carrot in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := - let* α0 := M.get_function "combinators_map::eat" [] in + let* α0 := M.get_function "combinators_map::eat" [] [] in let* α1 := M.read cooked_potato in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in 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 ed70986ac..0feec69e6 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 @@ -18,7 +18,7 @@ Module Impl_core_fmt_Debug_for_defining_an_error_type_DoubleError. | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] [] in let* α1 := M.read f in let* α2 := M.read (mk_str "DoubleError") in M.call_closure α0 [ α1; α2 ] @@ -57,10 +57,11 @@ End Impl_core_clone_Clone_for_defining_an_error_type_DoubleError. Axiom Result : forall (T : Ty.t), - (Ty.apply (Ty.path "defining_an_error_type::Result") [ T ]) = + (Ty.apply (Ty.path "defining_an_error_type::Result") [ T ] []) = (Ty.apply (Ty.path "core::result::Result") - [ T; Ty.path "defining_an_error_type::DoubleError" ]). + [ T; Ty.path "defining_an_error_type::DoubleError" ] + []). Module Impl_core_fmt_Display_for_defining_an_error_type_DoubleError. Definition Self : Ty.t := Ty.path "defining_an_error_type::DoubleError". @@ -75,9 +76,14 @@ Module Impl_core_fmt_Display_for_defining_an_error_type_DoubleError. | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_fmt" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_fmt" [] [] in let* α1 := M.read f in - let* α2 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α2 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α5 := (* Unsize *) let* α3 := M.read (mk_str "invalid first item to double") in @@ -118,38 +124,48 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "core::result::Result") [ - Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []; Ty.path "defining_an_error_type::DoubleError" - ]) + ] + []) "and_then" [ Ty.path "i32"; Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] [] ] + ] (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "defining_an_error_type::DoubleError" ]) - ] in + [ Ty.path "i32"; Ty.path "defining_an_error_type::DoubleError" ] + []) + ] + [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "core::option::Option") - [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ]) + [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] [] ] + []) "ok_or" - [ Ty.path "defining_an_error_type::DoubleError" ] in + [ Ty.path "defining_an_error_type::DoubleError" ] + [] in let* α2 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "first" - [] in + [] + [ Value.Bool true ] in let* α3 := M.get_trait_method "core::ops::deref::Deref" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref" + [] [] in let* α4 := M.call_closure α3 [ vec ] in let* α5 := M.call_closure α2 [ α4 ] in @@ -173,24 +189,28 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "defining_an_error_type::DoubleError" ]) + [ Ty.path "i32"; Ty.path "defining_an_error_type::DoubleError" ] + []) "map" [ Ty.path "i32"; Ty.function [ Ty.tuple [ Ty.path "i32" ] ] (Ty.path "i32") - ] in + ] + [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) "map_err" [ Ty.path "defining_an_error_type::DoubleError"; Ty.function [ Ty.tuple [ Ty.path "core::num::error::ParseIntError" ] ] (Ty.path "defining_an_error_type::DoubleError") - ] in + ] + [] in let* α2 := - M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α3 := M.read s in let* α4 := M.read α3 in let* α5 := M.call_closure α2 [ α4 ] in @@ -261,8 +281,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Ok" 0 in let* n := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The first doubled is ") in @@ -276,7 +297,8 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ n ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -288,8 +310,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* e := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Error: ") in @@ -303,7 +326,8 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "defining_an_error_type::DoubleError" ] in + [ Ty.path "defining_an_error_type::DoubleError" ] + [] in let* α7 := M.call_closure α6 [ e ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -333,9 +357,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* numbers := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α8 := (* Unsize *) let* α1 := @@ -343,10 +368,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::boxed::Box") [ - Ty.apply (Ty.path "array") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply + (Ty.path "array") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Integer Integer.Usize 3 ]; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α2 := M.read (mk_str "42") in let* α3 := M.read (mk_str "93") in @@ -362,17 +392,20 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* strings := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α8 := (* Unsize *) let* α1 := @@ -380,10 +413,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::boxed::Box") [ - Ty.apply (Ty.path "array") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply + (Ty.path "array") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Integer Integer.Usize 3 ]; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α2 := M.read (mk_str "tofu") in let* α3 := M.read (mk_str "93") in @@ -395,22 +433,22 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α9 := M.call_closure α0 [ α8 ] in M.alloc α9 in let* _ := - let* α0 := M.get_function "defining_an_error_type::print" [] in - let* α1 := M.get_function "defining_an_error_type::double_first" [] in + let* α0 := M.get_function "defining_an_error_type::print" [] [] in + let* α1 := M.get_function "defining_an_error_type::double_first" [] [] in let* α2 := M.read numbers in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in M.alloc α4 in let* _ := - let* α0 := M.get_function "defining_an_error_type::print" [] in - let* α1 := M.get_function "defining_an_error_type::double_first" [] in + let* α0 := M.get_function "defining_an_error_type::print" [] [] in + let* α1 := M.get_function "defining_an_error_type::double_first" [] [] in let* α2 := M.read empty in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in M.alloc α4 in let* _ := - let* α0 := M.get_function "defining_an_error_type::print" [] in - let* α1 := M.get_function "defining_an_error_type::double_first" [] in + let* α0 := M.get_function "defining_an_error_type::print" [] [] in + let* α1 := M.get_function "defining_an_error_type::double_first" [] [] in let* α2 := M.read strings in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in 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 d68565e58..d016960c0 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 @@ -22,7 +22,7 @@ Definition multiply (τ : list Ty.t) (α : list Value.t) : M := let* first_number_str := M.alloc first_number_str in let* second_number_str := M.alloc second_number_str in let* first_number := - let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α1 := M.read first_number_str in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.alloc α2 in @@ -46,7 +46,7 @@ Definition multiply (τ : list Ty.t) (α : list Value.t) : M := ] in M.copy α4 in let* second_number := - let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α1 := M.read second_number_str in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.alloc α2 in @@ -97,8 +97,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Ok" 0 in let* n := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "n is ") in @@ -112,7 +113,8 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ n ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -124,8 +126,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* e := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Error: ") in @@ -139,7 +142,8 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "core::num::error::ParseIntError" ] in + [ Ty.path "core::num::error::ParseIntError" ] + [] in let* α7 := M.call_closure α6 [ e ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -162,16 +166,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* _ := - let* α0 := M.get_function "early_returns::print" [] in - let* α1 := M.get_function "early_returns::multiply" [] in + let* α0 := M.get_function "early_returns::print" [] [] in + let* α1 := M.get_function "early_returns::multiply" [] [] in let* α2 := M.read (mk_str "10") in let* α3 := M.read (mk_str "2") in let* α4 := M.call_closure α1 [ α2; α3 ] in let* α5 := M.call_closure α0 [ α4 ] in M.alloc α5 in let* _ := - let* α0 := M.get_function "early_returns::print" [] in - let* α1 := M.get_function "early_returns::multiply" [] in + let* α0 := M.get_function "early_returns::print" [] [] in + let* α1 := M.get_function "early_returns::multiply" [] [] in let* α2 := M.read (mk_str "t") in let* α3 := M.read (mk_str "2") in let* α4 := M.call_closure α1 [ α2; α3 ] in 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 248d2ff85..8c536757f 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 @@ -20,11 +20,14 @@ Definition multiply (τ : list Ty.t) (α : list Value.t) : M := "core::ops::try_trait::Try" (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) + [] [] "branch" + [] [] in - let* α1 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + let* α1 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α2 := M.read first_number_str in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in @@ -45,7 +48,8 @@ Definition multiply (τ : list Ty.t) (α : list Value.t) : M := "core::ops::try_trait::FromResidual" (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) [ Ty.apply (Ty.path "core::result::Result") @@ -53,8 +57,11 @@ Definition multiply (τ : list Ty.t) (α : list Value.t) : M := Ty.path "core::convert::Infallible"; Ty.path "core::num::error::ParseIntError" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -78,11 +85,14 @@ Definition multiply (τ : list Ty.t) (α : list Value.t) : M := "core::ops::try_trait::Try" (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) + [] [] "branch" + [] [] in - let* α1 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + let* α1 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α2 := M.read second_number_str in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in @@ -103,7 +113,8 @@ Definition multiply (τ : list Ty.t) (α : list Value.t) : M := "core::ops::try_trait::FromResidual" (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) [ Ty.apply (Ty.path "core::result::Result") @@ -111,8 +122,11 @@ Definition multiply (τ : list Ty.t) (α : list Value.t) : M := Ty.path "core::convert::Infallible"; Ty.path "core::num::error::ParseIntError" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -158,8 +172,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Ok" 0 in let* n := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "n is ") in @@ -173,7 +188,8 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ n ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -185,8 +201,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* e := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Error: ") in @@ -200,7 +217,8 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "core::num::error::ParseIntError" ] in + [ Ty.path "core::num::error::ParseIntError" ] + [] in let* α7 := M.call_closure α6 [ e ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -223,16 +241,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* _ := - let* α0 := M.get_function "introducing_question_mark::print" [] in - let* α1 := M.get_function "introducing_question_mark::multiply" [] in + let* α0 := M.get_function "introducing_question_mark::print" [] [] in + let* α1 := M.get_function "introducing_question_mark::multiply" [] [] in let* α2 := M.read (mk_str "10") in let* α3 := M.read (mk_str "2") in let* α4 := M.call_closure α1 [ α2; α3 ] in let* α5 := M.call_closure α0 [ α4 ] in M.alloc α5 in let* _ := - let* α0 := M.get_function "introducing_question_mark::print" [] in - let* α1 := M.get_function "introducing_question_mark::multiply" [] in + let* α0 := M.get_function "introducing_question_mark::print" [] [] in + let* α1 := M.get_function "introducing_question_mark::multiply" [] [] in let* α2 := M.read (mk_str "t") in let* α3 := M.read (mk_str "2") in let* α4 := M.call_closure α1 [ α2; α3 ] in 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 59c35b139..a2d373f9e 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 @@ -15,7 +15,7 @@ Definition multiply (τ : list Ty.t) (α : list Value.t) : M := let* first_number_str := M.alloc first_number_str in let* second_number_str := M.alloc second_number_str in let* first_number := - let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α1 := M.read first_number_str in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.alloc α2 in @@ -36,7 +36,9 @@ Definition multiply (τ : list Ty.t) (α : list Value.t) : M := "core::convert::From" (Ty.path "core::num::error::ParseIntError") [ Ty.path "core::num::error::ParseIntError" ] + [] "from" + [] [] in let* α1 := M.read err in let* α2 := M.call_closure α0 [ α1 ] in @@ -47,7 +49,7 @@ Definition multiply (τ : list Ty.t) (α : list Value.t) : M := ] in M.copy α4 in let* second_number := - let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α1 := M.read second_number_str in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.alloc α2 in @@ -68,7 +70,9 @@ Definition multiply (τ : list Ty.t) (α : list Value.t) : M := "core::convert::From" (Ty.path "core::num::error::ParseIntError") [ Ty.path "core::num::error::ParseIntError" ] + [] "from" + [] [] in let* α1 := M.read err in let* α2 := M.call_closure α0 [ α1 ] in @@ -106,8 +110,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Ok" 0 in let* n := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "n is ") in @@ -121,7 +126,8 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ n ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -133,8 +139,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* e := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Error: ") in @@ -148,7 +155,8 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "core::num::error::ParseIntError" ] in + [ Ty.path "core::num::error::ParseIntError" ] + [] in let* α7 := M.call_closure α6 [ e ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -172,10 +180,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* _ := let* α0 := - M.get_function "introducing_question_mark_is_an_replacement_for_deprecated_try::print" [] in + M.get_function + "introducing_question_mark_is_an_replacement_for_deprecated_try::print" + [] + [] in let* α1 := M.get_function "introducing_question_mark_is_an_replacement_for_deprecated_try::multiply" + [] [] in let* α2 := M.read (mk_str "10") in let* α3 := M.read (mk_str "2") in @@ -184,10 +196,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α5 in let* _ := let* α0 := - M.get_function "introducing_question_mark_is_an_replacement_for_deprecated_try::print" [] in + M.get_function + "introducing_question_mark_is_an_replacement_for_deprecated_try::print" + [] + [] in let* α1 := M.get_function "introducing_question_mark_is_an_replacement_for_deprecated_try::multiply" + [] [] in let* α2 := M.read (mk_str "t") in let* α3 := M.read (mk_str "2") in 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 05f0d0588..fb2987f9f 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 @@ -18,9 +18,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* strings := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α8 := (* Unsize *) let* α1 := @@ -28,10 +29,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::boxed::Box") [ - Ty.apply (Ty.path "array") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply + (Ty.path "array") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Integer Integer.Usize 3 ]; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α2 := M.read (mk_str "tofu") in let* α3 := M.read (mk_str "93") in @@ -50,13 +56,17 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]; + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []; Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] ] (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) - ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) + ] + []) + [] [] "partition" [ @@ -65,9 +75,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]; + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []; Ty.path "alloc::alloc::Global" - ]; + ] + []; Ty.function [ Ty.apply @@ -76,36 +88,47 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "core::result::Result") [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + [] ] + [] ] (Ty.path "bool") - ] in + ] + [] in let* α1 := M.get_trait_method "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) + [] [] "map" [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]; + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []; Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] ] (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) - ] in + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) + ] + [] in let* α2 := M.get_trait_method "core::iter::traits::collect::IntoIterator" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) + [] [] "into_iter" + [] [] in let* α3 := M.read strings in let* α4 := M.call_closure α2 [ α3 ] in @@ -125,7 +148,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* s := M.copy γ in let* α0 := - M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α1 := M.read s in M.call_closure α0 [ α1 ] ] @@ -136,9 +159,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) "is_ok" - [] in + [] + [ Value.Bool true ] in let* α7 := M.call_closure α0 [ α5; α6 ] in let* α8 := M.alloc α7 in let* α0 := @@ -152,8 +177,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* errors := M.copy γ0_1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Numbers: ") in @@ -173,10 +199,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]; + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ numbers ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -186,8 +215,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Errors: ") in @@ -207,10 +237,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]; + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ errors ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 d2861339a..7176d25f7 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 @@ -20,9 +20,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* strings := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α8 := (* Unsize *) let* α1 := @@ -30,10 +31,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::boxed::Box") [ - Ty.apply (Ty.path "array") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply + (Ty.path "array") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Integer Integer.Usize 3 ]; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α2 := M.read (mk_str "tofu") in let* α3 := M.read (mk_str "93") in @@ -52,13 +58,17 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]; + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []; Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] ] (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) - ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) + ] + []) + [] [] "partition" [ @@ -67,9 +77,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]; + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []; Ty.path "alloc::alloc::Global" - ]; + ] + []; Ty.function [ Ty.apply @@ -78,36 +90,47 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "core::result::Result") [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + [] ] + [] ] (Ty.path "bool") - ] in + ] + [] in let* α1 := M.get_trait_method "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) + [] [] "map" [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]; + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []; Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] ] (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) - ] in + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) + ] + [] in let* α2 := M.get_trait_method "core::iter::traits::collect::IntoIterator" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) + [] [] "into_iter" + [] [] in let* α3 := M.read strings in let* α4 := M.call_closure α2 [ α3 ] in @@ -127,7 +150,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* s := M.copy γ in let* α0 := - M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α1 := M.read s in M.call_closure α0 [ α1 ] ] @@ -138,9 +161,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) "is_ok" - [] in + [] + [ Value.Bool true ] in let* α7 := M.call_closure α0 [ α5; α6 ] in let* α8 := M.alloc α7 in let* α0 := @@ -164,24 +189,31 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]; + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []; Ty.path "alloc::alloc::Global" - ]; + ] + []; Ty.function [ Ty.apply (Ty.path "core::result::Result") [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + [] ] (Ty.path "i32") - ]) + ] + []) + [] [] "collect" [ Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α1 := M.get_trait_method "core::iter::traits::iterator::Iterator" @@ -190,9 +222,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]; + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []; Ty.path "alloc::alloc::Global" - ]) + ] + []) + [] [] "map" [ @@ -202,9 +237,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "core::result::Result") [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + [] ] (Ty.path "i32") - ] in + ] + [] in let* α2 := M.get_trait_method "core::iter::traits::collect::IntoIterator" @@ -213,11 +250,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]; + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []; Ty.path "alloc::alloc::Global" - ]) + ] + []) + [] [] "into_iter" + [] [] in let* α3 := M.read numbers in let* α4 := M.call_closure α2 [ α3 ] in @@ -225,8 +266,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) "unwrap" + [] [] in let* α6 := M.call_closure α1 [ α4; α5 ] in let* α7 := M.call_closure α0 [ α6 ] in @@ -243,24 +286,31 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]; + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []; Ty.path "alloc::alloc::Global" - ]; + ] + []; Ty.function [ Ty.apply (Ty.path "core::result::Result") [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + [] ] (Ty.path "core::num::error::ParseIntError") - ]) + ] + []) + [] [] "collect" [ Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "core::num::error::ParseIntError"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α1 := M.get_trait_method "core::iter::traits::iterator::Iterator" @@ -269,9 +319,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]; + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []; Ty.path "alloc::alloc::Global" - ]) + ] + []) + [] [] "map" [ @@ -281,9 +334,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "core::result::Result") [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + [] ] (Ty.path "core::num::error::ParseIntError") - ] in + ] + [] in let* α2 := M.get_trait_method "core::iter::traits::collect::IntoIterator" @@ -292,11 +347,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]; + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []; Ty.path "alloc::alloc::Global" - ]) + ] + []) + [] [] "into_iter" + [] [] in let* α3 := M.read errors in let* α4 := M.call_closure α2 [ α3 ] in @@ -304,16 +363,19 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) "unwrap_err" + [] [] in let* α6 := M.call_closure α1 [ α4; α5 ] in let* α7 := M.call_closure α0 [ α6 ] in M.alloc α7 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Numbers: ") in @@ -331,7 +393,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ numbers ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -341,8 +405,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Errors: ") in @@ -363,7 +428,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.path "core::num::error::ParseIntError"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ errors ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 ef4965609..6fa3a2475 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 @@ -20,9 +20,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* strings := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α10 := (* Unsize *) let* α1 := @@ -30,10 +31,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::boxed::Box") [ - Ty.apply (Ty.path "array") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply + (Ty.path "array") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Integer Integer.Usize 5 ]; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α2 := M.read (mk_str "42") in let* α3 := M.read (mk_str "tofu") in @@ -51,8 +57,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "core::num::error::ParseIntError"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "core::num::error::ParseIntError"; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in @@ -68,13 +76,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]; + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []; Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] ] (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "u8"; Ty.path "core::num::error::ParseIntError" ]) - ]; + [ Ty.path "u8"; Ty.path "core::num::error::ParseIntError" ] + []) + ] + []; Ty.function [ Ty.tuple @@ -82,14 +93,18 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "core::result::Result") [ Ty.path "u8"; Ty.path "core::num::error::ParseIntError" ] + [] ] ] - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u8" ]) - ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u8" ] []) + ] + []) + [] [] "collect" - [ Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] - ] in + [ Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] [] + ] + [] in let* α1 := M.get_trait_method "core::iter::traits::iterator::Iterator" @@ -98,13 +113,17 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]; + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []; Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] ] (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "u8"; Ty.path "core::num::error::ParseIntError" ]) - ]) + [ Ty.path "u8"; Ty.path "core::num::error::ParseIntError" ] + []) + ] + []) + [] [] "filter_map" [ @@ -116,36 +135,46 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "core::result::Result") [ Ty.path "u8"; Ty.path "core::num::error::ParseIntError" ] + [] ] ] - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u8" ]) - ] in + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u8" ] []) + ] + [] in let* α2 := M.get_trait_method "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) + [] [] "map" [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "u8"; Ty.path "core::num::error::ParseIntError" ]; + [ Ty.path "u8"; Ty.path "core::num::error::ParseIntError" ] + []; Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] ] (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "u8"; Ty.path "core::num::error::ParseIntError" ]) - ] in + [ Ty.path "u8"; Ty.path "core::num::error::ParseIntError" ] + []) + ] + [] in let* α3 := M.get_trait_method "core::iter::traits::collect::IntoIterator" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) + [] [] "into_iter" + [] [] in let* α4 := M.read strings in let* α5 := M.call_closure α3 [ α4 ] in @@ -165,7 +194,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* s := M.copy γ in let* α0 := - M.get_associated_function (Ty.path "str") "parse" [ Ty.path "u8" ] in + M.get_associated_function (Ty.path "str") "parse" [ Ty.path "u8" ] [] in let* α1 := M.read s in M.call_closure α0 [ α1 ] ] @@ -191,21 +220,25 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "u8"; Ty.tuple [] ]) + [ Ty.path "u8"; Ty.tuple [] ] + []) "ok" + [] [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "u8"; Ty.path "core::num::error::ParseIntError" ]) + [ Ty.path "u8"; Ty.path "core::num::error::ParseIntError" ] + []) "map_err" [ Ty.tuple []; Ty.function [ Ty.tuple [ Ty.path "core::num::error::ParseIntError" ] ] (Ty.tuple []) - ] in + ] + [] in let* α2 := M.read r in let* α3 := M.call_closure @@ -229,8 +262,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "core::num::error::ParseIntError"; Ty.path "alloc::alloc::Global" - ]) + ] + []) "push" + [] [] in let* α1 := M.read e in M.call_closure α0 [ errors; α1 ] @@ -247,8 +282,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α8 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Numbers: ") in @@ -266,7 +301,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ numbers ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -276,8 +313,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Errors: ") in @@ -295,7 +332,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "core::num::error::ParseIntError"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ errors ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 58b4f6173..cecfd374a 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 @@ -14,9 +14,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* strings := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α8 := (* Unsize *) let* α1 := @@ -24,10 +25,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::boxed::Box") [ - Ty.apply (Ty.path "array") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply + (Ty.path "array") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Integer Integer.Usize 3 ]; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α2 := M.read (mk_str "tofu") in let* α3 := M.read (mk_str "93") in @@ -47,13 +53,17 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]; + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []; Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] ] (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) - ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) + ] + []) + [] [] "collect" [ @@ -62,36 +72,47 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]; + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []; Ty.path "core::num::error::ParseIntError" ] - ] in + [] + ] + [] in let* α1 := M.get_trait_method "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) + [] [] "map" [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]; + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []; Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] ] (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) - ] in + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) + ] + [] in let* α2 := M.get_trait_method "core::iter::traits::collect::IntoIterator" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) + [] [] "into_iter" + [] [] in let* α3 := M.read strings in let* α4 := M.call_closure α2 [ α3 ] in @@ -111,7 +132,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* s := M.copy γ in let* α0 := - M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α1 := M.read s in M.call_closure α0 [ α1 ] ] @@ -122,8 +143,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α6 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Results: ") in @@ -143,10 +164,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]; + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []; Ty.path "core::num::error::ParseIntError" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ numbers ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 410fdf4ff..1bbce6791 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 @@ -14,9 +14,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* strings := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α8 := (* Unsize *) let* α1 := @@ -24,10 +25,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::boxed::Box") [ - Ty.apply (Ty.path "array") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply + (Ty.path "array") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Integer Integer.Usize 3 ]; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α2 := M.read (mk_str "tofu") in let* α3 := M.read (mk_str "93") in @@ -47,13 +53,17 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]; + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []; Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] ] (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) - ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) + ] + []) + [] [] "collect" [ @@ -62,36 +72,47 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]; + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α1 := M.get_trait_method "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) + [] [] "map" [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]; + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []; Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] ] (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) - ] in + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) + ] + [] in let* α2 := M.get_trait_method "core::iter::traits::collect::IntoIterator" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) + [] [] "into_iter" + [] [] in let* α3 := M.read strings in let* α4 := M.call_closure α2 [ α3 ] in @@ -111,7 +132,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* s := M.copy γ in let* α0 := - M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α1 := M.read s in M.call_closure α0 [ α1 ] ] @@ -122,8 +143,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α6 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Results: ") in @@ -143,10 +164,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]; + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ numbers ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 a8c179a22..2fb3fa6bb 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 @@ -17,9 +17,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* strings := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α8 := (* Unsize *) let* α1 := @@ -27,10 +28,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::boxed::Box") [ - Ty.apply (Ty.path "array") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply + (Ty.path "array") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Integer Integer.Usize 3 ]; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α2 := M.read (mk_str "tofu") in let* α3 := M.read (mk_str "93") in @@ -50,37 +56,51 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]; + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []; Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ] - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ]) - ]) + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] ] + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] []) + ] + []) + [] [] "collect" - [ Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] - ] in + [ + Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + [] + ] + [] in let* α1 := M.get_trait_method "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) + [] [] "filter_map" [ Ty.path "i32"; Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ] - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ]) - ] in + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] ] + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] []) + ] + [] in let* α2 := M.get_trait_method "core::iter::traits::collect::IntoIterator" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) + [] [] "into_iter" + [] [] in let* α3 := M.read strings in let* α4 := M.call_closure α2 [ α3 ] in @@ -103,11 +123,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) "ok" + [] [] in let* α1 := - M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α2 := M.read s in let* α3 := M.call_closure α1 [ α2 ] in M.call_closure α0 [ α3 ] @@ -119,8 +141,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α6 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Results: ") in @@ -138,7 +160,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ numbers ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 00655dcdc..b97182c0e 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 @@ -19,7 +19,8 @@ Definition multiply (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) "and_then" [ Ty.path "i32"; @@ -27,9 +28,11 @@ Definition multiply (τ : list Ty.t) (α : list Value.t) : M := [ Ty.tuple [ Ty.path "i32" ] ] (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) - ] in - let* α1 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) + ] + [] in + let* α1 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α2 := M.read first_number_str in let* α3 := M.call_closure α1 [ α2 ] in M.call_closure @@ -50,12 +53,14 @@ Definition multiply (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) "map" [ Ty.path "i32"; Ty.function [ Ty.tuple [ Ty.path "i32" ] ] (Ty.path "i32") - ] in + ] + [] in let* α1 := - M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α2 := M.read second_number_str in let* α3 := M.call_closure α1 [ α2 ] in M.call_closure @@ -106,8 +111,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Ok" 0 in let* n := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "n is ") in @@ -121,7 +127,8 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ n ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -133,8 +140,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* e := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Error: ") in @@ -148,7 +156,8 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "core::num::error::ParseIntError" ] in + [ Ty.path "core::num::error::ParseIntError" ] + [] in let* α7 := M.call_closure α6 [ e ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -176,24 +185,24 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* twenty := - let* α0 := M.get_function "map_in_result_via_combinators::multiply" [] in + let* α0 := M.get_function "map_in_result_via_combinators::multiply" [] [] in let* α1 := M.read (mk_str "10") in let* α2 := M.read (mk_str "2") in let* α3 := M.call_closure α0 [ α1; α2 ] in M.alloc α3 in let* _ := - let* α0 := M.get_function "map_in_result_via_combinators::print" [] in + let* α0 := M.get_function "map_in_result_via_combinators::print" [] [] in let* α1 := M.read twenty in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* tt_ := - let* α0 := M.get_function "map_in_result_via_combinators::multiply" [] in + let* α0 := M.get_function "map_in_result_via_combinators::multiply" [] [] in let* α1 := M.read (mk_str "t") in let* α2 := M.read (mk_str "2") in let* α3 := M.call_closure α0 [ α1; α2 ] in M.alloc α3 in let* _ := - let* α0 := M.get_function "map_in_result_via_combinators::print" [] in + let* α0 := M.get_function "map_in_result_via_combinators::print" [] [] in let* α1 := M.read tt_ in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in 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 70e21d691..78cfb819b 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 @@ -17,7 +17,7 @@ Definition multiply (τ : list Ty.t) (α : list Value.t) : M := | [], [ first_number_str; second_number_str ] => let* first_number_str := M.alloc first_number_str in let* second_number_str := M.alloc second_number_str in - let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α1 := M.read first_number_str in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.alloc α2 in @@ -28,7 +28,7 @@ Definition multiply (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Ok" 0 in let* first_number := M.copy γ0_0 in - let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α1 := M.read second_number_str in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.alloc α2 in @@ -80,8 +80,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Ok" 0 in let* n := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "n is ") in @@ -95,7 +96,8 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ n ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -107,8 +109,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* e := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Error: ") in @@ -122,7 +125,8 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "core::num::error::ParseIntError" ] in + [ Ty.path "core::num::error::ParseIntError" ] + [] in let* α7 := M.call_closure α6 [ e ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -150,24 +154,24 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* twenty := - let* α0 := M.get_function "map_in_result_via_match::multiply" [] in + let* α0 := M.get_function "map_in_result_via_match::multiply" [] [] in let* α1 := M.read (mk_str "10") in let* α2 := M.read (mk_str "2") in let* α3 := M.call_closure α0 [ α1; α2 ] in M.alloc α3 in let* _ := - let* α0 := M.get_function "map_in_result_via_match::print" [] in + let* α0 := M.get_function "map_in_result_via_match::print" [] [] in let* α1 := M.read twenty in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* tt_ := - let* α0 := M.get_function "map_in_result_via_match::multiply" [] in + let* α0 := M.get_function "map_in_result_via_match::multiply" [] [] in let* α1 := M.read (mk_str "t") in let* α2 := M.read (mk_str "2") in let* α3 := M.call_closure α0 [ α1; α2 ] in M.alloc α3 in let* _ := - let* α0 := M.get_function "map_in_result_via_match::print" [] in + let* α0 := M.get_function "map_in_result_via_match::print" [] [] in let* α1 := M.read tt_ in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in 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 dcec9df28..b01ed4e77 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 @@ -16,22 +16,28 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::option::Option") - [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ]) + [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] [] ] + []) "unwrap" - [] in + [] + [ Value.Bool true ] in let* α1 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "first" - [] in + [] + [ Value.Bool true ] in let* α2 := M.get_trait_method "core::ops::deref::Deref" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref" + [] [] in let* α3 := M.call_closure α2 [ vec ] in let* α4 := M.call_closure α1 [ α3 ] in @@ -41,10 +47,12 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) "unwrap" + [] [] in - let* α1 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + let* α1 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α2 := M.read first in let* α3 := M.read α2 in let* α4 := M.call_closure α1 [ α3 ] in @@ -76,9 +84,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* numbers := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α8 := (* Unsize *) let* α1 := @@ -86,10 +95,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::boxed::Box") [ - Ty.apply (Ty.path "array") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply + (Ty.path "array") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Integer Integer.Usize 3 ]; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α2 := M.read (mk_str "42") in let* α3 := M.read (mk_str "93") in @@ -105,17 +119,20 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* strings := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α8 := (* Unsize *) let* α1 := @@ -123,10 +140,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::boxed::Box") [ - Ty.apply (Ty.path "array") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply + (Ty.path "array") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Integer Integer.Usize 3 ]; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α2 := M.read (mk_str "tofu") in let* α3 := M.read (mk_str "93") in @@ -139,8 +161,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α9 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The first doubled is ") in @@ -154,8 +176,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in - let* α7 := M.get_function "multiple_error_types::double_first" [] in + [ Ty.path "i32" ] + [] in + let* α7 := M.get_function "multiple_error_types::double_first" [] [] in let* α8 := M.read numbers in let* α9 := M.call_closure α7 [ α8 ] in let* α10 := M.alloc α9 in @@ -168,8 +191,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The first doubled is ") in @@ -183,8 +206,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in - let* α7 := M.get_function "multiple_error_types::double_first" [] in + [ Ty.path "i32" ] + [] in + let* α7 := M.get_function "multiple_error_types::double_first" [] [] in let* α8 := M.read empty in let* α9 := M.call_closure α7 [ α8 ] in let* α10 := M.alloc α9 in @@ -197,8 +221,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The first doubled is ") in @@ -212,8 +236,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in - let* α7 := M.get_function "multiple_error_types::double_first" [] in + [ Ty.path "i32" ] + [] in + let* α7 := M.get_function "multiple_error_types::double_first" [] [] in let* α8 := M.read strings in let* α9 := M.call_closure α7 [ α8 ] in let* α10 := M.alloc α9 in diff --git a/CoqOfRust/examples/default/examples/rust_book/error_handling/option_and_unwrap.err b/CoqOfRust/examples/default/examples/rust_book/error_handling/option_and_unwrap.err index e2cc1c9a9..e070b34be 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/option_and_unwrap.err +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/option_and_unwrap.err @@ -1,8 +1,10 @@ -warning: This kind of constant in patterns is not yet supported. +warning: This kind of literal is not yet supported. --> examples/rust_book/error_handling/option_and_unwrap.rs:6:14 | 6 | Some("lemonade") => println!("Yuck! Too sugary."), | ^^^^^^^^^^ + | + = note: We will work on it! 🪄 warning: 1 warning emitted 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 57d9bbd56..08cd5ec6d 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 @@ -22,9 +22,16 @@ Definition give_adult (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::option::Option::Some" 0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.read γ0_0 in + M.is_constant_or_break_match α0 UnsupportedLiteral in + let* _ := + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Yuck! Too sugary. @@ -39,8 +46,9 @@ Definition give_adult (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::option::Option::Some" 0 in let* inner := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -54,7 +62,8 @@ Definition give_adult (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ inner ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -64,9 +73,13 @@ Definition give_adult (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []); fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "No drink? Oh well. @@ -100,9 +113,13 @@ Definition drink (τ : list Ty.t) (α : list Value.t) : M := let* inside := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply + (Ty.path "core::option::Option") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + []) "unwrap" - [] in + [] + [ Value.Bool true ] in let* α1 := M.read drink in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -116,9 +133,11 @@ Definition drink (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "&") [ Ty.path "str" ]) - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] + (Ty.apply (Ty.path "&") [ Ty.path "str" ] []) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.call_closure α0 [ inside; mk_str "lemonade" ] in let* α2 := M.alloc α1 in @@ -129,7 +148,8 @@ Definition drink (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "std::panicking::begin_panic" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.read (mk_str "AAAaaaaa!!!!") in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.never_to_any α2 in @@ -138,8 +158,8 @@ Definition drink (τ : list Ty.t) (α : list Value.t) : M := ] in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "I love ") in @@ -153,7 +173,8 @@ Definition drink (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ inside ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -194,17 +215,17 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.StructTuple "core::option::Option::Some" [ α0 ]) in let* void := M.alloc (Value.StructTuple "core::option::Option::None" []) in let* _ := - let* α0 := M.get_function "option_and_unwrap::give_adult" [] in + let* α0 := M.get_function "option_and_unwrap::give_adult" [] [] in let* α1 := M.read water in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := - let* α0 := M.get_function "option_and_unwrap::give_adult" [] in + let* α0 := M.get_function "option_and_unwrap::give_adult" [] [] in let* α1 := M.read lemonade in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := - let* α0 := M.get_function "option_and_unwrap::give_adult" [] in + let* α0 := M.get_function "option_and_unwrap::give_adult" [] [] in let* α1 := M.read void in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -213,12 +234,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.StructTuple "core::option::Option::Some" [ α0 ]) in let* nothing := M.alloc (Value.StructTuple "core::option::Option::None" []) in let* _ := - let* α0 := M.get_function "option_and_unwrap::drink" [] in + let* α0 := M.get_function "option_and_unwrap::drink" [] [] in let* α1 := M.read coffee in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := - let* α0 := M.get_function "option_and_unwrap::drink" [] in + let* α0 := M.get_function "option_and_unwrap::drink" [] [] in let* α1 := M.read nothing in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in 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 47d070a3c..86330e2d7 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 @@ -3,7 +3,7 @@ Require Import CoqOfRust.CoqOfRust. Axiom Result : forall (T : Ty.t), - (Ty.apply (Ty.path "other_uses_of_question_mark::Result") [ T ]) = + (Ty.apply (Ty.path "other_uses_of_question_mark::Result") [ T ] []) = (Ty.apply (Ty.path "core::result::Result") [ @@ -11,7 +11,9 @@ Axiom Result : Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.dyn [ ("core::error::Error::Trait", []) ]; Ty.path "alloc::alloc::Global" ] - ]). + [] + ] + []). (* StructTuple { @@ -30,7 +32,7 @@ Module Impl_core_fmt_Debug_for_other_uses_of_question_mark_EmptyVec. | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] [] in let* α1 := M.read f in let* α2 := M.read (mk_str "EmptyVec") in M.call_closure α0 [ α1; α2 ] @@ -58,9 +60,14 @@ Module Impl_core_fmt_Display_for_other_uses_of_question_mark_EmptyVec. | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_fmt" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_fmt" [] [] in let* α1 := M.read f in - let* α2 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α2 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α5 := (* Unsize *) let* α3 := M.read (mk_str "invalid first item to double") in @@ -104,32 +111,41 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "core::result::Result") [ - Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []; Ty.path "other_uses_of_question_mark::EmptyVec" - ]) + ] + []) + [] [] "branch" + [] [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "core::option::Option") - [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ]) + [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] [] ] + []) "ok_or" - [ Ty.path "other_uses_of_question_mark::EmptyVec" ] in + [ Ty.path "other_uses_of_question_mark::EmptyVec" ] + [] in let* α2 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "first" - [] in + [] + [ Value.Bool true ] in let* α3 := M.get_trait_method "core::ops::deref::Deref" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref" + [] [] in let* α4 := M.call_closure α3 [ vec ] in let* α5 := M.call_closure α2 [ α4 ] in @@ -161,7 +177,9 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := Ty.dyn [ ("core::error::Error::Trait", []) ]; Ty.path "alloc::alloc::Global" ] - ]) + [] + ] + []) [ Ty.apply (Ty.path "core::result::Result") @@ -169,8 +187,11 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := Ty.path "core::convert::Infallible"; Ty.path "other_uses_of_question_mark::EmptyVec" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -194,11 +215,14 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := "core::ops::try_trait::Try" (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) + [] [] "branch" + [] [] in - let* α1 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + let* α1 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α2 := M.read first in let* α3 := M.read α2 in let* α4 := M.call_closure α1 [ α3 ] in @@ -228,7 +252,9 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := Ty.dyn [ ("core::error::Error::Trait", []) ]; Ty.path "alloc::alloc::Global" ] - ]) + [] + ] + []) [ Ty.apply (Ty.path "core::result::Result") @@ -236,8 +262,11 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := Ty.path "core::convert::Infallible"; Ty.path "core::num::error::ParseIntError" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -282,8 +311,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Ok" 0 in let* n := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The first doubled is ") in @@ -297,7 +327,8 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ n ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -309,8 +340,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* e := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Error: ") in @@ -331,7 +363,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := Ty.dyn [ ("core::error::Error::Trait", []) ]; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ e ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -361,9 +395,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* numbers := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α8 := (* Unsize *) let* α1 := @@ -371,10 +406,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::boxed::Box") [ - Ty.apply (Ty.path "array") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply + (Ty.path "array") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Integer Integer.Usize 3 ]; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α2 := M.read (mk_str "42") in let* α3 := M.read (mk_str "93") in @@ -390,17 +430,20 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* strings := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α8 := (* Unsize *) let* α1 := @@ -408,10 +451,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::boxed::Box") [ - Ty.apply (Ty.path "array") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply + (Ty.path "array") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Integer Integer.Usize 3 ]; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α2 := M.read (mk_str "tofu") in let* α3 := M.read (mk_str "93") in @@ -423,22 +471,22 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α9 := M.call_closure α0 [ α8 ] in M.alloc α9 in let* _ := - let* α0 := M.get_function "other_uses_of_question_mark::print" [] in - let* α1 := M.get_function "other_uses_of_question_mark::double_first" [] in + let* α0 := M.get_function "other_uses_of_question_mark::print" [] [] in + let* α1 := M.get_function "other_uses_of_question_mark::double_first" [] [] in let* α2 := M.read numbers in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in M.alloc α4 in let* _ := - let* α0 := M.get_function "other_uses_of_question_mark::print" [] in - let* α1 := M.get_function "other_uses_of_question_mark::double_first" [] in + let* α0 := M.get_function "other_uses_of_question_mark::print" [] [] in + let* α1 := M.get_function "other_uses_of_question_mark::double_first" [] [] in let* α2 := M.read empty in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in M.alloc α4 in let* _ := - let* α0 := M.get_function "other_uses_of_question_mark::print" [] in - let* α1 := M.get_function "other_uses_of_question_mark::double_first" [] in + let* α0 := M.get_function "other_uses_of_question_mark::print" [] [] in + let* α1 := M.get_function "other_uses_of_question_mark::double_first" [] [] in let* α2 := M.read strings in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in 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 1abedb062..aa7b02bde 100644 --- a/CoqOfRust/examples/default/examples/rust_book/error_handling/panic.v +++ b/CoqOfRust/examples/default/examples/rust_book/error_handling/panic.v @@ -25,9 +25,11 @@ Definition drink (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "&") [ Ty.path "str" ]) - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] + (Ty.apply (Ty.path "&") [ Ty.path "str" ] []) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.call_closure α0 [ beverage; mk_str "lemonade" ] in let* α2 := M.alloc α1 in @@ -38,7 +40,8 @@ Definition drink (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "std::panicking::begin_panic" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.read (mk_str "AAAaaaaa!!!!") in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.never_to_any α2 in @@ -47,8 +50,8 @@ Definition drink (τ : list Ty.t) (α : list Value.t) : M := ] in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Some refreshing ") in @@ -62,7 +65,8 @@ Definition drink (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ beverage ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -85,12 +89,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* _ := - let* α0 := M.get_function "panic::drink" [] in + let* α0 := M.get_function "panic::drink" [] [] in let* α1 := M.read (mk_str "water") in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := - let* α0 := M.get_function "panic::drink" [] in + let* α0 := M.get_function "panic::drink" [] [] in let* α1 := M.read (mk_str "lemonade") in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in 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 8da93293c..3790c405f 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 @@ -14,31 +14,40 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::option::Option") - [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ]) + [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] [] ] + []) "map" [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]; + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []; Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] [] ] + ] (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) - ] in + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) + ] + [] in let* α1 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "first" - [] in + [] + [ Value.Bool true ] in let* α2 := M.get_trait_method "core::ops::deref::Deref" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref" + [] [] in let* α3 := M.call_closure α2 [ vec ] in let* α4 := M.call_closure α1 [ α3 ] in @@ -60,12 +69,14 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) "map" [ Ty.path "i32"; Ty.function [ Ty.tuple [ Ty.path "i32" ] ] (Ty.path "i32") - ] in + ] + [] in let* α1 := - M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α2 := M.read first in let* α3 := M.read α2 in let* α4 := M.call_closure α1 [ α3 ] in @@ -117,9 +128,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* numbers := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α8 := (* Unsize *) let* α1 := @@ -127,10 +139,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::boxed::Box") [ - Ty.apply (Ty.path "array") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply + (Ty.path "array") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Integer Integer.Usize 3 ]; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α2 := M.read (mk_str "42") in let* α3 := M.read (mk_str "93") in @@ -146,17 +163,20 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* strings := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α8 := (* Unsize *) let* α1 := @@ -164,10 +184,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::boxed::Box") [ - Ty.apply (Ty.path "array") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply + (Ty.path "array") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Integer Integer.Usize 3 ]; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α2 := M.read (mk_str "tofu") in let* α3 := M.read (mk_str "93") in @@ -180,8 +205,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α9 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The first doubled is ") in @@ -202,9 +227,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "core::result::Result") [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + [] ] - ] in - let* α7 := M.get_function "pulling_results_out_of_options::double_first" [] in + [] + ] + [] in + let* α7 := M.get_function "pulling_results_out_of_options::double_first" [] [] in let* α8 := M.read numbers in let* α9 := M.call_closure α7 [ α8 ] in let* α10 := M.alloc α9 in @@ -217,8 +245,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The first doubled is ") in @@ -239,9 +267,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "core::result::Result") [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + [] ] - ] in - let* α7 := M.get_function "pulling_results_out_of_options::double_first" [] in + [] + ] + [] in + let* α7 := M.get_function "pulling_results_out_of_options::double_first" [] [] in let* α8 := M.read empty in let* α9 := M.call_closure α7 [ α8 ] in let* α10 := M.alloc α9 in @@ -254,8 +285,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The first doubled is ") in @@ -276,9 +307,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "core::result::Result") [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + [] ] - ] in - let* α7 := M.get_function "pulling_results_out_of_options::double_first" [] in + [] + ] + [] in + let* α7 := M.get_function "pulling_results_out_of_options::double_first" [] [] in let* α8 := M.read strings in let* α9 := M.call_closure α7 [ α8 ] in let* α10 := M.alloc α9 in 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 767390412..3a531ba09 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 @@ -17,31 +17,42 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::option::Option") - [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ]) + [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] [] ] + []) "map" [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]; + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []; Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ] ] + [ + Ty.tuple + [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] [] ] + ] (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) - ] in + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) + ] + [] in let* α1 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "first" - [] in + [] + [ Value.Bool true ] in let* α2 := M.get_trait_method "core::ops::deref::Deref" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref" + [] [] in let* α3 := M.call_closure α2 [ vec ] in let* α4 := M.call_closure α1 [ α3 ] in @@ -64,14 +75,16 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) "map" [ Ty.path "i32"; Ty.function [ Ty.tuple [ Ty.path "i32" ] ] (Ty.path "i32") - ] in + ] + [] in let* α1 := - M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α2 := M.read first in let* α3 := M.read α2 in let* α4 := M.call_closure α1 [ α3 ] in @@ -108,15 +121,18 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "core::result::Result") [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] - ]) + [] + ] + []) "map_or" [ Ty.apply (Ty.path "core::result::Result") [ - Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ]; + Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] []; Ty.path "core::num::error::ParseIntError" - ]; + ] + []; Ty.function [ Ty.tuple @@ -124,15 +140,18 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "core::result::Result") [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + [] ] ] (Ty.apply (Ty.path "core::result::Result") [ - Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ]; + Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] []; Ty.path "core::num::error::ParseIntError" - ]) - ] in + ] + []) + ] + [] in let* α1 := M.read opt in let* α2 := M.call_closure @@ -156,14 +175,16 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) "map" [ - Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ]; + Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] []; Ty.function [ Ty.path "i32" ] - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ]) - ] in + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] []) + ] + [] in let* α1 := M.read r in M.call_closure α0 @@ -194,9 +215,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* numbers := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α8 := (* Unsize *) let* α1 := @@ -204,10 +226,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::boxed::Box") [ - Ty.apply (Ty.path "array") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply + (Ty.path "array") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Integer Integer.Usize 3 ]; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α2 := M.read (mk_str "42") in let* α3 := M.read (mk_str "93") in @@ -223,17 +250,20 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* strings := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α8 := (* Unsize *) let* α1 := @@ -241,10 +271,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::boxed::Box") [ - Ty.apply (Ty.path "array") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply + (Ty.path "array") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Integer Integer.Usize 3 ]; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α2 := M.read (mk_str "tofu") in let* α3 := M.read (mk_str "93") in @@ -257,8 +292,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α9 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The first doubled is ") in @@ -276,13 +311,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "core::result::Result") [ - Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ]; + Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] []; Ty.path "core::num::error::ParseIntError" ] - ] in + [] + ] + [] in let* α7 := M.get_function "pulling_results_out_of_options_with_stop_error_processing::double_first" + [] [] in let* α8 := M.read numbers in let* α9 := M.call_closure α7 [ α8 ] in @@ -296,8 +334,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The first doubled is ") in @@ -315,13 +353,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "core::result::Result") [ - Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ]; + Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] []; Ty.path "core::num::error::ParseIntError" ] - ] in + [] + ] + [] in let* α7 := M.get_function "pulling_results_out_of_options_with_stop_error_processing::double_first" + [] [] in let* α8 := M.read empty in let* α9 := M.call_closure α7 [ α8 ] in @@ -335,8 +376,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The first doubled is ") in @@ -354,13 +395,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "core::result::Result") [ - Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ]; + Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] []; Ty.path "core::num::error::ParseIntError" ] - ] in + [] + ] + [] in let* α7 := M.get_function "pulling_results_out_of_options_with_stop_error_processing::double_first" + [] [] in let* α8 := M.read strings in let* α9 := M.call_closure α7 [ α8 ] in 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 d8bf7f205..5686bde63 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 @@ -17,7 +17,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* number_str := M.copy (mk_str "10") in let* number := - let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α1 := M.read number_str in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.alloc α2 in @@ -42,8 +42,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.copy α4 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -57,7 +57,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ number ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 b92a32f23..a2c3c4a8f 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 @@ -45,7 +45,7 @@ Module Impl_core_fmt_Debug_for_unpacking_options_and_defaults_via_get_or_insert_ | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] [] in let* α1 := M.read f in let* α2 := M.match_operator @@ -110,16 +110,18 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::option::Option") - [ Ty.path "unpacking_options_and_defaults_via_get_or_insert::Fruit" ]) + [ Ty.path "unpacking_options_and_defaults_via_get_or_insert::Fruit" ] + []) "get_or_insert" + [] [] in let* α1 := M.read apple in let* α2 := M.call_closure α0 [ my_fruit; α1 ] in M.alloc α2 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "my_fruit is: ") in @@ -137,7 +139,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "&mut") [ Ty.path "unpacking_options_and_defaults_via_get_or_insert::Fruit" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ first_available_fruit ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -147,8 +151,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "first_available_fruit is: ") in @@ -166,7 +170,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "&mut") [ Ty.path "unpacking_options_and_defaults_via_get_or_insert::Fruit" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ first_available_fruit ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 ec2c070d3..bc03aa7dd 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 @@ -45,7 +45,7 @@ Module Impl_core_fmt_Debug_for_unpacking_options_and_defaults_via_get_or_insert_ | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] [] in let* α1 := M.read f in let* α2 := M.match_operator @@ -126,12 +126,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" - [] in + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Providing lemon as fallback @@ -156,20 +157,22 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::option::Option") - [ Ty.path "unpacking_options_and_defaults_via_get_or_insert_with::Fruit" ]) + [ Ty.path "unpacking_options_and_defaults_via_get_or_insert_with::Fruit" ] + []) "get_or_insert_with" [ Ty.function [ Ty.tuple [] ] (Ty.path "unpacking_options_and_defaults_via_get_or_insert_with::Fruit") - ] in + ] + [] in let* α1 := M.read get_lemon_as_fallback in let* α2 := M.call_closure α0 [ my_fruit; α1 ] in M.alloc α2 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "my_fruit is: ") in @@ -187,7 +190,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "&mut") [ Ty.path "unpacking_options_and_defaults_via_get_or_insert_with::Fruit" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ first_available_fruit ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -197,8 +202,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "first_available_fruit is: ") in @@ -216,7 +221,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "&mut") [ Ty.path "unpacking_options_and_defaults_via_get_or_insert_with::Fruit" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ first_available_fruit ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -238,20 +245,22 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::option::Option") - [ Ty.path "unpacking_options_and_defaults_via_get_or_insert_with::Fruit" ]) + [ Ty.path "unpacking_options_and_defaults_via_get_or_insert_with::Fruit" ] + []) "get_or_insert_with" [ Ty.function [ Ty.tuple [] ] (Ty.path "unpacking_options_and_defaults_via_get_or_insert_with::Fruit") - ] in + ] + [] in let* α1 := M.read get_lemon_as_fallback in let* α2 := M.call_closure α0 [ my_apple; α1 ] in M.alloc α2 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "should_be_apple is: ") in @@ -269,7 +278,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "&mut") [ Ty.path "unpacking_options_and_defaults_via_get_or_insert_with::Fruit" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ should_be_apple ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -279,8 +290,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "my_apple is unchanged: ") in @@ -298,7 +309,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "core::option::Option") [ Ty.path "unpacking_options_and_defaults_via_get_or_insert_with::Fruit" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ my_apple ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 b4b414cc5..a4e8cf3b5 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 @@ -45,7 +45,7 @@ Module Impl_core_fmt_Debug_for_unpacking_options_and_defaults_via_or_Fruit. | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] [] in let* α1 := M.read f in let* α2 := M.match_operator @@ -121,15 +121,19 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::option::Option") - [ Ty.path "unpacking_options_and_defaults_via_or::Fruit" ]) + [ Ty.path "unpacking_options_and_defaults_via_or::Fruit" ] + []) "or" + [] [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "core::option::Option") - [ Ty.path "unpacking_options_and_defaults_via_or::Fruit" ]) + [ Ty.path "unpacking_options_and_defaults_via_or::Fruit" ] + []) "or" + [] [] in let* α2 := M.read no_fruit in let* α3 := M.read orange in @@ -139,8 +143,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α6 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "first_available_fruit: ") in @@ -158,7 +162,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "core::option::Option") [ Ty.path "unpacking_options_and_defaults_via_or::Fruit" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ first_available_fruit ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 bcfb96e3c..8ecb22f6a 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 @@ -45,7 +45,7 @@ Module Impl_core_fmt_Debug_for_unpacking_options_and_defaults_via_or_else_Fruit. | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] [] in let* α1 := M.read f in let* α2 := M.match_operator @@ -128,12 +128,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" - [] in + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Providing kiwi as fallback @@ -170,12 +171,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" - [] in + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Providing lemon as fallback @@ -204,28 +206,34 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::option::Option") - [ Ty.path "unpacking_options_and_defaults_via_or_else::Fruit" ]) + [ Ty.path "unpacking_options_and_defaults_via_or_else::Fruit" ] + []) "or_else" [ Ty.function [ Ty.tuple [] ] (Ty.apply (Ty.path "core::option::Option") - [ Ty.path "unpacking_options_and_defaults_via_or_else::Fruit" ]) - ] in + [ Ty.path "unpacking_options_and_defaults_via_or_else::Fruit" ] + []) + ] + [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "core::option::Option") - [ Ty.path "unpacking_options_and_defaults_via_or_else::Fruit" ]) + [ Ty.path "unpacking_options_and_defaults_via_or_else::Fruit" ] + []) "or_else" [ Ty.function [ Ty.tuple [] ] (Ty.apply (Ty.path "core::option::Option") - [ Ty.path "unpacking_options_and_defaults_via_or_else::Fruit" ]) - ] in + [ Ty.path "unpacking_options_and_defaults_via_or_else::Fruit" ] + []) + ] + [] in let* α2 := M.read no_fruit in let* α3 := M.read get_kiwi_as_fallback in let* α4 := M.call_closure α1 [ α2; α3 ] in @@ -234,8 +242,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α6 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "first_available_fruit: ") in @@ -253,7 +261,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "core::option::Option") [ Ty.path "unpacking_options_and_defaults_via_or_else::Fruit" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ first_available_fruit ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 80024278c..6b1a2660f 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 @@ -7,7 +7,7 @@ Require Import CoqOfRust.CoqOfRust. ty_params := []; fields := [ - ("area_code", Ty.apply (Ty.path "core::option::Option") [ Ty.path "u8" ]); + ("area_code", Ty.apply (Ty.path "core::option::Option") [ Ty.path "u8" ] []); ("number", Ty.path "u32") ]; } *) @@ -54,7 +54,8 @@ End Impl_core_marker_Copy_for_unpacking_options_via_question_mark_PhoneNumber. ("phone_number", Ty.apply (Ty.path "core::option::Option") - [ Ty.path "unpacking_options_via_question_mark::PhoneNumber" ]) + [ Ty.path "unpacking_options_via_question_mark::PhoneNumber" ] + []) ]; } *) @@ -97,7 +98,8 @@ End Impl_core_marker_Copy_for_unpacking_options_via_question_mark_Job. ("job", Ty.apply (Ty.path "core::option::Option") - [ Ty.path "unpacking_options_via_question_mark::Job" ]) + [ Ty.path "unpacking_options_via_question_mark::Job" ] + []) ]; } *) @@ -121,18 +123,24 @@ Module Impl_unpacking_options_via_question_mark_Person. "core::ops::try_trait::Try" (Ty.apply (Ty.path "core::option::Option") - [ Ty.path "unpacking_options_via_question_mark::PhoneNumber" ]) + [ Ty.path "unpacking_options_via_question_mark::PhoneNumber" ] + []) + [] [] "branch" + [] [] in let* α1 := M.get_trait_method "core::ops::try_trait::Try" (Ty.apply (Ty.path "core::option::Option") - [ Ty.path "unpacking_options_via_question_mark::Job" ]) + [ Ty.path "unpacking_options_via_question_mark::Job" ] + []) + [] [] "branch" + [] [] in let* α2 := M.read self in let* α3 := @@ -153,13 +161,16 @@ Module Impl_unpacking_options_via_question_mark_Person. let* α0 := 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 "u8" ] []) [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "core::convert::Infallible" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -198,13 +209,16 @@ Module Impl_unpacking_options_via_question_mark_Person. let* α0 := 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 "u8" ] []) [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "core::convert::Infallible" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -284,6 +298,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "unpacking_options_via_question_mark::Person") "work_phone_area_code" + [] [] in let* α1 := M.call_closure α0 [ p ] in let* α2 := M.alloc α1 in @@ -307,9 +322,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u8" ]) - [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "u8" ] ] + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "u8" ] []) + [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "u8" ] [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read left_val in let* α2 := M.read right_val in @@ -324,9 +341,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_function "core::panicking::assert_failed" [ - Ty.apply (Ty.path "core::option::Option") [ Ty.path "u8" ]; - Ty.apply (Ty.path "core::option::Option") [ Ty.path "u8" ] - ] in + Ty.apply (Ty.path "core::option::Option") [ Ty.path "u8" ] []; + Ty.apply (Ty.path "core::option::Option") [ Ty.path "u8" ] [] + ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in 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 a5a72af98..68c0bd5bc 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 @@ -37,7 +37,7 @@ Module Impl_core_fmt_Debug_for_wrapping_errors_DoubleError. fun γ => let* γ := M.read γ in let* α0 := - M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] in + M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] [] in let* α1 := M.read f in let* α2 := M.read (mk_str "EmptyVec") in let* α3 := M.call_closure α0 [ α1; α2 ] in @@ -51,6 +51,7 @@ Module Impl_core_fmt_Debug_for_wrapping_errors_DoubleError. M.get_associated_function (Ty.path "core::fmt::Formatter") "debug_tuple_field1_finish" + [] [] in let* α1 := M.read f in let* α2 := M.read (mk_str "Parse") in @@ -72,8 +73,8 @@ End Impl_core_fmt_Debug_for_wrapping_errors_DoubleError. Axiom Result : forall (T : Ty.t), - (Ty.apply (Ty.path "wrapping_errors::Result") [ T ]) = - (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "wrapping_errors::DoubleError" ]). + (Ty.apply (Ty.path "wrapping_errors::Result") [ T ] []) = + (Ty.apply (Ty.path "core::result::Result") [ T; Ty.path "wrapping_errors::DoubleError" ] []). Module Impl_core_fmt_Display_for_wrapping_errors_DoubleError. Definition Self : Ty.t := Ty.path "wrapping_errors::DoubleError". @@ -100,10 +101,14 @@ Module Impl_core_fmt_Display_for_wrapping_errors_DoubleError. [ fun γ => let* α0 := - M.get_associated_function (Ty.path "core::fmt::Formatter") "write_fmt" [] in + M.get_associated_function (Ty.path "core::fmt::Formatter") "write_fmt" [] [] in let* α1 := M.read f in let* α2 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α5 := (* Unsize *) let* α3 := M.read (mk_str "please use a vector with at least one element") in @@ -114,10 +119,14 @@ Module Impl_core_fmt_Display_for_wrapping_errors_DoubleError. M.alloc α7; fun γ => let* α0 := - M.get_associated_function (Ty.path "core::fmt::Formatter") "write_fmt" [] in + M.get_associated_function (Ty.path "core::fmt::Formatter") "write_fmt" [] [] in let* α1 := M.read f in let* α2 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α5 := (* Unsize *) let* α3 := M.read (mk_str "the provided string could not be parsed as int") in @@ -231,32 +240,41 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "core::result::Result") [ - Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []; Ty.path "wrapping_errors::DoubleError" - ]) + ] + []) + [] [] "branch" + [] [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "core::option::Option") - [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] ]) + [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] [] ] + []) "ok_or" - [ Ty.path "wrapping_errors::DoubleError" ] in + [ Ty.path "wrapping_errors::DoubleError" ] + [] in let* α2 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "first" - [] in + [] + [ Value.Bool true ] in let* α3 := M.get_trait_method "core::ops::deref::Deref" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref" + [] [] in let* α4 := M.call_closure α3 [ vec ] in let* α5 := M.call_closure α2 [ α4 ] in @@ -280,14 +298,18 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := "core::ops::try_trait::FromResidual" (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "wrapping_errors::DoubleError" ]) + [ Ty.path "i32"; Ty.path "wrapping_errors::DoubleError" ] + []) [ Ty.apply (Ty.path "core::result::Result") [ Ty.path "core::convert::Infallible"; Ty.path "wrapping_errors::DoubleError" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -311,11 +333,14 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := "core::ops::try_trait::Try" (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ]) + [ Ty.path "i32"; Ty.path "core::num::error::ParseIntError" ] + []) + [] [] "branch" + [] [] in - let* α1 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + let* α1 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α2 := M.read first in let* α3 := M.read α2 in let* α4 := M.call_closure α1 [ α3 ] in @@ -337,7 +362,8 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := "core::ops::try_trait::FromResidual" (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "wrapping_errors::DoubleError" ]) + [ Ty.path "i32"; Ty.path "wrapping_errors::DoubleError" ] + []) [ Ty.apply (Ty.path "core::result::Result") @@ -345,8 +371,11 @@ Definition double_first (τ : list Ty.t) (α : list Value.t) : M := Ty.path "core::convert::Infallible"; Ty.path "core::num::error::ParseIntError" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -396,8 +425,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Ok" 0 in let* n := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The first doubled is ") in @@ -411,7 +441,8 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ n ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -424,8 +455,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := let* e := M.copy γ0_0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Error: ") in @@ -439,7 +471,8 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "wrapping_errors::DoubleError" ] in + [ Ty.path "wrapping_errors::DoubleError" ] + [] in let* α7 := M.call_closure α6 [ e ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -458,7 +491,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := "core::error::Error" (Ty.path "wrapping_errors::DoubleError") [] + [] "source" + [] [] in let* α1 := M.call_closure α0 [ e ] in M.alloc α1 in @@ -467,9 +502,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := let* source := M.copy γ0_0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str " Caused by: ") in @@ -487,7 +522,9 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "&") [ Ty.dyn [ ("core::error::Error::Trait", []) ] ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ source ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -520,9 +557,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* numbers := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α8 := (* Unsize *) let* α1 := @@ -530,10 +568,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::boxed::Box") [ - Ty.apply (Ty.path "array") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply + (Ty.path "array") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Integer Integer.Usize 3 ]; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α2 := M.read (mk_str "42") in let* α3 := M.read (mk_str "93") in @@ -549,17 +592,20 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* strings := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α8 := (* Unsize *) let* α1 := @@ -567,10 +613,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::boxed::Box") [ - Ty.apply (Ty.path "array") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply + (Ty.path "array") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Integer Integer.Usize 3 ]; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α2 := M.read (mk_str "tofu") in let* α3 := M.read (mk_str "93") in @@ -582,22 +633,22 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α9 := M.call_closure α0 [ α8 ] in M.alloc α9 in let* _ := - let* α0 := M.get_function "wrapping_errors::print" [] in - let* α1 := M.get_function "wrapping_errors::double_first" [] in + let* α0 := M.get_function "wrapping_errors::print" [] [] in + let* α1 := M.get_function "wrapping_errors::double_first" [] [] in let* α2 := M.read numbers in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in M.alloc α4 in let* _ := - let* α0 := M.get_function "wrapping_errors::print" [] in - let* α1 := M.get_function "wrapping_errors::double_first" [] in + let* α0 := M.get_function "wrapping_errors::print" [] [] in + let* α1 := M.get_function "wrapping_errors::double_first" [] [] in let* α2 := M.read empty in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in M.alloc α4 in let* _ := - let* α0 := M.get_function "wrapping_errors::print" [] in - let* α1 := M.get_function "wrapping_errors::double_first" [] in + let* α0 := M.get_function "wrapping_errors::print" [] [] in + let* α1 := M.get_function "wrapping_errors::double_first" [] [] in let* α2 := M.read strings in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in diff --git a/CoqOfRust/examples/default/examples/rust_book/expressions/blocks.v b/CoqOfRust/examples/default/examples/rust_book/expressions/blocks.v index 2680e011f..f73515704 100644 --- a/CoqOfRust/examples/default/examples/rust_book/expressions/blocks.v +++ b/CoqOfRust/examples/default/examples/rust_book/expressions/blocks.v @@ -54,8 +54,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.copy α0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "x is ") in @@ -69,7 +69,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.call_closure α6 [ x ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -79,8 +80,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "y is ") in @@ -94,7 +95,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.call_closure α6 [ y ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -104,8 +106,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "z is ") in @@ -119,7 +121,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.tuple [] ] in + [ Ty.tuple [] ] + [] in let* α7 := M.call_closure α6 [ z ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_into_iter.err b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_into_iter.err index 681dfd6b5..cb87dc300 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_into_iter.err +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_into_iter.err @@ -1,8 +1,10 @@ -warning: This kind of constant in patterns is not yet supported. +warning: This kind of literal is not yet supported. --> examples/rust_book/flow_of_control/for_and_iterators_into_iter.rs:6:13 | 6 | "Ferris" => println!("There is a rustacean among us!"), | ^^^^^^^^ + | + = note: We will work on it! 🪄 warning: 1 warning emitted 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 230986ba6..ecc0bd5c1 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 @@ -22,9 +22,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* names := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α8 := (* Unsize *) let* α1 := @@ -32,10 +33,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::boxed::Box") [ - Ty.apply (Ty.path "array") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply + (Ty.path "array") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Integer Integer.Usize 3 ]; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α2 := M.read (mk_str "Bob") in let* α3 := M.read (mk_str "Frank") in @@ -51,18 +57,24 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::collect::IntoIterator" (Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) + [] [] "into_iter" + [] [] in let* α1 := M.get_trait_method "core::iter::traits::collect::IntoIterator" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) + [] [] "into_iter" + [] [] in let* α2 := M.read names in let* α3 := M.call_closure α1 [ α2 ] in @@ -81,9 +93,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" + ] + []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -104,12 +120,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.read γ in + M.is_constant_or_break_match α0 UnsupportedLiteral in + let* _ := + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" - [] in + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "There is a rustacean among us! @@ -122,11 +142,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []); fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -141,7 +162,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ name ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_iter.err b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_iter.err index 5b5377e8f..acafcd611 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_iter.err +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_iter.err @@ -1,8 +1,10 @@ -warning: This kind of constant in patterns is not yet supported. +warning: This kind of literal is not yet supported. --> examples/rust_book/flow_of_control/for_and_iterators_iter.rs:6:14 | 6 | &"Ferris" => println!("There is a rustacean among us!"), | ^^^^^^^^ + | + = note: We will work on it! 🪄 warning: 1 warning emitted 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 164ae5ae4..156221343 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 @@ -22,9 +22,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* names := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α8 := (* Unsize *) let* α1 := @@ -32,10 +33,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::boxed::Box") [ - Ty.apply (Ty.path "array") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply + (Ty.path "array") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Integer Integer.Usize 3 ]; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α2 := M.read (mk_str "Bob") in let* α3 := M.read (mk_str "Frank") in @@ -52,23 +58,30 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::collect::IntoIterator" (Ty.apply (Ty.path "core::slice::iter::Iter") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + []) + [] [] "into_iter" + [] [] in let* α1 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "iter" + [] [] in let* α2 := M.get_trait_method "core::ops::deref::Deref" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref" + [] [] in let* α3 := M.call_closure α2 [ names ] in let* α4 := M.call_closure α1 [ α3 ] in @@ -87,9 +100,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "core::slice::iter::Iter") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -114,12 +130,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* γ := M.read γ in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.read γ in + M.is_constant_or_break_match α0 UnsupportedLiteral in + let* _ := + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" - [] in + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "There is a rustacean among us! @@ -132,11 +152,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []); fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -154,8 +175,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "&") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] - ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] + ] + [] in let* α7 := M.call_closure α6 [ name ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -170,8 +193,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.pure (M.use α7) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "names: ") in @@ -188,8 +211,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ] - ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + [] + ] + [] in let* α7 := M.call_closure α6 [ names ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in diff --git a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_iter_mut.err b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_iter_mut.err index fb3e22f55..f5ac50dd0 100644 --- a/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_iter_mut.err +++ b/CoqOfRust/examples/default/examples/rust_book/flow_of_control/for_and_iterators_iter_mut.err @@ -1,8 +1,10 @@ -warning: This kind of constant in patterns is not yet supported. +warning: This kind of literal is not yet supported. --> examples/rust_book/flow_of_control/for_and_iterators_iter_mut.rs:6:18 | 6 | &mut "Ferris" => "There is a rustacean among us!", | ^^^^^^^^ + | + = note: We will work on it! 🪄 warning: 1 warning emitted 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 f1d465f1e..17ebf77a8 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 @@ -21,9 +21,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* names := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α8 := (* Unsize *) let* α1 := @@ -31,10 +32,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::boxed::Box") [ - Ty.apply (Ty.path "array") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]; + Ty.apply + (Ty.path "array") + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Integer Integer.Usize 3 ]; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α2 := M.read (mk_str "Bob") in let* α3 := M.read (mk_str "Frank") in @@ -51,23 +57,30 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::collect::IntoIterator" (Ty.apply (Ty.path "core::slice::iter::IterMut") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + []) + [] [] "into_iter" + [] [] in let* α1 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + (Ty.apply (Ty.path "slice") [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] []) "iter_mut" + [] [] in let* α2 := M.get_trait_method "core::ops::deref::DerefMut" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref_mut" + [] [] in let* α3 := M.call_closure α2 [ names ] in let* α4 := M.call_closure α1 [ α3 ] in @@ -86,9 +99,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "core::slice::iter::IterMut") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -114,6 +130,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ fun γ => let* γ := M.read γ in + let* _ := + let* α0 := M.read γ in + M.is_constant_or_break_match α0 UnsupportedLiteral in let* α0 := M.read (mk_str "There is a rustacean among us!") in M.alloc α0; fun γ => @@ -128,8 +147,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.pure (M.use α7) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "names: ") in @@ -146,8 +165,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ] - ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + [] + ] + [] in let* α7 := M.call_closure α6 [ names ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 21efa328c..72faefbf0 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 @@ -23,15 +23,18 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "core::ops::range::RangeInclusive") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::ops::range::RangeInclusive") [ Ty.path "i32" ] []) + [] [] "into_iter" + [] [] in let* α1 := M.get_associated_function - (Ty.apply (Ty.path "core::ops::range::RangeInclusive") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::ops::range::RangeInclusive") [ Ty.path "i32" ] []) "new" - [] in + [] + [ Value.Bool true ] in let* α2 := M.call_closure α1 [ Value.Integer Integer.I32 1; Value.Integer Integer.I32 100 ] in let* α3 := M.call_closure α0 [ α2 ] in let* α4 := M.alloc α3 in @@ -46,9 +49,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::ops::range::RangeInclusive") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::ops::range::RangeInclusive") [ Ty.path "i32" ] []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -79,12 +84,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" - [] in + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "fizzbuzz @@ -113,12 +119,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" - [] in + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "fizz @@ -149,12 +156,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := + M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" - [] in + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "buzz @@ -169,11 +178,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := + M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -188,7 +199,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ n ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 24527853e..4fa08171f 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 @@ -23,9 +23,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ] []) + [] [] "into_iter" + [] [] in let* α1 := M.call_closure @@ -47,9 +49,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ] []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -80,12 +84,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" - [] in + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "fizzbuzz @@ -114,12 +119,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" - [] in + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "fizz @@ -150,12 +156,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := + M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" - [] in + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "buzz @@ -170,11 +178,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := + M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -189,7 +199,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ n ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 6e7192e10..c0c73c808 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 @@ -49,8 +49,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -63,7 +64,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ n ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -87,9 +89,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -102,7 +104,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ n ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -114,9 +117,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -129,7 +132,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ n ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -161,9 +165,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str ", and is a small number, increase ten-fold @@ -180,9 +188,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str ", and is a big number, halve the number @@ -200,8 +212,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.copy α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -216,13 +228,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α8 := M.call_closure α7 [ n ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α10 := M.call_closure α9 [ big_n ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in M.pure (M.pointer_coercion α11) in 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 b87f6ba68..b92de3f96 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 @@ -55,8 +55,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* i := M.copy γ0_0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Matched ") in @@ -70,7 +71,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ i ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -92,8 +94,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* i := M.copy γ0_0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Matched ") in @@ -107,7 +110,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ i ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -119,9 +123,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Didn't match a number. Let's go with a letter! @@ -146,8 +154,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* i := M.copy γ0_0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Matched ") in @@ -161,7 +170,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ i ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -182,9 +192,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := @@ -200,9 +214,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := 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 fd27f7c3b..7ee4b1af3 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 @@ -38,9 +38,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let γ := a in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "a is foobar 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 5484cc333..c66c86d52 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 @@ -32,8 +32,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* i := M.copy γ0_0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "This is a really long string and `") in @@ -47,7 +48,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ i ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 6139923fd..578199e5f 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 @@ -73,9 +73,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let γ := a in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "a is foobar @@ -98,9 +102,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let γ := b in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "b is foobar @@ -126,8 +134,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* value := M.copy γ0_0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "c is ") in @@ -141,7 +150,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.call_closure α6 [ value ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -167,9 +177,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Integer Integer.U32 100) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "c is one hundred 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 bba318f30..48ab0f4a0 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 @@ -35,8 +35,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* count := M.alloc (Value.Integer Integer.U32 0) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Let's count until infinity! @@ -69,9 +74,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "three @@ -90,8 +99,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ] in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -105,7 +114,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.call_closure α6 [ count ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -127,9 +137,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "OK, that's enough 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 a9007cceb..601c2e1c2 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 @@ -29,8 +29,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.loop (let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Entered the outer loop @@ -46,9 +51,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.loop (let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Entered the inner loop @@ -65,8 +74,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α2 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "This point will never be reached @@ -80,8 +94,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple [])) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Exited the outer loop 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 6ba9f79d5..f5ee0c21c 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 @@ -77,7 +77,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "core::panicking::assert_failed" - [ Ty.path "i32"; Ty.path "i32" ] in + [ Ty.path "i32"; Ty.path "i32" ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in 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 0b51df398..c097d37f4 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 @@ -38,8 +38,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* number := M.alloc (Value.Integer Integer.I32 13) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Tell me about ") in @@ -53,7 +53,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ number ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -70,9 +71,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Integer Integer.I32 1) in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "One! @@ -118,9 +123,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match γ with | [] => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "This is a prime @@ -135,9 +144,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := end)); fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "A teen @@ -150,9 +163,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []); fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Ain't special @@ -184,8 +201,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.copy α0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -200,13 +217,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "bool" ] in + [ Ty.path "bool" ] + [] in let* α8 := M.call_closure α7 [ boolean ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α10 := M.call_closure α9 [ binary ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in M.pure (M.pointer_coercion α11) in 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 03c0525a0..3e5bb48ed 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 @@ -30,8 +30,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Tell me what type of person you are @@ -42,7 +47,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α6 := M.call_closure α0 [ α5 ] in M.alloc α6 in M.alloc (Value.Tuple []) in - let* α0 := M.get_function "match_binding::age" [] in + let* α0 := M.get_function "match_binding::age" [] [] in let* α1 := M.call_closure α0 [] in let* α2 := M.alloc α1 in let* α0 := @@ -54,9 +59,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Integer Integer.U32 0) in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "I haven't celebrated my first birthday yet @@ -70,8 +79,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* n := M.copy γ in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "I'm a child of age ") in @@ -85,7 +95,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.call_closure α6 [ n ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -96,8 +107,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* n := M.copy γ in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "I'm a teen of age ") in @@ -111,7 +123,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.call_closure α6 [ n ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -122,8 +135,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* n := M.copy γ in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "I'm an old person of age ") in @@ -137,7 +151,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.call_closure α6 [ n ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 28cf11087..1866bd32b 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 @@ -29,7 +29,7 @@ fn main() { Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_function "match_binding_destructure_enum_variants::some_number" [] in + let* α0 := M.get_function "match_binding_destructure_enum_variants::some_number" [] [] in let* α1 := M.call_closure α0 [] in let* α2 := M.alloc α1 in let* α3 := @@ -43,8 +43,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.read γ0_0 in M.is_constant_or_break_match α0 (Value.Integer Integer.U32 42) in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The Answer: ") in @@ -58,7 +59,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.call_closure α6 [ n ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -70,8 +72,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::option::Option::Some" 0 in let* n := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Not interesting... ") in @@ -85,7 +88,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.call_closure α6 [ n ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 5bd601ace..e745cedfd 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 @@ -62,8 +62,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* second := M.copy γ0_1 in let* third := M.copy γ0_2 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "array[0] = 0, array[1] = ") in @@ -78,13 +79,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α8 := M.call_closure α7 [ second ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α10 := M.call_closure α9 [ third ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in M.pure (M.pointer_coercion α11) in @@ -101,8 +104,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Integer Integer.I32 1) in let* third := M.copy γ0_2 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "array[0] = 1, array[2] = ") in @@ -116,7 +120,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ third ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -133,8 +138,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Integer Integer.I32 (-1)) in let* second := M.copy γ0_1 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "array[0] = -1, array[1] = ") in @@ -148,7 +154,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ second ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -166,8 +173,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* second := M.copy γ0_1 in let* tail := M.copy γ0_rest in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "array[0] = 3, array[1] = ") in @@ -182,13 +190,20 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α8 := M.call_closure α7 [ second ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "array") [ Ty.path "i32" ] ] in + [ + Ty.apply + (Ty.path "array") + [ Ty.path "i32" ] + [ Value.Integer Integer.Usize 1 ] + ] + [] in let* α10 := M.call_closure α9 [ tail ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in M.pure (M.pointer_coercion α11) in @@ -204,8 +219,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* middle := M.copy γ0_rest in let* last := M.copy γ0_rev0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α7 := (* Unsize *) let* α2 := M.read (mk_str "array[0] = ") in @@ -221,19 +237,27 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α9 := M.call_closure α8 [ first ] in let* α10 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "array") [ Ty.path "i32" ] ] in + [ + Ty.apply + (Ty.path "array") + [ Ty.path "i32" ] + [ Value.Integer Integer.Usize 1 ] + ] + [] in let* α11 := M.call_closure α10 [ middle ] in let* α12 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α13 := M.call_closure α12 [ last ] in let* α14 := M.alloc (Value.Array [ α9; α11; α13 ]) in M.pure (M.pointer_coercion α14) in 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 4220fb200..094ed2cf4 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 @@ -86,8 +86,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "What color is it? @@ -104,9 +109,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "The color is Red! @@ -119,9 +128,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []); fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "The color is Blue! @@ -134,9 +147,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []); fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "The color is Green! @@ -158,8 +175,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* g := M.copy γ0_1 in let* b := M.copy γ0_2 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α7 := (* Unsize *) let* α2 := M.read (mk_str "Red: ") in @@ -175,19 +193,22 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α9 := M.call_closure α8 [ r ] in let* α10 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α11 := M.call_closure α10 [ g ] in let* α12 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α13 := M.call_closure α12 [ b ] in let* α14 := M.alloc (Value.Array [ α9; α11; α13 ]) in M.pure (M.pointer_coercion α14) in @@ -206,8 +227,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* s := M.copy γ0_1 in let* v := M.copy γ0_2 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α7 := (* Unsize *) let* α2 := M.read (mk_str "Hue: ") in @@ -223,19 +245,22 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α9 := M.call_closure α8 [ h ] in let* α10 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α11 := M.call_closure α10 [ s ] in let* α12 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α13 := M.call_closure α12 [ v ] in let* α14 := M.alloc (Value.Array [ α9; α11; α13 ]) in M.pure (M.pointer_coercion α14) in @@ -254,8 +279,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* s := M.copy γ0_1 in let* l := M.copy γ0_2 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α7 := (* Unsize *) let* α2 := M.read (mk_str "Hue: ") in @@ -271,19 +297,22 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α9 := M.call_closure α8 [ h ] in let* α10 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α11 := M.call_closure α10 [ s ] in let* α12 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α13 := M.call_closure α12 [ l ] in let* α14 := M.alloc (Value.Array [ α9; α11; α13 ]) in M.pure (M.pointer_coercion α14) in @@ -302,8 +331,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* m := M.copy γ0_1 in let* y := M.copy γ0_2 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α7 := (* Unsize *) let* α2 := M.read (mk_str "Cyan: ") in @@ -319,19 +349,22 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α9 := M.call_closure α8 [ c ] in let* α10 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α11 := M.call_closure α10 [ m ] in let* α12 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α13 := M.call_closure α12 [ y ] in let* α14 := M.alloc (Value.Array [ α9; α11; α13 ]) in M.pure (M.pointer_coercion α14) in @@ -365,8 +398,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* y := M.copy γ0_2 in let* k := M.copy γ0_3 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α8 := (* Unsize *) let* α2 := M.read (mk_str "Cyan: ") in @@ -383,25 +417,29 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α10 := M.call_closure α9 [ c ] in let* α11 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α12 := M.call_closure α11 [ m ] in let* α13 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α14 := M.call_closure α13 [ y ] in let* α15 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α16 := M.call_closure α15 [ k ] in let* α17 := M.alloc (Value.Array [ α10; α12; α14; α16 ]) in M.pure (M.pointer_coercion α17) in 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 af7c34aac..139da0fdb 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 @@ -67,8 +67,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* γ := M.read γ in let* val := M.copy γ in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Got a value via destructuring: ") in @@ -82,7 +83,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ val ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -99,8 +101,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* val := M.copy γ in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Got a value via dereferencing: ") in @@ -114,7 +117,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ val ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -140,9 +144,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* r := M.alloc γ in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Got a reference to a value: ") in @@ -156,7 +160,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] in let* α7 := M.call_closure α6 [ r ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -177,9 +182,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.assign β α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "We added 10. `mut_value`: ") in @@ -193,7 +198,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "&mut") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "&mut") [ Ty.path "i32" ] [] ] + [] in let* α7 := M.call_closure α6 [ m ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 8977a0257..d301a793a 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 @@ -55,8 +55,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* b := M.copy γ1_1 in let* y := M.copy γ0_1 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "First of x is 1, b = ") in @@ -71,13 +72,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α8 := M.call_closure α7 [ b ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α10 := M.call_closure α9 [ y ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in M.pure (M.pointer_coercion α11) in @@ -95,8 +98,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Integer Integer.U32 2) in let* i := M.copy γ0_1 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "y is 2, i = ") in @@ -110,7 +114,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.tuple [ Ty.path "u32"; Ty.path "u32" ] ] in + [ Ty.tuple [ Ty.path "u32"; Ty.path "u32" ] ] + [] in let* α7 := M.call_closure α6 [ i ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -123,8 +128,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_struct_record_field_or_break_match γ "match_destructuring_structs::Foo" "y" in let* y := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "y = ") in @@ -138,7 +144,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.call_closure α6 [ y ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 a7831b2c6..4fb0132e2 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 @@ -30,8 +30,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Tell me about ") in @@ -45,7 +45,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.tuple [ Ty.path "i32"; Ty.path "i32"; Ty.path "i32" ] ] in + [ Ty.tuple [ Ty.path "i32"; Ty.path "i32"; Ty.path "i32" ] ] + [] in let* α7 := M.call_closure α6 [ triple ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -67,8 +68,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* y := M.copy γ0_1 in let* z := M.copy γ0_2 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "First is `0`, `y` is ") in @@ -83,13 +85,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α8 := M.call_closure α7 [ y ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α10 := M.call_closure α9 [ z ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in M.pure (M.pointer_coercion α11) in @@ -105,9 +109,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.read γ0_0 in M.is_constant_or_break_match α0 (Value.Integer Integer.I32 1) in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "First is `1` and the rest doesn't matter @@ -126,9 +134,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.read γ0_2 in M.is_constant_or_break_match α0 (Value.Integer Integer.I32 2) in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "last is `2` and the rest doesn't matter @@ -150,9 +162,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.read γ0_2 in M.is_constant_or_break_match α0 (Value.Integer Integer.I32 4) in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := @@ -166,9 +182,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []); fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "It doesn't matter what they are 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 582c8d8f0..7dad78bf0 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 @@ -30,8 +30,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Tell me about ") in @@ -45,7 +45,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.tuple [ Ty.path "i32"; Ty.path "i32"; Ty.path "i32" ] ] in + [ Ty.tuple [ Ty.path "i32"; Ty.path "i32"; Ty.path "i32" ] ] + [] in let* α7 := M.call_closure α6 [ triple ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -67,8 +68,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* y := M.copy γ0_1 in let* z := M.copy γ0_2 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "First is `0`, `y` is ") in @@ -83,13 +85,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α8 := M.call_closure α7 [ y ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α10 := M.call_closure α9 [ z ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in M.pure (M.pointer_coercion α11) in @@ -105,9 +109,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.read γ0_0 in M.is_constant_or_break_match α0 (Value.Integer Integer.I32 1) in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "First is `1` and the rest doesn't matter @@ -126,9 +134,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.read γ0_2 in M.is_constant_or_break_match α0 (Value.Integer Integer.I32 2) in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "last is `2` and the rest doesn't matter @@ -150,9 +162,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.read γ0_2 in M.is_constant_or_break_match α0 (Value.Integer Integer.I32 4) in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := @@ -166,9 +182,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []); fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "It doesn't matter what they are 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 169e2382d..65978a5f0 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 @@ -55,8 +55,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -70,7 +71,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ t ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -83,8 +85,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_struct_tuple_field_or_break_match γ "match_guards::Temperature::Celsius" 0 in let* t := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -98,7 +101,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ t ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -117,8 +121,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -132,7 +137,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ t ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -145,8 +151,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_struct_tuple_field_or_break_match γ "match_guards::Temperature::Fahrenheit" 0 in let* t := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -160,7 +167,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ t ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 f0136a28e..f5f7a3cc7 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 @@ -30,9 +30,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Zero @@ -52,9 +56,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Greater than zero @@ -69,7 +77,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "core::panicking::unreachable_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.call_closure α0 [ mk_str "Should never happen." ] in let* α2 := M.never_to_any α1 in M.alloc α2 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 8dc06139f..523ab38c1 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 @@ -57,12 +57,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" - [] in + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "fizzbuzz @@ -90,12 +91,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" - [] in + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "fizz @@ -124,12 +126,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" - [] in + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "buzz @@ -144,11 +147,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -163,7 +167,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ n ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 de7a6f31a..569660c39 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 @@ -53,12 +53,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" - [] in + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Greater than 9, quit! @@ -75,9 +76,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_v1" + [] + [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "`i` is `") in @@ -91,7 +96,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ i ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 9ea5d51c8..af1953149 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 @@ -56,12 +56,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" - [] in + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Greater than 9, quit! @@ -78,9 +79,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_v1" + [] + [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "`i` is `") in @@ -94,7 +99,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ i ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 07cba1df8..476d02a94 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 @@ -126,7 +126,7 @@ Module Impl_associated_functions_and_methods_Rectangle. "y" in let* x2 := M.copy γ0_0 in let* y2 := M.copy γ0_1 in - let* α0 := M.get_associated_function (Ty.path "f64") "abs" [] in + let* α0 := M.get_associated_function (Ty.path "f64") "abs" [] [] in let* α1 := M.read x1 in let* α2 := M.read x2 in let* α3 := BinOp.Panic.sub α1 α2 in @@ -192,12 +192,12 @@ Module Impl_associated_functions_and_methods_Rectangle. let* x2 := M.copy γ0_0 in let* y2 := M.copy γ0_1 in let* α0 := M.read UnsupportedLiteral in - let* α1 := M.get_associated_function (Ty.path "f64") "abs" [] in + let* α1 := M.get_associated_function (Ty.path "f64") "abs" [] [] in let* α2 := M.read x1 in let* α3 := M.read x2 in let* α4 := BinOp.Panic.sub α2 α3 in let* α5 := M.call_closure α1 [ α4 ] in - let* α6 := M.get_associated_function (Ty.path "f64") "abs" [] in + let* α6 := M.get_associated_function (Ty.path "f64") "abs" [] [] in let* α7 := M.read y1 in let* α8 := M.read y2 in let* α9 := BinOp.Panic.sub α7 α8 in @@ -290,8 +290,8 @@ End Impl_associated_functions_and_methods_Rectangle. ty_params := []; fields := [ - Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]; - Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] []; + Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] [] ]; } *) @@ -331,9 +331,9 @@ Module Impl_associated_functions_and_methods_Pair. let* second := M.copy γ0_1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "Destroying Pair(") in @@ -352,7 +352,9 @@ Module Impl_associated_functions_and_methods_Pair. Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α8 := M.call_closure α7 [ first ] in let* α9 := M.get_associated_function @@ -362,7 +364,9 @@ Module Impl_associated_functions_and_methods_Pair. Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α10 := M.call_closure α9 [ second ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in M.pure (M.pointer_coercion α11) in @@ -420,10 +424,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* rectangle := let* α0 := - M.get_associated_function (Ty.path "associated_functions_and_methods::Point") "origin" [] in + M.get_associated_function + (Ty.path "associated_functions_and_methods::Point") + "origin" + [] + [] in let* α1 := M.call_closure α0 [] in let* α2 := - M.get_associated_function (Ty.path "associated_functions_and_methods::Point") "new" [] in + M.get_associated_function (Ty.path "associated_functions_and_methods::Point") "new" [] [] in let* α3 := M.read UnsupportedLiteral in let* α4 := M.read UnsupportedLiteral in let* α5 := M.call_closure α2 [ α3; α4 ] in @@ -433,8 +441,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ ("p1", α1); ("p2", α5) ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Rectangle perimeter: ") in @@ -448,11 +456,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "f64" ] in + [ Ty.path "f64" ] + [] in let* α7 := M.get_associated_function (Ty.path "associated_functions_and_methods::Rectangle") "perimeter" + [] [] in let* α8 := M.call_closure α7 [ rectangle ] in let* α9 := M.alloc α8 in @@ -465,8 +475,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Rectangle area: ") in @@ -480,11 +490,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "f64" ] in + [ Ty.path "f64" ] + [] in let* α7 := M.get_associated_function (Ty.path "associated_functions_and_methods::Rectangle") "area" + [] [] in let* α8 := M.call_closure α7 [ rectangle ] in let* α9 := M.alloc α8 in @@ -497,10 +509,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* square := let* α0 := - M.get_associated_function (Ty.path "associated_functions_and_methods::Point") "origin" [] in + M.get_associated_function + (Ty.path "associated_functions_and_methods::Point") + "origin" + [] + [] in let* α1 := M.call_closure α0 [] in let* α2 := - M.get_associated_function (Ty.path "associated_functions_and_methods::Point") "new" [] in + M.get_associated_function (Ty.path "associated_functions_and_methods::Point") "new" [] [] in let* α3 := M.read UnsupportedLiteral in let* α4 := M.read UnsupportedLiteral in let* α5 := M.call_closure α2 [ α3; α4 ] in @@ -513,6 +529,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "associated_functions_and_methods::Rectangle") "translate" + [] [] in let* α1 := M.read UnsupportedLiteral in let* α2 := M.read UnsupportedLiteral in @@ -521,20 +538,32 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* pair_ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::boxed::Box") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.I32 1 ] in let* α2 := M.get_associated_function - (Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::boxed::Box") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α3 := M.call_closure α2 [ Value.Integer Integer.I32 2 ] in M.alloc (Value.StructTuple "associated_functions_and_methods::Pair" [ α1; α3 ]) in let* _ := let* α0 := - M.get_associated_function (Ty.path "associated_functions_and_methods::Pair") "destroy" [] in + M.get_associated_function + (Ty.path "associated_functions_and_methods::Pair") + "destroy" + [] + [] in let* α1 := M.read pair_ in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in 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 76016b3ad..0f6d42f64 100644 --- a/CoqOfRust/examples/default/examples/rust_book/functions/diverging_functions.v +++ b/CoqOfRust/examples/default/examples/rust_book/functions/diverging_functions.v @@ -21,7 +21,10 @@ Module main. match τ, α with | [], [] => let* α0 := - M.get_function "std::panicking::begin_panic" [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + M.get_function + "std::panicking::begin_panic" + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.read (mk_str "This call never returns.") in M.call_closure α0 [ α1 ] | _, _ => M.impossible 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 41464a50c..b77db3e10 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 @@ -31,8 +31,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Sum of odd numbers up to 9 (excluding): ") in @@ -46,10 +46,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.get_function "diverging_functions_example_sum_odd_numbers::main.sum_odd_numbers" + [] [] in let* α8 := M.call_closure α7 [ Value.Integer Integer.U32 9 ] in let* α9 := M.alloc α8 in @@ -94,9 +96,11 @@ Module main. let* α0 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "u32" ] []) + [] [] "into_iter" + [] [] in let* α1 := M.read up_to in let* α2 := @@ -119,9 +123,11 @@ Module main. let* α0 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "u32" ] []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in 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 bc9d4d583..0dcf0caa0 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 @@ -19,12 +19,17 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* a := - let* α0 := M.get_function "diverging_functions_no_info_in_return_type::some_fn" [] in + let* α0 := M.get_function "diverging_functions_no_info_in_return_type::some_fn" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "This function returns and you can see this line. diff --git a/CoqOfRust/examples/default/examples/rust_book/functions/functions.v b/CoqOfRust/examples/default/examples/rust_book/functions/functions.v index 30cb08903..d2f530358 100644 --- a/CoqOfRust/examples/default/examples/rust_book/functions/functions.v +++ b/CoqOfRust/examples/default/examples/rust_book/functions/functions.v @@ -68,7 +68,7 @@ Definition fizzbuzz (τ : list Ty.t) (α : list Value.t) : M := [ fun γ => let* γ := - let* α0 := M.get_function "functions::is_divisible_by" [] in + let* α0 := M.get_function "functions::is_divisible_by" [] [] in let* α1 := M.read n in let* α2 := M.call_closure α0 [ α1; Value.Integer Integer.U32 15 ] in let* α3 := M.alloc α2 in @@ -78,9 +78,13 @@ Definition fizzbuzz (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "fizzbuzz @@ -99,7 +103,7 @@ Definition fizzbuzz (τ : list Ty.t) (α : list Value.t) : M := [ fun γ => let* γ := - let* α0 := M.get_function "functions::is_divisible_by" [] in + let* α0 := M.get_function "functions::is_divisible_by" [] [] in let* α1 := M.read n in let* α2 := M.call_closure α0 [ α1; Value.Integer Integer.U32 3 ] in let* α3 := M.alloc α2 in @@ -109,9 +113,13 @@ Definition fizzbuzz (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "fizz @@ -130,7 +138,7 @@ Definition fizzbuzz (τ : list Ty.t) (α : list Value.t) : M := [ fun γ => let* γ := - let* α0 := M.get_function "functions::is_divisible_by" [] in + let* α0 := M.get_function "functions::is_divisible_by" [] [] in let* α1 := M.read n in let* α2 := M.call_closure α0 [ α1; Value.Integer Integer.U32 5 ] in let* α3 := M.alloc α2 in @@ -140,12 +148,13 @@ Definition fizzbuzz (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" - [] in + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "buzz @@ -160,11 +169,12 @@ Definition fizzbuzz (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -179,7 +189,8 @@ Definition fizzbuzz (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.call_closure α6 [ n ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -209,15 +220,18 @@ Definition fizzbuzz_to (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "core::ops::range::RangeInclusive") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::ops::range::RangeInclusive") [ Ty.path "u32" ] []) + [] [] "into_iter" + [] [] in let* α1 := M.get_associated_function - (Ty.apply (Ty.path "core::ops::range::RangeInclusive") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::ops::range::RangeInclusive") [ Ty.path "u32" ] []) "new" - [] in + [] + [ Value.Bool true ] in let* α2 := M.read n in let* α3 := M.call_closure α1 [ Value.Integer Integer.U32 1; α2 ] in let* α4 := M.call_closure α0 [ α3 ] in @@ -233,9 +247,11 @@ Definition fizzbuzz_to (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::ops::range::RangeInclusive") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::ops::range::RangeInclusive") [ Ty.path "u32" ] []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -252,7 +268,7 @@ Definition fizzbuzz_to (τ : list Ty.t) (α : list Value.t) : M := M.get_struct_tuple_field_or_break_match γ "core::option::Option::Some" 0 in let* n := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "functions::fizzbuzz" [] in + let* α0 := M.get_function "functions::fizzbuzz" [] [] in let* α1 := M.read n in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -274,7 +290,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* _ := - let* α0 := M.get_function "functions::fizzbuzz_to" [] in + let* α0 := M.get_function "functions::fizzbuzz_to" [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.U32 100 ] in M.alloc α1 in let* α0 := M.alloc (Value.Tuple []) in 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 7f93785dc..2d0602dde 100644 --- a/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures.v +++ b/CoqOfRust/examples/default/examples/rust_book/functions/functions_closures.v @@ -72,8 +72,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := end)) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "closure_annotated: ") in @@ -87,13 +87,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.get_trait_method "core::ops::function::Fn" (Ty.function [ Ty.tuple [ Ty.path "i32" ] ] (Ty.path "i32")) [ Ty.tuple [ Ty.path "i32" ] ] + [] "call" + [] [] in let* α8 := M.call_closure @@ -109,8 +112,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "closure_inferred: ") in @@ -124,13 +127,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.get_trait_method "core::ops::function::Fn" (Ty.function [ Ty.tuple [ Ty.path "i32" ] ] (Ty.path "i32")) [ Ty.tuple [ Ty.path "i32" ] ] + [] "call" + [] [] in let* α8 := M.call_closure α7 [ closure_inferred; Value.Tuple [ Value.Integer Integer.I32 1 ] ] in @@ -154,8 +160,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := end)) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "closure returning one: ") in @@ -169,13 +175,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.get_trait_method "core::ops::function::Fn" (Ty.function [ Ty.tuple [] ] (Ty.path "i32")) [ Ty.tuple [] ] + [] "call" + [] [] in let* α8 := M.call_closure α7 [ one; Value.Tuple [] ] in let* α9 := M.alloc α8 in 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 cf24defa6..4630adedd 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 @@ -18,7 +18,7 @@ Definition apply (τ : list Ty.t) (α : list Value.t) : M := let* f := M.alloc f in let* _ := let* α0 := - M.get_trait_method "core::ops::function::FnOnce" F [ Ty.tuple [] ] "call_once" [] in + M.get_trait_method "core::ops::function::FnOnce" F [ Ty.tuple [] ] [] "call_once" [] [] in let* α1 := M.read f in let* α2 := M.call_closure α0 [ α1; Value.Tuple [] ] in M.alloc α2 in @@ -41,7 +41,14 @@ Definition apply_to_3 (τ : list Ty.t) (α : list Value.t) : M := | [ F ], [ f ] => let* f := M.alloc f in let* α0 := - M.get_trait_method "core::ops::function::Fn" F [ Ty.tuple [ Ty.path "i32" ] ] "call" [] in + M.get_trait_method + "core::ops::function::Fn" + F + [ Ty.tuple [ Ty.path "i32" ] ] + [] + "call" + [] + [] in M.call_closure α0 [ f; Value.Tuple [ Value.Integer Integer.I32 3 ] ] | _, _ => M.impossible end. @@ -86,7 +93,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* greeting := M.copy (mk_str "hello") in let* farewell := - let* α0 := M.get_trait_method "alloc::borrow::ToOwned" (Ty.path "str") [] "to_owned" [] in + let* α0 := + M.get_trait_method "alloc::borrow::ToOwned" (Ty.path "str") [] [] "to_owned" [] [] in let* α1 := M.read (mk_str "goodbye") in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -103,9 +111,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_v1" + [] + [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "I said ") in @@ -119,7 +131,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ greeting ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -129,15 +142,23 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* α0 := - M.get_associated_function (Ty.path "alloc::string::String") "push_str" [] in + M.get_associated_function + (Ty.path "alloc::string::String") + "push_str" + [] + [] in let* α1 := M.read (mk_str "!!!") in let* α2 := M.call_closure α0 [ farewell; α1 ] in M.alloc α2 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_v1" + [] + [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Then I screamed ") in @@ -151,7 +172,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α7 := M.call_closure α6 [ farewell ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -161,12 +183,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" - [] in + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Now I can sleep. zzzzz @@ -179,7 +202,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* α0 := - M.get_function "core::mem::drop" [ Ty.path "alloc::string::String" ] in + M.get_function "core::mem::drop" [ Ty.path "alloc::string::String" ] [] in let* α1 := M.read farewell in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -192,7 +215,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "functions_closures_as_input_parameters::apply" - [ Ty.function [ Ty.tuple [] ] (Ty.tuple []) ] in + [ Ty.function [ Ty.tuple [] ] (Ty.tuple []) ] + [] in let* α1 := M.read diary in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -215,8 +239,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := end)) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "3 doubled: ") in @@ -230,11 +254,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.get_function "functions_closures_as_input_parameters::apply_to_3" - [ Ty.function [ Ty.tuple [ Ty.path "i32" ] ] (Ty.path "i32") ] in + [ Ty.function [ Ty.tuple [ Ty.path "i32" ] ] (Ty.path "i32") ] + [] in let* α8 := M.read double in let* α9 := M.call_closure α7 [ α8 ] in let* α10 := M.alloc α9 in 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 68a935429..3a0a6c937 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 @@ -12,7 +12,8 @@ Definition create_fn (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* text := - let* α0 := M.get_trait_method "alloc::borrow::ToOwned" (Ty.path "str") [] "to_owned" [] in + let* α0 := + M.get_trait_method "alloc::borrow::ToOwned" (Ty.path "str") [] [] "to_owned" [] [] in let* α1 := M.read (mk_str "Fn") in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -28,9 +29,9 @@ Definition create_fn (τ : list Ty.t) (α : list Value.t) : M := [ fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "This is a: ") in @@ -44,7 +45,8 @@ Definition create_fn (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α7 := M.call_closure α6 [ text ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -75,7 +77,8 @@ Definition create_fnmut (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* text := - let* α0 := M.get_trait_method "alloc::borrow::ToOwned" (Ty.path "str") [] "to_owned" [] in + let* α0 := + M.get_trait_method "alloc::borrow::ToOwned" (Ty.path "str") [] [] "to_owned" [] [] in let* α1 := M.read (mk_str "FnMut") in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -91,9 +94,9 @@ Definition create_fnmut (τ : list Ty.t) (α : list Value.t) : M := [ fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "This is a: ") in @@ -107,7 +110,8 @@ Definition create_fnmut (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α7 := M.call_closure α6 [ text ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -138,7 +142,8 @@ Definition create_fnonce (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* text := - let* α0 := M.get_trait_method "alloc::borrow::ToOwned" (Ty.path "str") [] "to_owned" [] in + let* α0 := + M.get_trait_method "alloc::borrow::ToOwned" (Ty.path "str") [] [] "to_owned" [] [] in let* α1 := M.read (mk_str "FnOnce") in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -154,9 +159,9 @@ Definition create_fnonce (τ : list Ty.t) (α : list Value.t) : M := [ fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "This is a: ") in @@ -170,7 +175,8 @@ Definition create_fnonce (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α7 := M.call_closure α6 [ text ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -205,20 +211,27 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* fn_plain := - let* α0 := M.get_function "functions_closures_as_output_parameters::create_fn" [] in + let* α0 := M.get_function "functions_closures_as_output_parameters::create_fn" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* fn_mut := - let* α0 := M.get_function "functions_closures_as_output_parameters::create_fnmut" [] in + let* α0 := M.get_function "functions_closures_as_output_parameters::create_fnmut" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* fn_once := - let* α0 := M.get_function "functions_closures_as_output_parameters::create_fnonce" [] in + let* α0 := M.get_function "functions_closures_as_output_parameters::create_fnonce" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := let* α0 := - M.get_trait_method "core::ops::function::Fn" Ty.associated [ Ty.tuple [] ] "call" [] in + M.get_trait_method + "core::ops::function::Fn" + Ty.associated + [ Ty.tuple [] ] + [] + "call" + [] + [] in let* α1 := M.call_closure α0 [ fn_plain; Value.Tuple [] ] in M.alloc α1 in let* _ := @@ -227,7 +240,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::ops::function::FnMut" Ty.associated [ Ty.tuple [] ] + [] "call_mut" + [] [] in let* α1 := M.call_closure α0 [ fn_mut; Value.Tuple [] ] in M.alloc α1 in @@ -237,7 +252,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::ops::function::FnOnce" Ty.associated [ Ty.tuple [] ] + [] "call_once" + [] [] in let* α1 := M.read fn_once in let* α2 := M.call_closure α0 [ α1; Value.Tuple [] ] in 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 d9287ca36..88be10305 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 @@ -77,8 +77,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_trait_method "core::convert::From" (Ty.path "alloc::string::String") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] "from" + [] [] in let* α1 := M.read (mk_str "green") in let* α2 := M.call_closure α0 [ α1 ] in @@ -95,9 +97,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "`color`: ") in @@ -111,7 +113,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α7 := M.call_closure α6 [ color ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -129,7 +132,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::ops::function::Fn" (Ty.function [ Ty.tuple [] ] (Ty.tuple [])) [ Ty.tuple [] ] + [] "call" + [] [] in let* α1 := M.call_closure α0 [ print; Value.Tuple [] ] in M.alloc α1 in @@ -140,7 +145,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::ops::function::Fn" (Ty.function [ Ty.tuple [] ] (Ty.tuple [])) [ Ty.tuple [] ] + [] "call" + [] [] in let* α1 := M.call_closure α0 [ print; Value.Tuple [] ] in M.alloc α1 in @@ -164,9 +171,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.assign β α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_v1" + [] + [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "`count`: ") in @@ -180,7 +191,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ count ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -199,7 +211,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::ops::function::FnMut" (Ty.function [ Ty.tuple [] ] (Ty.tuple [])) [ Ty.tuple [] ] + [] "call_mut" + [] [] in let* α1 := M.call_closure α0 [ inc; Value.Tuple [] ] in M.alloc α1 in @@ -209,7 +223,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::ops::function::FnMut" (Ty.function [ Ty.tuple [] ] (Ty.tuple [])) [ Ty.tuple [] ] + [] "call_mut" + [] [] in let* α1 := M.call_closure α0 [ inc; Value.Tuple [] ] in M.alloc α1 in @@ -217,8 +233,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* movable := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::boxed::Box") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.I32 3 ] in M.alloc α1 in @@ -235,9 +255,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_v1" + [] + [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "`movable`: ") in @@ -255,7 +279,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ movable ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -271,7 +297,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α1 := M.read movable in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -286,7 +314,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::ops::function::FnOnce" (Ty.function [ Ty.tuple [] ] (Ty.tuple [])) [ Ty.tuple [] ] + [] "call_once" + [] [] in let* α1 := M.read consume in let* α2 := M.call_closure α0 [ α1; Value.Tuple [] ] in 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 541684a10..ee31bb06a 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 @@ -34,17 +34,23 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* vec1 := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α5 := (* Unsize *) let* α1 := M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.apply (Ty.path "array") [ Ty.path "i32" ]; Ty.path "alloc::alloc::Global" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "i32" ] [ Value.Integer Integer.Usize 3 ]; + Ty.path "alloc::alloc::Global" + ] + []) "new" + [] [] in let* α2 := M.alloc @@ -62,17 +68,23 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* vec2 := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α5 := (* Unsize *) let* α1 := M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.apply (Ty.path "array") [ Ty.path "i32" ]; Ty.path "alloc::alloc::Global" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "i32" ] [ Value.Integer Integer.Usize 3 ]; + Ty.path "alloc::alloc::Global" + ] + []) "new" + [] [] in let* α2 := M.alloc @@ -89,8 +101,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α6 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "2 in vec1: ") in @@ -104,28 +116,38 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "bool" ] in + [ Ty.path "bool" ] + [] in let* α7 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ] []) + [] [] "any" [ Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] ] (Ty.path "bool") - ] in + ] + [] in let* α8 := - M.get_associated_function (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) "iter" [] in + M.get_associated_function + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) + "iter" + [] + [] in let* α9 := M.get_trait_method "core::ops::deref::Deref" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref" + [] [] in let* α10 := M.call_closure α9 [ vec1 ] in let* α11 := M.call_closure α8 [ α10 ] in @@ -162,8 +184,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "2 in vec2: ") in @@ -177,24 +199,31 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "bool" ] in + [ Ty.path "bool" ] + [] in let* α7 := M.get_trait_method "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "any" - [ Ty.function [ Ty.tuple [ Ty.path "i32" ] ] (Ty.path "bool") ] in + [ Ty.function [ Ty.tuple [ Ty.path "i32" ] ] (Ty.path "bool") ] + [] in let* α8 := M.get_trait_method "core::iter::traits::collect::IntoIterator" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "into_iter" + [] [] in let* α9 := M.read vec2 in let* α10 := M.call_closure α8 [ α9 ] in @@ -230,8 +259,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "vec1 len: ") in @@ -245,13 +274,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α7 := M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) "len" + [] [] in let* α8 := M.call_closure α7 [ vec1 ] in let* α9 := M.alloc α8 in @@ -264,8 +296,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "First element of vec1 is: ") in @@ -279,15 +311,19 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.get_trait_method "core::ops::index::Index" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) [ Ty.path "usize" ] + [] "index" + [] [] in let* α8 := M.call_closure α7 [ vec1; Value.Integer Integer.Usize 0 ] in let* α9 := M.call_closure α6 [ α8 ] in @@ -309,8 +345,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "2 in array1: ") in @@ -324,20 +360,27 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "bool" ] in + [ Ty.path "bool" ] + [] in let* α7 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ] []) + [] [] "any" [ Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] ] (Ty.path "bool") - ] in + ] + [] in let* α8 := - M.get_associated_function (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) "iter" [] in + M.get_associated_function + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) + "iter" + [] + [] in let* α9 := (* Unsize *) M.pure (M.pointer_coercion array1) in let* α10 := M.call_closure α8 [ α9 ] in let* α11 := M.alloc α10 in @@ -373,8 +416,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "2 in array2: ") in @@ -388,24 +431,32 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "bool" ] in + [ Ty.path "bool" ] + [] in let* α7 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ] []) + [] [] "any" [ Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] ] (Ty.path "bool") - ] in + ] + [] in let* α8 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "array") [ Ty.path "i32" ] ]) + (Ty.apply + (Ty.path "&") + [ Ty.apply (Ty.path "array") [ Ty.path "i32" ] [ Value.Integer Integer.Usize 3 ] ] + []) + [] [] "into_iter" + [] [] in let* α9 := M.call_closure α8 [ array2 ] in let* α10 := M.alloc α9 in 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 4c1bb642a..bf535a0d2 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 @@ -36,17 +36,23 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* vec1 := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α5 := (* Unsize *) let* α1 := M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.apply (Ty.path "array") [ Ty.path "i32" ]; Ty.path "alloc::alloc::Global" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "i32" ] [ Value.Integer Integer.Usize 3 ]; + Ty.path "alloc::alloc::Global" + ] + []) "new" + [] [] in let* α2 := M.alloc @@ -64,17 +70,23 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* vec2 := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α5 := (* Unsize *) let* α1 := M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.apply (Ty.path "array") [ Ty.path "i32" ]; Ty.path "alloc::alloc::Global" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "i32" ] [ Value.Integer Integer.Usize 3 ]; + Ty.path "alloc::alloc::Global" + ] + []) "new" + [] [] in let* α2 := M.alloc @@ -91,13 +103,18 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α6 in let* iter := let* α0 := - M.get_associated_function (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) "iter" [] in + M.get_associated_function (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) "iter" [] [] in let* α1 := M.get_trait_method "core::ops::deref::Deref" - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref" + [] [] in let* α2 := M.call_closure α1 [ vec1 ] in let* α3 := M.call_closure α0 [ α2 ] in @@ -106,17 +123,22 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "into_iter" + [] [] in let* α1 := M.read vec2 in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Find 2 in vec1: ") in @@ -133,22 +155,27 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "core::option::Option") - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] - ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] + ] + [] in let* α7 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ] []) + [] [] "find" [ Ty.function [ Ty.tuple - [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] ] + [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] [] + ] ] (Ty.path "bool") - ] in + ] + [] in let* α8 := M.call_closure α7 @@ -182,8 +209,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Find 2 in vec2: ") in @@ -197,20 +224,24 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] [] ] + [] in let* α7 := M.get_trait_method "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "find" [ Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] ] (Ty.path "bool") - ] in + ] + [] in let* α8 := M.call_closure α7 @@ -253,8 +284,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Find 2 in array1: ") in @@ -271,24 +302,33 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "core::option::Option") - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] - ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] + ] + [] in let* α7 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ] []) + [] [] "find" [ Ty.function [ Ty.tuple - [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] ] + [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] [] + ] ] (Ty.path "bool") - ] in + ] + [] in let* α8 := - M.get_associated_function (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) "iter" [] in + M.get_associated_function + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) + "iter" + [] + [] in let* α9 := (* Unsize *) M.pure (M.pointer_coercion array1) in let* α10 := M.call_closure α8 [ α9 ] in let* α11 := M.alloc α10 in @@ -325,8 +365,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Find 2 in array2: ") in @@ -343,28 +383,38 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "core::option::Option") - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] - ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] + ] + [] in let* α7 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ] []) + [] [] "find" [ Ty.function [ Ty.tuple - [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] ] + [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] [] + ] ] (Ty.path "bool") - ] in + ] + [] in let* α8 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "array") [ Ty.path "i32" ] ]) + (Ty.apply + (Ty.path "&") + [ Ty.apply (Ty.path "array") [ Ty.path "i32" ] [ Value.Integer Integer.Usize 3 ] ] + []) + [] [] "into_iter" + [] [] in let* α9 := M.call_closure α8 [ array2 ] in let* α10 := M.alloc α9 in 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 f25c3bc2f..95e3f7534 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 @@ -22,17 +22,23 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* vec := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α5 := (* Unsize *) let* α1 := M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.apply (Ty.path "array") [ Ty.path "i32" ]; Ty.path "alloc::alloc::Global" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "i32" ] [ Value.Integer Integer.Usize 6 ]; + Ty.path "alloc::alloc::Global" + ] + []) "new" + [] [] in let* α2 := M.alloc @@ -54,19 +60,29 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ] []) + [] [] "position" - [ Ty.function [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] ] (Ty.path "bool") - ] in + [ + Ty.function + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] ] + (Ty.path "bool") + ] + [] in let* α1 := - M.get_associated_function (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) "iter" [] in + M.get_associated_function (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) "iter" [] [] in let* α2 := M.get_trait_method "core::ops::deref::Deref" - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref" + [] [] in let* α3 := M.call_closure α2 [ vec ] in let* α4 := M.call_closure α1 [ α3 ] in @@ -117,9 +133,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "usize" ]) - [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "usize" ] ] + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "usize" ] []) + [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "usize" ] [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read left_val in let* α2 := M.read right_val in @@ -134,9 +152,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_function "core::panicking::assert_failed" [ - Ty.apply (Ty.path "core::option::Option") [ Ty.path "usize" ]; - Ty.apply (Ty.path "core::option::Option") [ Ty.path "usize" ] - ] in + Ty.apply (Ty.path "core::option::Option") [ Ty.path "usize" ] []; + Ty.apply (Ty.path "core::option::Option") [ Ty.path "usize" ] [] + ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in @@ -157,16 +176,24 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "position" - [ Ty.function [ Ty.tuple [ Ty.path "i32" ] ] (Ty.path "bool") ] in + [ Ty.function [ Ty.tuple [ Ty.path "i32" ] ] (Ty.path "bool") ] + [] in let* α1 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "into_iter" + [] [] in let* α2 := M.read vec in let* α3 := M.call_closure α1 [ α2 ] in @@ -213,9 +240,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "usize" ]) - [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "usize" ] ] + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "usize" ] []) + [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "usize" ] [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read left_val in let* α2 := M.read right_val in @@ -230,9 +259,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_function "core::panicking::assert_failed" [ - Ty.apply (Ty.path "core::option::Option") [ Ty.path "usize" ]; - Ty.apply (Ty.path "core::option::Option") [ Ty.path "usize" ] - ] in + Ty.apply (Ty.path "core::option::Option") [ Ty.path "usize" ] []; + Ty.apply (Ty.path "core::option::Option") [ Ty.path "usize" ] [] + ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in 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 967716443..d664b9b97 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 @@ -27,17 +27,23 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* haystack := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α5 := (* Unsize *) let* α1 := M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.apply (Ty.path "array") [ Ty.path "i32" ]; Ty.path "alloc::alloc::Global" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "i32" ] [ Value.Integer Integer.Usize 3 ]; + Ty.path "alloc::alloc::Global" + ] + []) "new" + [] [] in let* α2 := M.alloc @@ -66,17 +72,21 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* needle := M.copy γ in let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) "contains" + [] [] in let* α1 := M.get_trait_method "core::ops::deref::Deref" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref" + [] [] in let* α2 := M.call_closure α1 [ haystack ] in let* α3 := M.read needle in @@ -86,8 +96,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := end)) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -101,15 +111,18 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "bool" ] in + [ Ty.path "bool" ] + [] in let* α7 := M.get_trait_method "core::ops::function::Fn" (Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] ] (Ty.path "bool")) - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] ] + [] "call" + [] [] in let* α8 := M.alloc (Value.Integer Integer.I32 1) in let* α9 := M.call_closure α7 [ contains; Value.Tuple [ α8 ] ] in @@ -123,8 +136,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -138,15 +151,18 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "bool" ] in + [ Ty.path "bool" ] + [] in let* α7 := M.get_trait_method "core::ops::function::Fn" (Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] ] (Ty.path "bool")) - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] ] + [] "call" + [] [] in let* α8 := M.alloc (Value.Integer Integer.I32 4) in let* α9 := M.call_closure α7 [ contains; Value.Tuple [ α8 ] ] in 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 3c1394efe..46b03c4bb 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 @@ -11,7 +11,7 @@ Definition call_me (τ : list Ty.t) (α : list Value.t) : M := | [ F ], [ f ] => let* f := M.alloc f in let* _ := - let* α0 := M.get_trait_method "core::ops::function::Fn" F [ Ty.tuple [] ] "call" [] in + let* α0 := M.get_trait_method "core::ops::function::Fn" F [ Ty.tuple [] ] [] "call" [] [] in let* α1 := M.call_closure α0 [ f; Value.Tuple [] ] in M.alloc α1 in let* α0 := M.alloc (Value.Tuple []) in @@ -29,8 +29,13 @@ Definition function (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "I'm a function! @@ -70,9 +75,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "I'm a closure! @@ -91,7 +100,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "functions_closures_input_functions::call_me" - [ Ty.function [ Ty.tuple [] ] (Ty.tuple []) ] in + [ Ty.function [ Ty.tuple [] ] (Ty.tuple []) ] + [] in let* α1 := M.read closure in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -99,8 +109,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "functions_closures_input_functions::call_me" - [ Ty.function [] (Ty.tuple []) ] in - let* α1 := M.get_function "functions_closures_input_functions::function" [] in + [ Ty.function [] (Ty.tuple []) ] + [] in + let* α1 := M.get_function "functions_closures_input_functions::function" [] [] in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* α0 := M.alloc (Value.Tuple []) in 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 23d2443df..38c0d307d 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 @@ -30,7 +30,7 @@ Module main. let* f := M.alloc f in let* _ := let* α0 := - M.get_trait_method "core::ops::function::FnOnce" F [ Ty.tuple [] ] "call_once" [] in + M.get_trait_method "core::ops::function::FnOnce" F [ Ty.tuple [] ] [] "call_once" [] [] in let* α1 := M.read f in let* α2 := M.call_closure α0 [ α1; Value.Tuple [] ] in M.alloc α2 in 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 b016f3d95..e0a993446 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 @@ -14,7 +14,7 @@ Definition apply (τ : list Ty.t) (α : list Value.t) : M := | [ F ], [ f ] => let* f := M.alloc f in let* _ := - let* α0 := M.get_trait_method "core::ops::function::Fn" F [ Ty.tuple [] ] "call" [] in + let* α0 := M.get_trait_method "core::ops::function::Fn" F [ Ty.tuple [] ] [] "call" [] [] in let* α1 := M.call_closure α0 [ f; Value.Tuple [] ] in M.alloc α1 in let* α0 := M.alloc (Value.Tuple []) in @@ -49,9 +49,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -65,7 +65,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ x ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -81,7 +82,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "functions_closures_type_anonymity_define_and_use::apply" - [ Ty.function [ Ty.tuple [] ] (Ty.tuple []) ] in + [ Ty.function [ Ty.tuple [] ] (Ty.tuple []) ] + [] in let* α1 := M.read print in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in 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 613e22937..bf61216e0 100644 --- a/CoqOfRust/examples/default/examples/rust_book/functions/functions_order.v +++ b/CoqOfRust/examples/default/examples/rust_book/functions/functions_order.v @@ -28,7 +28,7 @@ Module Impl_functions_order_SomeType. | [], [ self ] => let* self := M.alloc self in let* _ := - let* α0 := M.get_associated_function (Ty.path "functions_order::SomeType") "meth2" [] in + let* α0 := M.get_associated_function (Ty.path "functions_order::SomeType") "meth2" [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -70,7 +70,9 @@ Definition depends_on_trait_impl (τ : list Ty.t) (α : list Value.t) : M := "functions_order::SomeTrait" (Ty.path "functions_order::OtherType") [] + [] "some_trait_foo" + [] [] in let* α1 := M.read b in let* α2 := M.alloc (Value.StructTuple "functions_order::OtherType" [ α1 ]) in @@ -82,7 +84,9 @@ Definition depends_on_trait_impl (τ : list Ty.t) (α : list Value.t) : M := "functions_order::SomeTrait" (Ty.path "functions_order::SomeType") [] + [] "some_trait_foo" + [] [] in let* α1 := M.read u in let* α2 := M.alloc (Value.StructTuple "functions_order::SomeType" [ α1 ]) in @@ -113,7 +117,9 @@ Module Impl_functions_order_SomeTrait_for_functions_order_SomeType. "functions_order::SomeTrait" (Ty.path "functions_order::SomeType") [] + [] "some_trait_bar" + [] [] in let* α1 := M.read self in M.call_closure α0 [ α1 ] @@ -191,7 +197,7 @@ Module inner_mod. match τ, α with | [], [] => let* _ := - let* α0 := M.get_function "functions_order::inner_mod::tar" [] in + let* α0 := M.get_function "functions_order::inner_mod::tar" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* α0 := M.alloc (Value.Tuple []) in @@ -215,7 +221,7 @@ Module inner_mod. match τ, α with | [], [] => let* _ := - let* α0 := M.get_function "functions_order::inner_mod::nested_mod::tack" [] in + let* α0 := M.get_function "functions_order::inner_mod::nested_mod::tack" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* α0 := M.alloc (Value.Tuple []) in @@ -243,15 +249,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* _ := - let* α0 := M.get_function "functions_order::foo" [] in + let* α0 := M.get_function "functions_order::foo" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := - let* α0 := M.get_function "functions_order::inner_mod::bar" [] in + let* α0 := M.get_function "functions_order::inner_mod::bar" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := - let* α0 := M.get_associated_function (Ty.path "functions_order::SomeType") "meth1" [] in + let* α0 := M.get_associated_function (Ty.path "functions_order::SomeType") "meth1" [] [] in let* α1 := M.call_closure α0 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 8de496b19..44c14fc61 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 @@ -53,8 +53,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Find the sum of all the squared odd numbers under 1000 @@ -71,9 +76,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "core::ops::range::RangeFrom") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::ops::range::RangeFrom") [ Ty.path "u32" ] []) + [] [] "into_iter" + [] [] in let* α1 := M.call_closure @@ -95,9 +102,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::ops::range::RangeFrom") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::ops::range::RangeFrom") [ Ty.path "u32" ] []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -146,7 +155,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* γ := let* α0 := - M.get_function "higher_order_functions::is_odd" [] in + M.get_function "higher_order_functions::is_odd" [] [] in let* α1 := M.read n_squared in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.alloc α2 in @@ -170,8 +179,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.pure (M.use α3) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "imperative style: ") in @@ -185,7 +194,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.call_closure α6 [ acc ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -206,18 +216,25 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "core::iter::adapters::map::Map") [ - Ty.apply (Ty.path "core::ops::range::RangeFrom") [ Ty.path "u32" ]; + Ty.apply (Ty.path "core::ops::range::RangeFrom") [ Ty.path "u32" ] []; Ty.function [ Ty.tuple [ Ty.path "u32" ] ] (Ty.path "u32") - ]; + ] + []; Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "u32" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "u32" ] [] ] ] (Ty.path "bool") - ]; - Ty.function [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "u32" ] ] ] (Ty.path "bool") - ]) + ] + []; + Ty.function + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "u32" ] [] ] ] + (Ty.path "bool") + ] + []) + [] [] "sum" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α1 := M.get_trait_method "core::iter::traits::iterator::Iterator" @@ -227,35 +244,52 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "core::iter::adapters::map::Map") [ - Ty.apply (Ty.path "core::ops::range::RangeFrom") [ Ty.path "u32" ]; + Ty.apply (Ty.path "core::ops::range::RangeFrom") [ Ty.path "u32" ] []; Ty.function [ Ty.tuple [ Ty.path "u32" ] ] (Ty.path "u32") - ]; - Ty.function [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "u32" ] ] ] (Ty.path "bool") - ]) + ] + []; + Ty.function + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "u32" ] [] ] ] + (Ty.path "bool") + ] + []) + [] [] "filter" - [ Ty.function [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "u32" ] ] ] (Ty.path "bool") - ] in + [ + Ty.function + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "u32" ] [] ] ] + (Ty.path "bool") + ] + [] in let* α2 := M.get_trait_method "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "core::iter::adapters::map::Map") [ - Ty.apply (Ty.path "core::ops::range::RangeFrom") [ Ty.path "u32" ]; + Ty.apply (Ty.path "core::ops::range::RangeFrom") [ Ty.path "u32" ] []; Ty.function [ Ty.tuple [ Ty.path "u32" ] ] (Ty.path "u32") - ]) + ] + []) + [] [] "take_while" - [ Ty.function [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "u32" ] ] ] (Ty.path "bool") - ] in + [ + Ty.function + [ Ty.tuple [ Ty.apply (Ty.path "&") [ Ty.path "u32" ] [] ] ] + (Ty.path "bool") + ] + [] in let* α3 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::ops::range::RangeFrom") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::ops::range::RangeFrom") [ Ty.path "u32" ] []) + [] [] "map" - [ Ty.path "u32"; Ty.function [ Ty.tuple [ Ty.path "u32" ] ] (Ty.path "u32") ] in + [ Ty.path "u32"; Ty.function [ Ty.tuple [ Ty.path "u32" ] ] (Ty.path "u32") ] + [] in let* α4 := M.call_closure α3 @@ -319,7 +353,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* γ := M.read γ in let* n_squared := M.copy γ in - let* α0 := M.get_function "higher_order_functions::is_odd" [] in + let* α0 := M.get_function "higher_order_functions::is_odd" [] [] in let* α1 := M.read n_squared in M.call_closure α0 [ α1 ] ] @@ -330,8 +364,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α7 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "functional style: ") in @@ -345,7 +379,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.call_closure α6 [ sum_of_squared_odd_numbers ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 1bfa43e8e..9f4ee6094 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 @@ -28,9 +28,11 @@ Module Impl_generics_associated_types_problem_Contains_i32_i32_for_generics_asso let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "&") [ Ty.path "i32" ]) - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] + (Ty.apply (Ty.path "&") [ Ty.path "i32" ] []) + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read self in let* α2 := @@ -41,9 +43,11 @@ Module Impl_generics_associated_types_problem_Contains_i32_i32_for_generics_asso (let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "&") [ Ty.path "i32" ]) - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] + (Ty.apply (Ty.path "&") [ Ty.path "i32" ] []) + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read self in let* α2 := @@ -106,11 +110,18 @@ Definition difference (τ : list Ty.t) (α : list Value.t) : M := | [ A; B; C ], [ container ] => let* container := M.alloc container in let* α0 := - M.get_trait_method "generics_associated_types_problem::Contains" C [ A; B ] "last" [] in + M.get_trait_method "generics_associated_types_problem::Contains" C [ A; B ] [] "last" [] [] in let* α1 := M.read container in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := - M.get_trait_method "generics_associated_types_problem::Contains" C [ A; B ] "first" [] in + M.get_trait_method + "generics_associated_types_problem::Contains" + C + [ A; B ] + [] + "first" + [] + [] in let* α4 := M.read container in let* α5 := M.call_closure α3 [ α4 ] in BinOp.Panic.sub α2 α5 @@ -147,8 +158,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.StructTuple "generics_associated_types_problem::Container" [ α0; α1 ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α7 := (* Unsize *) let* α2 := M.read (mk_str "Does container contain ") in @@ -164,27 +175,32 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] in let* α9 := M.alloc number_1 in let* α10 := M.call_closure α8 [ α9 ] in let* α11 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] in let* α12 := M.alloc number_2 in let* α13 := M.call_closure α11 [ α12 ] in let* α14 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "bool" ] in + [ Ty.path "bool" ] + [] in let* α15 := M.get_trait_method "generics_associated_types_problem::Contains" (Ty.path "generics_associated_types_problem::Container") [ Ty.path "i32"; Ty.path "i32" ] + [] "contains" + [] [] in let* α16 := M.call_closure α15 [ container; number_1; number_2 ] in let* α17 := M.alloc α16 in @@ -197,8 +213,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "First number: ") in @@ -212,13 +228,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.get_trait_method "generics_associated_types_problem::Contains" (Ty.path "generics_associated_types_problem::Container") [ Ty.path "i32"; Ty.path "i32" ] + [] "first" + [] [] in let* α8 := M.call_closure α7 [ container ] in let* α9 := M.alloc α8 in @@ -231,8 +250,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Last number: ") in @@ -246,13 +265,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.get_trait_method "generics_associated_types_problem::Contains" (Ty.path "generics_associated_types_problem::Container") [ Ty.path "i32"; Ty.path "i32" ] + [] "last" + [] [] in let* α8 := M.call_closure α7 [ container ] in let* α9 := M.alloc α8 in @@ -265,8 +287,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The difference is: ") in @@ -280,7 +302,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.get_function "generics_associated_types_problem::difference" @@ -288,7 +311,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.path "i32"; Ty.path "i32"; Ty.path "generics_associated_types_problem::Container" - ] in + ] + [] in let* α8 := M.call_closure α7 [ container ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in 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 8ca9af801..46d899001 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 @@ -38,9 +38,11 @@ Module Impl_generics_associated_types_solution_Contains_for_generics_associated_ let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "&") [ Ty.path "i32" ]) - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] + (Ty.apply (Ty.path "&") [ Ty.path "i32" ] []) + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read self in let* α2 := @@ -51,9 +53,11 @@ Module Impl_generics_associated_types_solution_Contains_for_generics_associated_ (let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "&") [ Ty.path "i32" ]) - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] + (Ty.apply (Ty.path "&") [ Ty.path "i32" ] []) + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read self in let* α2 := @@ -129,10 +133,12 @@ Definition difference (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [ C ], [ container ] => let* container := M.alloc container in - let* α0 := M.get_trait_method "generics_associated_types_solution::Contains" C [] "last" [] in + let* α0 := + M.get_trait_method "generics_associated_types_solution::Contains" C [] [] "last" [] [] in let* α1 := M.read container in let* α2 := M.call_closure α0 [ α1 ] in - let* α3 := M.get_trait_method "generics_associated_types_solution::Contains" C [] "first" [] in + let* α3 := + M.get_trait_method "generics_associated_types_solution::Contains" C [] [] "first" [] [] in let* α4 := M.read container in let* α5 := M.call_closure α3 [ α4 ] in BinOp.Panic.sub α2 α5 @@ -148,7 +154,8 @@ Definition get_a (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [ C ], [ container ] => let* container := M.alloc container in - let* α0 := M.get_trait_method "generics_associated_types_solution::Contains" C [] "a" [] in + let* α0 := + M.get_trait_method "generics_associated_types_solution::Contains" C [] [] "a" [] [] in let* α1 := M.read container in M.call_closure α0 [ α1 ] | _, _ => M.impossible @@ -184,8 +191,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.StructTuple "generics_associated_types_solution::Container" [ α0; α1 ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α7 := (* Unsize *) let* α2 := M.read (mk_str "Does container contain ") in @@ -201,27 +208,32 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] in let* α9 := M.alloc number_1 in let* α10 := M.call_closure α8 [ α9 ] in let* α11 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] in let* α12 := M.alloc number_2 in let* α13 := M.call_closure α11 [ α12 ] in let* α14 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "bool" ] in + [ Ty.path "bool" ] + [] in let* α15 := M.get_trait_method "generics_associated_types_solution::Contains" (Ty.path "generics_associated_types_solution::Container") [] + [] "contains" + [] [] in let* α16 := M.call_closure α15 [ container; number_1; number_2 ] in let* α17 := M.alloc α16 in @@ -234,8 +246,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "First number: ") in @@ -249,13 +261,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.get_trait_method "generics_associated_types_solution::Contains" (Ty.path "generics_associated_types_solution::Container") [] + [] "first" + [] [] in let* α8 := M.call_closure α7 [ container ] in let* α9 := M.alloc α8 in @@ -268,8 +283,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Last number: ") in @@ -283,13 +298,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.get_trait_method "generics_associated_types_solution::Contains" (Ty.path "generics_associated_types_solution::Container") [] + [] "last" + [] [] in let* α8 := M.call_closure α7 [ container ] in let* α9 := M.alloc α8 in @@ -302,8 +320,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The difference is: ") in @@ -317,11 +335,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.get_function "generics_associated_types_solution::difference" - [ Ty.path "generics_associated_types_solution::Container" ] in + [ Ty.path "generics_associated_types_solution::Container" ] + [] in let* α8 := M.call_closure α7 [ container ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in 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 b2ec59f0b..8dcfe56d4 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_bounds.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_bounds.v @@ -26,6 +26,7 @@ Module Impl_core_fmt_Debug_for_generics_bounds_Rectangle. M.get_associated_function (Ty.path "core::fmt::Formatter") "debug_struct_field2_finish" + [] [] in let* α1 := M.read f in let* α2 := M.read (mk_str "Rectangle") in @@ -100,8 +101,8 @@ Definition print_debug (τ : list Ty.t) (α : list Value.t) : M := let* t := M.alloc t in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -115,7 +116,8 @@ Definition print_debug (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "&") [ T ] ] in + [ Ty.apply (Ty.path "&") [ T ] [] ] + [] in let* α7 := M.call_closure α6 [ t ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -137,7 +139,7 @@ Definition area (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [ T ], [ t ] => let* t := M.alloc t in - let* α0 := M.get_trait_method "generics_bounds::HasArea" T [] "area" [] in + let* α0 := M.get_trait_method "generics_bounds::HasArea" T [] [] "area" [] [] in let* α1 := M.read t in M.call_closure α0 [ α1 ] | _, _ => M.impossible @@ -177,13 +179,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.StructRecord "generics_bounds::Triangle" [ ("length", α0); ("height", α1) ]) in let* _ := let* α0 := - M.get_function "generics_bounds::print_debug" [ Ty.path "generics_bounds::Rectangle" ] in + M.get_function "generics_bounds::print_debug" [ Ty.path "generics_bounds::Rectangle" ] [] in let* α1 := M.call_closure α0 [ rectangle ] in M.alloc α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Area: ") in @@ -197,13 +199,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "f64" ] in + [ Ty.path "f64" ] + [] in let* α7 := M.get_trait_method "generics_bounds::HasArea" (Ty.path "generics_bounds::Rectangle") [] + [] "area" + [] [] in let* α8 := M.call_closure α7 [ rectangle ] in let* α9 := M.alloc α8 in 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 f44a98a77..b8e752db3 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 @@ -98,8 +98,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.StructTuple "generics_bounds_test_case_empty_bounds::Turkey" []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "A cardinal is ") in @@ -113,11 +113,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.get_function "generics_bounds_test_case_empty_bounds::red" - [ Ty.path "generics_bounds_test_case_empty_bounds::Cardinal" ] in + [ Ty.path "generics_bounds_test_case_empty_bounds::Cardinal" ] + [] in let* α8 := M.call_closure α7 [ cardinal ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in @@ -129,8 +131,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "A blue jay is ") in @@ -144,11 +146,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.get_function "generics_bounds_test_case_empty_bounds::blue" - [ Ty.path "generics_bounds_test_case_empty_bounds::BlueJay" ] in + [ Ty.path "generics_bounds_test_case_empty_bounds::BlueJay" ] + [] in let* α8 := M.call_closure α7 [ blue_jay ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in 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 948cc9c15..596f32830 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_functions.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_functions.v @@ -83,7 +83,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* _ := - let* α0 := M.get_function "generics_functions::reg_fn" [] in + let* α0 := M.get_function "generics_functions::reg_fn" [] [] in let* α1 := M.call_closure α0 @@ -94,7 +94,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ] in M.alloc α1 in let* _ := - let* α0 := M.get_function "generics_functions::gen_spec_t" [] in + let* α0 := M.get_function "generics_functions::gen_spec_t" [] [] in let* α1 := M.call_closure α0 @@ -105,21 +105,21 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ] in M.alloc α1 in let* _ := - let* α0 := M.get_function "generics_functions::gen_spec_i32" [] in + let* α0 := M.get_function "generics_functions::gen_spec_i32" [] [] in let* α1 := M.call_closure α0 [ Value.StructTuple "generics_functions::SGen" [ Value.Integer Integer.I32 6 ] ] in M.alloc α1 in let* _ := - let* α0 := M.get_function "generics_functions::generic" [ Ty.path "char" ] in + let* α0 := M.get_function "generics_functions::generic" [ Ty.path "char" ] [] in let* α1 := M.call_closure α0 [ Value.StructTuple "generics_functions::SGen" [ Value.UnicodeChar 97 ] ] in M.alloc α1 in let* _ := - let* α0 := M.get_function "generics_functions::generic" [ Ty.path "char" ] in + let* α0 := M.get_function "generics_functions::generic" [ Ty.path "char" ] [] in let* α1 := M.call_closure α0 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 fe2c0898f..25454b4f4 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_implementation.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_implementation.v @@ -36,7 +36,8 @@ Module Impl_generics_implementation_Val. End Impl_generics_implementation_Val. Module Impl_generics_implementation_GenVal_T. - Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "generics_implementation::GenVal") [ T ]. + Definition Self (T : Ty.t) : Ty.t := + Ty.apply (Ty.path "generics_implementation::GenVal") [ T ] []. (* fn value(&self) -> &T { @@ -79,8 +80,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ ("gen_val", Value.Integer Integer.I32 3) ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -95,9 +96,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "f64" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "f64" ] [] ] + [] in let* α8 := - M.get_associated_function (Ty.path "generics_implementation::Val") "value" [] in + M.get_associated_function (Ty.path "generics_implementation::Val") "value" [] [] in let* α9 := M.call_closure α8 [ x ] in let* α10 := M.alloc α9 in let* α11 := M.call_closure α7 [ α10 ] in @@ -105,11 +107,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] in let* α13 := M.get_associated_function - (Ty.apply (Ty.path "generics_implementation::GenVal") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "generics_implementation::GenVal") [ Ty.path "i32" ] []) "value" + [] [] in let* α14 := M.call_closure α13 [ y ] in let* α15 := M.alloc α14 in 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 566c2248f..1bbc3e5f5 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 @@ -13,8 +13,8 @@ Definition compare_prints (τ : list Ty.t) (α : list Value.t) : M := let* t := M.alloc t in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Debug: `") in @@ -28,7 +28,8 @@ Definition compare_prints (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "&") [ T ] ] in + [ Ty.apply (Ty.path "&") [ T ] [] ] + [] in let* α7 := M.call_closure α6 [ t ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -38,8 +39,8 @@ Definition compare_prints (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Display: `") in @@ -53,7 +54,8 @@ Definition compare_prints (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ T ] ] in + [ Ty.apply (Ty.path "&") [ T ] [] ] + [] in let* α7 := M.call_closure α6 [ t ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -79,8 +81,8 @@ Definition compare_types (τ : list Ty.t) (α : list Value.t) : M := let* u := M.alloc u in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "t: `") in @@ -94,7 +96,8 @@ Definition compare_types (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "&") [ T ] ] in + [ Ty.apply (Ty.path "&") [ T ] [] ] + [] in let* α7 := M.call_closure α6 [ t ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -104,8 +107,8 @@ Definition compare_types (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "u: `") in @@ -119,7 +122,8 @@ Definition compare_types (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "&") [ U ] ] in + [ Ty.apply (Ty.path "&") [ U ] [] ] + [] in let* α7 := M.call_closure α6 [ u ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -157,17 +161,23 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* vec := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α5 := (* Unsize *) let* α1 := M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.apply (Ty.path "array") [ Ty.path "i32" ]; Ty.path "alloc::alloc::Global" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "i32" ] [ Value.Integer Integer.Usize 3 ]; + Ty.path "alloc::alloc::Global" + ] + []) "new" + [] [] in let* α2 := M.alloc @@ -186,7 +196,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "generics_multiple_bounds::compare_prints" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.call_closure α0 [ string ] in M.alloc α1 in let* _ := @@ -194,9 +205,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_function "generics_multiple_bounds::compare_types" [ - Ty.apply (Ty.path "array") [ Ty.path "i32" ]; - Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] - ] in + Ty.apply (Ty.path "array") [ Ty.path "i32" ] [ Value.Integer Integer.Usize 3 ]; + Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + [] + ] + [] in let* α1 := M.call_closure α0 [ array; vec ] in M.alloc α1 in let* α0 := M.alloc (Value.Tuple []) in 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 2692b30ef..bcb9366f1 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 @@ -91,13 +91,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Value.StructTuple "generics_new_type_idiom::Years" [ Value.Integer Integer.I64 5 ]) in let* age_days := let* α0 := - M.get_associated_function (Ty.path "generics_new_type_idiom::Years") "to_days" [] in + M.get_associated_function (Ty.path "generics_new_type_idiom::Years") "to_days" [] [] in let* α1 := M.call_closure α0 [ age ] in M.alloc α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Old enough ") in @@ -111,8 +111,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "bool" ] in - let* α7 := M.get_function "generics_new_type_idiom::old_enough" [] in + [ Ty.path "bool" ] + [] in + let* α7 := M.get_function "generics_new_type_idiom::old_enough" [] [] in let* α8 := M.call_closure α7 [ age ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in @@ -124,8 +125,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Old enough ") in @@ -139,10 +140,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "bool" ] in - let* α7 := M.get_function "generics_new_type_idiom::old_enough" [] in + [ Ty.path "bool" ] + [] in + let* α7 := M.get_function "generics_new_type_idiom::old_enough" [] [] in let* α8 := - M.get_associated_function (Ty.path "generics_new_type_idiom::Days") "to_years" [] in + M.get_associated_function + (Ty.path "generics_new_type_idiom::Days") + "to_years" + [] + [] in let* α9 := M.call_closure α8 [ age_days ] in let* α10 := M.alloc α9 in let* α11 := M.call_closure α7 [ α10 ] in 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 36129bfea..a648b9b20 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 @@ -5,12 +5,12 @@ Require Import CoqOfRust.CoqOfRust. { name := "PhantomTuple"; ty_params := [ "A"; "B" ]; - fields := [ A; Ty.apply (Ty.path "core::marker::PhantomData") [ B ] ]; + fields := [ A; Ty.apply (Ty.path "core::marker::PhantomData") [ B ] [] ]; } *) Module Impl_core_marker_StructuralPartialEq_for_generics_phantom_type_PhantomTuple_A_B. Definition Self (A B : Ty.t) : Ty.t := - Ty.apply (Ty.path "generics_phantom_type::PhantomTuple") [ A; B ]. + Ty.apply (Ty.path "generics_phantom_type::PhantomTuple") [ A; B ] []. Axiom Implements : forall (A B : Ty.t), @@ -23,7 +23,7 @@ End Impl_core_marker_StructuralPartialEq_for_generics_phantom_type_PhantomTuple_ Module Impl_core_cmp_PartialEq_for_generics_phantom_type_PhantomTuple_A_B. Definition Self (A B : Ty.t) : Ty.t := - Ty.apply (Ty.path "generics_phantom_type::PhantomTuple") [ A; B ]. + Ty.apply (Ty.path "generics_phantom_type::PhantomTuple") [ A; B ] []. (* PartialEq @@ -34,7 +34,7 @@ Module Impl_core_cmp_PartialEq_for_generics_phantom_type_PhantomTuple_A_B. | [], [ self; other ] => let* self := M.alloc self in let* other := M.alloc other in - let* α0 := M.get_trait_method "core::cmp::PartialEq" A [ A ] "eq" [] in + let* α0 := M.get_trait_method "core::cmp::PartialEq" A [ A ] [ Value.Bool true ] "eq" [] [] in let* α1 := M.read self in let* α2 := M.read other in let* α3 := @@ -49,9 +49,11 @@ Module Impl_core_cmp_PartialEq_for_generics_phantom_type_PhantomTuple_A_B. (let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "core::marker::PhantomData") [ B ]) - [ Ty.apply (Ty.path "core::marker::PhantomData") [ B ] ] + (Ty.apply (Ty.path "core::marker::PhantomData") [ B ] []) + [ Ty.apply (Ty.path "core::marker::PhantomData") [ B ] [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read self in let* α2 := M.read other in @@ -77,12 +79,13 @@ End Impl_core_cmp_PartialEq_for_generics_phantom_type_PhantomTuple_A_B. { name := "PhantomStruct"; ty_params := [ "A"; "B" ]; - fields := [ ("first", A); ("phantom", Ty.apply (Ty.path "core::marker::PhantomData") [ B ]) ]; + fields := + [ ("first", A); ("phantom", Ty.apply (Ty.path "core::marker::PhantomData") [ B ] []) ]; } *) Module Impl_core_marker_StructuralPartialEq_for_generics_phantom_type_PhantomStruct_A_B. Definition Self (A B : Ty.t) : Ty.t := - Ty.apply (Ty.path "generics_phantom_type::PhantomStruct") [ A; B ]. + Ty.apply (Ty.path "generics_phantom_type::PhantomStruct") [ A; B ] []. Axiom Implements : forall (A B : Ty.t), @@ -95,7 +98,7 @@ End Impl_core_marker_StructuralPartialEq_for_generics_phantom_type_PhantomStruct Module Impl_core_cmp_PartialEq_for_generics_phantom_type_PhantomStruct_A_B. Definition Self (A B : Ty.t) : Ty.t := - Ty.apply (Ty.path "generics_phantom_type::PhantomStruct") [ A; B ]. + Ty.apply (Ty.path "generics_phantom_type::PhantomStruct") [ A; B ] []. (* PartialEq @@ -106,7 +109,7 @@ Module Impl_core_cmp_PartialEq_for_generics_phantom_type_PhantomStruct_A_B. | [], [ self; other ] => let* self := M.alloc self in let* other := M.alloc other in - let* α0 := M.get_trait_method "core::cmp::PartialEq" A [ A ] "eq" [] in + let* α0 := M.get_trait_method "core::cmp::PartialEq" A [ A ] [ Value.Bool true ] "eq" [] [] in let* α1 := M.read self in let* α2 := M.read other in let* α3 := @@ -121,9 +124,11 @@ Module Impl_core_cmp_PartialEq_for_generics_phantom_type_PhantomStruct_A_B. (let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "core::marker::PhantomData") [ B ]) - [ Ty.apply (Ty.path "core::marker::PhantomData") [ B ] ] + (Ty.apply (Ty.path "core::marker::PhantomData") [ B ] []) + [ Ty.apply (Ty.path "core::marker::PhantomData") [ B ] [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read self in let* α2 := M.read other in 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 4adcab01b..9f505a09b 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 @@ -129,12 +129,12 @@ End Impl_core_marker_Copy_for_generics_phantom_type_test_case_unit_clarification { name := "Length"; ty_params := [ "Unit" ]; - fields := [ Ty.path "f64"; Ty.apply (Ty.path "core::marker::PhantomData") [ Unit ] ]; + fields := [ Ty.path "f64"; Ty.apply (Ty.path "core::marker::PhantomData") [ Unit ] [] ]; } *) Module Impl_core_fmt_Debug_for_generics_phantom_type_test_case_unit_clarification_Length_Unit. Definition Self (Unit : Ty.t) : Ty.t := - Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") [ Unit ]. + Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") [ Unit ] []. (* Debug @@ -146,7 +146,11 @@ Module Impl_core_fmt_Debug_for_generics_phantom_type_test_case_unit_clarificatio let* self := M.alloc self in let* f := M.alloc f in let* α0 := - M.get_associated_function (Ty.path "core::fmt::Formatter") "debug_tuple_field2_finish" [] in + M.get_associated_function + (Ty.path "core::fmt::Formatter") + "debug_tuple_field2_finish" + [] + [] in let* α1 := M.read f in let* α2 := M.read (mk_str "Length") in let* α4 := @@ -183,7 +187,7 @@ End Impl_core_fmt_Debug_for_generics_phantom_type_test_case_unit_clarification_L Module Impl_core_clone_Clone_for_generics_phantom_type_test_case_unit_clarification_Length_Unit. Definition Self (Unit : Ty.t) : Ty.t := - Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") [ Unit ]. + Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") [ Unit ] []. (* Clone @@ -193,7 +197,7 @@ Module Impl_core_clone_Clone_for_generics_phantom_type_test_case_unit_clarificat match τ, α with | [], [ self ] => let* self := M.alloc self in - let* α0 := M.get_trait_method "core::clone::Clone" (Ty.path "f64") [] "clone" [] in + let* α0 := M.get_trait_method "core::clone::Clone" (Ty.path "f64") [] [] "clone" [] [] in let* α1 := M.read self in let* α2 := M.call_closure @@ -207,9 +211,11 @@ Module Impl_core_clone_Clone_for_generics_phantom_type_test_case_unit_clarificat let* α3 := M.get_trait_method "core::clone::Clone" - (Ty.apply (Ty.path "core::marker::PhantomData") [ Unit ]) + (Ty.apply (Ty.path "core::marker::PhantomData") [ Unit ] []) + [] [] "clone" + [] [] in let* α4 := M.read self in let* α5 := @@ -237,7 +243,7 @@ End Impl_core_clone_Clone_for_generics_phantom_type_test_case_unit_clarification Module Impl_core_marker_Copy_for_generics_phantom_type_test_case_unit_clarification_Length_Unit. Definition Self (Unit : Ty.t) : Ty.t := - Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") [ Unit ]. + Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") [ Unit ] []. Axiom Implements : forall (Unit : Ty.t), @@ -250,13 +256,13 @@ End Impl_core_marker_Copy_for_generics_phantom_type_test_case_unit_clarification Module Impl_core_ops_arith_Add_for_generics_phantom_type_test_case_unit_clarification_Length_Unit. Definition Self (Unit : Ty.t) : Ty.t := - Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") [ Unit ]. + Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") [ Unit ] []. (* type Output = Length; *) Definition _Output (Unit : Ty.t) : Ty.t := - Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") [ Unit ]. + Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") [ Unit ] []. (* fn add(self, rhs: Length) -> Length { @@ -344,13 +350,17 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::ops::arith::Add" (Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") - [ Ty.path "generics_phantom_type_test_case_unit_clarification::Inch" ]) + [ Ty.path "generics_phantom_type_test_case_unit_clarification::Inch" ] + []) [ Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") [ Ty.path "generics_phantom_type_test_case_unit_clarification::Inch" ] + [] ] + [] "add" + [] [] in let* α1 := M.read one_foot in let* α2 := M.read one_foot in @@ -362,13 +372,17 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::ops::arith::Add" (Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") - [ Ty.path "generics_phantom_type_test_case_unit_clarification::Mm" ]) + [ Ty.path "generics_phantom_type_test_case_unit_clarification::Mm" ] + []) [ Ty.apply (Ty.path "generics_phantom_type_test_case_unit_clarification::Length") [ Ty.path "generics_phantom_type_test_case_unit_clarification::Mm" ] + [] ] + [] "add" + [] [] in let* α1 := M.read one_meter in let* α2 := M.read one_meter in @@ -376,8 +390,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α3 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "one foot + one_foot = ") in @@ -391,7 +405,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "f64" ] in + [ Ty.path "f64" ] + [] in let* α7 := M.call_closure α6 @@ -409,8 +424,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "one meter + one_meter = ") in @@ -424,7 +439,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "f64" ] in + [ Ty.path "f64" ] + [] in let* α7 := M.call_closure α6 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 68d53afdf..dee9ca2b8 100644 --- a/CoqOfRust/examples/default/examples/rust_book/generics/generics_traits.v +++ b/CoqOfRust/examples/default/examples/rust_book/generics/generics_traits.v @@ -65,7 +65,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "generics_traits::DoubleDrop" (Ty.path "generics_traits::Empty") [ Ty.path "generics_traits::Null" ] + [] "double_drop" + [] [] in let* α1 := M.read empty in let* α2 := M.read null in 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 684978cb4..22bca89cf 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 @@ -19,8 +19,8 @@ Module Impl_generics_where_clauses_PrintInOption_for_T. let* self := M.alloc self in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -34,7 +34,8 @@ Module Impl_generics_where_clauses_PrintInOption_for_T. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "core::option::Option") [ T ] ] in + [ Ty.apply (Ty.path "core::option::Option") [ T ] [] ] + [] in let* α7 := M.read self in let* α8 := M.alloc (Value.StructTuple "core::option::Option::Some" [ α7 ]) in let* α9 := M.call_closure α6 [ α8 ] in @@ -71,17 +72,23 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* vec := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α5 := (* Unsize *) let* α1 := M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.apply (Ty.path "array") [ Ty.path "i32" ]; Ty.path "alloc::alloc::Global" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "i32" ] [ Value.Integer Integer.Usize 3 ]; + Ty.path "alloc::alloc::Global" + ] + []) "new" + [] [] in let* α2 := M.alloc @@ -100,9 +107,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "generics_where_clauses::PrintInOption" - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "print_in_option" + [] [] in let* α1 := M.read vec in let* α2 := M.call_closure α0 [ α1 ] in 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 a093a4511..2efaeac6f 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 @@ -9,7 +9,7 @@ fn gen_range() -> u32 { Definition gen_range (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_function "core::panicking::panic" [] in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in let* α1 := M.read (mk_str "not yet implemented") in let* α2 := M.call_closure α0 [ α1 ] in M.never_to_any α2 @@ -55,8 +55,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Guess the number! @@ -68,15 +73,20 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α6 in M.alloc (Value.Tuple []) in let* secret_number := - let* α0 := M.get_function "guessing_game::gen_range" [] in + let* α0 := M.get_function "guessing_game::gen_range" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* α0 := M.loop (let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Please input your guess. @@ -88,7 +98,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α6 in M.alloc (Value.Tuple []) in let* guess := - let* α0 := M.get_associated_function (Ty.path "alloc::string::String") "new" [] in + let* α0 := M.get_associated_function (Ty.path "alloc::string::String") "new" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := @@ -96,11 +106,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "usize"; Ty.path "std::io::error::Error" ]) + [ Ty.path "usize"; Ty.path "std::io::error::Error" ] + []) "expect" + [] [] in - let* α1 := M.get_associated_function (Ty.path "std::io::stdio::Stdin") "read_line" [] in - let* α2 := M.get_function "std::io::stdio::stdin" [] in + let* α1 := + M.get_associated_function (Ty.path "std::io::stdio::Stdin") "read_line" [] [] in + let* α2 := M.get_function "std::io::stdio::stdin" [] [] in let* α3 := M.call_closure α2 [] in let* α4 := M.alloc α3 in let* α5 := M.call_closure α1 [ α4; guess ] in @@ -108,14 +121,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α7 := M.call_closure α0 [ α5; α6 ] in M.alloc α7 in let* guess := - let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "u32" ] in - let* α1 := M.get_associated_function (Ty.path "str") "trim" [] in + let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "u32" ] [] in + let* α1 := M.get_associated_function (Ty.path "str") "trim" [] [] in let* α2 := M.get_trait_method "core::ops::deref::Deref" (Ty.path "alloc::string::String") [] + [] "deref" + [] [] in let* α3 := M.call_closure α2 [ guess ] in let* α4 := M.call_closure α1 [ α3 ] in @@ -141,8 +156,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.copy α7 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "You guessed: ") in @@ -156,7 +171,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.call_closure α6 [ guess ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -164,7 +180,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α11 := M.call_closure α0 [ α10 ] in M.alloc α11 in M.alloc (Value.Tuple []) in - let* α0 := M.get_trait_method "core::cmp::Ord" (Ty.path "u32") [] "cmp" [] in + let* α0 := M.get_trait_method "core::cmp::Ord" (Ty.path "u32") [] [] "cmp" [] [] in let* α1 := M.call_closure α0 [ guess; secret_number ] in let* α2 := M.alloc α1 in M.match_operator @@ -172,9 +188,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Too small! @@ -187,9 +207,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []); fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Too big! @@ -203,9 +227,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "You win! 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 1bbc3dbd3..82f433533 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 @@ -68,8 +68,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "31 days @@ -78,7 +78,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.pure (M.pointer_coercion α3) in let* α8 := (* Unsize *) - let* α5 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "none" [] in + let* α5 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "none" [] [] in let* α6 := M.call_closure α5 [] in let* α7 := M.alloc α6 in M.pure (M.pointer_coercion α7) in @@ -88,8 +88,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Alice, this is Bob. Bob, this is Alice @@ -98,7 +98,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.pure (M.pointer_coercion α3) in let* α8 := (* Unsize *) - let* α5 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "none" [] in + let* α5 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "none" [] [] in let* α6 := M.call_closure α5 [] in let* α7 := M.alloc α6 in M.pure (M.pointer_coercion α7) in @@ -108,8 +108,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "the quick brown fox jumps over the lazy dog @@ -118,7 +118,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.pure (M.pointer_coercion α3) in let* α8 := (* Unsize *) - let* α5 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "none" [] in + let* α5 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "none" [] [] in let* α6 := M.call_closure α5 [] in let* α7 := M.alloc α6 in M.pure (M.pointer_coercion α7) in @@ -128,8 +128,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Base 10: 69420 @@ -138,7 +138,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.pure (M.pointer_coercion α3) in let* α8 := (* Unsize *) - let* α5 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "none" [] in + let* α5 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "none" [] [] in let* α6 := M.call_closure α5 [] in let* α7 := M.alloc α6 in M.pure (M.pointer_coercion α7) in @@ -148,8 +148,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Base 2 (binary): ") in @@ -163,7 +163,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_binary" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.alloc (Value.Integer Integer.I32 69420) in let* α8 := M.call_closure α6 [ α7 ] in let* α9 := M.alloc (Value.Array [ α8 ]) in @@ -174,8 +175,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Base 8 (octal): ") in @@ -189,7 +190,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_octal" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.alloc (Value.Integer Integer.I32 69420) in let* α8 := M.call_closure α6 [ α7 ] in let* α9 := M.alloc (Value.Array [ α8 ]) in @@ -200,8 +202,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Base 16 (hexadecimal): ") in @@ -215,7 +217,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_lower_hex" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.alloc (Value.Integer Integer.I32 69420) in let* α8 := M.call_closure α6 [ α7 ] in let* α9 := M.alloc (Value.Array [ α8 ]) in @@ -226,8 +229,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Base 16 (hexadecimal): ") in @@ -241,7 +244,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_upper_hex" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.alloc (Value.Integer Integer.I32 69420) in let* α8 := M.call_closure α6 [ α7 ] in let* α9 := M.alloc (Value.Array [ α8 ]) in @@ -252,9 +256,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1_formatted" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1_formatted" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -268,14 +272,20 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.alloc (Value.Integer Integer.I32 1) in let* α8 := M.call_closure α6 [ α7 ] in let* α9 := M.alloc (Value.Array [ α8 ]) in M.pure (M.pointer_coercion α9) in let* α14 := (* Unsize *) - let* α11 := M.get_associated_function (Ty.path "core::fmt::rt::Placeholder") "new" [] in + let* α11 := + M.get_associated_function + (Ty.path "core::fmt::rt::Placeholder") + "new" + [] + [ Value.Bool true ] in let* α12 := M.call_closure α11 @@ -289,7 +299,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ] in let* α13 := M.alloc (Value.Array [ α12 ]) in M.pure (M.pointer_coercion α13) in - let* α15 := M.get_associated_function (Ty.path "core::fmt::rt::UnsafeArg") "new" [] in + let* α15 := M.get_associated_function (Ty.path "core::fmt::rt::UnsafeArg") "new" [] [] in let* α16 := M.call_closure α15 [] in let* α17 := M.call_closure α1 [ α5; α10; α14; α16 ] in let* α18 := M.call_closure α0 [ α17 ] in @@ -297,9 +307,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1_formatted" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1_formatted" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -313,14 +323,20 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.alloc (Value.Integer Integer.I32 1) in let* α8 := M.call_closure α6 [ α7 ] in let* α9 := M.alloc (Value.Array [ α8 ]) in M.pure (M.pointer_coercion α9) in let* α14 := (* Unsize *) - let* α11 := M.get_associated_function (Ty.path "core::fmt::rt::Placeholder") "new" [] in + let* α11 := + M.get_associated_function + (Ty.path "core::fmt::rt::Placeholder") + "new" + [] + [ Value.Bool true ] in let* α12 := M.call_closure α11 @@ -334,7 +350,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ] in let* α13 := M.alloc (Value.Array [ α12 ]) in M.pure (M.pointer_coercion α13) in - let* α15 := M.get_associated_function (Ty.path "core::fmt::rt::UnsafeArg") "new" [] in + let* α15 := M.get_associated_function (Ty.path "core::fmt::rt::UnsafeArg") "new" [] [] in let* α16 := M.call_closure α15 [] in let* α17 := M.call_closure α1 [ α5; α10; α14; α16 ] in let* α18 := M.call_closure α0 [ α17 ] in @@ -342,9 +358,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1_formatted" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1_formatted" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -358,18 +374,24 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.alloc (Value.Integer Integer.I32 1) in let* α8 := M.call_closure α6 [ α7 ] in let* α9 := - M.get_associated_function (Ty.path "core::fmt::rt::Argument") "from_usize" [] in + M.get_associated_function (Ty.path "core::fmt::rt::Argument") "from_usize" [] [] in let* α10 := M.alloc (Value.Integer Integer.Usize 5) in let* α11 := M.call_closure α9 [ α10 ] in let* α12 := M.alloc (Value.Array [ α8; α11 ]) in M.pure (M.pointer_coercion α12) in let* α17 := (* Unsize *) - let* α14 := M.get_associated_function (Ty.path "core::fmt::rt::Placeholder") "new" [] in + let* α14 := + M.get_associated_function + (Ty.path "core::fmt::rt::Placeholder") + "new" + [] + [ Value.Bool true ] in let* α15 := M.call_closure α14 @@ -383,7 +405,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ] in let* α16 := M.alloc (Value.Array [ α15 ]) in M.pure (M.pointer_coercion α16) in - let* α18 := M.get_associated_function (Ty.path "core::fmt::rt::UnsafeArg") "new" [] in + let* α18 := M.get_associated_function (Ty.path "core::fmt::rt::UnsafeArg") "new" [] [] in let* α19 := M.call_closure α18 [] in let* α20 := M.call_closure α1 [ α5; α13; α17; α19 ] in let* α21 := M.call_closure α0 [ α20 ] in @@ -391,8 +413,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "My name is Bond, James Bond @@ -401,7 +423,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.pure (M.pointer_coercion α3) in let* α8 := (* Unsize *) - let* α5 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "none" [] in + let* α5 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "none" [] [] in let* α6 := M.call_closure α5 [] in let* α7 := M.alloc α6 in M.pure (M.pointer_coercion α7) in @@ -413,9 +435,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* width := M.alloc (Value.Integer Integer.Usize 5) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1_formatted" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1_formatted" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -429,16 +451,22 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "f64" ] in + [ Ty.path "f64" ] + [] in let* α7 := M.call_closure α6 [ number ] in let* α8 := - M.get_associated_function (Ty.path "core::fmt::rt::Argument") "from_usize" [] in + M.get_associated_function (Ty.path "core::fmt::rt::Argument") "from_usize" [] [] in let* α9 := M.call_closure α8 [ width ] in let* α10 := M.alloc (Value.Array [ α7; α9 ]) in M.pure (M.pointer_coercion α10) in let* α15 := (* Unsize *) - let* α12 := M.get_associated_function (Ty.path "core::fmt::rt::Placeholder") "new" [] in + let* α12 := + M.get_associated_function + (Ty.path "core::fmt::rt::Placeholder") + "new" + [] + [ Value.Bool true ] in let* α13 := M.call_closure α12 @@ -452,7 +480,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ] in let* α14 := M.alloc (Value.Array [ α13 ]) in M.pure (M.pointer_coercion α14) in - let* α16 := M.get_associated_function (Ty.path "core::fmt::rt::UnsafeArg") "new" [] in + let* α16 := M.get_associated_function (Ty.path "core::fmt::rt::UnsafeArg") "new" [] [] in let* α17 := M.call_closure α16 [] in let* α18 := M.call_closure α1 [ α5; α11; α15; α17 ] in let* α19 := M.call_closure α0 [ α18 ] in 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 602550daf..d8e1c0c93 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 @@ -14,8 +14,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Hello World! 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 023ef6ced..edc4a4393 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 @@ -11,8 +11,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Hello! 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 6f9eed98f..04b1c7eb9 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 @@ -12,8 +12,8 @@ Definition foo (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "You called ") in @@ -27,7 +27,8 @@ Definition foo (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ mk_str "foo" ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -51,8 +52,8 @@ Definition bar (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "You called ") in @@ -66,7 +67,8 @@ Definition bar (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ mk_str "bar" ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -98,17 +100,17 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* _ := - let* α0 := M.get_function "macro_rules_designators::foo" [] in + let* α0 := M.get_function "macro_rules_designators::foo" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := - let* α0 := M.get_function "macro_rules_designators::bar" [] in + let* α0 := M.get_function "macro_rules_designators::bar" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -123,13 +125,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α8 := M.call_closure α7 [ mk_str "1u32 + 1" ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α10 := BinOp.Panic.add (Value.Integer Integer.U32 1) (Value.Integer Integer.U32 1) in let* α11 := M.alloc α10 in @@ -142,8 +146,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -158,13 +162,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α8 := M.call_closure α7 [ mk_str "{ let x = 1u32; x * x + 2 * x - 1 }" ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* x := M.alloc (Value.Integer Integer.U32 1) in let* α0 := M.read x in let* α1 := M.read x in 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 c9036d265..914f9918c 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 @@ -22,8 +22,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "1 + 2 = ") in @@ -37,7 +37,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α7 := M.call_closure α6 [ val ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -53,8 +54,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α2 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "(1 + 2) * (3 / 4) = ") in @@ -68,7 +69,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α7 := M.call_closure α6 [ val ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 e3ad0f23b..3e5aeb557 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 @@ -12,8 +12,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α7 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -29,19 +29,22 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α9 := M.call_closure α8 [ mk_str "1i32 + 1 == 2i32" ] in let* α10 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α11 := M.call_closure α10 [ mk_str "2i32 * 2 == 4i32" ] in let* α12 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "bool" ] in + [ Ty.path "bool" ] + [] in let* α13 := BinOp.Panic.add (Value.Integer Integer.I32 1) (Value.Integer Integer.I32 1) in let* α14 := @@ -60,8 +63,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α7 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -77,19 +80,22 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α9 := M.call_closure α8 [ mk_str "true" ] in let* α10 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α11 := M.call_closure α10 [ mk_str "false" ] in let* α12 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "bool" ] in + [ Ty.path "bool" ] + [] in let* α13 := LogicalOp.or (Value.Bool true) (M.pure (Value.Bool false)) in let* α14 := M.alloc α13 in let* α15 := M.call_closure α12 [ α14 ] in 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 2593ece56..c8325ba35 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 @@ -13,8 +13,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "1 @@ -23,7 +23,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.pure (M.pointer_coercion α3) in let* α8 := (* Unsize *) - let* α5 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "none" [] in + let* α5 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "none" [] [] in let* α6 := M.call_closure α5 [] in let* α7 := M.alloc α6 in M.pure (M.pointer_coercion α7) in @@ -33,8 +33,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -48,8 +48,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in - let* α7 := M.get_function "core::cmp::min" [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in + let* α7 := M.get_function "core::cmp::min" [ Ty.path "i32" ] [] in let* α8 := BinOp.Panic.add (Value.Integer Integer.I32 1) (Value.Integer Integer.I32 2) in let* α9 := M.call_closure α7 [ α8; Value.Integer Integer.I32 2 ] in @@ -63,8 +64,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -78,9 +79,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in - let* α7 := M.get_function "core::cmp::min" [ Ty.path "i32" ] in - let* α8 := M.get_function "core::cmp::min" [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in + let* α7 := M.get_function "core::cmp::min" [ Ty.path "i32" ] [] in + let* α8 := M.get_function "core::cmp::min" [ Ty.path "i32" ] [] in let* α9 := BinOp.Panic.mul (Value.Integer Integer.I32 2) (Value.Integer Integer.I32 3) in let* α10 := M.call_closure α8 [ α9; Value.Integer Integer.I32 4 ] in 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 36686f8d8..cb32dac0a 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 @@ -20,8 +20,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "1 + 2 = ") in @@ -35,7 +35,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α7 := M.call_closure α6 [ val ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -51,8 +52,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "3 + 4 = ") in @@ -66,7 +67,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α7 := M.call_closure α6 [ val ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -81,8 +83,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "(2 * 3) + 1 = ") in @@ -96,7 +98,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α7 := M.call_closure α6 [ val ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 2e6577ab1..5dc961cba 100644 --- a/CoqOfRust/examples/default/examples/rust_book/modules/struct_visibility.v +++ b/CoqOfRust/examples/default/examples/rust_book/modules/struct_visibility.v @@ -18,7 +18,7 @@ Module my. Module Impl_struct_visibility_my_ClosedBox_T. Definition Self (T : Ty.t) : Ty.t := - Ty.apply (Ty.path "struct_visibility::my::ClosedBox") [ T ]. + Ty.apply (Ty.path "struct_visibility::my::ClosedBox") [ T ] []. (* pub fn new(contents: T) -> ClosedBox { @@ -72,8 +72,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.StructRecord "struct_visibility::my::OpenBox" [ ("contents", α0) ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The open box contains: ") in @@ -87,7 +87,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 @@ -104,8 +105,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "struct_visibility::my::ClosedBox") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + []) "new" + [] [] in let* α1 := M.read (mk_str "classified information") in let* α2 := M.call_closure α0 [ α1 ] in 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 c8dc63b2b..7b4752ace 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 @@ -11,8 +11,13 @@ Definition function (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "called `function()` @@ -39,8 +44,13 @@ Module cool. | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "called `cool::function()` @@ -68,8 +78,13 @@ Module my. | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "called `my::function()` @@ -96,8 +111,13 @@ Module my. | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "called `my::cool::function()` @@ -144,8 +164,13 @@ Module my. | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "called `my::indirect_call()`, that @@ -157,23 +182,23 @@ Module my. M.alloc α6 in M.alloc (Value.Tuple []) in let* _ := - let* α0 := M.get_function "super_and_self::my::function" [] in + let* α0 := M.get_function "super_and_self::my::function" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := - let* α0 := M.get_function "super_and_self::my::function" [] in + let* α0 := M.get_function "super_and_self::my::function" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := - let* α0 := M.get_function "super_and_self::my::cool::function" [] in + let* α0 := M.get_function "super_and_self::my::cool::function" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := - let* α0 := M.get_function "super_and_self::function" [] in + let* α0 := M.get_function "super_and_self::function" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := - let* α0 := M.get_function "super_and_self::cool::function" [] in + let* α0 := M.get_function "super_and_self::cool::function" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* α0 := M.alloc (Value.Tuple []) in @@ -191,7 +216,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* _ := - let* α0 := M.get_function "super_and_self::my::indirect_call" [] in + let* α0 := M.get_function "super_and_self::my::indirect_call" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* α0 := M.alloc (Value.Tuple []) in 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 ab7e08ff4..22cf7f6a4 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 @@ -11,8 +11,13 @@ Definition function (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "called `function()` @@ -40,8 +45,13 @@ Module deeply. | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "called `deeply::nested::function()` @@ -84,13 +94,18 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* _ := - let* α0 := M.get_function "the_use_as_declaration::deeply::nested::function" [] in + let* α0 := M.get_function "the_use_as_declaration::deeply::nested::function" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Entering block @@ -103,13 +118,18 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "the_use_as_declaration::deeply::nested::function" [] in + let* α0 := M.get_function "the_use_as_declaration::deeply::nested::function" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Leaving block @@ -122,7 +142,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in M.alloc (Value.Tuple []) in let* _ := - let* α0 := M.get_function "the_use_as_declaration::function" [] in + let* α0 := M.get_function "the_use_as_declaration::function" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* α0 := M.alloc (Value.Tuple []) in diff --git a/CoqOfRust/examples/default/examples/rust_book/modules/visibility.v b/CoqOfRust/examples/default/examples/rust_book/modules/visibility.v index cb6f5957c..fa69d9000 100644 --- a/CoqOfRust/examples/default/examples/rust_book/modules/visibility.v +++ b/CoqOfRust/examples/default/examples/rust_book/modules/visibility.v @@ -12,8 +12,13 @@ Module my_mod. | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "called `my_mod::private_function()` @@ -39,8 +44,13 @@ Module my_mod. | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "called `my_mod::function()` @@ -67,8 +77,13 @@ Module my_mod. | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "called `my_mod::indirect_access()`, that @@ -80,7 +95,7 @@ Module my_mod. M.alloc α6 in M.alloc (Value.Tuple []) in let* _ := - let* α0 := M.get_function "visibility::my_mod::private_function" [] in + let* α0 := M.get_function "visibility::my_mod::private_function" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* α0 := M.alloc (Value.Tuple []) in @@ -99,8 +114,13 @@ Module my_mod. | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "called `my_mod::nested::function()` @@ -126,8 +146,13 @@ Module my_mod. | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "called `my_mod::nested::private_function()` @@ -154,8 +179,13 @@ Module my_mod. | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := @@ -168,7 +198,7 @@ Module my_mod. M.alloc α6 in M.alloc (Value.Tuple []) in let* _ := - let* α0 := M.get_function "visibility::my_mod::nested::public_function_in_nested" [] in + let* α0 := M.get_function "visibility::my_mod::nested::public_function_in_nested" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* α0 := M.alloc (Value.Tuple []) in @@ -186,8 +216,13 @@ Module my_mod. | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := @@ -214,8 +249,13 @@ Module my_mod. | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := @@ -246,8 +286,13 @@ Module my_mod. | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := @@ -260,13 +305,18 @@ Module my_mod. M.alloc α6 in M.alloc (Value.Tuple []) in let* _ := - let* α0 := M.get_function "visibility::my_mod::nested::public_function_in_my_mod" [] in + let* α0 := M.get_function "visibility::my_mod::nested::public_function_in_my_mod" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "> ") in @@ -277,7 +327,8 @@ Module my_mod. M.alloc α6 in M.alloc (Value.Tuple []) in let* _ := - let* α0 := M.get_function "visibility::my_mod::nested::public_function_in_super_mod" [] in + let* α0 := + M.get_function "visibility::my_mod::nested::public_function_in_super_mod" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* α0 := M.alloc (Value.Tuple []) in @@ -295,8 +346,13 @@ Module my_mod. | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "called `my_mod::public_function_in_crate()` @@ -323,8 +379,13 @@ Module my_mod. | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "called `my_mod::private_nested::function()` @@ -350,8 +411,13 @@ Module my_mod. | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := @@ -380,8 +446,13 @@ Definition function (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "called `function()` @@ -441,27 +512,27 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* _ := - let* α0 := M.get_function "visibility::function" [] in + let* α0 := M.get_function "visibility::function" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := - let* α0 := M.get_function "visibility::my_mod::function" [] in + let* α0 := M.get_function "visibility::my_mod::function" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := - let* α0 := M.get_function "visibility::my_mod::indirect_access" [] in + let* α0 := M.get_function "visibility::my_mod::indirect_access" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := - let* α0 := M.get_function "visibility::my_mod::nested::function" [] in + let* α0 := M.get_function "visibility::my_mod::nested::function" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := - let* α0 := M.get_function "visibility::my_mod::call_public_function_in_my_mod" [] in + let* α0 := M.get_function "visibility::my_mod::call_public_function_in_my_mod" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := - let* α0 := M.get_function "visibility::my_mod::public_function_in_crate" [] in + let* α0 := M.get_function "visibility::my_mod::public_function_in_crate" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* α0 := M.alloc (Value.Tuple []) in 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 3a15de4e6..854100a2c 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 @@ -13,8 +13,8 @@ Definition analyze_slice (τ : list Ty.t) (α : list Value.t) : M := let* slice := M.alloc slice in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "first element of the slice: ") in @@ -28,7 +28,8 @@ Definition analyze_slice (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.read slice in let* α8 := M.alloc (Value.Integer Integer.Usize 0) in let* α9 := M.get_array_field α7 α8 in @@ -41,8 +42,8 @@ Definition analyze_slice (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "the slice has ") in @@ -56,9 +57,14 @@ Definition analyze_slice (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α7 := - M.get_associated_function (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) "len" [] in + M.get_associated_function + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) + "len" + [] + [ Value.Bool true ] in let* α8 := M.read slice in let* α9 := M.call_closure α7 [ α8 ] in let* α10 := M.alloc α9 in @@ -139,8 +145,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* ys := M.alloc (repeat (Value.Integer Integer.I32 0) 500) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "first element of the array: ") in @@ -154,7 +160,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.alloc (Value.Integer Integer.Usize 0) in let* α8 := M.get_array_field xs α7 in let* α9 := M.call_closure α6 [ α8 ] in @@ -166,8 +173,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "second element of the array: ") in @@ -181,7 +188,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.alloc (Value.Integer Integer.Usize 1) in let* α8 := M.get_array_field xs α7 in let* α9 := M.call_closure α6 [ α8 ] in @@ -193,8 +201,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "number of elements in array: ") in @@ -208,9 +216,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α7 := - M.get_associated_function (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) "len" [] in + M.get_associated_function + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) + "len" + [] + [ Value.Bool true ] in let* α8 := (* Unsize *) M.pure (M.pointer_coercion xs) in let* α9 := M.call_closure α7 [ α8 ] in let* α10 := M.alloc α9 in @@ -223,8 +236,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "array occupies ") in @@ -238,11 +251,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α7 := M.get_function "core::mem::size_of_val" - [ Ty.apply (Ty.path "array") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "array") [ Ty.path "i32" ] [ Value.Integer Integer.Usize 5 ] ] + [ Value.Bool true ] in let* α8 := M.call_closure α7 [ xs ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in @@ -254,8 +269,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "borrow the whole array as a slice @@ -267,14 +287,19 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α6 in M.alloc (Value.Tuple []) in let* _ := - let* α0 := M.get_function "arrays_and_slices::analyze_slice" [] in + let* α0 := M.get_function "arrays_and_slices::analyze_slice" [] [] in let* α1 := (* Unsize *) M.pure (M.pointer_coercion xs) in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "borrow a section of the array as a slice @@ -286,13 +311,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α6 in M.alloc (Value.Tuple []) in let* _ := - let* α0 := M.get_function "arrays_and_slices::analyze_slice" [] in + let* α0 := M.get_function "arrays_and_slices::analyze_slice" [] [] in let* α1 := M.get_trait_method "core::ops::index::Index" - (Ty.apply (Ty.path "array") [ Ty.path "i32" ]) - [ Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "usize" ] ] + (Ty.apply (Ty.path "array") [ Ty.path "i32" ] [ Value.Integer Integer.Usize 500 ]) + [ Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "usize" ] [] ] + [] "index" + [] [] in let* α2 := M.call_closure @@ -328,9 +355,29 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "array") [ Ty.path "u32" ] ]) - [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "array") [ Ty.path "u32" ] ] ] + (Ty.apply + (Ty.path "&") + [ + Ty.apply + (Ty.path "array") + [ Ty.path "u32" ] + [ Value.Integer Integer.Usize 0 ] + ] + []) + [ + Ty.apply + (Ty.path "&") + [ + Ty.apply + (Ty.path "array") + [ Ty.path "u32" ] + [ Value.Integer Integer.Usize 0 ] + ] + [] + ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read left_val in let* α2 := M.read right_val in @@ -345,9 +392,26 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_function "core::panicking::assert_failed" [ - Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "array") [ Ty.path "u32" ] ]; - Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "array") [ Ty.path "u32" ] ] - ] in + Ty.apply + (Ty.path "&") + [ + Ty.apply + (Ty.path "array") + [ Ty.path "u32" ] + [ Value.Integer Integer.Usize 0 ] + ] + []; + Ty.apply + (Ty.path "&") + [ + Ty.apply + (Ty.path "array") + [ Ty.path "u32" ] + [ Value.Integer Integer.Usize 0 ] + ] + [] + ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in @@ -367,9 +431,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α1 := M.get_trait_method "core::ops::index::Index" - (Ty.apply (Ty.path "array") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "array") [ Ty.path "u32" ] [ Value.Integer Integer.Usize 0 ]) [ Ty.path "core::ops::range::RangeFull" ] + [] "index" + [] [] in let* α2 := M.alloc (Value.Array []) in let* α3 := M.call_closure α1 [ α2; Value.StructTuple "core::ops::range::RangeFull" [] ] in @@ -392,9 +458,24 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "array") [ Ty.path "u32" ] ]) - [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "slice") [ Ty.path "u32" ] ] ] + (Ty.apply + (Ty.path "&") + [ + Ty.apply + (Ty.path "array") + [ Ty.path "u32" ] + [ Value.Integer Integer.Usize 0 ] + ] + []) + [ + Ty.apply + (Ty.path "&") + [ Ty.apply (Ty.path "slice") [ Ty.path "u32" ] [] ] + [] + ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read left_val in let* α2 := M.read right_val in @@ -409,9 +490,21 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_function "core::panicking::assert_failed" [ - Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "array") [ Ty.path "u32" ] ]; - Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "slice") [ Ty.path "u32" ] ] - ] in + Ty.apply + (Ty.path "&") + [ + Ty.apply + (Ty.path "array") + [ Ty.path "u32" ] + [ Value.Integer Integer.Usize 0 ] + ] + []; + Ty.apply + (Ty.path "&") + [ Ty.apply (Ty.path "slice") [ Ty.path "u32" ] [] ] + [] + ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in @@ -429,11 +522,18 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "usize" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "usize" ] []) + [] [] "into_iter" + [] [] in - let* α1 := M.get_associated_function (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) "len" [] in + let* α1 := + M.get_associated_function + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) + "len" + [] + [ Value.Bool true ] in let* α2 := (* Unsize *) M.pure (M.pointer_coercion xs) in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := BinOp.Panic.add α3 (Value.Integer Integer.Usize 1) in @@ -457,9 +557,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "usize" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "usize" ] []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -477,9 +579,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* i := M.copy γ0_0 in let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) "get" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α1 := (* Unsize *) M.pure (M.pointer_coercion xs) in let* α2 := M.read i in let* α3 := M.call_closure α0 [ α1; α2 ] in @@ -495,11 +598,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := 0 in let* xval := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α6 := (* Unsize *) @@ -515,13 +619,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α8 := M.call_closure α7 [ i ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] in let* α10 := M.call_closure α9 [ xval ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in M.pure (M.pointer_coercion α11) in @@ -531,11 +637,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []); fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -550,7 +657,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α7 := M.call_closure α6 [ i ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 15437153a..765e612bc 100644 --- a/CoqOfRust/examples/default/examples/rust_book/primitives/literals_operators.v +++ b/CoqOfRust/examples/default/examples/rust_book/primitives/literals_operators.v @@ -31,8 +31,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "1 + 2 = ") in @@ -46,7 +46,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := BinOp.Panic.add (Value.Integer Integer.U32 1) (Value.Integer Integer.U32 2) in let* α8 := M.alloc α7 in @@ -59,8 +60,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "1 - 2 = ") in @@ -74,7 +75,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := BinOp.Panic.sub (Value.Integer Integer.I32 1) (Value.Integer Integer.I32 2) in let* α8 := M.alloc α7 in @@ -87,8 +89,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "true AND false is ") in @@ -102,7 +104,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "bool" ] in + [ Ty.path "bool" ] + [] in let* α7 := LogicalOp.and (Value.Bool true) (M.pure (Value.Bool false)) in let* α8 := M.alloc α7 in let* α9 := M.call_closure α6 [ α8 ] in @@ -114,8 +117,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "true OR false is ") in @@ -129,7 +132,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "bool" ] in + [ Ty.path "bool" ] + [] in let* α7 := LogicalOp.or (Value.Bool true) (M.pure (Value.Bool false)) in let* α8 := M.alloc α7 in let* α9 := M.call_closure α6 [ α8 ] in @@ -141,8 +145,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "NOT true is ") in @@ -156,7 +160,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "bool" ] in + [ Ty.path "bool" ] + [] in let* α7 := M.alloc (UnOp.Pure.not (Value.Bool true)) in let* α8 := M.call_closure α6 [ α7 ] in let* α9 := M.alloc (Value.Array [ α8 ]) in @@ -167,9 +172,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1_formatted" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1_formatted" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "0011 AND 0101 is ") in @@ -183,7 +188,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_binary" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.alloc (BinOp.Pure.bit_and (Value.Integer Integer.U32 3) (Value.Integer Integer.U32 5)) in @@ -192,7 +198,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.pure (M.pointer_coercion α9) in let* α14 := (* Unsize *) - let* α11 := M.get_associated_function (Ty.path "core::fmt::rt::Placeholder") "new" [] in + let* α11 := + M.get_associated_function + (Ty.path "core::fmt::rt::Placeholder") + "new" + [] + [ Value.Bool true ] in let* α12 := M.call_closure α11 @@ -206,7 +217,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ] in let* α13 := M.alloc (Value.Array [ α12 ]) in M.pure (M.pointer_coercion α13) in - let* α15 := M.get_associated_function (Ty.path "core::fmt::rt::UnsafeArg") "new" [] in + let* α15 := M.get_associated_function (Ty.path "core::fmt::rt::UnsafeArg") "new" [] [] in let* α16 := M.call_closure α15 [] in let* α17 := M.call_closure α1 [ α5; α10; α14; α16 ] in let* α18 := M.call_closure α0 [ α17 ] in @@ -214,9 +225,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1_formatted" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1_formatted" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "0011 OR 0101 is ") in @@ -230,7 +241,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_binary" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.alloc (BinOp.Pure.bit_or (Value.Integer Integer.U32 3) (Value.Integer Integer.U32 5)) in @@ -239,7 +251,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.pure (M.pointer_coercion α9) in let* α14 := (* Unsize *) - let* α11 := M.get_associated_function (Ty.path "core::fmt::rt::Placeholder") "new" [] in + let* α11 := + M.get_associated_function + (Ty.path "core::fmt::rt::Placeholder") + "new" + [] + [ Value.Bool true ] in let* α12 := M.call_closure α11 @@ -253,7 +270,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ] in let* α13 := M.alloc (Value.Array [ α12 ]) in M.pure (M.pointer_coercion α13) in - let* α15 := M.get_associated_function (Ty.path "core::fmt::rt::UnsafeArg") "new" [] in + let* α15 := M.get_associated_function (Ty.path "core::fmt::rt::UnsafeArg") "new" [] [] in let* α16 := M.call_closure α15 [] in let* α17 := M.call_closure α1 [ α5; α10; α14; α16 ] in let* α18 := M.call_closure α0 [ α17 ] in @@ -261,9 +278,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1_formatted" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1_formatted" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "0011 XOR 0101 is ") in @@ -277,7 +294,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_binary" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.alloc (BinOp.Pure.bit_xor (Value.Integer Integer.U32 3) (Value.Integer Integer.U32 5)) in @@ -286,7 +304,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.pure (M.pointer_coercion α9) in let* α14 := (* Unsize *) - let* α11 := M.get_associated_function (Ty.path "core::fmt::rt::Placeholder") "new" [] in + let* α11 := + M.get_associated_function + (Ty.path "core::fmt::rt::Placeholder") + "new" + [] + [ Value.Bool true ] in let* α12 := M.call_closure α11 @@ -300,7 +323,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ] in let* α13 := M.alloc (Value.Array [ α12 ]) in M.pure (M.pointer_coercion α13) in - let* α15 := M.get_associated_function (Ty.path "core::fmt::rt::UnsafeArg") "new" [] in + let* α15 := M.get_associated_function (Ty.path "core::fmt::rt::UnsafeArg") "new" [] [] in let* α16 := M.call_closure α15 [] in let* α17 := M.call_closure α1 [ α5; α10; α14; α16 ] in let* α18 := M.call_closure α0 [ α17 ] in @@ -308,8 +331,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "1 << 5 is ") in @@ -323,7 +346,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := BinOp.Panic.shl (Value.Integer Integer.U32 1) (Value.Integer Integer.I32 5) in let* α8 := M.alloc α7 in @@ -336,8 +360,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "0x80 >> 2 is 0x") in @@ -351,7 +375,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_lower_hex" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := BinOp.Panic.shr (Value.Integer Integer.U32 128) (Value.Integer Integer.I32 2) in let* α8 := M.alloc α7 in @@ -364,8 +389,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "One million is written as 1000000 @@ -374,7 +399,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.pure (M.pointer_coercion α3) in let* α8 := (* Unsize *) - let* α5 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "none" [] in + let* α5 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "none" [] [] in let* α6 := M.call_closure α5 [] in let* α7 := M.alloc α6 in M.pure (M.pointer_coercion α7) in diff --git a/CoqOfRust/examples/default/examples/rust_book/primitives/tuples.v b/CoqOfRust/examples/default/examples/rust_book/primitives/tuples.v index 118dcfc3b..fed157dfb 100644 --- a/CoqOfRust/examples/default/examples/rust_book/primitives/tuples.v +++ b/CoqOfRust/examples/default/examples/rust_book/primitives/tuples.v @@ -49,7 +49,11 @@ Module Impl_core_fmt_Debug_for_tuples_Matrix. let* self := M.alloc self in let* f := M.alloc f in let* α0 := - M.get_associated_function (Ty.path "core::fmt::Formatter") "debug_tuple_field4_finish" [] in + M.get_associated_function + (Ty.path "core::fmt::Formatter") + "debug_tuple_field4_finish" + [] + [] in let* α1 := M.read f in let* α2 := M.read (mk_str "Matrix") in let* α4 := @@ -149,8 +153,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "long tuple first value: ") in @@ -164,7 +168,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u8" ] in + [ Ty.path "u8" ] + [] in let* α7 := M.call_closure α6 [ M.get_tuple_field long_tuple 0 ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -174,8 +179,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "long tuple second value: ") in @@ -189,7 +194,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u16" ] in + [ Ty.path "u16" ] + [] in let* α7 := M.call_closure α6 [ M.get_tuple_field long_tuple 1 ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -209,8 +215,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "tuple of tuples: ") in @@ -231,7 +237,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.tuple [ Ty.path "u64"; Ty.path "i8" ]; Ty.path "i16" ] - ] in + ] + [] in let* α7 := M.call_closure α6 [ tuple_of_tuples ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -242,8 +249,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* pair_ := M.alloc (Value.Tuple [ Value.Integer Integer.I32 1; Value.Bool true ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "pair is ") in @@ -257,7 +264,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.tuple [ Ty.path "i32"; Ty.path "bool" ] ] in + [ Ty.tuple [ Ty.path "i32"; Ty.path "bool" ] ] + [] in let* α7 := M.call_closure α6 [ pair_ ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -267,8 +275,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "the reversed pair is ") in @@ -282,8 +290,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.tuple [ Ty.path "bool"; Ty.path "i32" ] ] in - let* α7 := M.get_function "tuples::reverse" [] in + [ Ty.tuple [ Ty.path "bool"; Ty.path "i32" ] ] + [] in + let* α7 := M.get_function "tuples::reverse" [] [] in let* α8 := M.read pair_ in let* α9 := M.call_closure α7 [ α8 ] in let* α10 := M.alloc α9 in @@ -296,8 +305,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "one element tuple: ") in @@ -311,7 +320,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.tuple [ Ty.path "u32" ] ] in + [ Ty.tuple [ Ty.path "u32" ] ] + [] in let* α7 := M.alloc (Value.Tuple [ Value.Integer Integer.U32 5 ]) in let* α8 := M.call_closure α6 [ α7 ] in let* α9 := M.alloc (Value.Array [ α8 ]) in @@ -322,8 +332,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "just an integer: ") in @@ -337,7 +347,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.alloc (Value.Integer Integer.U32 5) in let* α8 := M.call_closure α6 [ α7 ] in let* α9 := M.alloc (Value.Array [ α8 ]) in @@ -365,8 +376,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* d := M.copy γ0_3 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α8 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -383,25 +395,29 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α10 := M.call_closure α9 [ a ] in let* α11 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α12 := M.call_closure α11 [ b ] in let* α13 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "f64" ] in + [ Ty.path "f64" ] + [] in let* α14 := M.call_closure α13 [ c ] in let* α15 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "bool" ] in + [ Ty.path "bool" ] + [] in let* α16 := M.call_closure α15 [ d ] in let* α17 := M.alloc (Value.Array [ α10; α12; α14; α16 ]) in M.pure (M.pointer_coercion α17) in @@ -417,8 +433,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.StructTuple "tuples::Matrix" [ α0; α1; α2; α3 ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -432,7 +449,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "tuples::Matrix" ] in + [ Ty.path "tuples::Matrix" ] + [] in let* α7 := M.call_closure α6 [ matrix ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 f5b801897..17cea155b 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 @@ -12,8 +12,8 @@ Definition eat_box_i32 (τ : list Ty.t) (α : list Value.t) : M := let* boxed_i32 := M.alloc boxed_i32 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Destroying box that contains ") in @@ -31,7 +31,9 @@ Definition eat_box_i32 (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ boxed_i32 ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -55,8 +57,8 @@ Definition borrow_i32 (τ : list Ty.t) (α : list Value.t) : M := let* borrowed_i32 := M.alloc borrowed_i32 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "This int is: ") in @@ -70,7 +72,8 @@ Definition borrow_i32 (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] in let* α7 := M.call_closure α6 [ borrowed_i32 ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -118,19 +121,23 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* boxed_i32 := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::boxed::Box") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.I32 5 ] in M.alloc α1 in let* stacked_i32 := M.alloc (Value.Integer Integer.I32 6) in let* _ := - let* α0 := M.get_function "scoping_rules_borrowing::borrow_i32" [] in + let* α0 := M.get_function "scoping_rules_borrowing::borrow_i32" [] [] in let* α1 := M.read boxed_i32 in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := - let* α0 := M.get_function "scoping_rules_borrowing::borrow_i32" [] in + let* α0 := M.get_function "scoping_rules_borrowing::borrow_i32" [] [] in let* α1 := M.call_closure α0 [ stacked_i32 ] in M.alloc α1 in let* _ := @@ -138,13 +145,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.read boxed_i32 in M.alloc α0 in let* _ := - let* α0 := M.get_function "scoping_rules_borrowing::borrow_i32" [] in + let* α0 := M.get_function "scoping_rules_borrowing::borrow_i32" [] [] in let* α1 := M.read _ref_to_i32 in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in M.alloc (Value.Tuple []) in let* _ := - let* α0 := M.get_function "scoping_rules_borrowing::eat_box_i32" [] in + let* α0 := M.get_function "scoping_rules_borrowing::eat_box_i32" [] [] in let* α1 := M.read boxed_i32 in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in 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 8ea02a9a2..0f2e6d5a3 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 @@ -81,8 +81,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* another_borrow := M.alloc point in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α7 := (* Unsize *) let* α2 := M.read (mk_str "Point has coordinates: (") in @@ -98,7 +98,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α9 := M.read borrowed_point in let* α10 := M.call_closure @@ -108,7 +109,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α12 := M.read another_borrow in let* α13 := M.call_closure @@ -118,7 +120,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α15 := M.call_closure α14 @@ -131,8 +134,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α7 := (* Unsize *) let* α2 := M.read (mk_str "Point has coordinates: (") in @@ -148,7 +151,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α9 := M.read borrowed_point in let* α10 := M.call_closure @@ -158,7 +162,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α12 := M.read another_borrow in let* α13 := M.call_closure @@ -168,7 +173,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α15 := M.call_closure α14 @@ -197,8 +203,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Value.Integer Integer.I32 1) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α7 := (* Unsize *) let* α2 := M.read (mk_str "Point has coordinates: (") in @@ -214,7 +220,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α9 := M.read mutable_borrow in let* α10 := M.call_closure @@ -224,7 +231,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α12 := M.read mutable_borrow in let* α13 := M.call_closure @@ -234,7 +242,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α15 := M.read mutable_borrow in let* α16 := M.call_closure @@ -249,8 +258,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* new_borrowed_point := M.alloc point in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α7 := (* Unsize *) let* α2 := M.read (mk_str "Point now has coordinates: (") in @@ -266,7 +275,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α9 := M.read new_borrowed_point in let* α10 := M.call_closure @@ -276,7 +286,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α12 := M.read new_borrowed_point in let* α13 := M.call_closure @@ -286,7 +297,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α15 := M.read new_borrowed_point in let* α16 := M.call_closure 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 3d4250bd3..8ef8046d0 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 @@ -7,8 +7,8 @@ Require Import CoqOfRust.CoqOfRust. ty_params := []; fields := [ - ("author", Ty.apply (Ty.path "&") [ Ty.path "str" ]); - ("title", Ty.apply (Ty.path "&") [ Ty.path "str" ]); + ("author", Ty.apply (Ty.path "&") [ Ty.path "str" ] []); + ("title", Ty.apply (Ty.path "&") [ Ty.path "str" ] []); ("year", Ty.path "u32") ]; } *) @@ -65,8 +65,8 @@ Definition borrow_book (τ : list Ty.t) (α : list Value.t) : M := let* book := M.alloc book in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "I immutably borrowed ") in @@ -81,7 +81,8 @@ Definition borrow_book (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α8 := M.read book in let* α9 := M.call_closure @@ -92,7 +93,8 @@ Definition borrow_book (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α11 := M.read book in let* α12 := M.call_closure @@ -127,8 +129,8 @@ Definition new_edition (τ : list Ty.t) (α : list Value.t) : M := (Value.Integer Integer.U32 2014) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "I mutably borrowed ") in @@ -143,7 +145,8 @@ Definition new_edition (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α8 := M.read book in let* α9 := M.call_closure @@ -154,7 +157,8 @@ Definition new_edition (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α11 := M.read book in let* α12 := M.call_closure @@ -211,15 +215,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ ("author", α0); ("title", α1); ("year", Value.Integer Integer.U32 1979) ]) in let* mutabook := M.copy immutabook in let* _ := - let* α0 := M.get_function "scoping_rules_borrowing_mutablity::borrow_book" [] in + let* α0 := M.get_function "scoping_rules_borrowing_mutablity::borrow_book" [] [] in let* α1 := M.call_closure α0 [ immutabook ] in M.alloc α1 in let* _ := - let* α0 := M.get_function "scoping_rules_borrowing_mutablity::borrow_book" [] in + let* α0 := M.get_function "scoping_rules_borrowing_mutablity::borrow_book" [] [] in let* α1 := M.call_closure α0 [ mutabook ] in M.alloc α1 in let* _ := - let* α0 := M.get_function "scoping_rules_borrowing_mutablity::new_edition" [] in + let* α0 := M.get_function "scoping_rules_borrowing_mutablity::new_edition" [] [] in let* α1 := M.call_closure α0 [ mutabook ] in M.alloc α1 in let* α0 := M.alloc (Value.Tuple []) in 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 3f18f1bc3..e3ae86bc9 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 @@ -108,8 +108,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* ref_c2 := M.alloc c in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "ref_c1 equals ref_c2: ") in @@ -123,7 +124,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "bool" ] in + [ Ty.path "bool" ] + [] in let* α7 := M.read ref_c1 in let* α8 := M.read α7 in let* α9 := M.read ref_c2 in @@ -185,8 +187,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ] in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "point is (") in @@ -201,7 +204,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α8 := M.call_closure α7 @@ -215,7 +219,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α10 := M.call_closure α9 @@ -233,8 +238,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "mutable_point is (") in @@ -249,7 +255,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α8 := M.call_closure α7 @@ -263,7 +270,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α10 := M.call_closure α9 @@ -284,8 +292,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.U32 5 ] in M.alloc (Value.Tuple [ α1; Value.Integer Integer.U32 3 ]) in @@ -304,8 +314,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ] in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "tuple is ") in @@ -324,10 +335,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ]; + [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ] + []; Ty.path "u32" ] - ] in + ] + [] in let* α7 := M.call_closure α6 [ mutable_tuple ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 c2a9d4302..a13127a49 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 @@ -30,8 +30,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* borrow1 := M.alloc i in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "borrow1: ") in @@ -45,7 +45,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] in let* α7 := M.call_closure α6 [ borrow1 ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -57,8 +58,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* borrow2 := M.alloc i in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "borrow2: ") in @@ -72,7 +73,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] in let* α7 := M.call_closure α6 [ borrow2 ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 17cef388d..fda11f97e 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 @@ -5,12 +5,12 @@ Require Import CoqOfRust.CoqOfRust. { name := "Ref"; ty_params := [ "T" ]; - fields := [ Ty.apply (Ty.path "&") [ T ] ]; + fields := [ Ty.apply (Ty.path "&") [ T ] [] ]; } *) Module Impl_core_fmt_Debug_for_scoping_rules_lifetimes_bounds_Ref_T. Definition Self (T : Ty.t) : Ty.t := - Ty.apply (Ty.path "scoping_rules_lifetimes_bounds::Ref") [ T ]. + Ty.apply (Ty.path "scoping_rules_lifetimes_bounds::Ref") [ T ] []. (* Debug @@ -22,7 +22,11 @@ Module Impl_core_fmt_Debug_for_scoping_rules_lifetimes_bounds_Ref_T. let* self := M.alloc self in let* f := M.alloc f in let* α0 := - M.get_associated_function (Ty.path "core::fmt::Formatter") "debug_tuple_field1_finish" [] in + M.get_associated_function + (Ty.path "core::fmt::Formatter") + "debug_tuple_field1_finish" + [] + [] in let* α1 := M.read f in let* α2 := M.read (mk_str "Ref") in let* α5 := @@ -58,8 +62,8 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := let* t := M.alloc t in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "`print`: t is ") in @@ -70,7 +74,7 @@ Definition print (τ : list Ty.t) (α : list Value.t) : M := let* α9 := (* Unsize *) let* α6 := - M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" [ T ] in + M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" [ T ] [] in let* α7 := M.call_closure α6 [ t ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -97,8 +101,8 @@ Definition print_ref (τ : list Ty.t) (α : list Value.t) : M := let* t := M.alloc t in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "`print_ref`: t is ") in @@ -112,7 +116,8 @@ Definition print_ref (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "&") [ T ] ] in + [ Ty.apply (Ty.path "&") [ T ] [] ] + [] in let* α7 := M.call_closure α6 [ t ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -143,14 +148,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "scoping_rules_lifetimes_bounds::print_ref" - [ Ty.apply (Ty.path "scoping_rules_lifetimes_bounds::Ref") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "scoping_rules_lifetimes_bounds::Ref") [ Ty.path "i32" ] [] ] + [] in let* α1 := M.call_closure α0 [ ref_x ] in M.alloc α1 in let* _ := let* α0 := M.get_function "scoping_rules_lifetimes_bounds::print" - [ Ty.apply (Ty.path "scoping_rules_lifetimes_bounds::Ref") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "scoping_rules_lifetimes_bounds::Ref") [ Ty.path "i32" ] [] ] + [] in let* α1 := M.read ref_x in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in 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 724abc367..e4e9f37cd 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 @@ -14,9 +14,11 @@ Definition multiply (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::ops::arith::Mul" - (Ty.apply (Ty.path "&") [ Ty.path "i32" ]) - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] + (Ty.apply (Ty.path "&") [ Ty.path "i32" ] []) + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] "mul" + [] [] in let* α1 := M.read first in let* α2 := M.read second in @@ -58,8 +60,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* second := M.alloc (Value.Integer Integer.I32 3) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The product is ") in @@ -73,8 +75,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in - let* α7 := M.get_function "scoping_rules_lifetimes_coercion::multiply" [] in + [ Ty.path "i32" ] + [] in + let* α7 := M.get_function "scoping_rules_lifetimes_coercion::multiply" [] [] in let* α8 := M.call_closure α7 [ first; second ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in @@ -86,8 +89,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -101,8 +104,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] in - let* α7 := M.get_function "scoping_rules_lifetimes_coercion::choose_first" [] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] in + let* α7 := M.get_function "scoping_rules_lifetimes_coercion::choose_first" [] [] in let* α8 := M.call_closure α7 [ first; second ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in 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 77448e002..3b0387c3b 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 @@ -12,8 +12,8 @@ Definition elided_input (τ : list Ty.t) (α : list Value.t) : M := let* x := M.alloc x in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "`elided_input`: ") in @@ -27,7 +27,8 @@ Definition elided_input (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] in let* α7 := M.call_closure α6 [ x ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -51,8 +52,8 @@ Definition annotated_input (τ : list Ty.t) (α : list Value.t) : M := let* x := M.alloc x in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "`annotated_input`: ") in @@ -66,7 +67,8 @@ Definition annotated_input (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] in let* α7 := M.call_closure α6 [ x ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -121,17 +123,17 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* x := M.alloc (Value.Integer Integer.I32 3) in let* _ := - let* α0 := M.get_function "scoping_rules_lifetimes_elision::elided_input" [] in + let* α0 := M.get_function "scoping_rules_lifetimes_elision::elided_input" [] [] in let* α1 := M.call_closure α0 [ x ] in M.alloc α1 in let* _ := - let* α0 := M.get_function "scoping_rules_lifetimes_elision::annotated_input" [] in + let* α0 := M.get_function "scoping_rules_lifetimes_elision::annotated_input" [] [] in let* α1 := M.call_closure α0 [ x ] in M.alloc α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "`elided_pass`: ") in @@ -145,8 +147,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] in - let* α7 := M.get_function "scoping_rules_lifetimes_elision::elided_pass" [] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] in + let* α7 := M.get_function "scoping_rules_lifetimes_elision::elided_pass" [] [] in let* α8 := M.call_closure α7 [ x ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in @@ -158,8 +161,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "`annotated_pass`: ") in @@ -173,8 +176,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] in - let* α7 := M.get_function "scoping_rules_lifetimes_elision::annotated_pass" [] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] in + let* α7 := M.get_function "scoping_rules_lifetimes_elision::annotated_pass" [] [] in let* α8 := M.call_closure α7 [ x ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in 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 ff8aa9168..6bc989c36 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 @@ -12,8 +12,8 @@ Definition print_one (τ : list Ty.t) (α : list Value.t) : M := let* x := M.alloc x in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "`print_one`: x is ") in @@ -27,7 +27,8 @@ Definition print_one (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] in let* α7 := M.call_closure α6 [ x ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -71,8 +72,8 @@ Definition print_multi (τ : list Ty.t) (α : list Value.t) : M := let* y := M.alloc y in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "`print_multi`: x is ") in @@ -87,13 +88,15 @@ Definition print_multi (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] in let* α8 := M.call_closure α7 [ x ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] in let* α10 := M.call_closure α9 [ y ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in M.pure (M.pointer_coercion α11) in @@ -142,29 +145,29 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* x := M.alloc (Value.Integer Integer.I32 7) in let* y := M.alloc (Value.Integer Integer.I32 9) in let* _ := - let* α0 := M.get_function "scoping_rules_lifetimes_functions::print_one" [] in + let* α0 := M.get_function "scoping_rules_lifetimes_functions::print_one" [] [] in let* α1 := M.call_closure α0 [ x ] in M.alloc α1 in let* _ := - let* α0 := M.get_function "scoping_rules_lifetimes_functions::print_multi" [] in + let* α0 := M.get_function "scoping_rules_lifetimes_functions::print_multi" [] [] in let* α1 := M.call_closure α0 [ x; y ] in M.alloc α1 in let* z := - let* α0 := M.get_function "scoping_rules_lifetimes_functions::pass_x" [] in + let* α0 := M.get_function "scoping_rules_lifetimes_functions::pass_x" [] [] in let* α1 := M.call_closure α0 [ x; y ] in M.alloc α1 in let* _ := - let* α0 := M.get_function "scoping_rules_lifetimes_functions::print_one" [] in + let* α0 := M.get_function "scoping_rules_lifetimes_functions::print_one" [] [] in let* α1 := M.read z in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* t := M.alloc (Value.Integer Integer.I32 3) in let* _ := - let* α0 := M.get_function "scoping_rules_lifetimes_functions::add_one" [] in + let* α0 := M.get_function "scoping_rules_lifetimes_functions::add_one" [] [] in let* α1 := M.call_closure α0 [ t ] in M.alloc α1 in let* _ := - let* α0 := M.get_function "scoping_rules_lifetimes_functions::print_one" [] in + let* α0 := M.get_function "scoping_rules_lifetimes_functions::print_one" [] [] in let* α1 := M.call_closure α0 [ t ] in M.alloc α1 in let* α0 := M.alloc (Value.Tuple []) in 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 d1ed0c0d9..0ac8b0bde 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 @@ -45,8 +45,8 @@ Module Impl_scoping_rules_lifetimes_methods_Owner. let* self := M.alloc self in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "`print`: ") in @@ -60,7 +60,8 @@ Module Impl_scoping_rules_lifetimes_methods_Owner. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.read self in let* α8 := M.call_closure @@ -98,12 +99,20 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Value.Integer Integer.I32 18 ]) in let* _ := let* α0 := - M.get_associated_function (Ty.path "scoping_rules_lifetimes_methods::Owner") "add_one" [] in + M.get_associated_function + (Ty.path "scoping_rules_lifetimes_methods::Owner") + "add_one" + [] + [] in let* α1 := M.call_closure α0 [ owner ] in M.alloc α1 in let* _ := let* α0 := - M.get_associated_function (Ty.path "scoping_rules_lifetimes_methods::Owner") "print" [] in + M.get_associated_function + (Ty.path "scoping_rules_lifetimes_methods::Owner") + "print" + [] + [] in let* α1 := M.call_closure α0 [ owner ] in M.alloc α1 in let* α0 := M.alloc (Value.Tuple []) in 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 f7af7ac0c..20518865c 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 @@ -56,8 +56,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* static_string := M.copy (mk_str "I'm in read-only memory") in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "static_string: ") in @@ -71,7 +71,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ static_string ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -84,13 +85,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* lifetime_num := M.alloc (Value.Integer Integer.I32 9) in let* coerced_static := let* α0 := - M.get_function "scoping_rules_lifetimes_reference_lifetime_static::coerce_static" [] in + M.get_function "scoping_rules_lifetimes_reference_lifetime_static::coerce_static" [] [] in let* α1 := M.call_closure α0 [ lifetime_num ] in M.alloc α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "coerced_static: ") in @@ -104,7 +105,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] in let* α7 := M.call_closure α6 [ coerced_static ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -115,8 +117,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "NUM: ") in @@ -130,7 +132,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.get_constant "scoping_rules_lifetimes_reference_lifetime_static::NUM" in let* α8 := M.read α7 in let* α9 := M.call_closure α6 [ α8 ] in 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 eaefe5cbd..3f4ff478a 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 @@ -5,7 +5,7 @@ Require Import CoqOfRust.CoqOfRust. { name := "Borrowed"; ty_params := []; - fields := [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ]; + fields := [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ]; } *) Module Impl_core_fmt_Debug_for_scoping_rules_lifetimes_structs_Borrowed. @@ -20,7 +20,11 @@ Module Impl_core_fmt_Debug_for_scoping_rules_lifetimes_structs_Borrowed. let* self := M.alloc self in let* f := M.alloc f in let* α0 := - M.get_associated_function (Ty.path "core::fmt::Formatter") "debug_tuple_field1_finish" [] in + M.get_associated_function + (Ty.path "core::fmt::Formatter") + "debug_tuple_field1_finish" + [] + [] in let* α1 := M.read f in let* α2 := M.read (mk_str "Borrowed") in let* α5 := @@ -47,8 +51,8 @@ End Impl_core_fmt_Debug_for_scoping_rules_lifetimes_structs_Borrowed. ty_params := []; fields := [ - ("x", Ty.apply (Ty.path "&") [ Ty.path "i32" ]); - ("y", Ty.apply (Ty.path "&") [ Ty.path "i32" ]) + ("x", Ty.apply (Ty.path "&") [ Ty.path "i32" ] []); + ("y", Ty.apply (Ty.path "&") [ Ty.path "i32" ] []) ]; } *) @@ -67,6 +71,7 @@ Module Impl_core_fmt_Debug_for_scoping_rules_lifetimes_structs_NamedBorrowed. M.get_associated_function (Ty.path "core::fmt::Formatter") "debug_struct_field2_finish" + [] [] in let* α1 := M.read f in let* α2 := M.read (mk_str "NamedBorrowed") in @@ -112,7 +117,7 @@ End Impl_core_fmt_Debug_for_scoping_rules_lifetimes_structs_NamedBorrowed. }; { name := "Ref"; - item := StructTuple [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ]; + item := StructTuple [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ]; discriminant := None; } ]; @@ -145,6 +150,7 @@ Module Impl_core_fmt_Debug_for_scoping_rules_lifetimes_structs_Either. M.get_associated_function (Ty.path "core::fmt::Formatter") "debug_tuple_field1_finish" + [] [] in let* α1 := M.read f in let* α2 := M.read (mk_str "Num") in @@ -163,6 +169,7 @@ Module Impl_core_fmt_Debug_for_scoping_rules_lifetimes_structs_Either. M.get_associated_function (Ty.path "core::fmt::Formatter") "debug_tuple_field1_finish" + [] [] in let* α1 := M.read f in let* α2 := M.read (mk_str "Ref") in @@ -216,8 +223,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.StructTuple "scoping_rules_lifetimes_structs::Either::Num" [ α0 ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "x is borrowed in ") in @@ -231,7 +238,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "scoping_rules_lifetimes_structs::Borrowed" ] in + [ Ty.path "scoping_rules_lifetimes_structs::Borrowed" ] + [] in let* α7 := M.call_closure α6 [ single ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -241,8 +249,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "x and y are borrowed in ") in @@ -256,7 +264,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "scoping_rules_lifetimes_structs::NamedBorrowed" ] in + [ Ty.path "scoping_rules_lifetimes_structs::NamedBorrowed" ] + [] in let* α7 := M.call_closure α6 [ double ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -266,8 +275,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "x is borrowed in ") in @@ -281,7 +290,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "scoping_rules_lifetimes_structs::Either" ] in + [ Ty.path "scoping_rules_lifetimes_structs::Either" ] + [] in let* α7 := M.call_closure α6 [ reference ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -291,8 +301,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "y is *not* borrowed in ") in @@ -306,7 +316,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "scoping_rules_lifetimes_structs::Either" ] in + [ Ty.path "scoping_rules_lifetimes_structs::Either" ] + [] in let* α7 := M.call_closure α6 [ number ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 4049a68e8..bae7e7d41 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 @@ -5,7 +5,7 @@ Require Import CoqOfRust.CoqOfRust. { name := "Borrowed"; ty_params := []; - fields := [ ("x", Ty.apply (Ty.path "&") [ Ty.path "i32" ]) ]; + fields := [ ("x", Ty.apply (Ty.path "&") [ Ty.path "i32" ] []) ]; } *) Module Impl_core_fmt_Debug_for_scoping_rules_lifetimes_traits_Borrowed. @@ -23,6 +23,7 @@ Module Impl_core_fmt_Debug_for_scoping_rules_lifetimes_traits_Borrowed. M.get_associated_function (Ty.path "core::fmt::Formatter") "debug_struct_field1_finish" + [] [] in let* α1 := M.read f in let* α2 := M.read (mk_str "Borrowed") in @@ -84,14 +85,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::default::Default" (Ty.path "scoping_rules_lifetimes_traits::Borrowed") [] + [] "default" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "b is ") in @@ -105,7 +108,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "scoping_rules_lifetimes_traits::Borrowed" ] in + [ Ty.path "scoping_rules_lifetimes_traits::Borrowed" ] + [] in let* α7 := M.call_closure α6 [ b ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 3679a8f78..5b2df9ff7 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 @@ -14,8 +14,8 @@ Definition destroy_box (τ : list Ty.t) (α : list Value.t) : M := let* c := M.alloc c in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Destroying a box that contains ") in @@ -33,7 +33,9 @@ Definition destroy_box (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ c ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -90,8 +92,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* y := M.copy x in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "x is ") in @@ -106,13 +108,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α8 := M.call_closure α7 [ x ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α10 := M.call_closure α9 [ y ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in M.pure (M.pointer_coercion α11) in @@ -123,15 +127,19 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* a := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::boxed::Box") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.I32 5 ] in M.alloc α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "a contains: ") in @@ -149,7 +157,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ a ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -159,7 +169,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* b := M.copy a in let* _ := - let* α0 := M.get_function "scoping_rules_ownership_and_rules::destroy_box" [] in + let* α0 := M.get_function "scoping_rules_ownership_and_rules::destroy_box" [] [] in let* α1 := M.read b in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in 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 eb2fa1d20..06baf28d2 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 @@ -27,15 +27,19 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* immutable_box := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::boxed::Box") + [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.U32 5 ] in M.alloc α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "immutable_box contains ") in @@ -53,7 +57,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ immutable_box ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -64,8 +70,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* mutable_box := M.copy immutable_box in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "mutable_box contains ") in @@ -83,7 +89,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ mutable_box ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -96,8 +104,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.assign α0 (Value.Integer Integer.U32 4) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "mutable_box now contains ") in @@ -115,7 +123,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ mutable_box ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 c7aee79df..26b7cb269 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 @@ -36,15 +36,21 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_trait_method "core::convert::From" (Ty.path "alloc::string::String") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] "from" + [] [] in let* α1 := M.read (mk_str "Alice") in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.get_associated_function - (Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::boxed::Box") + [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α4 := M.call_closure α3 [ Value.Integer Integer.U8 20 ] in M.alloc @@ -70,8 +76,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* age := M.alloc γ0_1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The person's age is ") in @@ -92,8 +99,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] + [] ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ age ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -103,8 +113,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The person's name is ") in @@ -118,7 +129,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α7 := M.call_closure α6 [ name ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -128,8 +140,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "The person's age from person struct is ") in @@ -147,7 +160,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 @@ -178,7 +193,10 @@ Module main. [ ("name", Ty.path "alloc::string::String"); ("age", - Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ]) + Ty.apply + (Ty.path "alloc::boxed::Box") + [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] + []) ]; } *) @@ -198,6 +216,7 @@ Module main. M.get_associated_function (Ty.path "core::fmt::Formatter") "debug_struct_field2_finish" + [] [] in let* α1 := M.read f in let* α2 := M.read (mk_str "Person") in 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 a4bd97e60..13f836423 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 @@ -15,8 +15,12 @@ Definition create_box (τ : list Ty.t) (α : list Value.t) : M := let* _box1 := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::boxed::Box") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.I32 3 ] in M.alloc α1 in @@ -53,8 +57,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* _box2 := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::boxed::Box") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.I32 5 ] in M.alloc α1 in @@ -64,8 +72,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.I32 4 ] in M.alloc α1 in @@ -73,9 +83,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "u32" ] []) + [] [] "into_iter" + [] [] in let* α1 := M.call_closure @@ -97,9 +109,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "u32" ] []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -115,7 +129,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::option::Option::Some" 0 in let* _ := - let* α0 := M.get_function "scoping_rules_raii::create_box" [] in + let* α0 := M.get_function "scoping_rules_raii::create_box" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in M.alloc (Value.Tuple []) 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 10e8919e1..2f1210bd7 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 @@ -21,8 +21,13 @@ Module Impl_core_ops_drop_Drop_for_scoping_rules_raii_desctructor_ToDrop. let* self := M.alloc self in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "ToDrop is being dropped @@ -58,8 +63,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* x := M.alloc (Value.StructTuple "scoping_rules_raii_desctructor::ToDrop" []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Made a ToDrop! 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 7f62df320..cc6f68353 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 @@ -30,8 +30,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "alloc::sync::Arc") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "alloc::alloc::Global" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.read (mk_str "the same apple") in let* α2 := M.call_closure α0 [ α1 ] in @@ -40,9 +42,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ] []) + [] [] "into_iter" + [] [] in let* α1 := M.call_closure @@ -64,9 +68,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ] []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -91,11 +97,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::sync::Arc") [ - Ty.apply (Ty.path "&") [ Ty.path "str" ]; + Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "alloc::alloc::Global" - ]) + ] + []) + [] [] "clone" + [] [] in let* α1 := M.call_closure α0 [ apple ] in M.alloc α1 in @@ -103,7 +112,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "std::thread::spawn" - [ Ty.function [ Ty.tuple [] ] (Ty.tuple []); Ty.tuple [] ] in + [ Ty.function [ Ty.tuple [] ] (Ty.tuple []); Ty.tuple [] ] + [] in let* α1 := M.call_closure α0 @@ -120,11 +130,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* _ := let* _ := let* α0 := - M.get_function "std::io::stdio::_print" [] in + M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -145,10 +156,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "&") - [ Ty.path "str" ]; + [ Ty.path "str" ] + []; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ apple ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -169,8 +183,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ] in M.pure (M.use α3) in let* _ := - let* α0 := M.get_function "std::thread::sleep" [] in - let* α1 := M.get_associated_function (Ty.path "core::time::Duration") "from_secs" [] in + let* α0 := M.get_function "std::thread::sleep" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::time::Duration") + "from_secs" + [] + [ Value.Bool true ] in let* α2 := M.call_closure α1 [ Value.Integer Integer.U64 1 ] in let* α3 := M.call_closure α0 [ α2 ] in M.alloc α3 in 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 446bce741..c8d836790 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 @@ -23,6 +23,7 @@ Module Impl_core_fmt_Debug_for_box_stack_heap_Point. M.get_associated_function (Ty.path "core::fmt::Formatter") "debug_struct_field2_finish" + [] [] in let* α1 := M.read f in let* α2 := M.read (mk_str "Point") in @@ -117,8 +118,10 @@ Definition boxed_origin (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.path "box_stack_heap::Point"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "box_stack_heap::Point"; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.read UnsupportedLiteral in let* α2 := M.read UnsupportedLiteral in @@ -183,11 +186,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* point := - let* α0 := M.get_function "box_stack_heap::origin" [] in + let* α0 := M.get_function "box_stack_heap::origin" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* rectangle := - let* α0 := M.get_function "box_stack_heap::origin" [] in + let* α0 := M.get_function "box_stack_heap::origin" [] [] in let* α1 := M.call_closure α0 [] in let* α2 := M.read UnsupportedLiteral in let* α3 := M.read UnsupportedLiteral in @@ -203,10 +206,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.path "box_stack_heap::Rectangle"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "box_stack_heap::Rectangle"; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in - let* α1 := M.get_function "box_stack_heap::origin" [] in + let* α1 := M.get_function "box_stack_heap::origin" [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.read UnsupportedLiteral in let* α4 := M.read UnsupportedLiteral in @@ -228,10 +233,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.path "box_stack_heap::Point"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "box_stack_heap::Point"; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in - let* α1 := M.get_function "box_stack_heap::origin" [] in + let* α1 := M.get_function "box_stack_heap::origin" [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.call_closure α0 [ α2 ] in M.alloc α3 in @@ -243,19 +250,22 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.path "box_stack_heap::Point"; Ty.path "alloc::alloc::Global" ]; + [ Ty.path "box_stack_heap::Point"; Ty.path "alloc::alloc::Global" ] + []; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in - let* α1 := M.get_function "box_stack_heap::boxed_origin" [] in + let* α1 := M.get_function "box_stack_heap::boxed_origin" [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.call_closure α0 [ α2 ] in M.alloc α3 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Point occupies ") in @@ -269,9 +279,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α7 := - M.get_function "core::mem::size_of_val" [ Ty.path "box_stack_heap::Point" ] in + M.get_function + "core::mem::size_of_val" + [ Ty.path "box_stack_heap::Point" ] + [ Value.Bool true ] in let* α8 := M.call_closure α7 [ point ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in @@ -283,8 +297,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Rectangle occupies ") in @@ -298,9 +312,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α7 := - M.get_function "core::mem::size_of_val" [ Ty.path "box_stack_heap::Rectangle" ] in + M.get_function + "core::mem::size_of_val" + [ Ty.path "box_stack_heap::Rectangle" ] + [ Value.Bool true ] in let* α8 := M.call_closure α7 [ rectangle ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in @@ -312,8 +330,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Boxed point occupies ") in @@ -327,7 +345,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α7 := M.get_function "core::mem::size_of_val" @@ -335,7 +354,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "box_stack_heap::Point"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [ Value.Bool true ] in let* α8 := M.call_closure α7 [ boxed_point ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in @@ -347,8 +368,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Boxed rectangle occupies ") in @@ -362,7 +383,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α7 := M.get_function "core::mem::size_of_val" @@ -370,7 +392,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "box_stack_heap::Rectangle"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [ Value.Bool true ] in let* α8 := M.call_closure α7 [ boxed_rectangle ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in @@ -382,8 +406,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Boxed box occupies ") in @@ -397,7 +421,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α7 := M.get_function "core::mem::size_of_val" @@ -407,10 +432,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.path "box_stack_heap::Point"; Ty.path "alloc::alloc::Global" ]; + [ Ty.path "box_stack_heap::Point"; Ty.path "alloc::alloc::Global" ] + []; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [ Value.Bool true ] in let* α8 := M.call_closure α7 [ box_in_a_box ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in @@ -425,8 +453,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.copy α0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Unboxed point occupies ") in @@ -440,9 +468,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α7 := - M.get_function "core::mem::size_of_val" [ Ty.path "box_stack_heap::Point" ] in + M.get_function + "core::mem::size_of_val" + [ Ty.path "box_stack_heap::Point" ] + [ Value.Bool true ] in let* α8 := M.call_closure α7 [ unboxed_point ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in diff --git a/CoqOfRust/examples/default/examples/rust_book/std_library_types/hash_map.err b/CoqOfRust/examples/default/examples/rust_book/std_library_types/hash_map.err index f4de39246..fe2c8bce7 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_library_types/hash_map.err +++ b/CoqOfRust/examples/default/examples/rust_book/std_library_types/hash_map.err @@ -1,14 +1,18 @@ -warning: This kind of constant in patterns is not yet supported. +warning: This kind of literal is not yet supported. --> examples/rust_book/std_library_types/hash_map.rs:5:9 | 5 | "798-1364" => { | ^^^^^^^^^^ + | + = note: We will work on it! 🪄 -warning: This kind of constant in patterns is not yet supported. +warning: This kind of literal is not yet supported. --> examples/rust_book/std_library_types/hash_map.rs:9:9 | 9 | "645-7689" => { | ^^^^^^^^^^ + | + = note: We will work on it! 🪄 warning: 2 warnings emitted 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 5c7456e9c..e1e0a3081 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 @@ -25,6 +25,9 @@ Definition call (τ : list Ty.t) (α : list Value.t) : M := number [ fun γ => + let* _ := + let* α0 := M.read γ in + M.is_constant_or_break_match α0 UnsupportedLiteral in let* α0 := M.read (mk_str @@ -32,6 +35,9 @@ Definition call (τ : list Ty.t) (α : list Value.t) : M := Please hang up and try again.") in M.alloc α0; fun γ => + let* _ := + let* α0 := M.read γ in + M.is_constant_or_break_match α0 UnsupportedLiteral in let* α0 := M.read (mk_str @@ -88,11 +94,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "std::collections::hash::map::HashMap") [ - Ty.apply (Ty.path "&") [ Ty.path "str" ]; - Ty.apply (Ty.path "&") [ Ty.path "str" ]; + Ty.apply (Ty.path "&") [ Ty.path "str" ] []; + Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "std::hash::random::RandomState" - ]) + ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in @@ -102,11 +110,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "std::collections::hash::map::HashMap") [ - Ty.apply (Ty.path "&") [ Ty.path "str" ]; - Ty.apply (Ty.path "&") [ Ty.path "str" ]; + Ty.apply (Ty.path "&") [ Ty.path "str" ] []; + Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "std::hash::random::RandomState" - ]) + ] + []) "insert" + [] [] in let* α1 := M.read (mk_str "Daniel") in let* α2 := M.read (mk_str "798-1364") in @@ -118,11 +128,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "std::collections::hash::map::HashMap") [ - Ty.apply (Ty.path "&") [ Ty.path "str" ]; - Ty.apply (Ty.path "&") [ Ty.path "str" ]; + Ty.apply (Ty.path "&") [ Ty.path "str" ] []; + Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "std::hash::random::RandomState" - ]) + ] + []) "insert" + [] [] in let* α1 := M.read (mk_str "Ashley") in let* α2 := M.read (mk_str "645-7689") in @@ -134,11 +146,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "std::collections::hash::map::HashMap") [ - Ty.apply (Ty.path "&") [ Ty.path "str" ]; - Ty.apply (Ty.path "&") [ Ty.path "str" ]; + Ty.apply (Ty.path "&") [ Ty.path "str" ] []; + Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "std::hash::random::RandomState" - ]) + ] + []) "insert" + [] [] in let* α1 := M.read (mk_str "Katie") in let* α2 := M.read (mk_str "435-8291") in @@ -150,11 +164,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "std::collections::hash::map::HashMap") [ - Ty.apply (Ty.path "&") [ Ty.path "str" ]; - Ty.apply (Ty.path "&") [ Ty.path "str" ]; + Ty.apply (Ty.path "&") [ Ty.path "str" ] []; + Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "std::hash::random::RandomState" - ]) + ] + []) "insert" + [] [] in let* α1 := M.read (mk_str "Robert") in let* α2 := M.read (mk_str "956-1745") in @@ -166,12 +182,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "std::collections::hash::map::HashMap") [ - Ty.apply (Ty.path "&") [ Ty.path "str" ]; - Ty.apply (Ty.path "&") [ Ty.path "str" ]; + Ty.apply (Ty.path "&") [ Ty.path "str" ] []; + Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "std::hash::random::RandomState" - ]) + ] + []) "get" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.call_closure α0 [ contacts; mk_str "Daniel" ] in let* α2 := M.alloc α1 in M.match_operator @@ -182,8 +200,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.read γ0_0 in let* number := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Calling Daniel: ") in @@ -197,8 +216,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in - let* α7 := M.get_function "hash_map::call" [] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in + let* α7 := M.get_function "hash_map::call" [] [] in let* α8 := M.read number in let* α9 := M.call_closure α7 [ α8 ] in let* α10 := M.alloc α9 in @@ -211,9 +231,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []); fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Don't have Daniel's number. @@ -231,11 +255,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "std::collections::hash::map::HashMap") [ - Ty.apply (Ty.path "&") [ Ty.path "str" ]; - Ty.apply (Ty.path "&") [ Ty.path "str" ]; + Ty.apply (Ty.path "&") [ Ty.path "str" ] []; + Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "std::hash::random::RandomState" - ]) + ] + []) "insert" + [] [] in let* α1 := M.read (mk_str "Daniel") in let* α2 := M.read (mk_str "164-6743") in @@ -247,12 +273,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "std::collections::hash::map::HashMap") [ - Ty.apply (Ty.path "&") [ Ty.path "str" ]; - Ty.apply (Ty.path "&") [ Ty.path "str" ]; + Ty.apply (Ty.path "&") [ Ty.path "str" ] []; + Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "std::hash::random::RandomState" - ]) + ] + []) "get" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.call_closure α0 [ contacts; mk_str "Ashley" ] in let* α2 := M.alloc α1 in M.match_operator @@ -263,8 +291,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.read γ0_0 in let* number := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Calling Ashley: ") in @@ -278,8 +307,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in - let* α7 := M.get_function "hash_map::call" [] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in + let* α7 := M.get_function "hash_map::call" [] [] in let* α8 := M.read number in let* α9 := M.call_closure α7 [ α8 ] in let* α10 := M.alloc α9 in @@ -292,9 +322,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []); fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Don't have Ashley's number. @@ -312,12 +346,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "std::collections::hash::map::HashMap") [ - Ty.apply (Ty.path "&") [ Ty.path "str" ]; - Ty.apply (Ty.path "&") [ Ty.path "str" ]; + Ty.apply (Ty.path "&") [ Ty.path "str" ] []; + Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "std::hash::random::RandomState" - ]) + ] + []) "remove" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.call_closure α0 [ contacts; mk_str "Ashley" ] in M.alloc α1 in let* α0 := @@ -325,20 +361,26 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::collect::IntoIterator" (Ty.apply (Ty.path "std::collections::hash::map::Iter") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.apply (Ty.path "&") [ Ty.path "str" ] ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.apply (Ty.path "&") [ Ty.path "str" ] [] + ] + []) + [] [] "into_iter" + [] [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "std::collections::hash::map::HashMap") [ - Ty.apply (Ty.path "&") [ Ty.path "str" ]; - Ty.apply (Ty.path "&") [ Ty.path "str" ]; + Ty.apply (Ty.path "&") [ Ty.path "str" ] []; + Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "std::hash::random::RandomState" - ]) + ] + []) "iter" + [] [] in let* α2 := M.call_closure α1 [ contacts ] in let* α3 := M.call_closure α0 [ α2 ] in @@ -357,11 +399,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "std::collections::hash::map::Iter") [ - Ty.apply (Ty.path "&") [ Ty.path "str" ]; - Ty.apply (Ty.path "&") [ Ty.path "str" ] - ]) + Ty.apply (Ty.path "&") [ Ty.path "str" ] []; + Ty.apply (Ty.path "&") [ Ty.path "str" ] [] + ] + []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -383,11 +428,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* number := M.copy γ1_1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α6 := (* Unsize *) @@ -406,15 +452,18 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "&") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] - ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] + ] + [] in let* α8 := M.call_closure α7 [ contact ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in - let* α10 := M.get_function "hash_map::call" [] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in + let* α10 := M.get_function "hash_map::call" [] [] in let* α11 := M.read number in let* α12 := M.call_closure α10 [ α11 ] in let* α13 := M.alloc α12 in 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 a96c7003e..e4878e209 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 @@ -7,8 +7,8 @@ Require Import CoqOfRust.CoqOfRust. ty_params := []; fields := [ - ("username", Ty.apply (Ty.path "&") [ Ty.path "str" ]); - ("password", Ty.apply (Ty.path "&") [ Ty.path "str" ]) + ("username", Ty.apply (Ty.path "&") [ Ty.path "str" ] []); + ("password", Ty.apply (Ty.path "&") [ Ty.path "str" ] []) ]; } *) @@ -37,9 +37,11 @@ Module Impl_core_cmp_PartialEq_for_hash_map_alternate_or_custom_key_types_Accoun let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "&") [ Ty.path "str" ]) - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] + (Ty.apply (Ty.path "&") [ Ty.path "str" ] []) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read self in let* α2 := M.read other in @@ -61,9 +63,11 @@ Module Impl_core_cmp_PartialEq_for_hash_map_alternate_or_custom_key_types_Accoun (let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "&") [ Ty.path "str" ]) - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] + (Ty.apply (Ty.path "&") [ Ty.path "str" ] []) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read self in let* α2 := M.read other in @@ -146,10 +150,12 @@ Module Impl_core_hash_Hash_for_hash_map_alternate_or_custom_key_types_Account. let* α0 := M.get_trait_method "core::hash::Hash" - (Ty.apply (Ty.path "&") [ Ty.path "str" ]) + (Ty.apply (Ty.path "&") [ Ty.path "str" ] []) + [] [] "hash" - [ __H ] in + [ __H ] + [] in let* α1 := M.read self in let* α2 := M.read state in let* α3 := @@ -166,10 +172,12 @@ Module Impl_core_hash_Hash_for_hash_map_alternate_or_custom_key_types_Account. let* α0 := M.get_trait_method "core::hash::Hash" - (Ty.apply (Ty.path "&") [ Ty.path "str" ]) + (Ty.apply (Ty.path "&") [ Ty.path "str" ] []) + [] [] "hash" - [ __H ] in + [ __H ] + [] in let* α1 := M.read self in let* α2 := M.read state in let* α3 := @@ -201,8 +209,8 @@ End Impl_core_hash_Hash_for_hash_map_alternate_or_custom_key_types_Account. ty_params := []; fields := [ - ("name", Ty.apply (Ty.path "&") [ Ty.path "str" ]); - ("email", Ty.apply (Ty.path "&") [ Ty.path "str" ]) + ("name", Ty.apply (Ty.path "&") [ Ty.path "str" ] []); + ("email", Ty.apply (Ty.path "&") [ Ty.path "str" ] []) ]; } *) @@ -214,7 +222,8 @@ Axiom Accounts : Ty.path "hash_map_alternate_or_custom_key_types::Account"; Ty.path "hash_map_alternate_or_custom_key_types::AccountInfo"; Ty.path "std::hash::random::RandomState" - ]). + ] + []). (* fn try_logon<'a>(accounts: &Accounts<'a>, username: &'a str, password: &'a str) { @@ -242,8 +251,8 @@ Definition try_logon (τ : list Ty.t) (α : list Value.t) : M := let* password := M.alloc password in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Username: ") in @@ -257,7 +266,8 @@ Definition try_logon (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ username ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -267,8 +277,8 @@ Definition try_logon (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Password: ") in @@ -282,7 +292,8 @@ Definition try_logon (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ password ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -292,8 +303,13 @@ Definition try_logon (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Attempting logon... @@ -319,9 +335,11 @@ Definition try_logon (τ : list Ty.t) (α : list Value.t) : M := Ty.path "hash_map_alternate_or_custom_key_types::Account"; Ty.path "hash_map_alternate_or_custom_key_types::AccountInfo"; Ty.path "std::hash::random::RandomState" - ]) + ] + []) "get" - [ Ty.path "hash_map_alternate_or_custom_key_types::Account" ] in + [ Ty.path "hash_map_alternate_or_custom_key_types::Account" ] + [] in let* α1 := M.read accounts in let* α2 := M.call_closure α0 [ α1; logon ] in let* α3 := M.alloc α2 in @@ -334,9 +352,13 @@ Definition try_logon (τ : list Ty.t) (α : list Value.t) : M := let* account_info := M.copy γ0_0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Successful logon! @@ -349,8 +371,9 @@ Definition try_logon (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Name: ") in @@ -364,7 +387,8 @@ Definition try_logon (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.read account_info in let* α8 := M.call_closure @@ -383,8 +407,9 @@ Definition try_logon (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Email: ") in @@ -398,7 +423,8 @@ Definition try_logon (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.read account_info in let* α8 := M.call_closure @@ -418,9 +444,13 @@ Definition try_logon (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []); fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Login failed! @@ -469,8 +499,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.path "hash_map_alternate_or_custom_key_types::Account"; Ty.path "hash_map_alternate_or_custom_key_types::AccountInfo"; Ty.path "std::hash::random::RandomState" - ]) + ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in @@ -497,21 +529,23 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.path "hash_map_alternate_or_custom_key_types::Account"; Ty.path "hash_map_alternate_or_custom_key_types::AccountInfo"; Ty.path "std::hash::random::RandomState" - ]) + ] + []) "insert" + [] [] in let* α1 := M.read account in let* α2 := M.read account_info in let* α3 := M.call_closure α0 [ accounts; α1; α2 ] in M.alloc α3 in let* _ := - let* α0 := M.get_function "hash_map_alternate_or_custom_key_types::try_logon" [] in + let* α0 := M.get_function "hash_map_alternate_or_custom_key_types::try_logon" [] [] in let* α1 := M.read (mk_str "j.everyman") in let* α2 := M.read (mk_str "psasword123") in let* α3 := M.call_closure α0 [ accounts; α1; α2 ] in M.alloc α3 in let* _ := - let* α0 := M.get_function "hash_map_alternate_or_custom_key_types::try_logon" [] in + let* α0 := M.get_function "hash_map_alternate_or_custom_key_types::try_logon" [] [] in let* α1 := M.read (mk_str "j.everyman") in let* α2 := M.read (mk_str "password123") in let* α3 := M.call_closure α0 [ accounts; α1; α2 ] in 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 fed84a45c..654fffa76 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 @@ -50,34 +50,49 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "collect" [ Ty.apply (Ty.path "std::collections::hash::set::HashSet") [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ] - ] in + [] + ] + [] in let* α1 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "into_iter" + [] [] in let* α2 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α7 := (* Unsize *) let* α3 := M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.apply (Ty.path "array") [ Ty.path "i32" ]; Ty.path "alloc::alloc::Global" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "i32" ] [ Value.Integer Integer.Usize 3 ]; + Ty.path "alloc::alloc::Global" + ] + []) "new" + [] [] in let* α4 := M.alloc @@ -100,34 +115,49 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "collect" [ Ty.apply (Ty.path "std::collections::hash::set::HashSet") [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ] - ] in + [] + ] + [] in let* α1 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "into_iter" + [] [] in let* α2 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α7 := (* Unsize *) let* α3 := M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.apply (Ty.path "array") [ Ty.path "i32" ]; Ty.path "alloc::alloc::Global" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "i32" ] [ Value.Integer Integer.Usize 3 ]; + Ty.path "alloc::alloc::Global" + ] + []) "new" + [] [] in let* α4 := M.alloc @@ -155,8 +185,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "std::collections::hash::set::HashSet") - [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ]) + [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ] + []) "insert" + [] [] in let* α1 := M.call_closure α0 [ a; Value.Integer Integer.I32 4 ] in let* α2 := M.alloc (UnOp.Pure.not α1) in @@ -164,7 +196,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* _ := let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Bool true) in - let* α0 := M.get_function "core::panicking::panic" [] in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in let* α1 := M.read (mk_str "assertion failed: a.insert(4)") in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.never_to_any α2 in @@ -182,9 +214,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "std::collections::hash::set::HashSet") - [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ]) + [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ] + []) "contains" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α1 := M.alloc (Value.Integer Integer.I32 4) in let* α2 := M.call_closure α0 [ a; α1 ] in let* α3 := M.alloc (UnOp.Pure.not α2) in @@ -192,7 +226,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* _ := let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Bool true) in - let* α0 := M.get_function "core::panicking::panic" [] in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in let* α1 := M.read (mk_str "assertion failed: a.contains(&4)") in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.never_to_any α2 in @@ -204,15 +238,17 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "std::collections::hash::set::HashSet") - [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ]) + [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ] + []) "insert" + [] [] in let* α1 := M.call_closure α0 [ b; Value.Integer Integer.I32 5 ] in M.alloc α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "A: ") in @@ -230,7 +266,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "std::collections::hash::set::HashSet") [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ a ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -240,8 +278,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "B: ") in @@ -259,7 +297,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "std::collections::hash::set::HashSet") [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ b ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -269,8 +309,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Union: ") in @@ -287,27 +327,35 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ]; Ty.path "alloc::alloc::Global" ] - ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] []; Ty.path "alloc::alloc::Global" ] + [] + ] + [] in let* α7 := M.get_trait_method "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "std::collections::hash::set::Union") - [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ]) + [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ] + []) + [] [] "collect" [ Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ]; Ty.path "alloc::alloc::Global" ] - ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] []; Ty.path "alloc::alloc::Global" ] + [] + ] + [] in let* α8 := M.get_associated_function (Ty.apply (Ty.path "std::collections::hash::set::HashSet") - [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ]) + [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ] + []) "union" + [] [] in let* α9 := M.call_closure α8 [ a; b ] in let* α10 := M.call_closure α7 [ α9 ] in @@ -321,8 +369,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Difference: ") in @@ -339,27 +387,35 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ]; Ty.path "alloc::alloc::Global" ] - ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] []; Ty.path "alloc::alloc::Global" ] + [] + ] + [] in let* α7 := M.get_trait_method "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "std::collections::hash::set::Difference") - [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ]) + [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ] + []) + [] [] "collect" [ Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ]; Ty.path "alloc::alloc::Global" ] - ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] []; Ty.path "alloc::alloc::Global" ] + [] + ] + [] in let* α8 := M.get_associated_function (Ty.apply (Ty.path "std::collections::hash::set::HashSet") - [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ]) + [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ] + []) "difference" + [] [] in let* α9 := M.call_closure α8 [ a; b ] in let* α10 := M.call_closure α7 [ α9 ] in @@ -373,8 +429,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Intersection: ") in @@ -391,27 +447,35 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ]; Ty.path "alloc::alloc::Global" ] - ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] []; Ty.path "alloc::alloc::Global" ] + [] + ] + [] in let* α7 := M.get_trait_method "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "std::collections::hash::set::Intersection") - [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ]) + [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ] + []) + [] [] "collect" [ Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ]; Ty.path "alloc::alloc::Global" ] - ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] []; Ty.path "alloc::alloc::Global" ] + [] + ] + [] in let* α8 := M.get_associated_function (Ty.apply (Ty.path "std::collections::hash::set::HashSet") - [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ]) + [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ] + []) "intersection" + [] [] in let* α9 := M.call_closure α8 [ a; b ] in let* α10 := M.call_closure α7 [ α9 ] in @@ -425,8 +489,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Symmetric Difference: ") in @@ -443,27 +507,35 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ]; Ty.path "alloc::alloc::Global" ] - ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] []; Ty.path "alloc::alloc::Global" ] + [] + ] + [] in let* α7 := M.get_trait_method "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "std::collections::hash::set::SymmetricDifference") - [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ]) + [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ] + []) + [] [] "collect" [ Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ]; Ty.path "alloc::alloc::Global" ] - ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] []; Ty.path "alloc::alloc::Global" ] + [] + ] + [] in let* α8 := M.get_associated_function (Ty.apply (Ty.path "std::collections::hash::set::HashSet") - [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ]) + [ Ty.path "i32"; Ty.path "std::hash::random::RandomState" ] + []) "symmetric_difference" + [] [] in let* α9 := M.call_closure α8 [ a; b ] in let* α10 := M.call_closure α7 [ α9 ] in 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 723571d57..d3eb04387 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 @@ -57,7 +57,7 @@ Definition try_division (τ : list Ty.t) (α : list Value.t) : M := | [], [ dividend; divisor ] => let* dividend := M.alloc dividend in let* divisor := M.alloc divisor in - let* α0 := M.get_function "option::checked_division" [] in + let* α0 := M.get_function "option::checked_division" [] [] in let* α1 := M.read dividend in let* α2 := M.read divisor in let* α3 := M.call_closure α0 [ α1; α2 ] in @@ -68,8 +68,9 @@ Definition try_division (τ : list Ty.t) (α : list Value.t) : M := [ fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -84,13 +85,15 @@ Definition try_division (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α8 := M.call_closure α7 [ dividend ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α10 := M.call_closure α9 [ divisor ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in M.pure (M.pointer_coercion α11) in @@ -102,8 +105,9 @@ Definition try_division (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::option::Option::Some" 0 in let* quotient := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α7 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -119,19 +123,22 @@ Definition try_division (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α9 := M.call_closure α8 [ dividend ] in let* α10 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α11 := M.call_closure α10 [ divisor ] in let* α12 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α13 := M.call_closure α12 [ quotient ] in let* α14 := M.alloc (Value.Array [ α9; α11; α13 ]) in M.pure (M.pointer_coercion α14) in @@ -170,11 +177,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* _ := - let* α0 := M.get_function "option::try_division" [] in + let* α0 := M.get_function "option::try_division" [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.I32 4; Value.Integer Integer.I32 2 ] in M.alloc α1 in let* _ := - let* α0 := M.get_function "option::try_division" [] in + let* α0 := M.get_function "option::try_division" [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.I32 1; Value.Integer Integer.I32 0 ] in M.alloc α1 in let* none := M.alloc (Value.StructTuple "core::option::Option::None" []) in @@ -184,8 +191,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.StructTuple "core::option::Option::Some" [ α0 ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -200,18 +207,21 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "f32" ] ] in + [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "f32" ] [] ] + [] in let* α8 := M.call_closure α7 [ optional_float ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "f32" ] in + [ Ty.path "f32" ] + [] in let* α10 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "f32" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "f32" ] []) "unwrap" - [] in + [] + [ Value.Bool true ] in let* α11 := M.read optional_float in let* α12 := M.call_closure α10 [ α11 ] in let* α13 := M.alloc α12 in @@ -224,8 +234,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -240,18 +250,21 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] [] ] + [] in let* α8 := M.call_closure α7 [ none ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α10 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] []) "unwrap" - [] in + [] + [ Value.Bool true ] in let* α11 := M.read none in let* α12 := M.call_closure α10 [ α11 ] in let* α13 := M.alloc α12 in 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 cb3ac9887..59dc70dab 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 @@ -32,7 +32,8 @@ Definition division (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "std::panicking::begin_panic" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.read (mk_str "division by zero") in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.never_to_any α2 in @@ -66,19 +67,28 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* _x := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::boxed::Box") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.I32 0 ] in M.alloc α1 in let* _ := - let* α0 := M.get_function "panic::division" [] in + let* α0 := M.get_function "panic::division" [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.I32 3; Value.Integer Integer.I32 0 ] in M.alloc α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "This point won't be reached! 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 0b7a84ac9..8f72671ec 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 @@ -42,14 +42,20 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* rc_examples := - let* α0 := M.get_trait_method "alloc::string::ToString" (Ty.path "str") [] "to_string" [] in + let* α0 := + M.get_trait_method "alloc::string::ToString" (Ty.path "str") [] [] "to_string" [] [] in let* α1 := M.read (mk_str "Rc examples") in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "--- rc_a is created --- @@ -65,16 +71,18 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "alloc::rc::Rc") - [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.read rc_examples in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Reference Count of rc_a: ") in @@ -88,13 +96,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α7 := M.get_associated_function (Ty.apply (Ty.path "alloc::rc::Rc") - [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ] + []) "strong_count" + [] [] in let* α8 := M.call_closure α7 [ rc_a ] in let* α9 := M.alloc α8 in @@ -108,8 +119,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* _ := let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "--- rc_a is cloned to rc_b --- @@ -126,16 +142,19 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::clone::Clone" (Ty.apply (Ty.path "alloc::rc::Rc") - [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "clone" + [] [] in let* α1 := M.call_closure α0 [ rc_a ] in M.alloc α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Reference Count of rc_b: ") in @@ -149,13 +168,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α7 := M.get_associated_function (Ty.apply (Ty.path "alloc::rc::Rc") - [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ] + []) "strong_count" + [] [] in let* α8 := M.call_closure α7 [ rc_b ] in let* α9 := M.alloc α8 in @@ -168,8 +190,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Reference Count of rc_a: ") in @@ -183,13 +205,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α7 := M.get_associated_function (Ty.apply (Ty.path "alloc::rc::Rc") - [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ] + []) "strong_count" + [] [] in let* α8 := M.call_closure α7 [ rc_a ] in let* α9 := M.alloc α8 in @@ -202,8 +227,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "rc_a and rc_b are equal: ") in @@ -217,19 +242,24 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "bool" ] in + [ Ty.path "bool" ] + [] in let* α7 := M.get_trait_method "core::cmp::PartialEq" (Ty.apply (Ty.path "alloc::rc::Rc") - [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ] + []) [ Ty.apply (Ty.path "alloc::rc::Rc") [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ] + [] ] + [ Value.Bool true ] "eq" + [] [] in let* α8 := M.call_closure α7 [ rc_a; rc_b ] in let* α9 := M.alloc α8 in @@ -242,8 +272,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Length of the value inside rc_a: ") in @@ -257,16 +287,20 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in - let* α7 := M.get_associated_function (Ty.path "alloc::string::String") "len" [] in + [ Ty.path "usize" ] + [] in + let* α7 := M.get_associated_function (Ty.path "alloc::string::String") "len" [] [] in let* α8 := M.get_trait_method "core::ops::deref::Deref" (Ty.apply (Ty.path "alloc::rc::Rc") - [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref" + [] [] in let* α9 := M.call_closure α8 [ rc_a ] in let* α10 := M.call_closure α7 [ α9 ] in @@ -280,8 +314,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Value of rc_b: ") in @@ -299,7 +333,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::rc::Rc") [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ rc_b ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -309,8 +345,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "--- rc_b is dropped out of scope --- @@ -324,8 +365,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Reference Count of rc_a: ") in @@ -339,13 +380,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α7 := M.get_associated_function (Ty.apply (Ty.path "alloc::rc::Rc") - [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ] + []) "strong_count" + [] [] in let* α8 := M.call_closure α7 [ rc_a ] in let* α9 := M.alloc α8 in @@ -358,8 +402,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "--- rc_a is dropped out of scope --- 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 05670b3ee..e65922871 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 @@ -36,7 +36,7 @@ Module checked. | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] [] in let* α1 := M.read f in let* α2 := M.match_operator @@ -72,7 +72,8 @@ Module checked. (Ty.path "result::checked::MathResult") = (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "f64"; Ty.path "result::checked::MathError" ]). + [ Ty.path "f64"; Ty.path "result::checked::MathError" ] + []). (* pub fn div(x: f64, y: f64) -> MathResult { @@ -151,7 +152,7 @@ Module checked. "core::result::Result::Err" [ Value.StructTuple "result::checked::MathError::NegativeSquareRoot" [] ]); fun γ => - let* α0 := M.get_associated_function (Ty.path "f64") "sqrt" [] in + let* α0 := M.get_associated_function (Ty.path "f64") "sqrt" [] [] in let* α1 := M.read x in let* α2 := M.call_closure α0 [ α1 ] in M.alloc (Value.StructTuple "core::result::Result::Ok" [ α2 ]) @@ -192,7 +193,7 @@ Module checked. "core::result::Result::Err" [ Value.StructTuple "result::checked::MathError::NonPositiveLogarithm" [] ]); fun γ => - let* α0 := M.get_associated_function (Ty.path "f64") "ln" [] in + let* α0 := M.get_associated_function (Ty.path "f64") "ln" [] [] in let* α1 := M.read x in let* α2 := M.call_closure α0 [ α1 ] in M.alloc (Value.StructTuple "core::result::Result::Ok" [ α2 ]) @@ -222,7 +223,7 @@ Definition op (τ : list Ty.t) (α : list Value.t) : M := | [], [ x; y ] => let* x := M.alloc x in let* y := M.alloc y in - let* α0 := M.get_function "result::checked::div" [] in + let* α0 := M.get_function "result::checked::div" [] [] in let* α1 := M.read x in let* α2 := M.read y in let* α3 := M.call_closure α0 [ α1; α2 ] in @@ -234,8 +235,8 @@ Definition op (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* why := M.copy γ0_0 in - let* α0 := M.get_function "core::panicking::panic_fmt" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "core::panicking::panic_fmt" [] [ Value.Bool true ] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -247,7 +248,8 @@ Definition op (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "result::checked::MathError" ] in + [ Ty.path "result::checked::MathError" ] + [] in let* α6 := M.call_closure α5 [ why ] in let* α7 := M.alloc (Value.Array [ α6 ]) in M.pure (M.pointer_coercion α7) in @@ -258,7 +260,7 @@ Definition op (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Ok" 0 in let* ratio := M.copy γ0_0 in - let* α0 := M.get_function "result::checked::ln" [] in + let* α0 := M.get_function "result::checked::ln" [] [] in let* α1 := M.read ratio in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.alloc α2 in @@ -269,9 +271,9 @@ Definition op (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* why := M.copy γ0_0 in - let* α0 := M.get_function "core::panicking::panic_fmt" [] in + let* α0 := M.get_function "core::panicking::panic_fmt" [] [ Value.Bool true ] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -283,7 +285,8 @@ Definition op (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "result::checked::MathError" ] in + [ Ty.path "result::checked::MathError" ] + [] in let* α6 := M.call_closure α5 [ why ] in let* α7 := M.alloc (Value.Array [ α6 ]) in M.pure (M.pointer_coercion α7) in @@ -295,7 +298,7 @@ Definition op (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Ok" 0 in let* ln := M.copy γ0_0 in - let* α0 := M.get_function "result::checked::sqrt" [] in + let* α0 := M.get_function "result::checked::sqrt" [] [] in let* α1 := M.read ln in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.alloc α2 in @@ -306,9 +309,14 @@ Definition op (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* why := M.copy γ0_0 in - let* α0 := M.get_function "core::panicking::panic_fmt" [] in + let* α0 := + M.get_function "core::panicking::panic_fmt" [] [ Value.Bool true ] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_v1" + [] + [] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -320,7 +328,8 @@ Definition op (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "result::checked::MathError" ] in + [ Ty.path "result::checked::MathError" ] + [] in let* α6 := M.call_closure α5 [ why ] in let* α7 := M.alloc (Value.Array [ α6 ]) in M.pure (M.pointer_coercion α7) in @@ -351,8 +360,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -366,8 +375,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "f64" ] in - let* α7 := M.get_function "result::op" [] in + [ Ty.path "f64" ] + [] in + let* α7 := M.get_function "result::op" [] [] in let* α8 := M.read UnsupportedLiteral in let* α9 := M.read UnsupportedLiteral in let* α10 := M.call_closure α7 [ α8; α9 ] in 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 6612775ba..597ea06f0 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 @@ -36,7 +36,7 @@ Module checked. | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] [] in let* α1 := M.read f in let* α2 := M.match_operator @@ -72,7 +72,8 @@ Module checked. (Ty.path "result_chaining_with_question_mark::checked::MathResult") = (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "f64"; Ty.path "result_chaining_with_question_mark::checked::MathError" ]). + [ Ty.path "f64"; Ty.path "result_chaining_with_question_mark::checked::MathError" ] + []). (* fn div(x: f64, y: f64) -> MathResult { @@ -156,7 +157,7 @@ Module checked. [] ]); fun γ => - let* α0 := M.get_associated_function (Ty.path "f64") "sqrt" [] in + let* α0 := M.get_associated_function (Ty.path "f64") "sqrt" [] [] in let* α1 := M.read x in let* α2 := M.call_closure α0 [ α1 ] in M.alloc (Value.StructTuple "core::result::Result::Ok" [ α2 ]) @@ -201,7 +202,7 @@ Module checked. [] ]); fun γ => - let* α0 := M.get_associated_function (Ty.path "f64") "ln" [] in + let* α0 := M.get_associated_function (Ty.path "f64") "ln" [] [] in let* α1 := M.read x in let* α2 := M.call_closure α0 [ α1 ] in M.alloc (Value.StructTuple "core::result::Result::Ok" [ α2 ]) @@ -232,11 +233,14 @@ Module checked. "core::ops::try_trait::Try" (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "f64"; Ty.path "result_chaining_with_question_mark::checked::MathError" ]) + [ Ty.path "f64"; Ty.path "result_chaining_with_question_mark::checked::MathError" ] + []) + [] [] "branch" + [] [] in - let* α1 := M.get_function "result_chaining_with_question_mark::checked::div" [] in + let* α1 := M.get_function "result_chaining_with_question_mark::checked::div" [] [] in let* α2 := M.read x in let* α3 := M.read y in let* α4 := M.call_closure α1 [ α2; α3 ] in @@ -261,7 +265,8 @@ Module checked. [ Ty.path "f64"; Ty.path "result_chaining_with_question_mark::checked::MathError" - ]) + ] + []) [ Ty.apply (Ty.path "core::result::Result") @@ -269,8 +274,11 @@ Module checked. Ty.path "core::convert::Infallible"; Ty.path "result_chaining_with_question_mark::checked::MathError" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -294,11 +302,14 @@ Module checked. "core::ops::try_trait::Try" (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "f64"; Ty.path "result_chaining_with_question_mark::checked::MathError" ]) + [ Ty.path "f64"; Ty.path "result_chaining_with_question_mark::checked::MathError" ] + []) + [] [] "branch" + [] [] in - let* α1 := M.get_function "result_chaining_with_question_mark::checked::ln" [] in + let* α1 := M.get_function "result_chaining_with_question_mark::checked::ln" [] [] in let* α2 := M.read ratio in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in @@ -322,7 +333,8 @@ Module checked. [ Ty.path "f64"; Ty.path "result_chaining_with_question_mark::checked::MathError" - ]) + ] + []) [ Ty.apply (Ty.path "core::result::Result") @@ -330,8 +342,11 @@ Module checked. Ty.path "core::convert::Infallible"; Ty.path "result_chaining_with_question_mark::checked::MathError" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -349,7 +364,7 @@ Module checked. M.pure val ] in M.copy α6 in - let* α0 := M.get_function "result_chaining_with_question_mark::checked::sqrt" [] in + let* α0 := M.get_function "result_chaining_with_question_mark::checked::sqrt" [] [] in let* α1 := M.read ln in let* α2 := M.call_closure α0 [ α1 ] in let* α0 := M.alloc α2 in @@ -377,7 +392,7 @@ Module checked. | [], [ x; y ] => let* x := M.alloc x in let* y := M.alloc y in - let* α0 := M.get_function "result_chaining_with_question_mark::checked::op_" [] in + let* α0 := M.get_function "result_chaining_with_question_mark::checked::op_" [] [] in let* α1 := M.read x in let* α2 := M.read y in let* α3 := M.call_closure α0 [ α1; α2 ] in @@ -393,7 +408,8 @@ Module checked. let* α0 := M.get_function "core::panicking::panic_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [ Value.Bool true ] in let* α1 := M.match_operator why @@ -413,8 +429,9 @@ Module checked. let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Ok" 0 in let* value := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -428,7 +445,8 @@ Module checked. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "f64" ] in + [ Ty.path "f64" ] + [] in let* α7 := M.call_closure α6 [ value ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -451,7 +469,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* _ := - let* α0 := M.get_function "result_chaining_with_question_mark::checked::op" [] in + let* α0 := M.get_function "result_chaining_with_question_mark::checked::op" [] [] in let* α1 := M.read UnsupportedLiteral in let* α2 := M.read UnsupportedLiteral in let* α3 := M.call_closure α0 [ α1; α2 ] in 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 01be8e4f0..daf849f27 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 @@ -49,8 +49,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* pangram := M.copy (mk_str "the quick brown fox jumps over the lazy dog") in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Pangram: ") in @@ -64,7 +64,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ pangram ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -74,8 +75,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Words in reverse @@ -92,18 +98,23 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::collect::IntoIterator" (Ty.apply (Ty.path "core::iter::adapters::rev::Rev") - [ Ty.path "core::str::iter::SplitWhitespace" ]) + [ Ty.path "core::str::iter::SplitWhitespace" ] + []) + [] [] "into_iter" + [] [] in let* α1 := M.get_trait_method "core::iter::traits::iterator::Iterator" (Ty.path "core::str::iter::SplitWhitespace") [] + [] "rev" + [] [] in - let* α2 := M.get_associated_function (Ty.path "str") "split_whitespace" [] in + let* α2 := M.get_associated_function (Ty.path "str") "split_whitespace" [] [] in let* α3 := M.read pangram in let* α4 := M.call_closure α2 [ α3 ] in let* α5 := M.call_closure α1 [ α4 ] in @@ -122,9 +133,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "core::iter::adapters::rev::Rev") - [ Ty.path "core::str::iter::SplitWhitespace" ]) + [ Ty.path "core::str::iter::SplitWhitespace" ] + []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -145,11 +159,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* word := M.copy γ0_0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -164,7 +179,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ word ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -183,23 +199,34 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::iterator::Iterator" (Ty.path "core::str::iter::Chars") [] + [] "collect" - [ Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "char"; Ty.path "alloc::alloc::Global" ] - ] in - let* α1 := M.get_associated_function (Ty.path "str") "chars" [] in + [ + Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "char"; Ty.path "alloc::alloc::Global" ] + [] + ] + [] in + let* α1 := M.get_associated_function (Ty.path "str") "chars" [] [] in let* α2 := M.read pangram in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in M.alloc α4 in let* _ := let* α0 := - M.get_associated_function (Ty.apply (Ty.path "slice") [ Ty.path "char" ]) "sort" [] in + M.get_associated_function (Ty.apply (Ty.path "slice") [ Ty.path "char" ] []) "sort" [] [] in let* α1 := M.get_trait_method "core::ops::deref::DerefMut" - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "char"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "char"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref_mut" + [] [] in let* α2 := M.call_closure α1 [ chars ] in let* α3 := M.call_closure α0 [ α2 ] in @@ -207,22 +234,31 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* _ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "char"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "char"; Ty.path "alloc::alloc::Global" ] + []) "dedup" + [] [] in let* α1 := M.call_closure α0 [ chars ] in M.alloc α1 in let* string := - let* α0 := M.get_associated_function (Ty.path "alloc::string::String") "new" [] in + let* α0 := M.get_associated_function (Ty.path "alloc::string::String") "new" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := let* α0 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "char"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "char"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "into_iter" + [] [] in let* α1 := M.read chars in let* α2 := M.call_closure α0 [ α1 ] in @@ -240,9 +276,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.path "char"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "char"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -263,7 +302,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* c := M.copy γ0_0 in let* _ := let* α0 := - M.get_associated_function (Ty.path "alloc::string::String") "push" [] in + M.get_associated_function + (Ty.path "alloc::string::String") + "push" + [] + [] in let* α1 := M.read c in let* α2 := M.call_closure α0 [ string; α1 ] in M.alloc α2 in @@ -272,6 +315,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "alloc::string::String") "push_str" + [] [] in let* α1 := M.read (mk_str ", ") in let* α2 := M.call_closure α0 [ string; α1 ] in @@ -292,13 +336,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "str") "trim_matches" - [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "slice") [ Ty.path "char" ] ] ] in + [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "slice") [ Ty.path "char" ] [] ] [] ] + [] in let* α1 := M.get_trait_method "core::ops::deref::Deref" (Ty.path "alloc::string::String") [] + [] "deref" + [] [] in let* α2 := M.call_closure α1 [ string ] in let* α3 := M.read chars_to_trim in @@ -306,8 +353,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α4 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Used characters: ") in @@ -321,7 +368,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ trimmed_str ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -334,8 +382,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_trait_method "core::convert::From" (Ty.path "alloc::string::String") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] "from" + [] [] in let* α1 := M.read (mk_str "I like dogs") in let* α2 := M.call_closure α0 [ α1 ] in @@ -345,13 +395,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "str") "replace" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.get_trait_method "core::ops::deref::Deref" (Ty.path "alloc::string::String") [] + [] "deref" + [] [] in let* α2 := M.call_closure α1 [ alice ] in let* α3 := M.read (mk_str "dog") in @@ -360,8 +413,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α5 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Alice says: ") in @@ -375,7 +428,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α7 := M.call_closure α6 [ alice ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -385,8 +439,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Bob says: ") in @@ -400,7 +454,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α7 := M.call_closure α6 [ bob ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 78c82cac3..fb85d4a04 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 @@ -45,8 +45,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "A byte string: ") in @@ -60,7 +60,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] ] in + [ + Ty.apply + (Ty.path "&") + [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 21 ] + ] + [] + ] + [] in let* α7 := M.call_closure α6 [ bytestring ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -71,8 +78,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* escaped := M.copy UnsupportedLiteral in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Some escaped bytes: ") in @@ -86,7 +93,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] ] in + [ + Ty.apply + (Ty.path "&") + [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 13 ] + ] + [] + ] + [] in let* α7 := M.call_closure α6 [ escaped ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -97,8 +111,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* raw_bytestring := M.copy UnsupportedLiteral in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -112,7 +126,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] ] ] in + [ + Ty.apply + (Ty.path "&") + [ Ty.apply (Ty.path "array") [ Ty.path "u8" ] [ Value.Integer Integer.Usize 28 ] + ] + [] + ] + [] in let* α7 := M.call_closure α6 [ raw_bytestring ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -127,7 +148,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ fun γ => let* γ := - let* α0 := M.get_function "core::str::converts::from_utf8" [] in + let* α0 := M.get_function "core::str::converts::from_utf8" [] [ Value.Bool true ] in let* α2 := (* Unsize *) let* α1 := M.read raw_bytestring in @@ -138,8 +159,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* my_str := M.copy γ0_0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "And the same as text: '") in @@ -153,7 +175,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ my_str ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -167,7 +190,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* _quotes := M.copy UnsupportedLiteral in let* shift_jis := M.copy UnsupportedLiteral in let* _ := - let* α0 := M.get_function "core::str::converts::from_utf8" [] in + let* α0 := M.get_function "core::str::converts::from_utf8" [] [ Value.Bool true ] in let* α2 := (* Unsize *) let* α1 := M.read shift_jis in @@ -181,8 +204,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Ok" 0 in let* my_str := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Conversion successful: '") in @@ -196,7 +220,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ my_str ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -208,8 +233,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* e := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Conversion failed: ") in @@ -223,7 +249,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "core::str::error::Utf8Error" ] in + [ Ty.path "core::str::error::Utf8Error" ] + [] in let* α7 := M.call_closure α6 [ e ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 9d3aa05f5..e9b658ea1 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 @@ -29,8 +29,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* byte_escape := M.copy (mk_str "I'm writing Rust!") in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "What are you doing? (\x3F means ?) ") in @@ -44,7 +44,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ byte_escape ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -56,8 +57,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* character_name := M.copy (mk_str """DOUBLE-STRUCK CAPITAL R""") in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "Unicode character ") in @@ -72,13 +73,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α8 := M.call_closure α7 [ unicode_codepoint ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α10 := M.call_closure α9 [ character_name ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in M.pure (M.pointer_coercion α11) in @@ -94,8 +97,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := The linebreak and indentation here -><- can be escaped too!") in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -109,7 +112,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ long_string ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 3af259d8c..839165871 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 @@ -23,8 +23,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* raw_str := M.copy (mk_str "Escapes don't work here: \x3F \u{211D}") in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -38,7 +38,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ raw_str ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -49,8 +50,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* quotes := M.copy (mk_str "And then I said: ""There is no escape!""") in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -64,7 +65,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ quotes ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -75,8 +77,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* longer_delimiter := M.copy (mk_str "A string with ""# in it. And even ""##!") in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -90,7 +92,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ longer_delimiter ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 dcfe84062..165201aa7 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 @@ -60,11 +60,17 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ] []) + [] [] "collect" - [ Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] - ] in + [ + Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + [] + ] + [] in let* α1 := M.call_closure α0 @@ -76,8 +82,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Collected (0..10) into: ") in @@ -95,7 +101,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ collected_iterator ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -106,17 +114,23 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* xs := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α5 := (* Unsize *) let* α1 := M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.apply (Ty.path "array") [ Ty.path "i32" ]; Ty.path "alloc::alloc::Global" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "i32" ] [ Value.Integer Integer.Usize 3 ]; + Ty.path "alloc::alloc::Global" + ] + []) "new" + [] [] in let* α2 := M.alloc @@ -133,8 +147,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α6 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Initial vector: ") in @@ -152,7 +166,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ xs ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -162,8 +178,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Push 4 into the vector @@ -177,15 +198,19 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* _ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) "push" + [] [] in let* α1 := M.call_closure α0 [ xs; Value.Integer Integer.I32 4 ] in M.alloc α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Vector: ") in @@ -203,7 +228,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ xs ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -213,8 +240,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Vector length: ") in @@ -228,13 +255,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α7 := M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) "len" + [] [] in let* α8 := M.call_closure α7 [ xs ] in let* α9 := M.alloc α8 in @@ -247,8 +277,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Second element: ") in @@ -262,15 +292,19 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.get_trait_method "core::ops::index::Index" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) [ Ty.path "usize" ] + [] "index" + [] [] in let* α8 := M.call_closure α7 [ xs; Value.Integer Integer.Usize 1 ] in let* α9 := M.call_closure α6 [ α8 ] in @@ -282,8 +316,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Pop last element: ") in @@ -297,13 +331,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] [] ] + [] in let* α7 := M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) "pop" + [] [] in let* α8 := M.call_closure α7 [ xs ] in let* α9 := M.alloc α8 in @@ -316,8 +353,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Contents of xs: @@ -332,18 +374,25 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ] []) + [] [] "into_iter" + [] [] in let* α1 := - M.get_associated_function (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) "iter" [] in + M.get_associated_function (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) "iter" [] [] in let* α2 := M.get_trait_method "core::ops::deref::Deref" - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref" + [] [] in let* α3 := M.call_closure α2 [ xs ] in let* α4 := M.call_closure α1 [ α3 ] in @@ -360,9 +409,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ] []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -383,11 +434,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* x := M.copy γ0_0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -402,7 +454,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] in let* α7 := M.call_closure α6 [ x ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -421,25 +474,35 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::collect::IntoIterator" (Ty.apply (Ty.path "core::iter::adapters::enumerate::Enumerate") - [ Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ] ]) + [ Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ] [] ] + []) + [] [] "into_iter" + [] [] in let* α1 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ] []) + [] [] "enumerate" + [] [] in let* α2 := - M.get_associated_function (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) "iter" [] in + M.get_associated_function (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) "iter" [] [] in let* α3 := M.get_trait_method "core::ops::deref::Deref" - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref" + [] [] in let* α4 := M.call_closure α3 [ xs ] in let* α5 := M.call_closure α2 [ α4 ] in @@ -459,9 +522,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "core::iter::adapters::enumerate::Enumerate") - [ Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ] ]) + [ Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "i32" ] [] ] + []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -485,11 +551,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* x := M.copy γ1_1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α6 := (* Unsize *) @@ -505,13 +572,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α8 := M.call_closure α7 [ i ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] in let* α10 := M.call_closure α9 [ x ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in M.pure (M.pointer_coercion α11) in @@ -528,18 +597,29 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "core::slice::iter::IterMut") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::slice::iter::IterMut") [ Ty.path "i32" ] []) + [] [] "into_iter" + [] [] in let* α1 := - M.get_associated_function (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) "iter_mut" [] in + M.get_associated_function + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) + "iter_mut" + [] + [] in let* α2 := M.get_trait_method "core::ops::deref::DerefMut" - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref_mut" + [] [] in let* α3 := M.call_closure α2 [ xs ] in let* α4 := M.call_closure α1 [ α3 ] in @@ -556,9 +636,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::slice::iter::IterMut") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::slice::iter::IterMut") [ Ty.path "i32" ] []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -589,8 +671,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.pure (M.use α7) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Updated vector: ") in @@ -608,7 +690,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ xs ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 00cd0ff4e..b67e11e11 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_misc/channels.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_misc/channels.v @@ -52,7 +52,7 @@ fn main() { Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => - let* α0 := M.get_function "std::sync::mpsc::channel" [ Ty.path "i32" ] in + let* α0 := M.get_function "std::sync::mpsc::channel" [ Ty.path "i32" ] [] in let* α1 := M.call_closure α0 [] in let* α2 := M.alloc α1 in let* α3 := @@ -70,10 +70,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::vec::Vec") [ - Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.tuple [] ]; + Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.tuple [] ] []; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in @@ -81,9 +83,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ] []) + [] [] "into_iter" + [] [] in let* α1 := M.get_constant "channels::NTHREADS" in let* α2 := M.read α1 in @@ -108,9 +112,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ] []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -135,9 +141,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::clone::Clone" (Ty.apply (Ty.path "std::sync::mpsc::Sender") - [ Ty.path "i32" ]) + [ Ty.path "i32" ] + []) + [] [] "clone" + [] [] in let* α1 := M.call_closure α0 [ tx ] in M.alloc α1 in @@ -145,7 +154,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "std::thread::spawn" - [ Ty.function [ Ty.tuple [] ] (Ty.tuple []); Ty.tuple [] ] in + [ Ty.function [ Ty.tuple [] ] (Ty.tuple []); Ty.tuple [] ] + [] in let* α1 := M.call_closure α0 @@ -170,15 +180,20 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.path "std::sync::mpsc::SendError") [ Ty.path "i32" ] - ]) + [] + ] + []) "unwrap" + [] [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "std::sync::mpsc::Sender") - [ Ty.path "i32" ]) + [ Ty.path "i32" ] + []) "send" + [] [] in let* α2 := M.read id in let* α3 := @@ -190,11 +205,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "std::io::stdio::_print" + [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -211,7 +228,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ id ] in let* α8 := M.alloc (Value.Array [ α7 ]) in @@ -235,10 +253,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "std::thread::JoinHandle") - [ Ty.tuple [] ]; + [ Ty.tuple [] ] + []; Ty.path "alloc::alloc::Global" - ]) + ] + []) "push" + [] [] in let* α1 := M.read child in let* α2 := M.call_closure α0 [ children; α1 ] in @@ -256,10 +277,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "std::sync::mpsc::RecvError" ]; + [ Ty.path "i32"; Ty.path "std::sync::mpsc::RecvError" ] + []; Ty.path "alloc::alloc::Global" - ]) + ] + []) "with_capacity" + [] [] in let* α1 := M.get_constant "channels::NTHREADS" in let* α2 := M.read α1 in @@ -270,9 +294,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ] []) + [] [] "into_iter" + [] [] in let* α1 := M.get_constant "channels::NTHREADS" in let* α2 := M.read α1 in @@ -297,9 +323,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ] []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -325,17 +353,22 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "std::sync::mpsc::RecvError" ]; + [ Ty.path "i32"; Ty.path "std::sync::mpsc::RecvError" ] + []; Ty.path "alloc::alloc::Global" - ]) + ] + []) "push" + [] [] in let* α1 := M.get_associated_function (Ty.apply (Ty.path "std::sync::mpsc::Receiver") - [ Ty.path "i32" ]) + [ Ty.path "i32" ] + []) "recv" + [] [] in let* α2 := M.call_closure α1 [ rx ] in let* α3 := M.call_closure α0 [ ids; α2 ] in @@ -352,11 +385,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::vec::Vec") [ - Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.tuple [] ]; + Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.tuple [] ] []; Ty.path "alloc::alloc::Global" - ]) + ] + []) + [] [] "into_iter" + [] [] in let* α1 := M.read children in let* α2 := M.call_closure α0 [ α1 ] in @@ -375,11 +411,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") [ - Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.tuple [] ]; + Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.tuple [] ] []; Ty.path "alloc::alloc::Global" - ]) + ] + []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -411,13 +450,20 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.dyn [ ("core::any::Any::Trait", []) ]; Ty.path "alloc::alloc::Global" ] - ]) + [] + ] + []) "expect" + [] [] in let* α1 := M.get_associated_function - (Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.tuple [] ]) + (Ty.apply + (Ty.path "std::thread::JoinHandle") + [ Ty.tuple [] ] + []) "join" + [] [] in let* α2 := M.read child in let* α3 := M.call_closure α1 [ α2 ] in @@ -431,8 +477,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.pure (M.use α4) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -452,10 +499,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "core::result::Result") - [ Ty.path "i32"; Ty.path "std::sync::mpsc::RecvError" ]; + [ Ty.path "i32"; Ty.path "std::sync::mpsc::RecvError" ] + []; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ ids ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 eec188be9..d227d7353 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 @@ -27,24 +27,28 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "std::process::Output"; Ty.path "std::io::error::Error" ]) + [ Ty.path "std::process::Output"; Ty.path "std::io::error::Error" ] + []) "unwrap_or_else" [ Ty.function [ Ty.tuple [ Ty.path "std::io::error::Error" ] ] (Ty.path "std::process::Output") - ] in - let* α1 := M.get_associated_function (Ty.path "std::process::Command") "output" [] in + ] + [] in + let* α1 := M.get_associated_function (Ty.path "std::process::Command") "output" [] [] in let* α2 := M.get_associated_function (Ty.path "std::process::Command") "arg" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α3 := M.get_associated_function (Ty.path "std::process::Command") "new" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α4 := M.read (mk_str "rustc") in let* α5 := M.call_closure α3 [ α4 ] in let* α6 := M.alloc α5 in @@ -66,9 +70,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ fun γ => let* e := M.copy γ in - let* α0 := M.get_function "core::panicking::panic_fmt" [] in + let* α0 := + M.get_function "core::panicking::panic_fmt" [] [ Value.Bool true ] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_v1" + [] + [] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "failed to execute process: ") in @@ -80,7 +89,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "std::io::error::Error" ] in + [ Ty.path "std::io::error::Error" ] + [] in let* α6 := M.call_closure α5 [ e ] in let* α7 := M.alloc (Value.Array [ α6 ]) in M.pure (M.pointer_coercion α7) in @@ -100,7 +110,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* γ := let* α0 := - M.get_associated_function (Ty.path "std::process::ExitStatus") "success" [] in + M.get_associated_function (Ty.path "std::process::ExitStatus") "success" [] [] in let* α1 := M.call_closure α0 @@ -112,15 +122,22 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Bool true) in let* s := let* α0 := - M.get_associated_function (Ty.path "alloc::string::String") "from_utf8_lossy" [] in + M.get_associated_function + (Ty.path "alloc::string::String") + "from_utf8_lossy" + [] + [] in let* α1 := M.get_trait_method "core::ops::deref::Deref" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref" + [] [] in let* α2 := M.call_closure @@ -130,8 +147,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α3 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "rustc succeeded and stdout was: @@ -144,7 +162,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "alloc::borrow::Cow") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "alloc::borrow::Cow") [ Ty.path "str" ] [] ] + [] in let* α6 := M.call_closure α5 [ s ] in let* α7 := M.alloc (Value.Array [ α6 ]) in M.pure (M.pointer_coercion α7) in @@ -156,15 +175,22 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* s := let* α0 := - M.get_associated_function (Ty.path "alloc::string::String") "from_utf8_lossy" [] in + M.get_associated_function + (Ty.path "alloc::string::String") + "from_utf8_lossy" + [] + [] in let* α1 := M.get_trait_method "core::ops::deref::Deref" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "deref" + [] [] in let* α2 := M.call_closure @@ -174,8 +200,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α3 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "rustc failed and stderr was: @@ -188,7 +215,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "alloc::borrow::Cow") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "alloc::borrow::Cow") [ Ty.path "str" ] [] ] + [] in let* α6 := M.call_closure α5 [ s ] in let* α7 := M.alloc (Value.Array [ α6 ]) in M.pure (M.pointer_coercion α7) in 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 8cd3e8146..fe74616d8 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 @@ -44,29 +44,32 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* process := - let* α0 := M.get_associated_function (Ty.path "std::process::Command") "spawn" [] in + let* α0 := M.get_associated_function (Ty.path "std::process::Command") "spawn" [] [] in let* α1 := M.get_associated_function (Ty.path "std::process::Command") "stdout" - [ Ty.path "std::process::Stdio" ] in + [ Ty.path "std::process::Stdio" ] + [] in let* α2 := M.get_associated_function (Ty.path "std::process::Command") "stdin" - [ Ty.path "std::process::Stdio" ] in + [ Ty.path "std::process::Stdio" ] + [] in let* α3 := M.get_associated_function (Ty.path "std::process::Command") "new" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α4 := M.read (mk_str "wc") in let* α5 := M.call_closure α3 [ α4 ] in let* α6 := M.alloc α5 in - let* α7 := M.get_associated_function (Ty.path "std::process::Stdio") "piped" [] in + let* α7 := M.get_associated_function (Ty.path "std::process::Stdio") "piped" [] [] in let* α8 := M.call_closure α7 [] in let* α9 := M.call_closure α2 [ α6; α8 ] in - let* α10 := M.get_associated_function (Ty.path "std::process::Stdio") "piped" [] in + let* α10 := M.get_associated_function (Ty.path "std::process::Stdio") "piped" [] [] in let* α11 := M.call_closure α10 [] in let* α12 := M.call_closure α1 [ α9; α11 ] in let* α13 := M.call_closure α0 [ α12 ] in @@ -79,8 +82,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* why := M.copy γ0_0 in - let* α0 := M.get_function "core::panicking::panic_fmt" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "core::panicking::panic_fmt" [] [ Value.Bool true ] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "couldn't spawn wc: ") in @@ -92,7 +96,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "std::io::error::Error" ] in + [ Ty.path "std::io::error::Error" ] + [] in let* α6 := M.call_closure α5 [ why ] in let* α7 := M.alloc (Value.Array [ α6 ]) in M.pure (M.pointer_coercion α7) in @@ -112,17 +117,20 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "std::io::Write" (Ty.path "std::process::ChildStdin") [] + [] "write_all" + [] [] in let* α1 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "std::process::ChildStdin" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "std::process::ChildStdin" ] []) "unwrap" - [] in + [] + [ Value.Bool true ] in let* α2 := M.read (M.get_struct_record_field process "std::process::Child" "stdin") in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in - let* α5 := M.get_associated_function (Ty.path "str") "as_bytes" [] in + let* α5 := M.get_associated_function (Ty.path "str") "as_bytes" [] [ Value.Bool true ] in let* α6 := M.get_constant "child_processes_pipes::PANGRAM" in let* α7 := M.read α6 in let* α8 := M.read α7 in @@ -135,8 +143,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* why := M.copy γ0_0 in - let* α0 := M.get_function "core::panicking::panic_fmt" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "core::panicking::panic_fmt" [] [ Value.Bool true ] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "couldn't write to wc stdin: ") in @@ -148,7 +156,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "std::io::error::Error" ] in + [ Ty.path "std::io::error::Error" ] + [] in let* α6 := M.call_closure α5 [ why ] in let* α7 := M.alloc (Value.Array [ α6 ]) in M.pure (M.pointer_coercion α7) in @@ -159,9 +168,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Ok" 0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "sent pangram to wc @@ -174,7 +187,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) ] in let* s := - let* α0 := M.get_associated_function (Ty.path "alloc::string::String") "new" [] in + let* α0 := M.get_associated_function (Ty.path "alloc::string::String") "new" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* α0 := @@ -182,13 +195,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "std::io::Read" (Ty.path "std::process::ChildStdout") [] + [] "read_to_string" + [] [] in let* α1 := M.get_associated_function - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "std::process::ChildStdout" ]) + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "std::process::ChildStdout" ] []) "unwrap" - [] in + [] + [ Value.Bool true ] in let* α2 := M.read (M.get_struct_record_field process "std::process::Child" "stdout") in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc α3 in @@ -201,8 +217,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* why := M.copy γ0_0 in - let* α0 := M.get_function "core::panicking::panic_fmt" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "core::panicking::panic_fmt" [] [ Value.Bool true ] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "couldn't read wc stdout: ") in @@ -214,7 +230,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "std::io::error::Error" ] in + [ Ty.path "std::io::error::Error" ] + [] in let* α6 := M.call_closure α5 [ why ] in let* α7 := M.alloc (Value.Array [ α6 ]) in M.pure (M.pointer_coercion α7) in @@ -225,8 +242,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Ok" 0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "wc responded with: @@ -239,7 +257,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α6 := M.call_closure α5 [ s ] in let* α7 := M.alloc (Value.Array [ α6 ]) in M.pure (M.pointer_coercion α7) in 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 9e5e03f8d..d3c8f1d01 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 @@ -17,20 +17,24 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "std::process::Child"; Ty.path "std::io::error::Error" ]) + [ Ty.path "std::process::Child"; Ty.path "std::io::error::Error" ] + []) "unwrap" + [] [] in - let* α1 := M.get_associated_function (Ty.path "std::process::Command") "spawn" [] in + let* α1 := M.get_associated_function (Ty.path "std::process::Command") "spawn" [] [] in let* α2 := M.get_associated_function (Ty.path "std::process::Command") "arg" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α3 := M.get_associated_function (Ty.path "std::process::Command") "new" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α4 := M.read (mk_str "sleep") in let* α5 := M.call_closure α3 [ α4 ] in let* α6 := M.alloc α5 in @@ -44,17 +48,24 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "std::process::ExitStatus"; Ty.path "std::io::error::Error" ]) + [ Ty.path "std::process::ExitStatus"; Ty.path "std::io::error::Error" ] + []) "unwrap" + [] [] in - let* α1 := M.get_associated_function (Ty.path "std::process::Child") "wait" [] in + let* α1 := M.get_associated_function (Ty.path "std::process::Child") "wait" [] [] in let* α2 := M.call_closure α1 [ child ] in let* α3 := M.call_closure α0 [ α2 ] in M.alloc α3 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "reached end of 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 917be3269..e89db2336 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 @@ -35,12 +35,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* path := - let* α0 := M.get_associated_function (Ty.path "std::path::Path") "new" [ Ty.path "str" ] in + let* α0 := M.get_associated_function (Ty.path "std::path::Path") "new" [ Ty.path "str" ] [] in let* α1 := M.read (mk_str "lorem_ipsum.txt") in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* display := - let* α0 := M.get_associated_function (Ty.path "std::path::Path") "display" [] in + let* α0 := M.get_associated_function (Ty.path "std::path::Path") "display" [] [] in let* α1 := M.read path in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -49,7 +49,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "std::fs::File") "create" - [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "std::path::Path" ] ] ] in + [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "std::path::Path" ] [] ] [] ] + [] in let* α1 := M.call_closure α0 [ path ] in let* α2 := M.alloc α1 in let* α3 := @@ -60,8 +61,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* why := M.copy γ0_0 in - let* α0 := M.get_function "core::panicking::panic_fmt" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "core::panicking::panic_fmt" [] [ Value.Bool true ] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "couldn't create ") in @@ -74,13 +76,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "std::path::Display" ] in + [ Ty.path "std::path::Display" ] + [] in let* α7 := M.call_closure α6 [ display ] in let* α8 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "std::io::error::Error" ] in + [ Ty.path "std::io::error::Error" ] + [] in let* α9 := M.call_closure α8 [ why ] in let* α10 := M.alloc (Value.Array [ α7; α9 ]) in M.pure (M.pointer_coercion α10) in @@ -94,8 +98,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.pure file ] in M.copy α3 in - let* α0 := M.get_trait_method "std::io::Write" (Ty.path "std::fs::File") [] "write_all" [] in - let* α1 := M.get_associated_function (Ty.path "str") "as_bytes" [] in + let* α0 := + M.get_trait_method "std::io::Write" (Ty.path "std::fs::File") [] [] "write_all" [] [] in + let* α1 := M.get_associated_function (Ty.path "str") "as_bytes" [] [ Value.Bool true ] in let* α2 := M.get_constant "file_io_create::LOREM_IPSUM" in let* α3 := M.read α2 in let* α4 := M.read α3 in @@ -109,8 +114,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* why := M.copy γ0_0 in - let* α0 := M.get_function "core::panicking::panic_fmt" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "core::panicking::panic_fmt" [] [ Value.Bool true ] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "couldn't write to ") in @@ -123,13 +128,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "std::path::Display" ] in + [ Ty.path "std::path::Display" ] + [] in let* α7 := M.call_closure α6 [ display ] in let* α8 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "std::io::error::Error" ] in + [ Ty.path "std::io::error::Error" ] + [] in let* α9 := M.call_closure α8 [ why ] in let* α10 := M.alloc (Value.Array [ α7; α9 ]) in M.pure (M.pointer_coercion α10) in @@ -140,8 +147,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Ok" 0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "successfully wrote to ") in @@ -155,7 +163,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "std::path::Display" ] in + [ Ty.path "std::path::Display" ] + [] in let* α7 := M.call_closure α6 [ display ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 c5b8d30da..80264ade8 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 @@ -27,12 +27,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* path := - let* α0 := M.get_associated_function (Ty.path "std::path::Path") "new" [ Ty.path "str" ] in + let* α0 := M.get_associated_function (Ty.path "std::path::Path") "new" [ Ty.path "str" ] [] in let* α1 := M.read (mk_str "hello.txt") in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* display := - let* α0 := M.get_associated_function (Ty.path "std::path::Path") "display" [] in + let* α0 := M.get_associated_function (Ty.path "std::path::Path") "display" [] [] in let* α1 := M.read path in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -41,7 +41,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "std::fs::File") "open" - [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "std::path::Path" ] ] ] in + [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "&") [ Ty.path "std::path::Path" ] [] ] [] ] + [] in let* α1 := M.call_closure α0 [ path ] in let* α2 := M.alloc α1 in let* α3 := @@ -52,8 +53,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* why := M.copy γ0_0 in - let* α0 := M.get_function "core::panicking::panic_fmt" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "core::panicking::panic_fmt" [] [ Value.Bool true ] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "couldn't open ") in @@ -66,13 +68,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "std::path::Display" ] in + [ Ty.path "std::path::Display" ] + [] in let* α7 := M.call_closure α6 [ display ] in let* α8 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "std::io::error::Error" ] in + [ Ty.path "std::io::error::Error" ] + [] in let* α9 := M.call_closure α8 [ why ] in let* α10 := M.alloc (Value.Array [ α7; α9 ]) in M.pure (M.pointer_coercion α10) in @@ -87,11 +91,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ] in M.copy α3 in let* s := - let* α0 := M.get_associated_function (Ty.path "alloc::string::String") "new" [] in + let* α0 := M.get_associated_function (Ty.path "alloc::string::String") "new" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* α0 := - M.get_trait_method "std::io::Read" (Ty.path "std::fs::File") [] "read_to_string" [] in + M.get_trait_method "std::io::Read" (Ty.path "std::fs::File") [] [] "read_to_string" [] [] in let* α1 := M.call_closure α0 [ file; s ] in let* α2 := M.alloc α1 in let* α0 := @@ -101,8 +105,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* why := M.copy γ0_0 in - let* α0 := M.get_function "core::panicking::panic_fmt" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "core::panicking::panic_fmt" [] [ Value.Bool true ] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "couldn't read ") in @@ -115,13 +119,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "std::path::Display" ] in + [ Ty.path "std::path::Display" ] + [] in let* α7 := M.call_closure α6 [ display ] in let* α8 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "std::io::error::Error" ] in + [ Ty.path "std::io::error::Error" ] + [] in let* α9 := M.call_closure α8 [ why ] in let* α10 := M.alloc (Value.Array [ α7; α9 ]) in M.pure (M.pointer_coercion α10) in @@ -132,8 +138,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := fun γ => let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Ok" 0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -147,13 +154,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "std::path::Display" ] in + [ Ty.path "std::path::Display" ] + [] in let* α7 := M.call_closure α6 [ display ] in let* α8 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α9 := M.call_closure α8 [ s ] in let* α10 := M.alloc (Value.Array [ α7; α9 ]) in M.pure (M.pointer_coercion α10) in 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 6689fb053..bbb30fdeb 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 @@ -18,14 +18,17 @@ Definition read_lines (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "std::fs::File"; Ty.path "std::io::error::Error" ]) + [ Ty.path "std::fs::File"; Ty.path "std::io::error::Error" ] + []) "unwrap" + [] [] in let* α1 := M.get_associated_function (Ty.path "std::fs::File") "open" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α2 := M.read filename in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in @@ -33,14 +36,23 @@ Definition read_lines (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "std::io::BufRead" - (Ty.apply (Ty.path "std::io::buffered::bufreader::BufReader") [ Ty.path "std::fs::File" ]) + (Ty.apply + (Ty.path "std::io::buffered::bufreader::BufReader") + [ Ty.path "std::fs::File" ] + []) + [] [] "lines" + [] [] in let* α1 := M.get_associated_function - (Ty.apply (Ty.path "std::io::buffered::bufreader::BufReader") [ Ty.path "std::fs::File" ]) + (Ty.apply + (Ty.path "std::io::buffered::bufreader::BufReader") + [ Ty.path "std::fs::File" ] + []) "new" + [] [] in let* α2 := M.read file in let* α3 := M.call_closure α1 [ α2 ] in @@ -65,8 +77,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* lines := - let* α0 := M.get_function "file_io_read_lines::read_lines" [] in - let* α1 := M.get_trait_method "alloc::string::ToString" (Ty.path "str") [] "to_string" [] in + let* α0 := M.get_function "file_io_read_lines::read_lines" [] [] in + let* α1 := + M.get_trait_method "alloc::string::ToString" (Ty.path "str") [] [] "to_string" [] [] in let* α2 := M.read (mk_str "./hosts") in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in @@ -76,10 +89,17 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::collect::IntoIterator" (Ty.apply (Ty.path "std::io::Lines") - [ Ty.apply (Ty.path "std::io::buffered::bufreader::BufReader") [ Ty.path "std::fs::File" ] - ]) + [ + Ty.apply + (Ty.path "std::io::buffered::bufreader::BufReader") + [ Ty.path "std::fs::File" ] + [] + ] + []) + [] [] "into_iter" + [] [] in let* α1 := M.read lines in let* α2 := M.call_closure α0 [ α1 ] in @@ -101,9 +121,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "std::io::buffered::bufreader::BufReader") [ Ty.path "std::fs::File" ] - ]) + [] + ] + []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -121,11 +145,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* line := M.copy γ0_0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -140,7 +165,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α7 := M.get_associated_function (Ty.apply @@ -148,8 +174,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "alloc::string::String"; Ty.path "std::io::error::Error" - ]) + ] + []) "unwrap" + [] [] in let* α8 := M.read line in let* α9 := M.call_closure α7 [ α8 ] in 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 3e7285b0c..b6650d69e 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 @@ -20,11 +20,14 @@ Definition read_lines (τ : list Ty.t) (α : list Value.t) : M := "core::ops::try_trait::Try" (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "std::fs::File"; Ty.path "std::io::error::Error" ]) + [ Ty.path "std::fs::File"; Ty.path "std::io::error::Error" ] + []) + [] [] "branch" + [] [] in - let* α1 := M.get_associated_function (Ty.path "std::fs::File") "open" [ P ] in + let* α1 := M.get_associated_function (Ty.path "std::fs::File") "open" [ P ] [] in let* α2 := M.read filename in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in @@ -52,15 +55,21 @@ Definition read_lines (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "std::io::buffered::bufreader::BufReader") [ Ty.path "std::fs::File" ] - ]; + [] + ] + []; Ty.path "std::io::error::Error" - ]) + ] + []) [ Ty.apply (Ty.path "core::result::Result") [ Ty.path "core::convert::Infallible"; Ty.path "std::io::error::Error" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -81,14 +90,23 @@ Definition read_lines (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "std::io::BufRead" - (Ty.apply (Ty.path "std::io::buffered::bufreader::BufReader") [ Ty.path "std::fs::File" ]) + (Ty.apply + (Ty.path "std::io::buffered::bufreader::BufReader") + [ Ty.path "std::fs::File" ] + []) + [] [] "lines" + [] [] in let* α1 := M.get_associated_function - (Ty.apply (Ty.path "std::io::buffered::bufreader::BufReader") [ Ty.path "std::fs::File" ]) + (Ty.apply + (Ty.path "std::io::buffered::bufreader::BufReader") + [ Ty.path "std::fs::File" ] + []) "new" + [] [] in let* α2 := M.read file in let* α3 := M.call_closure α1 [ α2 ] in @@ -124,7 +142,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "file_io_read_lines_efficient_method::read_lines" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.read (mk_str "./hosts") in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -139,9 +158,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "std::io::buffered::bufreader::BufReader") [ Ty.path "std::fs::File" ] - ]) + [] + ] + []) + [] [] "into_iter" + [] [] in let* α1 := M.read lines in let* α2 := M.call_closure α0 [ α1 ] in @@ -163,9 +186,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "std::io::buffered::bufreader::BufReader") [ Ty.path "std::fs::File" ] - ]) + [] + ] + []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -198,11 +225,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* ip := M.copy γ0_0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -217,7 +245,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α7 := M.call_closure α6 [ ip ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 7f21ab1b7..1f8d20217 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 @@ -21,15 +21,19 @@ Definition cat (τ : list Ty.t) (α : list Value.t) : M := "core::ops::try_trait::Try" (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "std::fs::File"; Ty.path "std::io::error::Error" ]) + [ Ty.path "std::fs::File"; Ty.path "std::io::error::Error" ] + []) + [] [] "branch" + [] [] in let* α1 := M.get_associated_function (Ty.path "std::fs::File") "open" - [ Ty.apply (Ty.path "&") [ Ty.path "std::path::Path" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "std::path::Path" ] [] ] + [] in let* α2 := M.read path in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in @@ -50,13 +54,17 @@ Definition cat (τ : list Ty.t) (α : list Value.t) : M := "core::ops::try_trait::FromResidual" (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "alloc::string::String"; Ty.path "std::io::error::Error" ]) + [ Ty.path "alloc::string::String"; Ty.path "std::io::error::Error" ] + []) [ Ty.apply (Ty.path "core::result::Result") [ Ty.path "core::convert::Infallible"; Ty.path "std::io::error::Error" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -75,11 +83,11 @@ Definition cat (τ : list Ty.t) (α : list Value.t) : M := ] in M.copy α6 in let* s := - let* α0 := M.get_associated_function (Ty.path "alloc::string::String") "new" [] in + let* α0 := M.get_associated_function (Ty.path "alloc::string::String") "new" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* α0 := - M.get_trait_method "std::io::Read" (Ty.path "std::fs::File") [] "read_to_string" [] in + M.get_trait_method "std::io::Read" (Ty.path "std::fs::File") [] [] "read_to_string" [] [] in let* α1 := M.call_closure α0 [ f; s ] in let* α2 := M.alloc α1 in let* α0 := @@ -118,15 +126,19 @@ Definition echo (τ : list Ty.t) (α : list Value.t) : M := "core::ops::try_trait::Try" (Ty.apply (Ty.path "core::result::Result") - [ Ty.path "std::fs::File"; Ty.path "std::io::error::Error" ]) + [ Ty.path "std::fs::File"; Ty.path "std::io::error::Error" ] + []) + [] [] "branch" + [] [] in let* α1 := M.get_associated_function (Ty.path "std::fs::File") "create" - [ Ty.apply (Ty.path "&") [ Ty.path "std::path::Path" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "std::path::Path" ] [] ] + [] in let* α2 := M.read path in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in @@ -147,13 +159,17 @@ Definition echo (τ : list Ty.t) (α : list Value.t) : M := "core::ops::try_trait::FromResidual" (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "std::io::error::Error" ]) + [ Ty.tuple []; Ty.path "std::io::error::Error" ] + []) [ Ty.apply (Ty.path "core::result::Result") [ Ty.path "core::convert::Infallible"; Ty.path "std::io::error::Error" ] + [] ] + [] "from_residual" + [] [] in let* α1 := M.read residual in let* α2 := M.call_closure α0 [ α1 ] in @@ -171,8 +187,9 @@ Definition echo (τ : list Ty.t) (α : list Value.t) : M := M.pure val ] in M.copy α6 in - let* α0 := M.get_trait_method "std::io::Write" (Ty.path "std::fs::File") [] "write_all" [] in - let* α1 := M.get_associated_function (Ty.path "str") "as_bytes" [] in + let* α0 := + M.get_trait_method "std::io::Write" (Ty.path "std::fs::File") [] [] "write_all" [] [] in + let* α1 := M.get_associated_function (Ty.path "str") "as_bytes" [] [ Value.Bool true ] in let* α2 := M.read s in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ f; α3 ] in @@ -197,10 +214,11 @@ Definition touch (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "std::fs::OpenOptions") "open" - [ Ty.apply (Ty.path "&") [ Ty.path "std::path::Path" ] ] in - let* α1 := M.get_associated_function (Ty.path "std::fs::OpenOptions") "write" [] in - let* α2 := M.get_associated_function (Ty.path "std::fs::OpenOptions") "create" [] in - let* α3 := M.get_associated_function (Ty.path "std::fs::OpenOptions") "new" [] in + [ Ty.apply (Ty.path "&") [ Ty.path "std::path::Path" ] [] ] + [] in + let* α1 := M.get_associated_function (Ty.path "std::fs::OpenOptions") "write" [] [] in + let* α2 := M.get_associated_function (Ty.path "std::fs::OpenOptions") "create" [] [] in + let* α3 := M.get_associated_function (Ty.path "std::fs::OpenOptions") "new" [] [] in let* α4 := M.call_closure α3 [] in let* α5 := M.alloc α4 in let* α6 := M.call_closure α2 [ α5; Value.Bool true ] in @@ -294,8 +312,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "`mkdir a` @@ -308,7 +331,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* α0 := - M.get_function "std::fs::create_dir" [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + M.get_function "std::fs::create_dir" [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] [] in let* α1 := M.read (mk_str "a") in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.alloc α2 in @@ -319,8 +342,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* why := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "! ") in @@ -334,9 +358,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "std::io::error::ErrorKind" ] in + [ Ty.path "std::io::error::ErrorKind" ] + [] in let* α7 := - M.get_associated_function (Ty.path "std::io::error::Error") "kind" [] in + M.get_associated_function (Ty.path "std::io::error::Error") "kind" [] [] in let* α8 := M.call_closure α7 [ why ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in @@ -352,8 +377,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ] in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "`echo hello > a/b.txt` @@ -369,12 +399,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "std::io::error::Error" ]) + [ Ty.tuple []; Ty.path "std::io::error::Error" ] + []) "unwrap_or_else" - [ Ty.function [ Ty.tuple [ Ty.path "std::io::error::Error" ] ] (Ty.tuple []) ] in - let* α1 := M.get_function "filesystem_operations::echo" [] in + [ Ty.function [ Ty.tuple [ Ty.path "std::io::error::Error" ] ] (Ty.tuple []) ] + [] in + let* α1 := M.get_function "filesystem_operations::echo" [] [] in let* α2 := M.read (mk_str "hello") in - let* α3 := M.get_associated_function (Ty.path "std::path::Path") "new" [ Ty.path "str" ] in + let* α3 := M.get_associated_function (Ty.path "std::path::Path") "new" [ Ty.path "str" ] [] in let* α4 := M.read (mk_str "a/b.txt") in let* α5 := M.call_closure α3 [ α4 ] in let* α6 := M.call_closure α1 [ α2; α5 ] in @@ -395,11 +427,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* why := M.copy γ in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -414,11 +447,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "std::io::error::ErrorKind" ] in + [ Ty.path "std::io::error::ErrorKind" ] + [] in let* α7 := M.get_associated_function (Ty.path "std::io::error::Error") "kind" + [] [] in let* α8 := M.call_closure α7 [ why ] in let* α9 := M.alloc α8 in @@ -438,8 +473,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α7 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "`mkdir -p a/c/d` @@ -455,11 +495,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "std::io::error::Error" ]) + [ Ty.tuple []; Ty.path "std::io::error::Error" ] + []) "unwrap_or_else" - [ Ty.function [ Ty.tuple [ Ty.path "std::io::error::Error" ] ] (Ty.tuple []) ] in + [ Ty.function [ Ty.tuple [ Ty.path "std::io::error::Error" ] ] (Ty.tuple []) ] + [] in let* α1 := - M.get_function "std::fs::create_dir_all" [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + M.get_function + "std::fs::create_dir_all" + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α2 := M.read (mk_str "a/c/d") in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := @@ -479,11 +524,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* why := M.copy γ in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -498,11 +544,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "std::io::error::ErrorKind" ] in + [ Ty.path "std::io::error::ErrorKind" ] + [] in let* α7 := M.get_associated_function (Ty.path "std::io::error::Error") "kind" + [] [] in let* α8 := M.call_closure α7 [ why ] in let* α9 := M.alloc α8 in @@ -522,8 +570,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α4 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "`touch a/c/e.txt` @@ -539,11 +592,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "std::io::error::Error" ]) + [ Ty.tuple []; Ty.path "std::io::error::Error" ] + []) "unwrap_or_else" - [ Ty.function [ Ty.tuple [ Ty.path "std::io::error::Error" ] ] (Ty.tuple []) ] in - let* α1 := M.get_function "filesystem_operations::touch" [] in - let* α2 := M.get_associated_function (Ty.path "std::path::Path") "new" [ Ty.path "str" ] in + [ Ty.function [ Ty.tuple [ Ty.path "std::io::error::Error" ] ] (Ty.tuple []) ] + [] in + let* α1 := M.get_function "filesystem_operations::touch" [] [] in + let* α2 := M.get_associated_function (Ty.path "std::path::Path") "new" [ Ty.path "str" ] [] in let* α3 := M.read (mk_str "a/c/e.txt") in let* α4 := M.call_closure α2 [ α3 ] in let* α5 := M.call_closure α1 [ α4 ] in @@ -564,11 +619,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* why := M.copy γ in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -583,11 +639,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "std::io::error::ErrorKind" ] in + [ Ty.path "std::io::error::ErrorKind" ] + [] in let* α7 := M.get_associated_function (Ty.path "std::io::error::Error") "kind" + [] [] in let* α8 := M.call_closure α7 [ why ] in let* α9 := M.alloc α8 in @@ -607,8 +665,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α6 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "`ln -s ../b.txt a/c/b.txt` @@ -636,16 +699,19 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "std::io::error::Error" ]) + [ Ty.tuple []; Ty.path "std::io::error::Error" ] + []) "unwrap_or_else" - [ Ty.function [ Ty.tuple [ Ty.path "std::io::error::Error" ] ] (Ty.tuple []) ] in + [ Ty.function [ Ty.tuple [ Ty.path "std::io::error::Error" ] ] (Ty.tuple []) ] + [] in let* α1 := M.get_function "std::os::unix::fs::symlink" [ - Ty.apply (Ty.path "&") [ Ty.path "str" ]; - Ty.apply (Ty.path "&") [ Ty.path "str" ] - ] in + Ty.apply (Ty.path "&") [ Ty.path "str" ] []; + Ty.apply (Ty.path "&") [ Ty.path "str" ] [] + ] + [] in let* α2 := M.read (mk_str "../b.txt") in let* α3 := M.read (mk_str "a/c/b.txt") in let* α4 := M.call_closure α1 [ α2; α3 ] in @@ -666,11 +732,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* why := M.copy γ in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -685,11 +752,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "std::io::error::ErrorKind" ] in + [ Ty.path "std::io::error::ErrorKind" ] + [] in let* α7 := M.get_associated_function (Ty.path "std::io::error::Error") "kind" + [] [] in let* α8 := M.call_closure α7 [ why ] in let* α9 := M.alloc α8 in @@ -712,8 +781,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ] in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "`cat a/c/b.txt` @@ -725,8 +799,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α6 in M.alloc (Value.Tuple []) in let* _ := - let* α0 := M.get_function "filesystem_operations::cat" [] in - let* α1 := M.get_associated_function (Ty.path "std::path::Path") "new" [ Ty.path "str" ] in + let* α0 := M.get_function "filesystem_operations::cat" [] [] in + let* α1 := M.get_associated_function (Ty.path "std::path::Path") "new" [ Ty.path "str" ] [] in let* α2 := M.read (mk_str "a/c/b.txt") in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in @@ -738,8 +812,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* why := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "! ") in @@ -753,9 +828,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "std::io::error::ErrorKind" ] in + [ Ty.path "std::io::error::ErrorKind" ] + [] in let* α7 := - M.get_associated_function (Ty.path "std::io::error::Error") "kind" [] in + M.get_associated_function (Ty.path "std::io::error::Error") "kind" [] [] in let* α8 := M.call_closure α7 [ why ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in @@ -769,8 +845,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Ok" 0 in let* s := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "> ") in @@ -784,7 +861,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α7 := M.call_closure α6 [ s ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -795,8 +873,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ] in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "`ls a` @@ -808,7 +891,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α6 in M.alloc (Value.Tuple []) in let* _ := - let* α0 := M.get_function "std::fs::read_dir" [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + let* α0 := + M.get_function "std::fs::read_dir" [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] [] in let* α1 := M.read (mk_str "a") in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.alloc α2 in @@ -819,8 +903,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* why := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "! ") in @@ -834,9 +919,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "std::io::error::ErrorKind" ] in + [ Ty.path "std::io::error::ErrorKind" ] + [] in let* α7 := - M.get_associated_function (Ty.path "std::io::error::Error") "kind" [] in + M.get_associated_function (Ty.path "std::io::error::Error") "kind" [] [] in let* α8 := M.call_closure α7 [ why ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in @@ -854,7 +940,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::collect::IntoIterator" (Ty.path "std::fs::ReadDir") [] + [] "into_iter" + [] [] in let* α1 := M.read paths in let* α2 := M.call_closure α0 [ α1 ] in @@ -872,7 +960,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::iterator::Iterator" (Ty.path "std::fs::ReadDir") [] + [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -893,11 +983,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* path := M.copy γ0_0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -912,11 +1003,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "std::path::PathBuf" ] in + [ Ty.path "std::path::PathBuf" ] + [] in let* α7 := M.get_associated_function (Ty.path "std::fs::DirEntry") "path" + [] [] in let* α8 := M.get_associated_function @@ -925,8 +1018,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "std::fs::DirEntry"; Ty.path "std::io::error::Error" - ]) + ] + []) "unwrap" + [] [] in let* α9 := M.read path in let* α10 := M.call_closure α8 [ α9 ] in @@ -948,8 +1043,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ] in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "`rm a/c/e.txt` @@ -965,11 +1065,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "std::io::error::Error" ]) + [ Ty.tuple []; Ty.path "std::io::error::Error" ] + []) "unwrap_or_else" - [ Ty.function [ Ty.tuple [ Ty.path "std::io::error::Error" ] ] (Ty.tuple []) ] in + [ Ty.function [ Ty.tuple [ Ty.path "std::io::error::Error" ] ] (Ty.tuple []) ] + [] in let* α1 := - M.get_function "std::fs::remove_file" [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + M.get_function "std::fs::remove_file" [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] [] in let* α2 := M.read (mk_str "a/c/e.txt") in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := @@ -989,11 +1091,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* why := M.copy γ in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -1008,11 +1111,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "std::io::error::ErrorKind" ] in + [ Ty.path "std::io::error::ErrorKind" ] + [] in let* α7 := M.get_associated_function (Ty.path "std::io::error::Error") "kind" + [] [] in let* α8 := M.call_closure α7 [ why ] in let* α9 := M.alloc α8 in @@ -1032,8 +1137,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α4 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "`rmdir a/c/d` @@ -1049,11 +1159,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.tuple []; Ty.path "std::io::error::Error" ]) + [ Ty.tuple []; Ty.path "std::io::error::Error" ] + []) "unwrap_or_else" - [ Ty.function [ Ty.tuple [ Ty.path "std::io::error::Error" ] ] (Ty.tuple []) ] in + [ Ty.function [ Ty.tuple [ Ty.path "std::io::error::Error" ] ] (Ty.tuple []) ] + [] in let* α1 := - M.get_function "std::fs::remove_dir" [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + M.get_function "std::fs::remove_dir" [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] [] in let* α2 := M.read (mk_str "a/c/d") in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := @@ -1073,11 +1185,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* why := M.copy γ in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -1092,11 +1205,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "std::io::error::ErrorKind" ] in + [ Ty.path "std::io::error::ErrorKind" ] + [] in let* α7 := M.get_associated_function (Ty.path "std::io::error::Error") "kind" + [] [] in let* α8 := M.call_closure α7 [ why ] in let* α9 := M.alloc α8 in 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 8a13a8ed0..5adaf280b 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 @@ -12,7 +12,7 @@ Definition cos (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [ z ] => let* z := M.alloc z in - let* α0 := M.get_function "foreign_function_interface::ccosf" [] in + let* α0 := M.get_function "foreign_function_interface::ccosf" [] [] in let* α1 := M.read z in M.call_closure α0 [ α1 ] | _, _ => M.impossible @@ -41,14 +41,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.StructRecord "foreign_function_interface::Complex" [ ("re", α0); ("im", α1) ]) in let* z_sqrt := - let* α0 := M.get_function "foreign_function_interface::csqrtf" [] in + let* α0 := M.get_function "foreign_function_interface::csqrtf" [] [] in let* α1 := M.read z in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "the square root of ") in @@ -63,13 +63,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "foreign_function_interface::Complex" ] in + [ Ty.path "foreign_function_interface::Complex" ] + [] in let* α8 := M.call_closure α7 [ z ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "foreign_function_interface::Complex" ] in + [ Ty.path "foreign_function_interface::Complex" ] + [] in let* α10 := M.call_closure α9 [ z_sqrt ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in M.pure (M.pointer_coercion α11) in @@ -79,8 +81,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "cos(") in @@ -95,14 +97,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "foreign_function_interface::Complex" ] in + [ Ty.path "foreign_function_interface::Complex" ] + [] in let* α8 := M.call_closure α7 [ z ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "foreign_function_interface::Complex" ] in - let* α10 := M.get_function "foreign_function_interface::cos" [] in + [ Ty.path "foreign_function_interface::Complex" ] + [] in + let* α10 := M.get_function "foreign_function_interface::cos" [] [] in let* α11 := M.read z in let* α12 := M.call_closure α10 [ α11 ] in let* α13 := M.alloc α12 in @@ -190,9 +194,10 @@ Module Impl_core_fmt_Debug_for_foreign_function_interface_Complex. let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Bool true) in let* α0 := - M.get_associated_function (Ty.path "core::fmt::Formatter") "write_fmt" [] in + M.get_associated_function (Ty.path "core::fmt::Formatter") "write_fmt" [] [] in let* α1 := M.read f in - let* α2 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α2 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α7 := (* Unsize *) let* α3 := M.read (mk_str "") in @@ -206,7 +211,8 @@ Module Impl_core_fmt_Debug_for_foreign_function_interface_Complex. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "f32" ] in + [ Ty.path "f32" ] + [] in let* α9 := M.read self in let* α10 := M.call_closure @@ -216,7 +222,8 @@ Module Impl_core_fmt_Debug_for_foreign_function_interface_Complex. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "f32" ] in + [ Ty.path "f32" ] + [] in let* α12 := M.read self in let* α13 := M.read @@ -231,9 +238,10 @@ Module Impl_core_fmt_Debug_for_foreign_function_interface_Complex. M.alloc α20; fun γ => let* α0 := - M.get_associated_function (Ty.path "core::fmt::Formatter") "write_fmt" [] in + M.get_associated_function (Ty.path "core::fmt::Formatter") "write_fmt" [] [] in let* α1 := M.read f in - let* α2 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α2 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α7 := (* Unsize *) let* α3 := M.read (mk_str "") in @@ -247,7 +255,8 @@ Module Impl_core_fmt_Debug_for_foreign_function_interface_Complex. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "f32" ] in + [ Ty.path "f32" ] + [] in let* α9 := M.read self in let* α10 := M.call_closure @@ -257,7 +266,8 @@ Module Impl_core_fmt_Debug_for_foreign_function_interface_Complex. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "f32" ] in + [ Ty.path "f32" ] + [] in let* α12 := M.read self in let* α13 := M.call_closure 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 5480334d5..42657f293 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_misc/path.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_misc/path.v @@ -31,12 +31,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* path := - let* α0 := M.get_associated_function (Ty.path "std::path::Path") "new" [ Ty.path "str" ] in + let* α0 := M.get_associated_function (Ty.path "std::path::Path") "new" [ Ty.path "str" ] [] in let* α1 := M.read (mk_str ".") in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _display := - let* α0 := M.get_associated_function (Ty.path "std::path::Path") "display" [] in + let* α0 := M.get_associated_function (Ty.path "std::path::Path") "display" [] [] in let* α1 := M.read path in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -45,14 +45,23 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "std::path::Path") "join" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := - M.get_trait_method "core::ops::deref::Deref" (Ty.path "std::path::PathBuf") [] "deref" [] in + M.get_trait_method + "core::ops::deref::Deref" + (Ty.path "std::path::PathBuf") + [] + [] + "deref" + [] + [] in let* α2 := M.get_associated_function (Ty.path "std::path::Path") "join" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α3 := M.read path in let* α4 := M.read (mk_str "a") in let* α5 := M.call_closure α2 [ α3; α4 ] in @@ -66,7 +75,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "std::path::PathBuf") "push" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.read (mk_str "c") in let* α2 := M.call_closure α0 [ new_path; α1 ] in M.alloc α2 in @@ -75,7 +85,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "std::path::PathBuf") "push" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.read (mk_str "myfile.tar.gz") in let* α2 := M.call_closure α0 [ new_path; α1 ] in M.alloc α2 in @@ -84,13 +95,21 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "std::path::PathBuf") "set_file_name" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.read (mk_str "package.tgz") in let* α2 := M.call_closure α0 [ new_path; α1 ] in M.alloc α2 in - let* α0 := M.get_associated_function (Ty.path "std::path::Path") "to_str" [] in + let* α0 := M.get_associated_function (Ty.path "std::path::Path") "to_str" [] [] in let* α1 := - M.get_trait_method "core::ops::deref::Deref" (Ty.path "std::path::PathBuf") [] "deref" [] in + M.get_trait_method + "core::ops::deref::Deref" + (Ty.path "std::path::PathBuf") + [] + [] + "deref" + [] + [] in let* α2 := M.call_closure α1 [ new_path ] in let* α3 := M.call_closure α0 [ α2 ] in let* α4 := M.alloc α3 in @@ -102,7 +121,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "std::panicking::begin_panic" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.read (mk_str "new path is not a valid UTF-8 sequence") in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.never_to_any α2 in @@ -111,8 +131,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* γ0_0 := M.get_struct_tuple_field_or_break_match γ "core::option::Option::Some" 0 in let* s := M.copy γ0_0 in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "new path is ") in @@ -126,7 +147,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ s ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 5aaea80c5..1b30a7350 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 @@ -23,20 +23,23 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::iterator::Iterator" (Ty.path "std::env::Args") [] + [] "collect" [ Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ] - ] in - let* α1 := M.get_function "std::env::args" [] in + [] + ] + [] in + let* α1 := M.get_function "std::env::args" [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.call_closure α0 [ α2 ] in M.alloc α3 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "My path is ") in @@ -50,15 +53,19 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α7 := M.get_trait_method "core::ops::index::Index" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ] + []) [ Ty.path "usize" ] + [] "index" + [] [] in let* α8 := M.call_closure α7 [ args; Value.Integer Integer.Usize 0 ] in let* α9 := M.call_closure α6 [ α8 ] in @@ -70,8 +77,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "I got ") in @@ -86,13 +93,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α8 := M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ] + []) "len" + [] [] in let* α9 := M.call_closure α8 [ args ] in let* α10 := BinOp.Panic.sub α9 (Value.Integer Integer.Usize 1) in @@ -105,16 +115,21 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "&") - [ Ty.apply (Ty.path "slice") [ Ty.path "alloc::string::String" ] ] - ] in + [ Ty.apply (Ty.path "slice") [ Ty.path "alloc::string::String" ] [] ] + [] + ] + [] in let* α14 := M.get_trait_method "core::ops::index::Index" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ]) - [ Ty.apply (Ty.path "core::ops::range::RangeFrom") [ Ty.path "usize" ] ] + [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ] + []) + [ Ty.apply (Ty.path "core::ops::range::RangeFrom") [ Ty.path "usize" ] [] ] + [] "index" + [] [] in let* α15 := M.call_closure diff --git a/CoqOfRust/examples/default/examples/rust_book/std_misc/program_arguments_parsing.err b/CoqOfRust/examples/default/examples/rust_book/std_misc/program_arguments_parsing.err index cc2b36b92..585343f57 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_misc/program_arguments_parsing.err +++ b/CoqOfRust/examples/default/examples/rust_book/std_misc/program_arguments_parsing.err @@ -1,14 +1,18 @@ -warning: This kind of constant in patterns is not yet supported. +warning: This kind of literal is not yet supported. --> examples/rust_book/std_misc/program_arguments_parsing.rs:49:17 | 49 | "increase" => increase(number), | ^^^^^^^^^^ + | + = note: We will work on it! 🪄 -warning: This kind of constant in patterns is not yet supported. +warning: This kind of literal is not yet supported. --> examples/rust_book/std_misc/program_arguments_parsing.rs:50:17 | 50 | "decrease" => decrease(number), | ^^^^^^^^^^ + | + = note: We will work on it! 🪄 warning: 2 warnings emitted 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 9862b0873..8d9b0e738 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 @@ -12,8 +12,8 @@ Definition increase (τ : list Ty.t) (α : list Value.t) : M := let* number := M.alloc number in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -27,7 +27,8 @@ Definition increase (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.read number in let* α8 := BinOp.Panic.add α7 (Value.Integer Integer.I32 1) in let* α9 := M.alloc α8 in @@ -54,8 +55,8 @@ Definition decrease (τ : list Ty.t) (α : list Value.t) : M := let* number := M.alloc number in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -69,7 +70,8 @@ Definition decrease (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.read number in let* α8 := BinOp.Panic.sub α7 (Value.Integer Integer.I32 1) in let* α9 := M.alloc α8 in @@ -101,8 +103,13 @@ Definition help (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := @@ -179,13 +186,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::iterator::Iterator" (Ty.path "std::env::Args") [] + [] "collect" [ Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ] - ] in - let* α1 := M.get_function "std::env::args" [] in + [] + ] + [] in + let* α1 := M.get_function "std::env::args" [] [] in let* α2 := M.call_closure α1 [] in let* α3 := M.call_closure α0 [ α2 ] in M.alloc α3 in @@ -193,8 +203,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ] + []) "len" + [] [] in let* α1 := M.call_closure α0 [ args ] in let* α2 := M.alloc α1 in @@ -208,9 +220,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.is_constant_or_break_match α0 (Value.Integer Integer.Usize 1) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := @@ -227,22 +243,27 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* _ := let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Integer Integer.Usize 2) in - let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α1 := M.get_trait_method "core::ops::deref::Deref" (Ty.path "alloc::string::String") [] + [] "deref" + [] [] in let* α2 := M.get_trait_method "core::ops::index::Index" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ] + []) [ Ty.path "usize" ] + [] "index" + [] [] in let* α3 := M.call_closure α2 [ args; Value.Integer Integer.Usize 1 ] in let* α4 := M.call_closure α1 [ α3 ] in @@ -258,9 +279,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.read γ0_0 in M.is_constant_or_break_match α0 (Value.Integer Integer.I32 42) in let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "This is the answer! @@ -273,9 +298,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []); fun γ => let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "This is not the answer. @@ -297,9 +326,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::ops::index::Index" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ] + []) [ Ty.path "usize" ] + [] "index" + [] [] in let* α1 := M.call_closure α0 [ args; Value.Integer Integer.Usize 1 ] in M.alloc α1 in @@ -309,20 +341,25 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::ops::index::Index" (Ty.apply (Ty.path "alloc::vec::Vec") - [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "alloc::string::String"; Ty.path "alloc::alloc::Global" ] + []) [ Ty.path "usize" ] + [] "index" + [] [] in let* α1 := M.call_closure α0 [ args; Value.Integer Integer.Usize 2 ] in M.alloc α1 in let* number := - let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] in + let* α0 := M.get_associated_function (Ty.path "str") "parse" [ Ty.path "i32" ] [] in let* α1 := M.get_trait_method "core::ops::deref::Deref" (Ty.path "alloc::string::String") [] + [] "deref" + [] [] in let* α2 := M.read num in let* α3 := M.call_closure α1 [ α2 ] in @@ -342,12 +379,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_struct_tuple_field_or_break_match γ "core::result::Result::Err" 0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_eprint" [] in + let* α0 := M.get_function "std::io::stdio::_eprint" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" - [] in + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "error: second argument not an integer @@ -359,7 +397,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α6 in M.alloc (Value.Tuple []) in let* _ := - let* α0 := M.get_function "program_arguments_parsing::help" [] in + let* α0 := M.get_function "program_arguments_parsing::help" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* α0 := M.return_ (Value.Tuple []) in @@ -373,7 +411,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::ops::index::Index" (Ty.path "alloc::string::String") [ Ty.path "core::ops::range::RangeFull" ] + [] "index" + [] [] in let* α1 := M.read cmd in let* α2 := @@ -383,21 +423,31 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := α3 [ fun γ => - let* α0 := M.get_function "program_arguments_parsing::increase" [] in + let* _ := + let* α0 := M.read γ in + M.is_constant_or_break_match α0 UnsupportedLiteral in + let* α0 := M.get_function "program_arguments_parsing::increase" [] [] in let* α1 := M.read number in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2; fun γ => - let* α0 := M.get_function "program_arguments_parsing::decrease" [] in + let* _ := + let* α0 := M.read γ in + M.is_constant_or_break_match α0 UnsupportedLiteral in + let* α0 := M.get_function "program_arguments_parsing::decrease" [] [] in let* α1 := M.read number in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2; fun γ => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_eprint" [] in + let* α0 := M.get_function "std::io::stdio::_eprint" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "error: invalid command @@ -409,14 +459,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α6 in M.alloc (Value.Tuple []) in let* _ := - let* α0 := M.get_function "program_arguments_parsing::help" [] in + let* α0 := M.get_function "program_arguments_parsing::help" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in M.alloc (Value.Tuple []) ]; fun γ => let* _ := - let* α0 := M.get_function "program_arguments_parsing::help" [] in + let* α0 := M.get_function "program_arguments_parsing::help" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in M.alloc (Value.Tuple []) 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 e430f3749..807398e81 100644 --- a/CoqOfRust/examples/default/examples/rust_book/std_misc/threads.v +++ b/CoqOfRust/examples/default/examples/rust_book/std_misc/threads.v @@ -30,10 +30,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::vec::Vec") [ - Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.tuple [] ]; + Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.tuple [] ] []; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in @@ -41,9 +43,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "u32" ] []) + [] [] "into_iter" + [] [] in let* α1 := M.get_constant "threads::NTHREADS" in let* α2 := M.read α1 in @@ -67,9 +71,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "u32" ] []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -94,15 +100,18 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::vec::Vec") [ - Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.tuple [] ]; + Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.tuple [] ] []; Ty.path "alloc::alloc::Global" - ]) + ] + []) "push" + [] [] in let* α1 := M.get_function "std::thread::spawn" - [ Ty.function [ Ty.tuple [] ] (Ty.tuple []); Ty.tuple [] ] in + [ Ty.function [ Ty.tuple [] ] (Ty.tuple []); Ty.tuple [] ] + [] in let* α2 := M.call_closure α1 @@ -119,11 +128,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* _ := let* _ := let* α0 := - M.get_function "std::io::stdio::_print" [] in + M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -139,7 +149,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.call_closure α6 [ i ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -166,11 +177,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::vec::Vec") [ - Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.tuple [] ]; + Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.tuple [] ] []; Ty.path "alloc::alloc::Global" - ]) + ] + []) + [] [] "into_iter" + [] [] in let* α1 := M.read children in let* α2 := M.call_closure α0 [ α1 ] in @@ -189,11 +203,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") [ - Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.tuple [] ]; + Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.tuple [] ] []; Ty.path "alloc::alloc::Global" - ]) + ] + []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -211,8 +228,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* child := M.copy γ0_0 in let* α0 := M.get_associated_function - (Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.tuple [] ]) + (Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.tuple [] ] []) "join" + [] [] in let* α1 := M.read child in let* α2 := M.call_closure α0 [ α1 ] in 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 fa299a670..02f6c33a5 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 @@ -108,15 +108,17 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::vec::Vec") [ - Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.path "u32" ]; + Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.path "u32" ] []; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* chunked_data := - let* α0 := M.get_associated_function (Ty.path "str") "split_whitespace" [] in + let* α0 := M.get_associated_function (Ty.path "str") "split_whitespace" [] [] in let* α1 := M.read data in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -126,16 +128,21 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::collect::IntoIterator" (Ty.apply (Ty.path "core::iter::adapters::enumerate::Enumerate") - [ Ty.path "core::str::iter::SplitWhitespace" ]) + [ Ty.path "core::str::iter::SplitWhitespace" ] + []) + [] [] "into_iter" + [] [] in let* α1 := M.get_trait_method "core::iter::traits::iterator::Iterator" (Ty.path "core::str::iter::SplitWhitespace") [] + [] "enumerate" + [] [] in let* α2 := M.read chunked_data in let* α3 := M.call_closure α1 [ α2 ] in @@ -154,9 +161,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "core::iter::adapters::enumerate::Enumerate") - [ Ty.path "core::str::iter::SplitWhitespace" ]) + [ Ty.path "core::str::iter::SplitWhitespace" ] + []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -180,11 +190,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* data_segment := M.copy γ1_1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α6 := (* Unsize *) @@ -200,13 +211,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α8 := M.call_closure α7 [ i ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α10 := M.call_closure α9 [ data_segment ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in M.pure (M.pointer_coercion α11) in @@ -220,15 +233,18 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "alloc::vec::Vec") [ - Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.path "u32" ]; + Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.path "u32" ] []; Ty.path "alloc::alloc::Global" - ]) + ] + []) "push" + [] [] in let* α1 := M.get_function "std::thread::spawn" - [ Ty.function [ Ty.tuple [] ] (Ty.path "u32"); Ty.path "u32" ] in + [ Ty.function [ Ty.tuple [] ] (Ty.path "u32"); Ty.path "u32" ] + [] in let* α2 := M.call_closure α1 @@ -253,26 +269,32 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.function [ Ty.tuple [ Ty.path "char" ] ] (Ty.path "u32") - ]) + ] + []) + [] [] "sum" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α1 := M.get_trait_method "core::iter::traits::iterator::Iterator" (Ty.path "core::str::iter::Chars") [] + [] "map" [ Ty.path "u32"; Ty.function [ Ty.tuple [ Ty.path "char" ] ] (Ty.path "u32") - ] in + ] + [] in let* α2 := M.get_associated_function (Ty.path "str") "chars" + [] [] in let* α3 := M.read data_segment in let* α4 := M.call_closure α2 [ α3 ] in @@ -296,14 +318,17 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := (Ty.apply (Ty.path "core::option::Option") - [ Ty.path "u32" ]) + [ Ty.path "u32" ] + []) "expect" - [] in + [] + [ Value.Bool true ] in let* α1 := M.get_associated_function (Ty.path "char") "to_digit" - [] in + [] + [ Value.Bool true ] in let* α2 := M.read c in let* α3 := M.call_closure @@ -325,11 +350,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* _ := let* _ := let* α0 := - M.get_function "std::io::stdio::_print" [] in + M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α6 := (* Unsize *) @@ -347,13 +373,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in + [ Ty.path "usize" ] + [] in let* α8 := M.call_closure α7 [ i ] in let* α9 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α10 := M.call_closure α9 [ result ] in let* α11 := M.alloc (Value.Array [ α8; α10 ]) in M.pure (M.pointer_coercion α11) in @@ -383,44 +411,54 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") [ - Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.path "u32" ]; + Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.path "u32" ] []; Ty.path "alloc::alloc::Global" - ]; + ] + []; Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.path "u32" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.path "u32" ] [] ] ] (Ty.path "u32") - ]) + ] + []) + [] [] "sum" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α1 := M.get_trait_method "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") [ - Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.path "u32" ]; + Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.path "u32" ] []; Ty.path "alloc::alloc::Global" - ]) + ] + []) + [] [] "map" [ Ty.path "u32"; Ty.function - [ Ty.tuple [ Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.path "u32" ] ] ] + [ Ty.tuple [ Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.path "u32" ] [] ] ] (Ty.path "u32") - ] in + ] + [] in let* α2 := M.get_trait_method "core::iter::traits::collect::IntoIterator" (Ty.apply (Ty.path "alloc::vec::Vec") [ - Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.path "u32" ]; + Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.path "u32" ] []; Ty.path "alloc::alloc::Global" - ]) + ] + []) + [] [] "into_iter" + [] [] in let* α3 := M.read children in let* α4 := M.call_closure α2 [ α3 ] in @@ -451,13 +489,17 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.dyn [ ("core::any::Any::Trait", []) ]; Ty.path "alloc::alloc::Global" ] - ]) + [] + ] + []) "unwrap" + [] [] in let* α1 := M.get_associated_function - (Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "std::thread::JoinHandle") [ Ty.path "u32" ] []) "join" + [] [] in let* α2 := M.read c in let* α3 := M.call_closure α1 [ α2 ] in @@ -470,8 +512,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α6 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Final sum result: ") in @@ -485,7 +527,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.call_closure α6 [ final_result ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 0c3727615..2955f7f92 100644 --- a/CoqOfRust/examples/default/examples/rust_book/testing/documentation_testing.v +++ b/CoqOfRust/examples/default/examples/rust_book/testing/documentation_testing.v @@ -47,7 +47,8 @@ Definition div (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "std::panicking::begin_panic" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α1 := M.read (mk_str "Divide-by-zero error") in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.never_to_any α2 in 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 b5d5caff0..485f7667c 100644 --- a/CoqOfRust/examples/default/examples/rust_book/testing/unit_testing.v +++ b/CoqOfRust/examples/default/examples/rust_book/testing/unit_testing.v @@ -43,7 +43,7 @@ Module tests. match τ, α with | [], [] => let* _ := - let* α0 := M.get_function "unit_testing::add" [] in + let* α0 := M.get_function "unit_testing::add" [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.I32 1; Value.Integer Integer.I32 2 ] in let* α2 := M.alloc α1 in let* α3 := M.alloc (Value.Integer Integer.I32 3) in @@ -75,7 +75,8 @@ Module tests. let* α0 := M.get_function "core::panicking::assert_failed" - [ Ty.path "i32"; Ty.path "i32" ] in + [ Ty.path "i32"; Ty.path "i32" ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in @@ -106,7 +107,7 @@ Module tests. match τ, α with | [], [] => let* _ := - let* α0 := M.get_function "unit_testing::bad_add" [] in + let* α0 := M.get_function "unit_testing::bad_add" [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.I32 1; Value.Integer Integer.I32 2 ] in let* α2 := M.alloc α1 in let* α3 := M.alloc (Value.Integer Integer.I32 3) in @@ -138,7 +139,8 @@ Module tests. let* α0 := M.get_function "core::panicking::assert_failed" - [ Ty.path "i32"; Ty.path "i32" ] in + [ Ty.path "i32"; Ty.path "i32" ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/clone.v b/CoqOfRust/examples/default/examples/rust_book/traits/clone.v index c5335466d..91a89ca3c 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/clone.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/clone.v @@ -18,7 +18,7 @@ Module Impl_core_fmt_Debug_for_clone_Unit. | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] [] in let* α1 := M.read f in let* α2 := M.read (mk_str "Unit") in M.call_closure α0 [ α1; α2 ] @@ -69,8 +69,8 @@ End Impl_core_marker_Copy_for_clone_Unit. ty_params := []; fields := [ - Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]; - Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] []; + Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] [] ]; } *) @@ -87,18 +87,28 @@ Module Impl_core_clone_Clone_for_clone_Pair. let* α0 := M.get_trait_method "core::clone::Clone" - (Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::boxed::Box") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "clone" + [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ M.get_struct_tuple_field α1 "clone::Pair" 0 ] in let* α3 := M.get_trait_method "core::clone::Clone" - (Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::boxed::Box") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "clone" + [] [] in let* α4 := M.read self in let* α5 := M.call_closure α3 [ M.get_struct_tuple_field α4 "clone::Pair" 1 ] in @@ -126,7 +136,11 @@ Module Impl_core_fmt_Debug_for_clone_Pair. let* self := M.alloc self in let* f := M.alloc f in let* α0 := - M.get_associated_function (Ty.path "core::fmt::Formatter") "debug_tuple_field2_finish" [] in + M.get_associated_function + (Ty.path "core::fmt::Formatter") + "debug_tuple_field2_finish" + [] + [] in let* α1 := M.read f in let* α2 := M.read (mk_str "Pair") in let* α4 := @@ -193,8 +207,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* copied_unit := M.copy unit_ in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "original: ") in @@ -208,7 +222,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "clone::Unit" ] in + [ Ty.path "clone::Unit" ] + [] in let* α7 := M.call_closure α6 [ unit_ ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -218,8 +233,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "copy: ") in @@ -233,7 +248,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "clone::Unit" ] in + [ Ty.path "clone::Unit" ] + [] in let* α7 := M.call_closure α6 [ copied_unit ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -244,21 +260,29 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* pair_ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::boxed::Box") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.I32 1 ] in let* α2 := M.get_associated_function - (Ty.apply (Ty.path "alloc::boxed::Box") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::boxed::Box") + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) "new" + [] [] in let* α3 := M.call_closure α2 [ Value.Integer Integer.I32 2 ] in M.alloc (Value.StructTuple "clone::Pair" [ α1; α3 ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "original: ") in @@ -272,7 +296,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "clone::Pair" ] in + [ Ty.path "clone::Pair" ] + [] in let* α7 := M.call_closure α6 [ pair_ ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -283,8 +308,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* moved_pair := M.copy pair_ in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "moved: ") in @@ -298,7 +323,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "clone::Pair" ] in + [ Ty.path "clone::Pair" ] + [] in let* α7 := M.call_closure α6 [ moved_pair ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -307,18 +333,19 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α11 in M.alloc (Value.Tuple []) in let* cloned_pair := - let* α0 := M.get_trait_method "core::clone::Clone" (Ty.path "clone::Pair") [] "clone" [] in + let* α0 := + M.get_trait_method "core::clone::Clone" (Ty.path "clone::Pair") [] [] "clone" [] [] in let* α1 := M.call_closure α0 [ moved_pair ] in M.alloc α1 in let* _ := - let* α0 := M.get_function "core::mem::drop" [ Ty.path "clone::Pair" ] in + let* α0 := M.get_function "core::mem::drop" [ Ty.path "clone::Pair" ] [] in let* α1 := M.read moved_pair in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "clone: ") in @@ -332,7 +359,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "clone::Pair" ] in + [ Ty.path "clone::Pair" ] + [] in let* α7 := M.call_closure α6 [ cloned_pair ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/derive.v b/CoqOfRust/examples/default/examples/rust_book/traits/derive.v index 84f0931df..3ffe842fa 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/derive.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/derive.v @@ -62,7 +62,9 @@ Module Impl_core_cmp_PartialOrd_for_derive_Centimeters. "core::cmp::PartialOrd" (Ty.path "f64") [ Ty.path "f64" ] + [] "partial_cmp" + [] [] in let* α1 := M.read self in let* α2 := M.read other in @@ -102,7 +104,11 @@ Module Impl_core_fmt_Debug_for_derive_Inches. let* self := M.alloc self in let* f := M.alloc f in let* α0 := - M.get_associated_function (Ty.path "core::fmt::Formatter") "debug_tuple_field1_finish" [] in + M.get_associated_function + (Ty.path "core::fmt::Formatter") + "debug_tuple_field1_finish" + [] + [] in let* α1 := M.read f in let* α2 := M.read (mk_str "Inches") in let* α5 := @@ -199,8 +205,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* foot := M.alloc (Value.StructTuple "derive::Inches" [ Value.Integer Integer.I32 12 ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "One foot equals ") in @@ -214,7 +220,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "derive::Inches" ] in + [ Ty.path "derive::Inches" ] + [] in let* α7 := M.call_closure α6 [ foot ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -238,10 +245,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::cmp::PartialOrd" (Ty.path "derive::Centimeters") [ Ty.path "derive::Centimeters" ] + [] "lt" + [] [] in let* α1 := - M.get_associated_function (Ty.path "derive::Inches") "to_centimeters" [] in + M.get_associated_function (Ty.path "derive::Inches") "to_centimeters" [] [] in let* α2 := M.call_closure α1 [ foot ] in let* α3 := M.alloc α2 in let* α4 := M.call_closure α0 [ α3; meter ] in @@ -258,8 +267,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.copy α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "One foot is ") in @@ -273,7 +282,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ cmp ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 cf1153a94..9e57a379c 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 @@ -27,7 +27,14 @@ Module Impl_disambiguating_overlapping_traits_UsernameWidget_for_disambiguating_ | [], [ self ] => let* self := M.alloc self in let* α0 := - M.get_trait_method "core::clone::Clone" (Ty.path "alloc::string::String") [] "clone" [] in + M.get_trait_method + "core::clone::Clone" + (Ty.path "alloc::string::String") + [] + [] + "clone" + [] + [] in let* α1 := M.read self in M.call_closure α0 @@ -90,7 +97,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* form := - let* α0 := M.get_trait_method "alloc::borrow::ToOwned" (Ty.path "str") [] "to_owned" [] in + let* α0 := + M.get_trait_method "alloc::borrow::ToOwned" (Ty.path "str") [] [] "to_owned" [] [] in let* α1 := M.read (mk_str "rustacean") in let* α2 := M.call_closure α0 [ α1 ] in M.alloc @@ -103,12 +111,15 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "disambiguating_overlapping_traits::UsernameWidget" (Ty.path "disambiguating_overlapping_traits::Form") [] + [] "get" + [] [] in let* α1 := M.call_closure α0 [ form ] in M.alloc α1 in let* _ := - let* α0 := M.get_trait_method "alloc::string::ToString" (Ty.path "str") [] "to_string" [] in + let* α0 := + M.get_trait_method "alloc::string::ToString" (Ty.path "str") [] [] "to_string" [] [] in let* α1 := M.read (mk_str "rustacean") in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.alloc α2 in @@ -132,7 +143,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::cmp::PartialEq" (Ty.path "alloc::string::String") [ Ty.path "alloc::string::String" ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read left_val in let* α2 := M.read right_val in @@ -146,7 +159,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "core::panicking::assert_failed" - [ Ty.path "alloc::string::String"; Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String"; Ty.path "alloc::string::String" ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in @@ -167,7 +181,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "disambiguating_overlapping_traits::AgeWidget" (Ty.path "disambiguating_overlapping_traits::Form") [] + [] "get" + [] [] in let* α1 := M.call_closure α0 [ form ] in M.alloc α1 in @@ -201,7 +217,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "core::panicking::assert_failed" - [ Ty.path "u8"; Ty.path "u8" ] in + [ Ty.path "u8"; Ty.path "u8" ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/drop.v b/CoqOfRust/examples/default/examples/rust_book/traits/drop.v index f0b503b19..42d16fc02 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/drop.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/drop.v @@ -5,7 +5,7 @@ Require Import CoqOfRust.CoqOfRust. { name := "Droppable"; ty_params := []; - fields := [ ("name", Ty.apply (Ty.path "&") [ Ty.path "str" ]) ]; + fields := [ ("name", Ty.apply (Ty.path "&") [ Ty.path "str" ] []) ]; } *) Module Impl_core_ops_drop_Drop_for_drop_Droppable. @@ -22,8 +22,8 @@ Module Impl_core_ops_drop_Drop_for_drop_Droppable. let* self := M.alloc self in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "> Dropping ") in @@ -37,7 +37,8 @@ Module Impl_core_ops_drop_Drop_for_drop_Droppable. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.read self in let* α8 := M.call_closure α6 [ M.get_struct_record_field α7 "drop::Droppable" "name" ] in @@ -110,8 +111,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.StructRecord "drop::Droppable" [ ("name", α0) ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Exiting block B @@ -125,8 +131,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Just exited block B @@ -139,8 +150,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Exiting block A @@ -154,8 +170,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Just exited block A @@ -167,14 +188,19 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc α6 in M.alloc (Value.Tuple []) in let* _ := - let* α0 := M.get_function "core::mem::drop" [ Ty.path "drop::Droppable" ] in + let* α0 := M.get_function "core::mem::drop" [ Ty.path "drop::Droppable" ] [] in let* α1 := M.read _a in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "end of the main function diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/hash.v b/CoqOfRust/examples/default/examples/rust_book/traits/hash.v index f3a210f30..680a30130 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/hash.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/hash.v @@ -22,7 +22,7 @@ Module Impl_core_hash_Hash_for_hash_Person. let* self := M.alloc self in let* state := M.alloc state in let* _ := - let* α0 := M.get_trait_method "core::hash::Hash" (Ty.path "u32") [] "hash" [ __H ] in + let* α0 := M.get_trait_method "core::hash::Hash" (Ty.path "u32") [] [] "hash" [ __H ] [] in let* α1 := M.read self in let* α2 := M.read state in let* α3 := M.call_closure α0 [ M.get_struct_record_field α1 "hash::Person" "id"; α2 ] in @@ -33,13 +33,15 @@ Module Impl_core_hash_Hash_for_hash_Person. "core::hash::Hash" (Ty.path "alloc::string::String") [] + [] "hash" - [ __H ] in + [ __H ] + [] in let* α1 := M.read self in let* α2 := M.read state in let* α3 := M.call_closure α0 [ M.get_struct_record_field α1 "hash::Person" "name"; α2 ] in M.alloc α3 in - let* α0 := M.get_trait_method "core::hash::Hash" (Ty.path "u64") [] "hash" [ __H ] in + let* α0 := M.get_trait_method "core::hash::Hash" (Ty.path "u64") [] [] "hash" [ __H ] [] in let* α1 := M.read self in let* α2 := M.read state in let* α3 := M.call_closure α0 [ M.get_struct_record_field α1 "hash::Person" "phone"; α2 ] in @@ -68,7 +70,8 @@ Definition calculate_hash (τ : list Ty.t) (α : list Value.t) : M := | [ T ], [ t ] => let* t := M.alloc t in let* s := - let* α0 := M.get_associated_function (Ty.path "std::hash::random::DefaultHasher") "new" [] in + let* α0 := + M.get_associated_function (Ty.path "std::hash::random::DefaultHasher") "new" [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := @@ -77,8 +80,10 @@ Definition calculate_hash (τ : list Ty.t) (α : list Value.t) : M := "core::hash::Hash" T [] + [] "hash" - [ Ty.path "std::hash::random::DefaultHasher" ] in + [ Ty.path "std::hash::random::DefaultHasher" ] + [] in let* α1 := M.read t in let* α2 := M.call_closure α0 [ α1; s ] in M.alloc α2 in @@ -87,7 +92,9 @@ Definition calculate_hash (τ : list Ty.t) (α : list Value.t) : M := "core::hash::Hasher" (Ty.path "std::hash::random::DefaultHasher") [] + [] "finish" + [] [] in let* α1 := M.call_closure α0 [ s ] in let* α0 := M.alloc α1 in @@ -115,7 +122,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* person1 := - let* α0 := M.get_trait_method "alloc::string::ToString" (Ty.path "str") [] "to_string" [] in + let* α0 := + M.get_trait_method "alloc::string::ToString" (Ty.path "str") [] [] "to_string" [] [] in let* α1 := M.read (mk_str "Janet") in let* α2 := M.call_closure α0 [ α1 ] in M.alloc @@ -127,7 +135,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ("phone", Value.Integer Integer.U64 5556667777) ]) in let* person2 := - let* α0 := M.get_trait_method "alloc::string::ToString" (Ty.path "str") [] "to_string" [] in + let* α0 := + M.get_trait_method "alloc::string::ToString" (Ty.path "str") [] [] "to_string" [] [] in let* α1 := M.read (mk_str "Bob") in let* α2 := M.call_closure α0 [ α1 ] in M.alloc @@ -145,16 +154,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ fun γ => let* γ := - let* α0 := M.get_function "hash::calculate_hash" [ Ty.path "hash::Person" ] in + let* α0 := M.get_function "hash::calculate_hash" [ Ty.path "hash::Person" ] [] in let* α1 := M.call_closure α0 [ person1 ] in - let* α2 := M.get_function "hash::calculate_hash" [ Ty.path "hash::Person" ] in + let* α2 := M.get_function "hash::calculate_hash" [ Ty.path "hash::Person" ] [] in let* α3 := M.call_closure α2 [ person2 ] in let* α4 := M.alloc (UnOp.Pure.not (BinOp.Pure.ne α1 α3)) in M.pure (M.use α4) in let* _ := let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Bool true) in - let* α0 := M.get_function "core::panicking::panic" [] in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in let* α1 := M.read (mk_str "assertion failed: calculate_hash(&person1) != calculate_hash(&person2)") in 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 46796636a..22bc68526 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 @@ -22,42 +22,55 @@ Definition combine_vecs_explicit_return_type (τ : list Ty.t) (α : list Value.t [ Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]; + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []; Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] - ]) + [] + ] + []) + [] [] "cycle" + [] [] in let* α1 := M.get_trait_method "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "chain" [ Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α2 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] []) + [] [] "into_iter" + [] [] in let* α3 := M.read v in let* α4 := M.call_closure α2 [ α3 ] in let* α5 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] []) + [] [] "into_iter" + [] [] in let* α6 := M.read u in let* α7 := M.call_closure α5 [ α6 ] in @@ -84,42 +97,55 @@ Definition combine_vecs (τ : list Ty.t) (α : list Value.t) : M := [ Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]; + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []; Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] - ]) + [] + ] + []) + [] [] "cycle" + [] [] in let* α1 := M.get_trait_method "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") - [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] + []) + [] [] "chain" [ Ty.apply (Ty.path "alloc::vec::into_iter::IntoIter") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α2 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] []) + [] [] "into_iter" + [] [] in let* α3 := M.read v in let* α4 := M.call_closure α2 [ α3 ] in let* α5 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "i32"; Ty.path "alloc::alloc::Global" ] []) + [] [] "into_iter" + [] [] in let* α6 := M.read u in let* α7 := M.call_closure α5 [ α6 ] in @@ -151,17 +177,23 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* v1 := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α5 := (* Unsize *) let* α1 := M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.apply (Ty.path "array") [ Ty.path "i32" ]; Ty.path "alloc::alloc::Global" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "i32" ] [ Value.Integer Integer.Usize 3 ]; + Ty.path "alloc::alloc::Global" + ] + []) "new" + [] [] in let* α2 := M.alloc @@ -179,17 +211,23 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* v2 := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "slice") [ Ty.path "i32" ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α5 := (* Unsize *) let* α1 := M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.apply (Ty.path "array") [ Ty.path "i32" ]; Ty.path "alloc::alloc::Global" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "i32" ] [ Value.Integer Integer.Usize 2 ]; + Ty.path "alloc::alloc::Global" + ] + []) "new" + [] [] in let* α2 := M.alloc (Value.Array [ Value.Integer Integer.I32 4; Value.Integer Integer.I32 5 ]) in @@ -199,7 +237,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α6 := M.call_closure α0 [ α5 ] in M.alloc α6 in let* v3 := - let* α0 := M.get_function "impl_trait_as_return_type::combine_vecs" [] in + let* α0 := M.get_function "impl_trait_as_return_type::combine_vecs" [] [] in let* α1 := M.read v1 in let* α2 := M.read v2 in let* α3 := M.call_closure α0 [ α1; α2 ] in @@ -208,7 +246,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.alloc (Value.StructTuple "core::option::Option::Some" [ Value.Integer Integer.I32 1 ]) in let* α1 := - M.get_trait_method "core::iter::traits::iterator::Iterator" Ty.associated [] "next" [] in + M.get_trait_method + "core::iter::traits::iterator::Iterator" + Ty.associated + [] + [] + "next" + [] + [] in let* α2 := M.call_closure α1 [ v3 ] in let* α3 := M.alloc α2 in let* α4 := M.alloc (Value.Tuple [ α0; α3 ]) in @@ -229,9 +274,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ]) - [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] ] + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] []) + [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read left_val in let* α2 := M.read right_val in @@ -246,9 +293,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_function "core::panicking::assert_failed" [ - Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ]; - Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] - ] in + Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] []; + Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] [] + ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in @@ -267,7 +315,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.alloc (Value.StructTuple "core::option::Option::Some" [ Value.Integer Integer.I32 2 ]) in let* α1 := - M.get_trait_method "core::iter::traits::iterator::Iterator" Ty.associated [] "next" [] in + M.get_trait_method + "core::iter::traits::iterator::Iterator" + Ty.associated + [] + [] + "next" + [] + [] in let* α2 := M.call_closure α1 [ v3 ] in let* α3 := M.alloc α2 in let* α4 := M.alloc (Value.Tuple [ α0; α3 ]) in @@ -288,9 +343,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ]) - [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] ] + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] []) + [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read left_val in let* α2 := M.read right_val in @@ -305,9 +362,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_function "core::panicking::assert_failed" [ - Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ]; - Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] - ] in + Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] []; + Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] [] + ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in @@ -326,7 +384,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.alloc (Value.StructTuple "core::option::Option::Some" [ Value.Integer Integer.I32 3 ]) in let* α1 := - M.get_trait_method "core::iter::traits::iterator::Iterator" Ty.associated [] "next" [] in + M.get_trait_method + "core::iter::traits::iterator::Iterator" + Ty.associated + [] + [] + "next" + [] + [] in let* α2 := M.call_closure α1 [ v3 ] in let* α3 := M.alloc α2 in let* α4 := M.alloc (Value.Tuple [ α0; α3 ]) in @@ -347,9 +412,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ]) - [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] ] + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] []) + [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read left_val in let* α2 := M.read right_val in @@ -364,9 +431,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_function "core::panicking::assert_failed" [ - Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ]; - Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] - ] in + Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] []; + Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] [] + ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in @@ -385,7 +453,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.alloc (Value.StructTuple "core::option::Option::Some" [ Value.Integer Integer.I32 4 ]) in let* α1 := - M.get_trait_method "core::iter::traits::iterator::Iterator" Ty.associated [] "next" [] in + M.get_trait_method + "core::iter::traits::iterator::Iterator" + Ty.associated + [] + [] + "next" + [] + [] in let* α2 := M.call_closure α1 [ v3 ] in let* α3 := M.alloc α2 in let* α4 := M.alloc (Value.Tuple [ α0; α3 ]) in @@ -406,9 +481,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ]) - [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] ] + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] []) + [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read left_val in let* α2 := M.read right_val in @@ -423,9 +500,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_function "core::panicking::assert_failed" [ - Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ]; - Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] - ] in + Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] []; + Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] [] + ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in @@ -444,7 +522,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.alloc (Value.StructTuple "core::option::Option::Some" [ Value.Integer Integer.I32 5 ]) in let* α1 := - M.get_trait_method "core::iter::traits::iterator::Iterator" Ty.associated [] "next" [] in + M.get_trait_method + "core::iter::traits::iterator::Iterator" + Ty.associated + [] + [] + "next" + [] + [] in let* α2 := M.call_closure α1 [ v3 ] in let* α3 := M.alloc α2 in let* α4 := M.alloc (Value.Tuple [ α0; α3 ]) in @@ -465,9 +550,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ]) - [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] ] + (Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] []) + [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] [] ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read left_val in let* α2 := M.read right_val in @@ -482,9 +569,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_function "core::panicking::assert_failed" [ - Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ]; - Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] - ] in + Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] []; + Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] [] + ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in @@ -501,8 +589,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ] in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "all done diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/iterators.v b/CoqOfRust/examples/default/examples/rust_book/traits/iterators.v index c1f8503e8..e2e8981bf 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/iterators.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/iterators.v @@ -125,8 +125,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := [ ("start", Value.Integer Integer.I32 0); ("end_", Value.Integer Integer.I32 3) ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Four consecutive `next` calls on 0..3 @@ -139,8 +144,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "> ") in @@ -154,13 +159,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] [] ] + [] in let* α7 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ] []) + [] [] "next" + [] [] in let* α8 := M.call_closure α7 [ sequence ] in let* α9 := M.alloc α8 in @@ -173,8 +181,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "> ") in @@ -188,13 +196,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] [] ] + [] in let* α7 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ] []) + [] [] "next" + [] [] in let* α8 := M.call_closure α7 [ sequence ] in let* α9 := M.alloc α8 in @@ -207,8 +218,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "> ") in @@ -222,13 +233,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] [] ] + [] in let* α7 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ] []) + [] [] "next" + [] [] in let* α8 := M.call_closure α7 [ sequence ] in let* α9 := M.alloc α8 in @@ -241,8 +255,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "> ") in @@ -256,13 +270,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] ] in + [ Ty.apply (Ty.path "core::option::Option") [ Ty.path "i32" ] [] ] + [] in let* α7 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ] []) + [] [] "next" + [] [] in let* α8 := M.call_closure α7 [ sequence ] in let* α9 := M.alloc α8 in @@ -275,8 +292,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "Iterate through 0..3 using `for` @@ -291,9 +313,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ] []) + [] [] "into_iter" + [] [] in let* α1 := M.call_closure @@ -315,9 +339,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "core::ops::range::Range") [ Ty.path "i32" ] []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -338,11 +364,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* i := M.copy γ0_0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -357,7 +384,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ i ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -372,8 +400,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.pure (M.use α3) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "The first four terms of the Fibonacci sequence are: @@ -388,18 +421,25 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "core::iter::adapters::take::Take") [ Ty.path "iterators::Fibonacci" ]) + (Ty.apply + (Ty.path "core::iter::adapters::take::Take") + [ Ty.path "iterators::Fibonacci" ] + []) + [] [] "into_iter" + [] [] in let* α1 := M.get_trait_method "core::iter::traits::iterator::Iterator" (Ty.path "iterators::Fibonacci") [] + [] "take" + [] [] in - let* α2 := M.get_function "iterators::fibonacci" [] in + let* α2 := M.get_function "iterators::fibonacci" [] [] in let* α3 := M.call_closure α2 [] in let* α4 := M.call_closure α1 [ α3; Value.Integer Integer.Usize 4 ] in let* α5 := M.call_closure α0 [ α4 ] in @@ -417,9 +457,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := "core::iter::traits::iterator::Iterator" (Ty.apply (Ty.path "core::iter::adapters::take::Take") - [ Ty.path "iterators::Fibonacci" ]) + [ Ty.path "iterators::Fibonacci" ] + []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -440,11 +483,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* i := M.copy γ0_0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -459,7 +503,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.call_closure α6 [ i ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -474,8 +519,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.pure (M.use α7) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "The next four terms of the Fibonacci sequence are: @@ -496,25 +546,36 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "core::iter::adapters::skip::Skip") [ Ty.path "iterators::Fibonacci" ] - ]) + [] + ] + []) + [] [] "into_iter" + [] [] in let* α1 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::iter::adapters::skip::Skip") [ Ty.path "iterators::Fibonacci" ]) + (Ty.apply + (Ty.path "core::iter::adapters::skip::Skip") + [ Ty.path "iterators::Fibonacci" ] + []) + [] [] "take" + [] [] in let* α2 := M.get_trait_method "core::iter::traits::iterator::Iterator" (Ty.path "iterators::Fibonacci") [] + [] "skip" + [] [] in - let* α3 := M.get_function "iterators::fibonacci" [] in + let* α3 := M.get_function "iterators::fibonacci" [] [] in let* α4 := M.call_closure α3 [] in let* α5 := M.call_closure α2 [ α4; Value.Integer Integer.Usize 4 ] in let* α6 := M.call_closure α1 [ α5; Value.Integer Integer.Usize 4 ] in @@ -537,9 +598,13 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "core::iter::adapters::skip::Skip") [ Ty.path "iterators::Fibonacci" ] - ]) + [] + ] + []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -560,11 +625,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* i := M.copy γ0_0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -579,7 +645,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.call_closure α6 [ i ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -603,8 +670,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := ]) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Iterate the following array ") in @@ -618,7 +685,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "array") [ Ty.path "u32" ] ] ] in + [ + Ty.apply + (Ty.path "&") + [ Ty.apply (Ty.path "array") [ Ty.path "u32" ] [ Value.Integer Integer.Usize 4 ] + ] + [] + ] + [] in let* α7 := M.alloc array in let* α8 := M.call_closure α6 [ α7 ] in let* α9 := M.alloc (Value.Array [ α8 ]) in @@ -630,11 +704,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::collect::IntoIterator" - (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u32" ] []) + [] [] "into_iter" + [] [] in - let* α1 := M.get_associated_function (Ty.apply (Ty.path "slice") [ Ty.path "u32" ]) "iter" [] in + let* α1 := + M.get_associated_function (Ty.apply (Ty.path "slice") [ Ty.path "u32" ] []) "iter" [] [] in let* α2 := (* Unsize *) M.pure (M.pointer_coercion array) in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in @@ -650,9 +727,11 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "core::slice::iter::Iter") [ Ty.path "u32" ] []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -670,11 +749,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* i := M.copy γ0_0 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" + [] [] in let* α5 := (* Unsize *) @@ -689,7 +769,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "u32" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "u32" ] [] ] + [] in let* α7 := M.call_closure α6 [ i ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) 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 aefef7553..be7e4d807 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/operator_overloading.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/operator_overloading.v @@ -30,7 +30,7 @@ Module Impl_core_fmt_Debug_for_operator_overloading_FooBar. | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] [] in let* α1 := M.read f in let* α2 := M.read (mk_str "FooBar") in M.call_closure α0 [ α1; α2 ] @@ -62,7 +62,7 @@ Module Impl_core_fmt_Debug_for_operator_overloading_BarFoo. | [], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] in + let* α0 := M.get_associated_function (Ty.path "core::fmt::Formatter") "write_str" [] [] in let* α1 := M.read f in let* α2 := M.read (mk_str "BarFoo") in M.call_closure α0 [ α1; α2 ] @@ -99,8 +99,13 @@ Module Impl_core_ops_arith_Add_operator_overloading_Bar_for_operator_overloading let* _rhs := M.alloc _rhs in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "> Foo.add(Bar) was called @@ -146,8 +151,13 @@ Module Impl_core_ops_arith_Add_operator_overloading_Foo_for_operator_overloading let* _rhs := M.alloc _rhs in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_const" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := + M.get_associated_function + (Ty.path "core::fmt::Arguments") + "new_const" + [] + [ Value.Bool true ] in let* α4 := (* Unsize *) let* α2 := M.read (mk_str "> Bar.add(Foo) was called @@ -182,8 +192,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Foo + Bar = ") in @@ -197,13 +207,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "operator_overloading::FooBar" ] in + [ Ty.path "operator_overloading::FooBar" ] + [] in let* α7 := M.get_trait_method "core::ops::arith::Add" (Ty.path "operator_overloading::Foo") [ Ty.path "operator_overloading::Bar" ] + [] "add" + [] [] in let* α8 := M.call_closure @@ -222,8 +235,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Bar + Foo = ") in @@ -237,13 +250,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "operator_overloading::BarFoo" ] in + [ Ty.path "operator_overloading::BarFoo" ] + [] in let* α7 := M.get_trait_method "core::ops::arith::Add" (Ty.path "operator_overloading::Bar") [ Ty.path "operator_overloading::Foo" ] + [] "add" + [] [] in let* α8 := M.call_closure 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 a1798b0ca..bd8a9af75 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 @@ -105,8 +105,10 @@ Definition random_animal (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "returning_traits_with_dyn::Sheep"; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α1 := M.call_closure @@ -125,8 +127,10 @@ Definition random_animal (τ : list Ty.t) (α : list Value.t) : M := [ Ty.path "returning_traits_with_dyn::Cow"; Ty.path "alloc::alloc::Global" - ]) + ] + []) "new" + [] [] in let* α1 := M.call_closure @@ -156,14 +160,14 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := | [], [] => let* random_number := M.copy UnsupportedLiteral in let* animal := - let* α0 := M.get_function "returning_traits_with_dyn::random_animal" [] in + let* α0 := M.get_function "returning_traits_with_dyn::random_animal" [] [] in let* α1 := M.read random_number in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "You've randomly chosen an animal, and it says ") in @@ -177,13 +181,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.get_trait_method "returning_traits_with_dyn::Animal" (Ty.dyn [ ("returning_traits_with_dyn::Animal::Trait", []) ]) [] + [] "noise" + [] [] in let* α8 := M.read animal in let* α9 := M.call_closure α7 [ α8 ] in diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/supertraits.v b/CoqOfRust/examples/default/examples/rust_book/traits/supertraits.v index 8dace5bc8..892ef0cdc 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/supertraits.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/supertraits.v @@ -29,8 +29,8 @@ Definition comp_sci_student_greeting (τ : list Ty.t) (α : list Value.t) : M := | [], [ student ] => let* student := M.alloc student in let* res := - let* α0 := M.get_function "alloc::fmt::format" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "alloc::fmt::format" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α7 := (* Unsize *) let* α2 := M.read (mk_str "My name is ") in @@ -45,13 +45,16 @@ Definition comp_sci_student_greeting (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α9 := M.get_trait_method "supertraits::Person" (Ty.dyn [ ("supertraits::CompSciStudent::Trait", []) ]) [] + [] "name" + [] [] in let* α10 := M.read student in let* α11 := M.call_closure α9 [ α10 ] in @@ -61,13 +64,16 @@ Definition comp_sci_student_greeting (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α15 := M.get_trait_method "supertraits::Student" (Ty.dyn [ ("supertraits::CompSciStudent::Trait", []) ]) [] + [] "university" + [] [] in let* α16 := M.read student in let* α17 := M.call_closure α15 [ α16 ] in @@ -77,13 +83,16 @@ Definition comp_sci_student_greeting (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α21 := M.get_trait_method "supertraits::Programmer" (Ty.dyn [ ("supertraits::CompSciStudent::Trait", []) ]) [] + [] "fav_language" + [] [] in let* α22 := M.read student in let* α23 := M.call_closure α21 [ α22 ] in @@ -93,13 +102,16 @@ Definition comp_sci_student_greeting (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "alloc::string::String" ] in + [ Ty.path "alloc::string::String" ] + [] in let* α27 := M.get_trait_method "supertraits::CompSciStudent" (Ty.dyn [ ("supertraits::CompSciStudent::Trait", []) ]) [] + [] "git_username" + [] [] in let* α28 := M.read student in let* α29 := M.call_closure α27 [ α28 ] in diff --git a/CoqOfRust/examples/default/examples/rust_book/traits/traits.v b/CoqOfRust/examples/default/examples/rust_book/traits/traits.v index 055b1937f..a37795092 100644 --- a/CoqOfRust/examples/default/examples/rust_book/traits/traits.v +++ b/CoqOfRust/examples/default/examples/rust_book/traits/traits.v @@ -5,7 +5,7 @@ Require Import CoqOfRust.CoqOfRust. { name := "Sheep"; ty_params := []; - fields := [ ("naked", Ty.path "bool"); ("name", Ty.apply (Ty.path "&") [ Ty.path "str" ]) ]; + fields := [ ("naked", Ty.path "bool"); ("name", Ty.apply (Ty.path "&") [ Ty.path "str" ] []) ]; } *) (* Trait *) @@ -16,8 +16,8 @@ Module Animal. let* self := M.alloc self in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -32,8 +32,9 @@ Module Animal. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in - let* α8 := M.get_trait_method "traits::Animal" Self [] "name" [] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in + let* α8 := M.get_trait_method "traits::Animal" Self [] [] "name" [] [] in let* α9 := M.read self in let* α10 := M.call_closure α8 [ α9 ] in let* α11 := M.alloc α10 in @@ -42,8 +43,9 @@ Module Animal. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in - let* α14 := M.get_trait_method "traits::Animal" Self [] "noise" [] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in + let* α14 := M.get_trait_method "traits::Animal" Self [] [] "noise" [] [] in let* α15 := M.read self in let* α16 := M.call_closure α14 [ α15 ] in let* α17 := M.alloc α16 in @@ -136,7 +138,7 @@ Module Impl_traits_Animal_for_traits_Sheep. [ fun γ => let* γ := - let* α0 := M.get_associated_function (Ty.path "traits::Sheep") "is_naked" [] in + let* α0 := M.get_associated_function (Ty.path "traits::Sheep") "is_naked" [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.alloc α2 in @@ -163,8 +165,8 @@ Module Impl_traits_Animal_for_traits_Sheep. let* self := M.alloc self in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α6 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -179,7 +181,8 @@ Module Impl_traits_Animal_for_traits_Sheep. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α8 := M.read self in let* α9 := M.call_closure α7 [ M.get_struct_record_field α8 "traits::Sheep" "name" ] in @@ -187,9 +190,10 @@ Module Impl_traits_Animal_for_traits_Sheep. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α11 := - M.get_trait_method "traits::Animal" (Ty.path "traits::Sheep") [] "noise" [] in + M.get_trait_method "traits::Animal" (Ty.path "traits::Sheep") [] [] "noise" [] [] in let* α12 := M.read self in let* α13 := M.call_closure α11 [ α12 ] in let* α14 := M.alloc α13 in @@ -246,7 +250,7 @@ Module Impl_traits_Sheep. [ fun γ => let* γ := - let* α0 := M.get_associated_function (Ty.path "traits::Sheep") "is_naked" [] in + let* α0 := M.get_associated_function (Ty.path "traits::Sheep") "is_naked" [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.alloc α2 in @@ -256,9 +260,9 @@ Module Impl_traits_Sheep. M.is_constant_or_break_match α0 (Value.Bool true) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -272,13 +276,16 @@ Module Impl_traits_Sheep. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.get_trait_method "traits::Animal" (Ty.path "traits::Sheep") [] + [] "name" + [] [] in let* α8 := M.read self in let* α9 := M.call_closure α7 [ α8 ] in @@ -294,9 +301,9 @@ Module Impl_traits_Sheep. fun γ => let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in let* α1 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -310,7 +317,8 @@ Module Impl_traits_Sheep. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.read self in let* α8 := M.call_closure α6 [ M.get_struct_record_field α7 "traits::Sheep" "name" ] in @@ -349,20 +357,20 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := match τ, α with | [], [] => let* dolly := - let* α0 := M.get_trait_method "traits::Animal" (Ty.path "traits::Sheep") [] "new" [] in + let* α0 := M.get_trait_method "traits::Animal" (Ty.path "traits::Sheep") [] [] "new" [] [] in let* α1 := M.read (mk_str "Dolly") in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* _ := - let* α0 := M.get_trait_method "traits::Animal" (Ty.path "traits::Sheep") [] "talk" [] in + let* α0 := M.get_trait_method "traits::Animal" (Ty.path "traits::Sheep") [] [] "talk" [] [] in let* α1 := M.call_closure α0 [ dolly ] in M.alloc α1 in let* _ := - let* α0 := M.get_associated_function (Ty.path "traits::Sheep") "shear" [] in + let* α0 := M.get_associated_function (Ty.path "traits::Sheep") "shear" [] [] in let* α1 := M.call_closure α0 [ dolly ] in M.alloc α1 in let* _ := - let* α0 := M.get_trait_method "traits::Animal" (Ty.path "traits::Sheep") [] "talk" [] in + let* α0 := M.get_trait_method "traits::Animal" (Ty.path "traits::Sheep") [] [] "talk" [] [] in let* α1 := M.call_closure α0 [ dolly ] in M.alloc α1 in let* α0 := M.alloc (Value.Tuple []) in diff --git a/CoqOfRust/examples/default/examples/rust_book/types/aliasing.v b/CoqOfRust/examples/default/examples/rust_book/types/aliasing.v index be742ee8e..70e44e36b 100644 --- a/CoqOfRust/examples/default/examples/rust_book/types/aliasing.v +++ b/CoqOfRust/examples/default/examples/rust_book/types/aliasing.v @@ -34,8 +34,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.copy (M.use α0) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α7 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -51,19 +51,22 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u64" ] in + [ Ty.path "u64" ] + [] in let* α9 := M.call_closure α8 [ nanoseconds ] in let* α10 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u64" ] in + [ Ty.path "u64" ] + [] in let* α11 := M.call_closure α10 [ inches ] in let* α12 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u64" ] in + [ Ty.path "u64" ] + [] in let* α13 := M.read nanoseconds in let* α14 := M.read inches in let* α15 := BinOp.Panic.add α13 α14 in diff --git a/CoqOfRust/examples/default/examples/rust_book/types/casting.v b/CoqOfRust/examples/default/examples/rust_book/types/casting.v index be9879e22..ee061efac 100644 --- a/CoqOfRust/examples/default/examples/rust_book/types/casting.v +++ b/CoqOfRust/examples/default/examples/rust_book/types/casting.v @@ -93,8 +93,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (M.rust_cast α0) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α7 := (* Unsize *) let* α2 := M.read (mk_str "Casting: ") in @@ -110,19 +110,22 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "f32" ] in + [ Ty.path "f32" ] + [] in let* α9 := M.call_closure α8 [ decimal ] in let* α10 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u8" ] in + [ Ty.path "u8" ] + [] in let* α11 := M.call_closure α10 [ integer ] in let* α12 := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "char" ] in + [ Ty.path "char" ] + [] in let* α13 := M.call_closure α12 [ character ] in let* α14 := M.alloc (Value.Array [ α9; α11; α13 ]) in M.pure (M.pointer_coercion α14) in @@ -132,8 +135,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "1000 as a u16 is: ") in @@ -147,7 +150,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u16" ] in + [ Ty.path "u16" ] + [] in let* α7 := M.alloc (Value.Integer Integer.U16 1000) in let* α8 := M.call_closure α6 [ M.use α7 ] in let* α9 := M.alloc (Value.Array [ α8 ]) in @@ -158,8 +162,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "1000 as a u8 is : ") in @@ -173,7 +177,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u8" ] in + [ Ty.path "u8" ] + [] in let* α7 := M.alloc (Value.Integer Integer.U8 1000) in let* α8 := M.call_closure α6 [ M.use α7 ] in let* α9 := M.alloc (Value.Array [ α8 ]) in @@ -184,8 +189,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str " -1 as a u8 is : ") in @@ -199,7 +204,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u8" ] in + [ Ty.path "u8" ] + [] in let* α7 := M.alloc (M.rust_cast (Value.Integer Integer.I8 (-1))) in let* α8 := M.call_closure α6 [ α7 ] in let* α9 := M.alloc (Value.Array [ α8 ]) in @@ -210,8 +216,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "1000 mod 256 is : ") in @@ -225,7 +231,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := BinOp.Panic.rem (Value.Integer Integer.I32 1000) (Value.Integer Integer.I32 256) in let* α8 := M.alloc α7 in @@ -238,8 +245,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str " 128 as a i16 is: ") in @@ -253,7 +260,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i16" ] in + [ Ty.path "i16" ] + [] in let* α7 := M.alloc (Value.Integer Integer.I16 128) in let* α8 := M.call_closure α6 [ M.use α7 ] in let* α9 := M.alloc (Value.Array [ α8 ]) in @@ -264,8 +272,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str " 128 as a i8 is : ") in @@ -279,7 +287,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i8" ] in + [ Ty.path "i8" ] + [] in let* α7 := M.alloc (Value.Integer Integer.I8 128) in let* α8 := M.call_closure α6 [ M.use α7 ] in let* α9 := M.alloc (Value.Array [ α8 ]) in @@ -290,8 +299,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "1000 as a u8 is : ") in @@ -305,7 +314,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u8" ] in + [ Ty.path "u8" ] + [] in let* α7 := M.alloc (Value.Integer Integer.U8 1000) in let* α8 := M.call_closure α6 [ M.use α7 ] in let* α9 := M.alloc (Value.Array [ α8 ]) in @@ -316,8 +326,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str " 232 as a i8 is : ") in @@ -331,7 +341,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i8" ] in + [ Ty.path "i8" ] + [] in let* α7 := M.alloc (Value.Integer Integer.I8 232) in let* α8 := M.call_closure α6 [ M.use α7 ] in let* α9 := M.alloc (Value.Array [ α8 ]) in @@ -342,8 +353,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str " 300.0 as u8 is : ") in @@ -357,7 +368,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u8" ] in + [ Ty.path "u8" ] + [] in let* α7 := M.read UnsupportedLiteral in let* α8 := M.alloc (M.rust_cast α7) in let* α9 := M.call_closure α6 [ α8 ] in @@ -369,8 +381,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "-100.0 as u8 is : ") in @@ -384,7 +396,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u8" ] in + [ Ty.path "u8" ] + [] in let* α7 := M.read UnsupportedLiteral in let* α8 := M.alloc (M.rust_cast α7) in let* α9 := M.call_closure α6 [ α8 ] in @@ -396,8 +409,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str " nan as u8 is : ") in @@ -411,7 +424,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u8" ] in + [ Ty.path "u8" ] + [] in let* α7 := M.get_constant "core::f32::NAN" in let* α8 := M.read α7 in let* α9 := M.alloc (M.rust_cast α8) in @@ -424,8 +438,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str " 300.0 as u8 is : ") in @@ -439,9 +453,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u8" ] in + [ Ty.path "u8" ] + [] in let* α7 := - M.get_associated_function (Ty.path "f32") "to_int_unchecked" [ Ty.path "u8" ] in + M.get_associated_function (Ty.path "f32") "to_int_unchecked" [ Ty.path "u8" ] [] in let* α8 := M.read UnsupportedLiteral in let* α9 := M.call_closure α7 [ α8 ] in let* α10 := M.alloc α9 in @@ -454,8 +469,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "-100.0 as u8 is : ") in @@ -469,9 +484,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u8" ] in + [ Ty.path "u8" ] + [] in let* α7 := - M.get_associated_function (Ty.path "f32") "to_int_unchecked" [ Ty.path "u8" ] in + M.get_associated_function (Ty.path "f32") "to_int_unchecked" [ Ty.path "u8" ] [] in let* α8 := M.read UnsupportedLiteral in let* α9 := M.call_closure α7 [ α8 ] in let* α10 := M.alloc α9 in @@ -484,8 +500,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str " nan as u8 is : ") in @@ -499,9 +515,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "u8" ] in + [ Ty.path "u8" ] + [] in let* α7 := - M.get_associated_function (Ty.path "f32") "to_int_unchecked" [ Ty.path "u8" ] in + M.get_associated_function (Ty.path "f32") "to_int_unchecked" [ Ty.path "u8" ] [] in let* α8 := M.get_constant "core::f32::NAN" in let* α9 := M.read α8 in let* α10 := M.call_closure α7 [ α9 ] in diff --git a/CoqOfRust/examples/default/examples/rust_book/types/inference.v b/CoqOfRust/examples/default/examples/rust_book/types/inference.v index 09ab41c30..017949d19 100644 --- a/CoqOfRust/examples/default/examples/rust_book/types/inference.v +++ b/CoqOfRust/examples/default/examples/rust_book/types/inference.v @@ -26,24 +26,26 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* vec := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] []) "new" + [] [] in let* α1 := M.call_closure α0 [] in M.alloc α1 in let* _ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] []) "push" + [] [] in let* α1 := M.read elem in let* α2 := M.call_closure α0 [ vec; α1 ] in M.alloc α2 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "") in @@ -61,7 +63,9 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ] - ] in + [] + ] + [] in let* α7 := M.call_closure α6 [ vec ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in diff --git a/CoqOfRust/examples/default/examples/rust_book/types/literals.v b/CoqOfRust/examples/default/examples/rust_book/types/literals.v index efb741d80..82815d0ef 100644 --- a/CoqOfRust/examples/default/examples/rust_book/types/literals.v +++ b/CoqOfRust/examples/default/examples/rust_book/types/literals.v @@ -30,8 +30,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* f := M.copy UnsupportedLiteral in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "size of `x` in bytes: ") in @@ -45,8 +45,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in - let* α7 := M.get_function "core::mem::size_of_val" [ Ty.path "u8" ] in + [ Ty.path "usize" ] + [] in + let* α7 := + M.get_function "core::mem::size_of_val" [ Ty.path "u8" ] [ Value.Bool true ] in let* α8 := M.call_closure α7 [ x ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in @@ -58,8 +60,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "size of `y` in bytes: ") in @@ -73,8 +75,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in - let* α7 := M.get_function "core::mem::size_of_val" [ Ty.path "u32" ] in + [ Ty.path "usize" ] + [] in + let* α7 := + M.get_function "core::mem::size_of_val" [ Ty.path "u32" ] [ Value.Bool true ] in let* α8 := M.call_closure α7 [ y ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in @@ -86,8 +90,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "size of `z` in bytes: ") in @@ -101,8 +105,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in - let* α7 := M.get_function "core::mem::size_of_val" [ Ty.path "f32" ] in + [ Ty.path "usize" ] + [] in + let* α7 := + M.get_function "core::mem::size_of_val" [ Ty.path "f32" ] [ Value.Bool true ] in let* α8 := M.call_closure α7 [ z ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in @@ -114,8 +120,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "size of `i` in bytes: ") in @@ -129,8 +135,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in - let* α7 := M.get_function "core::mem::size_of_val" [ Ty.path "i32" ] in + [ Ty.path "usize" ] + [] in + let* α7 := + M.get_function "core::mem::size_of_val" [ Ty.path "i32" ] [ Value.Bool true ] in let* α8 := M.call_closure α7 [ i ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in @@ -142,8 +150,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "size of `f` in bytes: ") in @@ -157,8 +165,10 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "usize" ] in - let* α7 := M.get_function "core::mem::size_of_val" [ Ty.path "f64" ] in + [ Ty.path "usize" ] + [] in + let* α7 := + M.get_function "core::mem::size_of_val" [ Ty.path "f64" ] [ Value.Bool true ] in let* α8 := M.call_closure α7 [ f ] in let* α9 := M.alloc α8 in let* α10 := M.call_closure α6 [ α9 ] in 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 cab57ac6a..7ef0f6c54 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 @@ -21,17 +21,23 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* some_vector := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "slice") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "slice") [ Ty.path "u32" ] []) "into_vec" - [ Ty.path "alloc::alloc::Global" ] in + [ Ty.path "alloc::alloc::Global" ] + [] in let* α5 := (* Unsize *) let* α1 := M.get_associated_function (Ty.apply (Ty.path "alloc::boxed::Box") - [ Ty.apply (Ty.path "array") [ Ty.path "u32" ]; Ty.path "alloc::alloc::Global" ]) + [ + Ty.apply (Ty.path "array") [ Ty.path "u32" ] [ Value.Integer Integer.Usize 4 ]; + Ty.path "alloc::alloc::Global" + ] + []) "new" + [] [] in let* α2 := M.alloc @@ -50,21 +56,30 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* pointer := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ] + []) "as_ptr" + [] [] in let* α1 := M.call_closure α0 [ some_vector ] in M.alloc α1 in let* length := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ] + []) "len" + [] [] in let* α1 := M.call_closure α0 [ some_vector ] in M.alloc α1 in let* my_slice := - let* α0 := M.get_function "core::slice::raw::from_raw_parts" [ Ty.path "u32" ] in + let* α0 := + M.get_function "core::slice::raw::from_raw_parts" [ Ty.path "u32" ] [ Value.Bool true ] in let* α1 := M.read pointer in let* α2 := M.read length in let* α3 := M.call_closure α0 [ α1; α2 ] in @@ -72,8 +87,12 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* _ := let* α0 := M.get_associated_function - (Ty.apply (Ty.path "alloc::vec::Vec") [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ]) + (Ty.apply + (Ty.path "alloc::vec::Vec") + [ Ty.path "u32"; Ty.path "alloc::alloc::Global" ] + []) "as_slice" + [] [] in let* α1 := M.call_closure α0 [ some_vector ] in let* α2 := M.alloc α1 in @@ -95,9 +114,19 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_trait_method "core::cmp::PartialEq" - (Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "slice") [ Ty.path "u32" ] ]) - [ Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "slice") [ Ty.path "u32" ] ] ] + (Ty.apply + (Ty.path "&") + [ Ty.apply (Ty.path "slice") [ Ty.path "u32" ] [] ] + []) + [ + Ty.apply + (Ty.path "&") + [ Ty.apply (Ty.path "slice") [ Ty.path "u32" ] [] ] + [] + ] + [ Value.Bool true ] "eq" + [] [] in let* α1 := M.read left_val in let* α2 := M.read right_val in @@ -112,9 +141,16 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_function "core::panicking::assert_failed" [ - Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "slice") [ Ty.path "u32" ] ]; - Ty.apply (Ty.path "&") [ Ty.apply (Ty.path "slice") [ Ty.path "u32" ] ] - ] in + Ty.apply + (Ty.path "&") + [ Ty.apply (Ty.path "slice") [ Ty.path "u32" ] [] ] + []; + Ty.apply + (Ty.path "&") + [ Ty.apply (Ty.path "slice") [ Ty.path "u32" ] [] ] + [] + ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in 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 8b012e691..aea6996fd 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 @@ -48,18 +48,20 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.apply (Ty.path "core::result::Result") - [ Ty.apply (Ty.path "&") [ Ty.path "str" ]; Ty.path "core::str::error::Utf8Error" ]) + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] []; Ty.path "core::str::error::Utf8Error" ] + []) "unwrap" + [] [] in - let* α1 := M.get_function "core::str::converts::from_utf8" [] in + let* α1 := M.get_function "core::str::converts::from_utf8" [] [ Value.Bool true ] in let* α2 := (* Unsize *) M.pure (M.pointer_coercion name_buf) in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.call_closure α0 [ α3 ] in M.alloc α4 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "CPU Manufacturer ID: ") in @@ -73,7 +75,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ name ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 8cfebec30..0e0e655c6 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 @@ -51,7 +51,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "core::panicking::assert_failed" - [ Ty.path "u64"; Ty.path "u64" ] in + [ Ty.path "u64"; Ty.path "u64" ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in 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 423c2d96e..3bfcfc36f 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 @@ -59,7 +59,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "core::panicking::assert_failed" - [ Ty.path "u64"; Ty.path "u64" ] in + [ Ty.path "u64"; Ty.path "u64" ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in 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 ca4bdef3a..fbaf6856b 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 @@ -51,7 +51,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "core::panicking::assert_failed" - [ Ty.path "u64"; Ty.path "u64" ] in + [ Ty.path "u64"; Ty.path "u64" ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in 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 af7dbd80b..c4794624a 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 @@ -49,7 +49,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "core::panicking::assert_failed" - [ Ty.path "u64"; Ty.path "u64" ] in + [ Ty.path "u64"; Ty.path "u64" ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in 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 c8fa1e7b2..8a44c5b71 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 @@ -56,7 +56,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "core::panicking::assert_failed" - [ Ty.path "u64"; Ty.path "u64" ] in + [ Ty.path "u64"; Ty.path "u64" ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in 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 6db4ca2cf..50b1c992e 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 @@ -49,7 +49,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "core::panicking::assert_failed" - [ Ty.path "u64"; Ty.path "u64" ] in + [ Ty.path "u64"; Ty.path "u64" ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in 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 89ee6dbf6..f0fb3eec9 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 @@ -59,7 +59,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "core::panicking::assert_failed" - [ Ty.path "i32"; Ty.path "i32" ] in + [ Ty.path "i32"; Ty.path "i32" ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in 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 4b1257494..cb5710fbe 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 @@ -55,7 +55,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "core::panicking::assert_failed" - [ Ty.path "u64"; Ty.path "u64" ] in + [ Ty.path "u64"; Ty.path "u64" ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in 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 ee91c2626..7cd4dedea 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 @@ -51,7 +51,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "core::panicking::assert_failed" - [ Ty.path "u16"; Ty.path "u16" ] in + [ Ty.path "u16"; Ty.path "u16" ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in 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 878c30a70..391e4d0b6 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 @@ -58,7 +58,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* α0 := M.get_function "core::panicking::assert_failed" - [ Ty.path "u64"; Ty.path "u64" ] in + [ Ty.path "u64"; Ty.path "u64" ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in 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 ab6f7015f..3d877a1a7 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 @@ -46,8 +46,8 @@ Module main. let* arg := M.alloc arg in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "arg = ") in @@ -61,7 +61,8 @@ Module main. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ arg ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 4e35f6548..2cac3ba86 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 @@ -31,7 +31,7 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* _ := let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Bool true) in - let* α0 := M.get_function "core::panicking::panic" [] in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in let* α1 := M.read (mk_str "assertion failed: *raw_p == 10") in let* α2 := M.call_closure α0 [ α1 ] in let* α3 := M.never_to_any α2 in 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 d66592cfa..daa7a722b 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 @@ -40,8 +40,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "a binding: ") in @@ -55,7 +55,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ a_binding ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -67,8 +68,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* _ := M.assign another_binding (Value.Integer Integer.I32 1) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "another binding: ") in @@ -82,7 +83,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ another_binding ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 2e5d3bb2a..df3400560 100644 --- a/CoqOfRust/examples/default/examples/rust_book/variable_bindings/mutability.v +++ b/CoqOfRust/examples/default/examples/rust_book/variable_bindings/mutability.v @@ -25,8 +25,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* mutable_binding := M.alloc (Value.Integer Integer.I32 1) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Before mutation: ") in @@ -40,7 +40,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ mutable_binding ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -55,8 +56,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.assign β α1 in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "After mutation: ") in @@ -70,7 +71,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ mutable_binding ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 79c0aa1c6..77e47f035 100644 --- a/CoqOfRust/examples/default/examples/rust_book/variable_bindings/scope.v +++ b/CoqOfRust/examples/default/examples/rust_book/variable_bindings/scope.v @@ -30,8 +30,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* short_lived_binding := M.alloc (Value.Integer Integer.I32 2) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "inner short: ") in @@ -45,7 +45,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ short_lived_binding ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -56,8 +57,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "outer long: ") in @@ -71,7 +72,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ long_lived_binding ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 0fa666d40..6705f6fc5 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 @@ -32,8 +32,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* copied_integer := M.copy an_integer in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "An integer: ") in @@ -47,7 +47,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "u32" ] in + [ Ty.path "u32" ] + [] in let* α7 := M.call_closure α6 [ copied_integer ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -57,8 +58,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "A boolean: ") in @@ -72,7 +73,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.path "bool" ] in + [ Ty.path "bool" ] + [] in let* α7 := M.call_closure α6 [ a_boolean ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -82,8 +84,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "Meet the unit value: ") in @@ -97,7 +99,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_debug" - [ Ty.tuple [] ] in + [ Ty.tuple [] ] + [] in let* α7 := M.call_closure α6 [ unit_ ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in 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 0c68275b0..e61dc2a04 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 @@ -27,8 +27,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* _ := let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "before being shadowed: ") in @@ -42,7 +42,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ shadowed_binding ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -53,8 +54,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* shadowed_binding := M.copy (mk_str "abc") in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "shadowed in inner block: ") in @@ -68,7 +69,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α7 := M.call_closure α6 [ shadowed_binding ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -79,8 +81,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "outside inner block: ") in @@ -94,7 +96,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ shadowed_binding ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in @@ -105,8 +108,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := let* shadowed_binding := M.alloc (Value.Integer Integer.I32 2) in let* _ := let* _ := - let* α0 := M.get_function "std::io::stdio::_print" [] in - let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + let* α0 := M.get_function "std::io::stdio::_print" [] [] in + let* α1 := M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α5 := (* Unsize *) let* α2 := M.read (mk_str "shadowed in outer block: ") in @@ -120,7 +123,8 @@ Definition main (τ : list Ty.t) (α : list Value.t) : M := M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.path "i32" ] in + [ Ty.path "i32" ] + [] in let* α7 := M.call_closure α6 [ shadowed_binding ] in let* α8 := M.alloc (Value.Array [ α7 ]) in M.pure (M.pointer_coercion α8) in diff --git a/CoqOfRust/examples/default/examples/subtle.v b/CoqOfRust/examples/default/examples/subtle.v index 71c0209e3..e42d7aef7 100644 --- a/CoqOfRust/examples/default/examples/subtle.v +++ b/CoqOfRust/examples/default/examples/subtle.v @@ -50,7 +50,11 @@ Module Impl_core_fmt_Debug_for_subtle_Choice. let* self := M.alloc self in let* f := M.alloc f in let* α0 := - M.get_associated_function (Ty.path "core::fmt::Formatter") "debug_tuple_field1_finish" [] in + M.get_associated_function + (Ty.path "core::fmt::Formatter") + "debug_tuple_field1_finish" + [] + [] in let* α1 := M.read f in let* α2 := M.read (mk_str "Choice") in let* α5 := @@ -134,7 +138,7 @@ Module Impl_core_convert_From_subtle_Choice_for_bool. let* _ := let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Bool true) in - let* α0 := M.get_function "core::panicking::panic" [] in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in let* α1 := M.read (mk_str "assertion failed: (source.0 == 0u8) | (source.0 == 1u8)") in let* α2 := M.call_closure α0 [ α1 ] in @@ -182,7 +186,9 @@ Module Impl_core_ops_bit_BitAnd_for_subtle_Choice. "core::convert::Into" (Ty.path "u8") [ Ty.path "subtle::Choice" ] + [] "into" + [] [] in let* α1 := M.read (M.get_struct_tuple_field self "subtle::Choice" 0) in let* α2 := M.read (M.get_struct_tuple_field rhs "subtle::Choice" 0) in @@ -219,7 +225,9 @@ Module Impl_core_ops_bit_BitAndAssign_for_subtle_Choice. "core::ops::bit::BitAnd" (Ty.path "subtle::Choice") [ Ty.path "subtle::Choice" ] + [] "bitand" + [] [] in let* α2 := M.read self in let* α3 := M.read α2 in @@ -262,7 +270,9 @@ Module Impl_core_ops_bit_BitOr_for_subtle_Choice. "core::convert::Into" (Ty.path "u8") [ Ty.path "subtle::Choice" ] + [] "into" + [] [] in let* α1 := M.read (M.get_struct_tuple_field self "subtle::Choice" 0) in let* α2 := M.read (M.get_struct_tuple_field rhs "subtle::Choice" 0) in @@ -299,7 +309,9 @@ Module Impl_core_ops_bit_BitOrAssign_for_subtle_Choice. "core::ops::bit::BitOr" (Ty.path "subtle::Choice") [ Ty.path "subtle::Choice" ] + [] "bitor" + [] [] in let* α2 := M.read self in let* α3 := M.read α2 in @@ -342,7 +354,9 @@ Module Impl_core_ops_bit_BitXor_for_subtle_Choice. "core::convert::Into" (Ty.path "u8") [ Ty.path "subtle::Choice" ] + [] "into" + [] [] in let* α1 := M.read (M.get_struct_tuple_field self "subtle::Choice" 0) in let* α2 := M.read (M.get_struct_tuple_field rhs "subtle::Choice" 0) in @@ -379,7 +393,9 @@ Module Impl_core_ops_bit_BitXorAssign_for_subtle_Choice. "core::ops::bit::BitXor" (Ty.path "subtle::Choice") [ Ty.path "subtle::Choice" ] + [] "bitxor" + [] [] in let* α2 := M.read self in let* α3 := M.read α2 in @@ -421,7 +437,9 @@ Module Impl_core_ops_bit_Not_for_subtle_Choice. "core::convert::Into" (Ty.path "u8") [ Ty.path "subtle::Choice" ] + [] "into" + [] [] in let* α1 := M.read (M.get_struct_tuple_field self "subtle::Choice" 0) in M.call_closure α0 [ BinOp.Pure.bit_and (Value.Integer Integer.U8 1) (UnOp.Pure.not α1) ] @@ -488,7 +506,7 @@ Definition black_box (τ : list Ty.t) (α : list Value.t) : M := let* _ := let* α0 := M.read γ in M.is_constant_or_break_match α0 (Value.Bool true) in - let* α0 := M.get_function "core::panicking::panic" [] in + let* α0 := M.get_function "core::panicking::panic" [] [ Value.Bool true ] in let* α1 := M.read (mk_str "assertion failed: (input == 0u8) | (input == 1u8)") in let* α2 := M.call_closure α0 [ α1 ] in @@ -499,7 +517,7 @@ Definition black_box (τ : list Ty.t) (α : list Value.t) : M := M.alloc (Value.Tuple []); fun γ => M.alloc (Value.Tuple []) ] in - let* α0 := M.get_function "core::ptr::read_volatile" [ Ty.path "u8" ] in + let* α0 := M.get_function "core::ptr::read_volatile" [ Ty.path "u8" ] [] in let* α1 := M.alloc input in let* α2 := M.read (M.use α1) in let* α3 := M.call_closure α0 [ α2 ] in @@ -522,7 +540,7 @@ Module Impl_core_convert_From_u8_for_subtle_Choice. match τ, α with | [], [ input ] => let* input := M.alloc input in - let* α0 := M.get_function "subtle::black_box" [] in + let* α0 := M.get_function "subtle::black_box" [] [] in let* α1 := M.read input in let* α2 := M.call_closure α0 [ α1 ] in M.pure (Value.StructTuple "subtle::Choice" [ α2 ]) @@ -544,8 +562,9 @@ Module ConstantTimeEq. | [], [ self; other ] => let* self := M.alloc self in let* other := M.alloc other in - let* α0 := M.get_trait_method "core::ops::bit::Not" (Ty.path "subtle::Choice") [] "not" [] in - let* α1 := M.get_trait_method "subtle::ConstantTimeEq" Self [] "ct_eq" [] in + let* α0 := + M.get_trait_method "core::ops::bit::Not" (Ty.path "subtle::Choice") [] [] "not" [] [] in + let* α1 := M.get_trait_method "subtle::ConstantTimeEq" Self [] [] "ct_eq" [] [] in let* α2 := M.read self in let* α3 := M.read other in let* α4 := M.call_closure α1 [ α2; α3 ] in @@ -557,7 +576,7 @@ Module ConstantTimeEq. End ConstantTimeEq. Module Impl_subtle_ConstantTimeEq_for_slice_T. - Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "slice") [ T ]. + Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "slice") [ T ] []. (* fn ct_eq(&self, _rhs: &[T]) -> Choice { @@ -587,7 +606,12 @@ Module Impl_subtle_ConstantTimeEq_for_slice_T. let* self := M.alloc self in let* _rhs := M.alloc _rhs in let* len := - let* α0 := M.get_associated_function (Ty.apply (Ty.path "slice") [ T ]) "len" [] in + let* α0 := + M.get_associated_function + (Ty.apply (Ty.path "slice") [ T ] []) + "len" + [] + [ Value.Bool true ] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -599,7 +623,12 @@ Module Impl_subtle_ConstantTimeEq_for_slice_T. fun γ => let* γ := let* α0 := M.read len in - let* α1 := M.get_associated_function (Ty.apply (Ty.path "slice") [ T ]) "len" [] in + let* α1 := + M.get_associated_function + (Ty.apply (Ty.path "slice") [ T ] []) + "len" + [] + [ Value.Bool true ] in let* α2 := M.read _rhs in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := M.alloc (BinOp.Pure.ne α0 α3) in @@ -612,7 +641,9 @@ Module Impl_subtle_ConstantTimeEq_for_slice_T. "core::convert::From" (Ty.path "subtle::Choice") [ Ty.path "u8" ] + [] "from" + [] [] in let* α1 := M.call_closure α0 [ Value.Integer Integer.U8 0 ] in let* α2 := M.return_ α1 in @@ -629,23 +660,28 @@ Module Impl_subtle_ConstantTimeEq_for_slice_T. (Ty.apply (Ty.path "core::iter::adapters::zip::Zip") [ - Ty.apply (Ty.path "core::slice::iter::Iter") [ T ]; - Ty.apply (Ty.path "core::slice::iter::Iter") [ T ] - ]) + Ty.apply (Ty.path "core::slice::iter::Iter") [ T ] []; + Ty.apply (Ty.path "core::slice::iter::Iter") [ T ] [] + ] + []) + [] [] "into_iter" + [] [] in let* α1 := M.get_trait_method "core::iter::traits::iterator::Iterator" - (Ty.apply (Ty.path "core::slice::iter::Iter") [ T ]) + (Ty.apply (Ty.path "core::slice::iter::Iter") [ T ] []) + [] [] "zip" - [ Ty.apply (Ty.path "core::slice::iter::Iter") [ T ] ] in - let* α2 := M.get_associated_function (Ty.apply (Ty.path "slice") [ T ]) "iter" [] in + [ Ty.apply (Ty.path "core::slice::iter::Iter") [ T ] [] ] + [] in + let* α2 := M.get_associated_function (Ty.apply (Ty.path "slice") [ T ] []) "iter" [] [] in let* α3 := M.read self in let* α4 := M.call_closure α2 [ α3 ] in - let* α5 := M.get_associated_function (Ty.apply (Ty.path "slice") [ T ]) "iter" [] in + let* α5 := M.get_associated_function (Ty.apply (Ty.path "slice") [ T ] []) "iter" [] [] in let* α6 := M.read _rhs in let* α7 := M.call_closure α5 [ α6 ] in let* α8 := M.call_closure α1 [ α4; α7 ] in @@ -665,11 +701,14 @@ Module Impl_subtle_ConstantTimeEq_for_slice_T. (Ty.apply (Ty.path "core::iter::adapters::zip::Zip") [ - Ty.apply (Ty.path "core::slice::iter::Iter") [ T ]; - Ty.apply (Ty.path "core::slice::iter::Iter") [ T ] - ]) + Ty.apply (Ty.path "core::slice::iter::Iter") [ T ] []; + Ty.apply (Ty.path "core::slice::iter::Iter") [ T ] [] + ] + []) + [] [] "next" + [] [] in let* α1 := M.call_closure α0 [ iter ] in let* α2 := M.alloc α1 in @@ -695,9 +734,13 @@ Module Impl_subtle_ConstantTimeEq_for_slice_T. let β := x in let* α0 := M.read β in let* α1 := - M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + M.get_associated_function + (Ty.path "subtle::Choice") + "unwrap_u8" + [] + [] in let* α2 := - M.get_trait_method "subtle::ConstantTimeEq" T [] "ct_eq" [] in + M.get_trait_method "subtle::ConstantTimeEq" T [] [] "ct_eq" [] [] in let* α3 := M.read ai in let* α4 := M.read bi in let* α5 := M.call_closure α2 [ α3; α4 ] in @@ -714,7 +757,9 @@ Module Impl_subtle_ConstantTimeEq_for_slice_T. "core::convert::Into" (Ty.path "u8") [ Ty.path "subtle::Choice" ] + [] "into" + [] [] in let* α1 := M.read x in let* α2 := M.call_closure α0 [ α1 ] in @@ -745,13 +790,16 @@ Module Impl_subtle_ConstantTimeEq_for_subtle_Choice. | [], [ self; rhs ] => let* self := M.alloc self in let* rhs := M.alloc rhs in - let* α0 := M.get_trait_method "core::ops::bit::Not" (Ty.path "subtle::Choice") [] "not" [] in + let* α0 := + M.get_trait_method "core::ops::bit::Not" (Ty.path "subtle::Choice") [] [] "not" [] [] in let* α1 := M.get_trait_method "core::ops::bit::BitXor" (Ty.path "subtle::Choice") [ Ty.path "subtle::Choice" ] + [] "bitxor" + [] [] in let* α2 := M.read self in let* α3 := M.read α2 in @@ -795,9 +843,11 @@ Module Impl_subtle_ConstantTimeEq_for_u8. let* α0 := M.get_trait_method "core::ops::bit::BitXor" - (Ty.apply (Ty.path "&") [ Ty.path "u8" ]) - [ Ty.apply (Ty.path "&") [ Ty.path "u8" ] ] + (Ty.apply (Ty.path "&") [ Ty.path "u8" ] []) + [ Ty.apply (Ty.path "&") [ Ty.path "u8" ] [] ] + [] "bitxor" + [] [] in let* α1 := M.read self in let* α2 := M.read other in @@ -805,7 +855,7 @@ Module Impl_subtle_ConstantTimeEq_for_u8. M.alloc α3 in let* y := let* α0 := M.read x in - let* α1 := M.get_associated_function (Ty.path "u8") "wrapping_neg" [] in + let* α1 := M.get_associated_function (Ty.path "u8") "wrapping_neg" [] [ Value.Bool true ] in let* α2 := M.read x in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := BinOp.Panic.sub (Value.Integer Integer.I32 8) (Value.Integer Integer.I32 1) in @@ -816,7 +866,9 @@ Module Impl_subtle_ConstantTimeEq_for_u8. "core::convert::Into" (Ty.path "u8") [ Ty.path "subtle::Choice" ] + [] "into" + [] [] in let* α1 := M.read y in let* α2 := M.alloc (Value.Integer Integer.U8 1) in @@ -851,7 +903,7 @@ Module Impl_subtle_ConstantTimeEq_for_i8. | [], [ self; other ] => let* self := M.alloc self in let* other := M.alloc other in - let* α0 := M.get_trait_method "subtle::ConstantTimeEq" (Ty.path "u8") [] "ct_eq" [] in + let* α0 := M.get_trait_method "subtle::ConstantTimeEq" (Ty.path "u8") [] [] "ct_eq" [] [] in let* α1 := M.read self in let* α2 := M.read α1 in let* α3 := M.alloc (M.rust_cast α2) in @@ -895,9 +947,11 @@ Module Impl_subtle_ConstantTimeEq_for_u16. let* α0 := M.get_trait_method "core::ops::bit::BitXor" - (Ty.apply (Ty.path "&") [ Ty.path "u16" ]) - [ Ty.apply (Ty.path "&") [ Ty.path "u16" ] ] + (Ty.apply (Ty.path "&") [ Ty.path "u16" ] []) + [ Ty.apply (Ty.path "&") [ Ty.path "u16" ] [] ] + [] "bitxor" + [] [] in let* α1 := M.read self in let* α2 := M.read other in @@ -905,7 +959,8 @@ Module Impl_subtle_ConstantTimeEq_for_u16. M.alloc α3 in let* y := let* α0 := M.read x in - let* α1 := M.get_associated_function (Ty.path "u16") "wrapping_neg" [] in + let* α1 := + M.get_associated_function (Ty.path "u16") "wrapping_neg" [] [ Value.Bool true ] in let* α2 := M.read x in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := BinOp.Panic.sub (Value.Integer Integer.I32 16) (Value.Integer Integer.I32 1) in @@ -916,7 +971,9 @@ Module Impl_subtle_ConstantTimeEq_for_u16. "core::convert::Into" (Ty.path "u8") [ Ty.path "subtle::Choice" ] + [] "into" + [] [] in let* α1 := M.read y in let* α2 := M.alloc (Value.Integer Integer.U16 1) in @@ -949,7 +1006,7 @@ Module Impl_subtle_ConstantTimeEq_for_i16. | [], [ self; other ] => let* self := M.alloc self in let* other := M.alloc other in - let* α0 := M.get_trait_method "subtle::ConstantTimeEq" (Ty.path "u16") [] "ct_eq" [] in + let* α0 := M.get_trait_method "subtle::ConstantTimeEq" (Ty.path "u16") [] [] "ct_eq" [] [] in let* α1 := M.read self in let* α2 := M.read α1 in let* α3 := M.alloc (M.rust_cast α2) in @@ -993,9 +1050,11 @@ Module Impl_subtle_ConstantTimeEq_for_u32. let* α0 := M.get_trait_method "core::ops::bit::BitXor" - (Ty.apply (Ty.path "&") [ Ty.path "u32" ]) - [ Ty.apply (Ty.path "&") [ Ty.path "u32" ] ] + (Ty.apply (Ty.path "&") [ Ty.path "u32" ] []) + [ Ty.apply (Ty.path "&") [ Ty.path "u32" ] [] ] + [] "bitxor" + [] [] in let* α1 := M.read self in let* α2 := M.read other in @@ -1003,7 +1062,8 @@ Module Impl_subtle_ConstantTimeEq_for_u32. M.alloc α3 in let* y := let* α0 := M.read x in - let* α1 := M.get_associated_function (Ty.path "u32") "wrapping_neg" [] in + let* α1 := + M.get_associated_function (Ty.path "u32") "wrapping_neg" [] [ Value.Bool true ] in let* α2 := M.read x in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := BinOp.Panic.sub (Value.Integer Integer.I32 32) (Value.Integer Integer.I32 1) in @@ -1014,7 +1074,9 @@ Module Impl_subtle_ConstantTimeEq_for_u32. "core::convert::Into" (Ty.path "u8") [ Ty.path "subtle::Choice" ] + [] "into" + [] [] in let* α1 := M.read y in let* α2 := M.alloc (Value.Integer Integer.U32 1) in @@ -1047,7 +1109,7 @@ Module Impl_subtle_ConstantTimeEq_for_i32. | [], [ self; other ] => let* self := M.alloc self in let* other := M.alloc other in - let* α0 := M.get_trait_method "subtle::ConstantTimeEq" (Ty.path "u32") [] "ct_eq" [] in + let* α0 := M.get_trait_method "subtle::ConstantTimeEq" (Ty.path "u32") [] [] "ct_eq" [] [] in let* α1 := M.read self in let* α2 := M.read α1 in let* α3 := M.alloc (M.rust_cast α2) in @@ -1091,9 +1153,11 @@ Module Impl_subtle_ConstantTimeEq_for_u64. let* α0 := M.get_trait_method "core::ops::bit::BitXor" - (Ty.apply (Ty.path "&") [ Ty.path "u64" ]) - [ Ty.apply (Ty.path "&") [ Ty.path "u64" ] ] + (Ty.apply (Ty.path "&") [ Ty.path "u64" ] []) + [ Ty.apply (Ty.path "&") [ Ty.path "u64" ] [] ] + [] "bitxor" + [] [] in let* α1 := M.read self in let* α2 := M.read other in @@ -1101,7 +1165,8 @@ Module Impl_subtle_ConstantTimeEq_for_u64. M.alloc α3 in let* y := let* α0 := M.read x in - let* α1 := M.get_associated_function (Ty.path "u64") "wrapping_neg" [] in + let* α1 := + M.get_associated_function (Ty.path "u64") "wrapping_neg" [] [ Value.Bool true ] in let* α2 := M.read x in let* α3 := M.call_closure α1 [ α2 ] in let* α4 := BinOp.Panic.sub (Value.Integer Integer.I32 64) (Value.Integer Integer.I32 1) in @@ -1112,7 +1177,9 @@ Module Impl_subtle_ConstantTimeEq_for_u64. "core::convert::Into" (Ty.path "u8") [ Ty.path "subtle::Choice" ] + [] "into" + [] [] in let* α1 := M.read y in let* α2 := M.alloc (Value.Integer Integer.U64 1) in @@ -1145,7 +1212,7 @@ Module Impl_subtle_ConstantTimeEq_for_i64. | [], [ self; other ] => let* self := M.alloc self in let* other := M.alloc other in - let* α0 := M.get_trait_method "subtle::ConstantTimeEq" (Ty.path "u64") [] "ct_eq" [] in + let* α0 := M.get_trait_method "subtle::ConstantTimeEq" (Ty.path "u64") [] [] "ct_eq" [] [] in let* α1 := M.read self in let* α2 := M.read α1 in let* α3 := M.alloc (M.rust_cast α2) in @@ -1189,9 +1256,11 @@ Module Impl_subtle_ConstantTimeEq_for_usize. let* α0 := M.get_trait_method "core::ops::bit::BitXor" - (Ty.apply (Ty.path "&") [ Ty.path "usize" ]) - [ Ty.apply (Ty.path "&") [ Ty.path "usize" ] ] + (Ty.apply (Ty.path "&") [ Ty.path "usize" ] []) + [ Ty.apply (Ty.path "&") [ Ty.path "usize" ] [] ] + [] "bitxor" + [] [] in let* α1 := M.read self in let* α2 := M.read other in @@ -1199,10 +1268,11 @@ Module Impl_subtle_ConstantTimeEq_for_usize. M.alloc α3 in let* y := let* α0 := M.read x in - let* α1 := M.get_associated_function (Ty.path "usize") "wrapping_neg" [] in + let* α1 := + M.get_associated_function (Ty.path "usize") "wrapping_neg" [] [ Value.Bool true ] in let* α2 := M.read x in let* α3 := M.call_closure α1 [ α2 ] in - let* α4 := M.get_function "core::mem::size_of" [ Ty.path "usize" ] in + let* α4 := M.get_function "core::mem::size_of" [ Ty.path "usize" ] [ Value.Bool true ] in let* α5 := M.call_closure α4 [] in let* α6 := BinOp.Panic.mul α5 (Value.Integer Integer.Usize 8) in let* α7 := BinOp.Panic.sub α6 (Value.Integer Integer.Usize 1) in @@ -1213,7 +1283,9 @@ Module Impl_subtle_ConstantTimeEq_for_usize. "core::convert::Into" (Ty.path "u8") [ Ty.path "subtle::Choice" ] + [] "into" + [] [] in let* α1 := M.read y in let* α2 := M.alloc (Value.Integer Integer.Usize 1) in @@ -1246,7 +1318,8 @@ Module Impl_subtle_ConstantTimeEq_for_isize. | [], [ self; other ] => let* self := M.alloc self in let* other := M.alloc other in - let* α0 := M.get_trait_method "subtle::ConstantTimeEq" (Ty.path "usize") [] "ct_eq" [] in + let* α0 := + M.get_trait_method "subtle::ConstantTimeEq" (Ty.path "usize") [] [] "ct_eq" [] [] in let* α1 := M.read self in let* α2 := M.read α1 in let* α3 := M.alloc (M.rust_cast α2) in @@ -1276,7 +1349,14 @@ Module ConditionallySelectable. let* _ := let* α0 := M.read self in let* α1 := - M.get_trait_method "subtle::ConditionallySelectable" Self [] "conditional_select" [] in + M.get_trait_method + "subtle::ConditionallySelectable" + Self + [] + [] + "conditional_select" + [] + [] in let* α2 := M.read self in let* α3 := M.read other in let* α4 := M.read choice in @@ -1300,7 +1380,14 @@ Module ConditionallySelectable. M.copy α0 in let* _ := let* α0 := - M.get_trait_method "subtle::ConditionallySelectable" Self [] "conditional_assign" [] in + M.get_trait_method + "subtle::ConditionallySelectable" + Self + [] + [] + "conditional_assign" + [] + [] in let* α1 := M.read a in let* α2 := M.read b in let* α3 := M.read choice in @@ -1308,7 +1395,14 @@ Module ConditionallySelectable. M.alloc α4 in let* _ := let* α0 := - M.get_trait_method "subtle::ConditionallySelectable" Self [] "conditional_assign" [] in + M.get_trait_method + "subtle::ConditionallySelectable" + Self + [] + [] + "conditional_assign" + [] + [] in let* α1 := M.read b in let* α2 := M.read choice in let* α3 := M.call_closure α0 [ α1; t; α2 ] in @@ -1340,25 +1434,29 @@ Module Impl_subtle_ConditionallySelectable_for_u8. let* b := M.alloc b in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in M.alloc (M.rust_cast α2) in let* α0 := M.get_trait_method "core::ops::bit::BitXor" - (Ty.apply (Ty.path "&") [ Ty.path "u8" ]) + (Ty.apply (Ty.path "&") [ Ty.path "u8" ] []) [ Ty.path "u8" ] + [] "bitxor" + [] [] in let* α1 := M.read a in let* α2 := M.read mask in let* α3 := M.get_trait_method "core::ops::bit::BitXor" - (Ty.apply (Ty.path "&") [ Ty.path "u8" ]) - [ Ty.apply (Ty.path "&") [ Ty.path "u8" ] ] + (Ty.apply (Ty.path "&") [ Ty.path "u8" ] []) + [ Ty.apply (Ty.path "&") [ Ty.path "u8" ] [] ] + [] "bitxor" + [] [] in let* α4 := M.read a in let* α5 := M.read b in @@ -1384,7 +1482,7 @@ Module Impl_subtle_ConditionallySelectable_for_u8. let* other := M.alloc other in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in M.alloc (M.rust_cast α2) in @@ -1419,7 +1517,7 @@ Module Impl_subtle_ConditionallySelectable_for_u8. let* b := M.alloc b in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in M.alloc (M.rust_cast α2) in @@ -1476,7 +1574,7 @@ Module Impl_subtle_ConditionallySelectable_for_i8. let* b := M.alloc b in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in let* α3 := M.alloc α2 in @@ -1484,18 +1582,22 @@ Module Impl_subtle_ConditionallySelectable_for_i8. let* α0 := M.get_trait_method "core::ops::bit::BitXor" - (Ty.apply (Ty.path "&") [ Ty.path "i8" ]) + (Ty.apply (Ty.path "&") [ Ty.path "i8" ] []) [ Ty.path "i8" ] + [] "bitxor" + [] [] in let* α1 := M.read a in let* α2 := M.read mask in let* α3 := M.get_trait_method "core::ops::bit::BitXor" - (Ty.apply (Ty.path "&") [ Ty.path "i8" ]) - [ Ty.apply (Ty.path "&") [ Ty.path "i8" ] ] + (Ty.apply (Ty.path "&") [ Ty.path "i8" ] []) + [ Ty.apply (Ty.path "&") [ Ty.path "i8" ] [] ] + [] "bitxor" + [] [] in let* α4 := M.read a in let* α5 := M.read b in @@ -1521,7 +1623,7 @@ Module Impl_subtle_ConditionallySelectable_for_i8. let* other := M.alloc other in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in let* α3 := M.alloc α2 in @@ -1557,7 +1659,7 @@ Module Impl_subtle_ConditionallySelectable_for_i8. let* b := M.alloc b in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in let* α3 := M.alloc α2 in @@ -1615,25 +1717,29 @@ Module Impl_subtle_ConditionallySelectable_for_u16. let* b := M.alloc b in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in M.alloc (M.rust_cast α2) in let* α0 := M.get_trait_method "core::ops::bit::BitXor" - (Ty.apply (Ty.path "&") [ Ty.path "u16" ]) + (Ty.apply (Ty.path "&") [ Ty.path "u16" ] []) [ Ty.path "u16" ] + [] "bitxor" + [] [] in let* α1 := M.read a in let* α2 := M.read mask in let* α3 := M.get_trait_method "core::ops::bit::BitXor" - (Ty.apply (Ty.path "&") [ Ty.path "u16" ]) - [ Ty.apply (Ty.path "&") [ Ty.path "u16" ] ] + (Ty.apply (Ty.path "&") [ Ty.path "u16" ] []) + [ Ty.apply (Ty.path "&") [ Ty.path "u16" ] [] ] + [] "bitxor" + [] [] in let* α4 := M.read a in let* α5 := M.read b in @@ -1659,7 +1765,7 @@ Module Impl_subtle_ConditionallySelectable_for_u16. let* other := M.alloc other in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in M.alloc (M.rust_cast α2) in @@ -1694,7 +1800,7 @@ Module Impl_subtle_ConditionallySelectable_for_u16. let* b := M.alloc b in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in M.alloc (M.rust_cast α2) in @@ -1751,7 +1857,7 @@ Module Impl_subtle_ConditionallySelectable_for_i16. let* b := M.alloc b in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in let* α3 := M.alloc α2 in @@ -1759,18 +1865,22 @@ Module Impl_subtle_ConditionallySelectable_for_i16. let* α0 := M.get_trait_method "core::ops::bit::BitXor" - (Ty.apply (Ty.path "&") [ Ty.path "i16" ]) + (Ty.apply (Ty.path "&") [ Ty.path "i16" ] []) [ Ty.path "i16" ] + [] "bitxor" + [] [] in let* α1 := M.read a in let* α2 := M.read mask in let* α3 := M.get_trait_method "core::ops::bit::BitXor" - (Ty.apply (Ty.path "&") [ Ty.path "i16" ]) - [ Ty.apply (Ty.path "&") [ Ty.path "i16" ] ] + (Ty.apply (Ty.path "&") [ Ty.path "i16" ] []) + [ Ty.apply (Ty.path "&") [ Ty.path "i16" ] [] ] + [] "bitxor" + [] [] in let* α4 := M.read a in let* α5 := M.read b in @@ -1796,7 +1906,7 @@ Module Impl_subtle_ConditionallySelectable_for_i16. let* other := M.alloc other in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in let* α3 := M.alloc α2 in @@ -1832,7 +1942,7 @@ Module Impl_subtle_ConditionallySelectable_for_i16. let* b := M.alloc b in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in let* α3 := M.alloc α2 in @@ -1890,25 +2000,29 @@ Module Impl_subtle_ConditionallySelectable_for_u32. let* b := M.alloc b in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in M.alloc (M.rust_cast α2) in let* α0 := M.get_trait_method "core::ops::bit::BitXor" - (Ty.apply (Ty.path "&") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "&") [ Ty.path "u32" ] []) [ Ty.path "u32" ] + [] "bitxor" + [] [] in let* α1 := M.read a in let* α2 := M.read mask in let* α3 := M.get_trait_method "core::ops::bit::BitXor" - (Ty.apply (Ty.path "&") [ Ty.path "u32" ]) - [ Ty.apply (Ty.path "&") [ Ty.path "u32" ] ] + (Ty.apply (Ty.path "&") [ Ty.path "u32" ] []) + [ Ty.apply (Ty.path "&") [ Ty.path "u32" ] [] ] + [] "bitxor" + [] [] in let* α4 := M.read a in let* α5 := M.read b in @@ -1934,7 +2048,7 @@ Module Impl_subtle_ConditionallySelectable_for_u32. let* other := M.alloc other in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in M.alloc (M.rust_cast α2) in @@ -1969,7 +2083,7 @@ Module Impl_subtle_ConditionallySelectable_for_u32. let* b := M.alloc b in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in M.alloc (M.rust_cast α2) in @@ -2026,7 +2140,7 @@ Module Impl_subtle_ConditionallySelectable_for_i32. let* b := M.alloc b in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in let* α3 := M.alloc α2 in @@ -2034,18 +2148,22 @@ Module Impl_subtle_ConditionallySelectable_for_i32. let* α0 := M.get_trait_method "core::ops::bit::BitXor" - (Ty.apply (Ty.path "&") [ Ty.path "i32" ]) + (Ty.apply (Ty.path "&") [ Ty.path "i32" ] []) [ Ty.path "i32" ] + [] "bitxor" + [] [] in let* α1 := M.read a in let* α2 := M.read mask in let* α3 := M.get_trait_method "core::ops::bit::BitXor" - (Ty.apply (Ty.path "&") [ Ty.path "i32" ]) - [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] ] + (Ty.apply (Ty.path "&") [ Ty.path "i32" ] []) + [ Ty.apply (Ty.path "&") [ Ty.path "i32" ] [] ] + [] "bitxor" + [] [] in let* α4 := M.read a in let* α5 := M.read b in @@ -2071,7 +2189,7 @@ Module Impl_subtle_ConditionallySelectable_for_i32. let* other := M.alloc other in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in let* α3 := M.alloc α2 in @@ -2107,7 +2225,7 @@ Module Impl_subtle_ConditionallySelectable_for_i32. let* b := M.alloc b in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in let* α3 := M.alloc α2 in @@ -2165,25 +2283,29 @@ Module Impl_subtle_ConditionallySelectable_for_u64. let* b := M.alloc b in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in M.alloc (M.rust_cast α2) in let* α0 := M.get_trait_method "core::ops::bit::BitXor" - (Ty.apply (Ty.path "&") [ Ty.path "u64" ]) + (Ty.apply (Ty.path "&") [ Ty.path "u64" ] []) [ Ty.path "u64" ] + [] "bitxor" + [] [] in let* α1 := M.read a in let* α2 := M.read mask in let* α3 := M.get_trait_method "core::ops::bit::BitXor" - (Ty.apply (Ty.path "&") [ Ty.path "u64" ]) - [ Ty.apply (Ty.path "&") [ Ty.path "u64" ] ] + (Ty.apply (Ty.path "&") [ Ty.path "u64" ] []) + [ Ty.apply (Ty.path "&") [ Ty.path "u64" ] [] ] + [] "bitxor" + [] [] in let* α4 := M.read a in let* α5 := M.read b in @@ -2209,7 +2331,7 @@ Module Impl_subtle_ConditionallySelectable_for_u64. let* other := M.alloc other in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in M.alloc (M.rust_cast α2) in @@ -2244,7 +2366,7 @@ Module Impl_subtle_ConditionallySelectable_for_u64. let* b := M.alloc b in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in M.alloc (M.rust_cast α2) in @@ -2301,7 +2423,7 @@ Module Impl_subtle_ConditionallySelectable_for_i64. let* b := M.alloc b in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in let* α3 := M.alloc α2 in @@ -2309,18 +2431,22 @@ Module Impl_subtle_ConditionallySelectable_for_i64. let* α0 := M.get_trait_method "core::ops::bit::BitXor" - (Ty.apply (Ty.path "&") [ Ty.path "i64" ]) + (Ty.apply (Ty.path "&") [ Ty.path "i64" ] []) [ Ty.path "i64" ] + [] "bitxor" + [] [] in let* α1 := M.read a in let* α2 := M.read mask in let* α3 := M.get_trait_method "core::ops::bit::BitXor" - (Ty.apply (Ty.path "&") [ Ty.path "i64" ]) - [ Ty.apply (Ty.path "&") [ Ty.path "i64" ] ] + (Ty.apply (Ty.path "&") [ Ty.path "i64" ] []) + [ Ty.apply (Ty.path "&") [ Ty.path "i64" ] [] ] + [] "bitxor" + [] [] in let* α4 := M.read a in let* α5 := M.read b in @@ -2346,7 +2472,7 @@ Module Impl_subtle_ConditionallySelectable_for_i64. let* other := M.alloc other in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in let* α3 := M.alloc α2 in @@ -2382,7 +2508,7 @@ Module Impl_subtle_ConditionallySelectable_for_i64. let* b := M.alloc b in let* choice := M.alloc choice in let* mask := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ choice ] in let* α2 := UnOp.Panic.neg (M.rust_cast α1) in let* α3 := M.alloc α2 in @@ -2441,7 +2567,9 @@ Module Impl_subtle_ConditionallySelectable_for_subtle_Choice. "subtle::ConditionallySelectable" (Ty.path "u8") [] + [] "conditional_select" + [] [] in let* α1 := M.read a in let* α2 := M.read b in @@ -2487,7 +2615,14 @@ Module Impl_subtle_ConditionallyNegatable_for_T. let* choice := M.alloc choice in let* self_neg := let* α0 := - M.get_trait_method "core::ops::arith::Neg" (Ty.apply (Ty.path "&") [ T ]) [] "neg" [] in + M.get_trait_method + "core::ops::arith::Neg" + (Ty.apply (Ty.path "&") [ T ] []) + [] + [] + "neg" + [] + [] in let* α1 := M.read self in let* α2 := M.alloc α1 in let* α3 := M.read (M.use α2) in @@ -2495,7 +2630,7 @@ Module Impl_subtle_ConditionallyNegatable_for_T. M.alloc α4 in let* _ := let* α0 := - M.get_trait_method "subtle::ConditionallySelectable" T [] "conditional_assign" [] in + M.get_trait_method "subtle::ConditionallySelectable" T [] [] "conditional_assign" [] [] in let* α1 := M.read self in let* α2 := M.read choice in let* α3 := M.call_closure α0 [ α1; self_neg; α2 ] in @@ -2522,7 +2657,7 @@ End Impl_subtle_ConditionallyNegatable_for_T. } *) Module Impl_core_clone_Clone_for_subtle_CtOption_T. - Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ]. + Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ] []. (* Clone @@ -2532,10 +2667,11 @@ Module Impl_core_clone_Clone_for_subtle_CtOption_T. match τ, α with | [], [ self ] => let* self := M.alloc self in - let* α0 := M.get_trait_method "core::clone::Clone" T [] "clone" [] in + let* α0 := M.get_trait_method "core::clone::Clone" T [] [] "clone" [] [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ M.get_struct_record_field α1 "subtle::CtOption" "value" ] in - let* α3 := M.get_trait_method "core::clone::Clone" (Ty.path "subtle::Choice") [] "clone" [] in + let* α3 := + M.get_trait_method "core::clone::Clone" (Ty.path "subtle::Choice") [] [] "clone" [] [] in let* α4 := M.read self in let* α5 := M.call_closure α3 [ M.get_struct_record_field α4 "subtle::CtOption" "is_some" ] in M.pure (Value.StructRecord "subtle::CtOption" [ ("value", α2); ("is_some", α5) ]) @@ -2552,7 +2688,7 @@ Module Impl_core_clone_Clone_for_subtle_CtOption_T. End Impl_core_clone_Clone_for_subtle_CtOption_T. Module Impl_core_marker_Copy_for_subtle_CtOption_T. - Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ]. + Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ] []. Axiom Implements : forall (T : Ty.t), @@ -2564,7 +2700,7 @@ Module Impl_core_marker_Copy_for_subtle_CtOption_T. End Impl_core_marker_Copy_for_subtle_CtOption_T. Module Impl_core_fmt_Debug_for_subtle_CtOption_T. - Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ]. + Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ] []. (* Debug @@ -2579,6 +2715,7 @@ Module Impl_core_fmt_Debug_for_subtle_CtOption_T. M.get_associated_function (Ty.path "core::fmt::Formatter") "debug_struct_field2_finish" + [] [] in let* α1 := M.read f in let* α2 := M.read (mk_str "CtOption") in @@ -2607,7 +2744,7 @@ Module Impl_core_fmt_Debug_for_subtle_CtOption_T. End Impl_core_fmt_Debug_for_subtle_CtOption_T. Module Impl_core_convert_From_subtle_CtOption_T_for_core_option_Option_T. - Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "core::option::Option") [ T ]. + Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "core::option::Option") [ T ] []. (* fn from(source: CtOption) -> Option { @@ -2630,11 +2767,12 @@ Module Impl_core_convert_From_subtle_CtOption_T_for_core_option_Option_T. [ fun γ => let* γ := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.get_associated_function - (Ty.apply (Ty.path "subtle::CtOption") [ T ]) + (Ty.apply (Ty.path "subtle::CtOption") [ T ] []) "is_some" + [] [] in let* α2 := M.call_closure α1 [ source ] in let* α3 := M.alloc α2 in @@ -2657,12 +2795,12 @@ Module Impl_core_convert_From_subtle_CtOption_T_for_core_option_Option_T. M.IsTraitInstance "core::convert::From" (Self T) - (* Trait polymorphic types *) [ (* T *) Ty.apply (Ty.path "subtle::CtOption") [ T ] ] + (* Trait polymorphic types *) [ (* T *) Ty.apply (Ty.path "subtle::CtOption") [ T ] [] ] (* Instance *) [ ("from", InstanceField.Method (from T)) ]. End Impl_core_convert_From_subtle_CtOption_T_for_core_option_Option_T. Module Impl_subtle_CtOption_T. - Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ]. + Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ] []. (* pub fn new(value: T, is_some: Choice) -> CtOption { @@ -2700,7 +2838,7 @@ Module Impl_subtle_CtOption_T. let* self := M.alloc self in let* msg := M.alloc msg in let* _ := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ M.get_struct_record_field self "subtle::CtOption" "is_some" ] in let* α2 := M.alloc α1 in @@ -2733,12 +2871,13 @@ Module Impl_subtle_CtOption_T. let* α0 := M.get_function "core::panicking::assert_failed" - [ Ty.path "u8"; Ty.path "u8" ] in + [ Ty.path "u8"; Ty.path "u8" ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in let* α4 := - M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] in + M.get_associated_function (Ty.path "core::fmt::Arguments") "new_v1" [] [] in let* α7 := (* Unsize *) let* α5 := M.read (mk_str "") in @@ -2750,7 +2889,8 @@ Module Impl_subtle_CtOption_T. M.get_associated_function (Ty.path "core::fmt::rt::Argument") "new_display" - [ Ty.apply (Ty.path "&") [ Ty.path "str" ] ] in + [ Ty.apply (Ty.path "&") [ Ty.path "str" ] [] ] + [] in let* α9 := M.call_closure α8 [ msg ] in let* α10 := M.alloc (Value.Array [ α9 ]) in M.pure (M.pointer_coercion α10) in @@ -2787,7 +2927,7 @@ Module Impl_subtle_CtOption_T. | [], [ self ] => let* self := M.alloc self in let* _ := - let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] in + let* α0 := M.get_associated_function (Ty.path "subtle::Choice") "unwrap_u8" [] [] in let* α1 := M.call_closure α0 [ M.get_struct_record_field self "subtle::CtOption" "is_some" ] in let* α2 := M.alloc α1 in @@ -2820,7 +2960,8 @@ Module Impl_subtle_CtOption_T. let* α0 := M.get_function "core::panicking::assert_failed" - [ Ty.path "u8"; Ty.path "u8" ] in + [ Ty.path "u8"; Ty.path "u8" ] + [] in let* α1 := M.read kind in let* α2 := M.read left_val in let* α3 := M.read right_val in @@ -2858,7 +2999,7 @@ Module Impl_subtle_CtOption_T. let* self := M.alloc self in let* def := M.alloc def in let* α0 := - M.get_trait_method "subtle::ConditionallySelectable" T [] "conditional_select" [] in + M.get_trait_method "subtle::ConditionallySelectable" T [] [] "conditional_select" [] [] in let* α1 := M.read (M.get_struct_record_field self "subtle::CtOption" "is_some") in M.call_closure α0 [ def; M.get_struct_record_field self "subtle::CtOption" "value"; α1 ] | _, _ => M.impossible @@ -2884,9 +3025,9 @@ Module Impl_subtle_CtOption_T. let* self := M.alloc self in let* f := M.alloc f in let* α0 := - M.get_trait_method "subtle::ConditionallySelectable" T [] "conditional_select" [] in + M.get_trait_method "subtle::ConditionallySelectable" T [] [] "conditional_select" [] [] in let* α1 := - M.get_trait_method "core::ops::function::FnOnce" F [ Ty.tuple [] ] "call_once" [] in + M.get_trait_method "core::ops::function::FnOnce" F [ Ty.tuple [] ] [] "call_once" [] [] in let* α2 := M.read f in let* α3 := M.call_closure α1 [ α2; Value.Tuple [] ] in let* α4 := M.alloc α3 in @@ -2928,7 +3069,8 @@ Module Impl_subtle_CtOption_T. match τ, α with | [], [ self ] => let* self := M.alloc self in - let* α0 := M.get_trait_method "core::ops::bit::Not" (Ty.path "subtle::Choice") [] "not" [] in + let* α0 := + M.get_trait_method "core::ops::bit::Not" (Ty.path "subtle::Choice") [] [] "not" [] [] in let* α1 := M.read self in let* α2 := M.read (M.get_struct_record_field α1 "subtle::CtOption" "is_some") in M.call_closure α0 [ α2 ] @@ -2961,13 +3103,21 @@ Module Impl_subtle_CtOption_T. | [ U; F ], [ self; f ] => let* self := M.alloc self in let* f := M.alloc f in - let* α0 := M.get_associated_function (Ty.apply (Ty.path "subtle::CtOption") [ U ]) "new" [] in + let* α0 := + M.get_associated_function (Ty.apply (Ty.path "subtle::CtOption") [ U ] []) "new" [] [] in let* α1 := - M.get_trait_method "core::ops::function::FnOnce" F [ Ty.tuple [ T ] ] "call_once" [] in + M.get_trait_method + "core::ops::function::FnOnce" + F + [ Ty.tuple [ T ] ] + [] + "call_once" + [] + [] in let* α2 := M.read f in let* α3 := - M.get_trait_method "subtle::ConditionallySelectable" T [] "conditional_select" [] in - let* α4 := M.get_trait_method "core::default::Default" T [] "default" [] in + M.get_trait_method "subtle::ConditionallySelectable" T [] [] "conditional_select" [] [] in + let* α4 := M.get_trait_method "core::default::Default" T [] [] "default" [] [] in let* α5 := M.call_closure α4 [] in let* α6 := M.alloc α5 in let* α7 := M.read (M.get_struct_record_field self "subtle::CtOption" "is_some") in @@ -3005,11 +3155,18 @@ Module Impl_subtle_CtOption_T. let* f := M.alloc f in let* tmp := let* α0 := - M.get_trait_method "core::ops::function::FnOnce" F [ Ty.tuple [ T ] ] "call_once" [] in + M.get_trait_method + "core::ops::function::FnOnce" + F + [ Ty.tuple [ T ] ] + [] + "call_once" + [] + [] in let* α1 := M.read f in let* α2 := - M.get_trait_method "subtle::ConditionallySelectable" T [] "conditional_select" [] in - let* α3 := M.get_trait_method "core::default::Default" T [] "default" [] in + M.get_trait_method "subtle::ConditionallySelectable" T [] [] "conditional_select" [] [] in + let* α3 := M.get_trait_method "core::default::Default" T [] [] "default" [] [] in let* α4 := M.call_closure α3 [] in let* α5 := M.alloc α4 in let* α6 := M.read (M.get_struct_record_field self "subtle::CtOption" "is_some") in @@ -3023,7 +3180,9 @@ Module Impl_subtle_CtOption_T. "core::ops::bit::BitAndAssign" (Ty.path "subtle::Choice") [ Ty.path "subtle::Choice" ] + [] "bitand_assign" + [] [] in let* α1 := M.read (M.get_struct_record_field self "subtle::CtOption" "is_some") in let* α2 := @@ -3057,21 +3216,27 @@ Module Impl_subtle_CtOption_T. let* f := M.alloc f in let* is_none := let* α0 := - M.get_associated_function (Ty.apply (Ty.path "subtle::CtOption") [ T ]) "is_none" [] in + M.get_associated_function + (Ty.apply (Ty.path "subtle::CtOption") [ T ] []) + "is_none" + [] + [] in let* α1 := M.call_closure α0 [ self ] in M.alloc α1 in let* f := let* α0 := - M.get_trait_method "core::ops::function::FnOnce" F [ Ty.tuple [] ] "call_once" [] in + M.get_trait_method "core::ops::function::FnOnce" F [ Ty.tuple [] ] [] "call_once" [] [] in let* α1 := M.read f in let* α2 := M.call_closure α0 [ α1; Value.Tuple [] ] in M.alloc α2 in let* α0 := M.get_trait_method "subtle::ConditionallySelectable" - (Ty.apply (Ty.path "subtle::CtOption") [ T ]) + (Ty.apply (Ty.path "subtle::CtOption") [ T ] []) + [] [] "conditional_select" + [] [] in let* α1 := M.read is_none in let* α2 := M.call_closure α0 [ self; f; α1 ] in @@ -3086,7 +3251,7 @@ Module Impl_subtle_CtOption_T. End Impl_subtle_CtOption_T. Module Impl_subtle_ConditionallySelectable_for_subtle_CtOption_T. - Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ]. + Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ] []. (* fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self { @@ -3103,9 +3268,10 @@ Module Impl_subtle_ConditionallySelectable_for_subtle_CtOption_T. let* a := M.alloc a in let* b := M.alloc b in let* choice := M.alloc choice in - let* α0 := M.get_associated_function (Ty.apply (Ty.path "subtle::CtOption") [ T ]) "new" [] in + let* α0 := + M.get_associated_function (Ty.apply (Ty.path "subtle::CtOption") [ T ] []) "new" [] [] in let* α1 := - M.get_trait_method "subtle::ConditionallySelectable" T [] "conditional_select" [] in + M.get_trait_method "subtle::ConditionallySelectable" T [] [] "conditional_select" [] [] in let* α2 := M.read a in let* α3 := M.read b in let* α4 := M.read choice in @@ -3122,7 +3288,9 @@ Module Impl_subtle_ConditionallySelectable_for_subtle_CtOption_T. "subtle::ConditionallySelectable" (Ty.path "subtle::Choice") [] + [] "conditional_select" + [] [] in let* α7 := M.read a in let* α8 := M.read b in @@ -3149,7 +3317,7 @@ Module Impl_subtle_ConditionallySelectable_for_subtle_CtOption_T. End Impl_subtle_ConditionallySelectable_for_subtle_CtOption_T. Module Impl_subtle_ConstantTimeEq_for_subtle_CtOption_T. - Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ]. + Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "subtle::CtOption") [ T ] []. (* fn ct_eq(&self, rhs: &CtOption) -> Choice { @@ -3167,13 +3335,21 @@ Module Impl_subtle_ConstantTimeEq_for_subtle_CtOption_T. let* rhs := M.alloc rhs in let* a := let* α0 := - M.get_associated_function (Ty.apply (Ty.path "subtle::CtOption") [ T ]) "is_some" [] in + M.get_associated_function + (Ty.apply (Ty.path "subtle::CtOption") [ T ] []) + "is_some" + [] + [] in let* α1 := M.read self in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in let* b := let* α0 := - M.get_associated_function (Ty.apply (Ty.path "subtle::CtOption") [ T ]) "is_some" [] in + M.get_associated_function + (Ty.apply (Ty.path "subtle::CtOption") [ T ] []) + "is_some" + [] + [] in let* α1 := M.read rhs in let* α2 := M.call_closure α0 [ α1 ] in M.alloc α2 in @@ -3182,26 +3358,32 @@ Module Impl_subtle_ConstantTimeEq_for_subtle_CtOption_T. "core::ops::bit::BitOr" (Ty.path "subtle::Choice") [ Ty.path "subtle::Choice" ] + [] "bitor" + [] [] in let* α1 := M.get_trait_method "core::ops::bit::BitAnd" (Ty.path "subtle::Choice") [ Ty.path "subtle::Choice" ] + [] "bitand" + [] [] in let* α2 := M.get_trait_method "core::ops::bit::BitAnd" (Ty.path "subtle::Choice") [ Ty.path "subtle::Choice" ] + [] "bitand" + [] [] in let* α3 := M.read a in let* α4 := M.read b in let* α5 := M.call_closure α2 [ α3; α4 ] in - let* α6 := M.get_trait_method "subtle::ConstantTimeEq" T [] "ct_eq" [] in + let* α6 := M.get_trait_method "subtle::ConstantTimeEq" T [] [] "ct_eq" [] [] in let* α7 := M.read self in let* α8 := M.read rhs in let* α9 := @@ -3217,12 +3399,16 @@ Module Impl_subtle_ConstantTimeEq_for_subtle_CtOption_T. "core::ops::bit::BitAnd" (Ty.path "subtle::Choice") [ Ty.path "subtle::Choice" ] + [] "bitand" + [] [] in - let* α12 := M.get_trait_method "core::ops::bit::Not" (Ty.path "subtle::Choice") [] "not" [] in + let* α12 := + M.get_trait_method "core::ops::bit::Not" (Ty.path "subtle::Choice") [] [] "not" [] [] in let* α13 := M.read a in let* α14 := M.call_closure α12 [ α13 ] in - let* α15 := M.get_trait_method "core::ops::bit::Not" (Ty.path "subtle::Choice") [] "not" [] in + let* α15 := + M.get_trait_method "core::ops::bit::Not" (Ty.path "subtle::Choice") [] [] "not" [] [] in let* α16 := M.read b in let* α17 := M.call_closure α15 [ α16 ] in let* α18 := M.call_closure α11 [ α14; α17 ] in @@ -3279,17 +3465,21 @@ Module Impl_subtle_ConstantTimeGreater_for_u8. let* α0 := M.get_trait_method "core::ops::bit::BitAnd" - (Ty.apply (Ty.path "&") [ Ty.path "u8" ]) + (Ty.apply (Ty.path "&") [ Ty.path "u8" ] []) [ Ty.path "u8" ] + [] "bitand" + [] [] in let* α1 := M.read self in let* α2 := M.get_trait_method "core::ops::bit::Not" - (Ty.apply (Ty.path "&") [ Ty.path "u8" ]) + (Ty.apply (Ty.path "&") [ Ty.path "u8" ] []) + [] [] "not" + [] [] in let* α3 := M.read other in let* α4 := M.call_closure α2 [ α3 ] in @@ -3300,15 +3490,19 @@ Module Impl_subtle_ConstantTimeGreater_for_u8. M.get_trait_method "core::ops::bit::BitAnd" (Ty.path "u8") - [ Ty.apply (Ty.path "&") [ Ty.path "u8" ] ] + [ Ty.apply (Ty.path "&") [ Ty.path "u8" ] [] ] + [] "bitand" + [] [] in let* α1 := M.get_trait_method "core::ops::bit::Not" - (Ty.apply (Ty.path "&") [ Ty.path "u8" ]) + (Ty.apply (Ty.path "&") [ Ty.path "u8" ] []) + [] [] "not" + [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in @@ -3404,7 +3598,9 @@ Module Impl_subtle_ConstantTimeGreater_for_u8. "core::convert::From" (Ty.path "subtle::Choice") [ Ty.path "u8" ] + [] "from" + [] [] in let* α1 := M.read bit in let* α2 := M.alloc (BinOp.Pure.bit_and α1 (Value.Integer Integer.U8 1)) in @@ -3458,17 +3654,21 @@ Module Impl_subtle_ConstantTimeGreater_for_u16. let* α0 := M.get_trait_method "core::ops::bit::BitAnd" - (Ty.apply (Ty.path "&") [ Ty.path "u16" ]) + (Ty.apply (Ty.path "&") [ Ty.path "u16" ] []) [ Ty.path "u16" ] + [] "bitand" + [] [] in let* α1 := M.read self in let* α2 := M.get_trait_method "core::ops::bit::Not" - (Ty.apply (Ty.path "&") [ Ty.path "u16" ]) + (Ty.apply (Ty.path "&") [ Ty.path "u16" ] []) + [] [] "not" + [] [] in let* α3 := M.read other in let* α4 := M.call_closure α2 [ α3 ] in @@ -3479,15 +3679,19 @@ Module Impl_subtle_ConstantTimeGreater_for_u16. M.get_trait_method "core::ops::bit::BitAnd" (Ty.path "u16") - [ Ty.apply (Ty.path "&") [ Ty.path "u16" ] ] + [ Ty.apply (Ty.path "&") [ Ty.path "u16" ] [] ] + [] "bitand" + [] [] in let* α1 := M.get_trait_method "core::ops::bit::Not" - (Ty.apply (Ty.path "&") [ Ty.path "u16" ]) + (Ty.apply (Ty.path "&") [ Ty.path "u16" ] []) + [] [] "not" + [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in @@ -3583,7 +3787,9 @@ Module Impl_subtle_ConstantTimeGreater_for_u16. "core::convert::From" (Ty.path "subtle::Choice") [ Ty.path "u8" ] + [] "from" + [] [] in let* α1 := M.read bit in let* α2 := @@ -3636,17 +3842,21 @@ Module Impl_subtle_ConstantTimeGreater_for_u32. let* α0 := M.get_trait_method "core::ops::bit::BitAnd" - (Ty.apply (Ty.path "&") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "&") [ Ty.path "u32" ] []) [ Ty.path "u32" ] + [] "bitand" + [] [] in let* α1 := M.read self in let* α2 := M.get_trait_method "core::ops::bit::Not" - (Ty.apply (Ty.path "&") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "&") [ Ty.path "u32" ] []) + [] [] "not" + [] [] in let* α3 := M.read other in let* α4 := M.call_closure α2 [ α3 ] in @@ -3657,15 +3867,19 @@ Module Impl_subtle_ConstantTimeGreater_for_u32. M.get_trait_method "core::ops::bit::BitAnd" (Ty.path "u32") - [ Ty.apply (Ty.path "&") [ Ty.path "u32" ] ] + [ Ty.apply (Ty.path "&") [ Ty.path "u32" ] [] ] + [] "bitand" + [] [] in let* α1 := M.get_trait_method "core::ops::bit::Not" - (Ty.apply (Ty.path "&") [ Ty.path "u32" ]) + (Ty.apply (Ty.path "&") [ Ty.path "u32" ] []) + [] [] "not" + [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in @@ -3761,7 +3975,9 @@ Module Impl_subtle_ConstantTimeGreater_for_u32. "core::convert::From" (Ty.path "subtle::Choice") [ Ty.path "u8" ] + [] "from" + [] [] in let* α1 := M.read bit in let* α2 := @@ -3814,17 +4030,21 @@ Module Impl_subtle_ConstantTimeGreater_for_u64. let* α0 := M.get_trait_method "core::ops::bit::BitAnd" - (Ty.apply (Ty.path "&") [ Ty.path "u64" ]) + (Ty.apply (Ty.path "&") [ Ty.path "u64" ] []) [ Ty.path "u64" ] + [] "bitand" + [] [] in let* α1 := M.read self in let* α2 := M.get_trait_method "core::ops::bit::Not" - (Ty.apply (Ty.path "&") [ Ty.path "u64" ]) + (Ty.apply (Ty.path "&") [ Ty.path "u64" ] []) + [] [] "not" + [] [] in let* α3 := M.read other in let* α4 := M.call_closure α2 [ α3 ] in @@ -3835,15 +4055,19 @@ Module Impl_subtle_ConstantTimeGreater_for_u64. M.get_trait_method "core::ops::bit::BitAnd" (Ty.path "u64") - [ Ty.apply (Ty.path "&") [ Ty.path "u64" ] ] + [ Ty.apply (Ty.path "&") [ Ty.path "u64" ] [] ] + [] "bitand" + [] [] in let* α1 := M.get_trait_method "core::ops::bit::Not" - (Ty.apply (Ty.path "&") [ Ty.path "u64" ]) + (Ty.apply (Ty.path "&") [ Ty.path "u64" ] []) + [] [] "not" + [] [] in let* α2 := M.read self in let* α3 := M.call_closure α1 [ α2 ] in @@ -3939,7 +4163,9 @@ Module Impl_subtle_ConstantTimeGreater_for_u64. "core::convert::From" (Ty.path "subtle::Choice") [ Ty.path "u8" ] + [] "from" + [] [] in let* α1 := M.read bit in let* α2 := @@ -3969,16 +4195,20 @@ Module ConstantTimeLess. "core::ops::bit::BitAnd" (Ty.path "subtle::Choice") [ Ty.path "subtle::Choice" ] + [] "bitand" + [] [] in - let* α1 := M.get_trait_method "core::ops::bit::Not" (Ty.path "subtle::Choice") [] "not" [] in - let* α2 := M.get_trait_method "subtle::ConstantTimeGreater" Self [] "ct_gt" [] in + let* α1 := + M.get_trait_method "core::ops::bit::Not" (Ty.path "subtle::Choice") [] [] "not" [] [] in + let* α2 := M.get_trait_method "subtle::ConstantTimeGreater" Self [] [] "ct_gt" [] [] in let* α3 := M.read self in let* α4 := M.read other in let* α5 := M.call_closure α2 [ α3; α4 ] in let* α6 := M.call_closure α1 [ α5 ] in - let* α7 := M.get_trait_method "core::ops::bit::Not" (Ty.path "subtle::Choice") [] "not" [] in - let* α8 := M.get_trait_method "subtle::ConstantTimeEq" Self [] "ct_eq" [] in + let* α7 := + M.get_trait_method "core::ops::bit::Not" (Ty.path "subtle::Choice") [] [] "not" [] [] in + let* α8 := M.get_trait_method "subtle::ConstantTimeEq" Self [] [] "ct_eq" [] [] in let* α9 := M.read self in let* α10 := M.read other in let* α11 := M.call_closure α8 [ α9; α10 ] in diff --git a/lib/src/expression.rs b/lib/src/expression.rs index 7e8612659..072b959ce 100644 --- a/lib/src/expression.rs +++ b/lib/src/expression.rs @@ -80,18 +80,22 @@ pub(crate) enum Expr { GetFunction { func: Path, generic_tys: Vec>, + generic_consts: Vec>, }, GetTraitMethod { trait_name: Path, self_ty: Rc, trait_tys: Vec>, + trait_consts: Vec>, method_name: String, generic_tys: Vec>, + generic_consts: Vec>, }, GetAssociatedFunction { ty: Rc, func: String, generic_tys: Vec>, + generic_consts: Vec>, }, Literal(Rc), Call { @@ -226,6 +230,7 @@ impl Expr { func: Rc::new(Expr::GetFunction { func: Path::new(&["core", "panicking", "panic"]), generic_tys: vec![], + generic_consts: vec![], }), kind: CallKind::Closure, args: vec![Rc::new(Expr::Call { @@ -339,15 +344,19 @@ pub(crate) fn mt_expression(fresh_vars: FreshVars, expr: Rc) -> (Rc, trait_name, self_ty, trait_tys, + trait_consts, method_name, generic_tys, + generic_consts, } => ( Rc::new(Expr::GetTraitMethod { trait_name: trait_name.clone(), self_ty: self_ty.clone(), trait_tys: trait_tys.clone(), + trait_consts: trait_consts.clone(), method_name: method_name.clone(), generic_tys: generic_tys.clone(), + generic_consts: generic_consts.clone(), }), fresh_vars, ), @@ -647,7 +656,7 @@ fn string_pieces_to_coq<'a>(pieces: &[StringPiece]) -> coq::Expression<'a> { } } -fn string_to_coq(message: &str) -> coq::Expression { +fn string_to_coq<'a>(message: &str) -> coq::Expression<'a> { let pieces = cut_string_in_pieces_for_coq(message); coq::Expression::just_name("mk_str").apply(&string_pieces_to_coq(&pieces)) } @@ -662,7 +671,7 @@ impl LoopControlFlow { } impl Literal { - pub(crate) fn to_coq(&self) -> coq::Expression { + pub(crate) fn to_coq<'a>(&self) -> coq::Expression<'a> { match self { Literal::Bool(b) => coq::Expression::just_name("Value.Bool") .apply(&coq::Expression::just_name(b.to_string().as_str())), @@ -685,6 +694,34 @@ impl Literal { Literal::Error => coq::Expression::just_name("UnsupportedLiteral"), } } + + fn char_to_name(c: char) -> String { + if c.is_ascii_alphanumeric() { + format!("{}", c) + } else { + format!("char{}", c as u32) + } + } + + pub(crate) fn to_name(&self) -> String { + match self { + Literal::Bool(b) => format!("{}", b), + Literal::Integer(LiteralInteger { + name: _, + negative_sign, + value, + }) => { + if *negative_sign { + format!("minus_{}", value) + } else { + format!("{}", value) + } + } + Literal::Char(c) => Self::char_to_name(*c), + Literal::String(s) => s.chars().map(Self::char_to_name).collect(), + Literal::Error => "UnsupportedLiteral".to_string(), + } + } } impl Expr { @@ -694,22 +731,33 @@ impl Expr { Expr::LocalVar(ref name) => coq::Expression::just_name(name), Expr::GetConst(path) => coq::Expression::just_name("M.get_constant") .apply(&coq::Expression::String(path.to_string())), - Expr::GetFunction { func, generic_tys } => coq::Expression::just_name("M.get_function") - .apply_many(&[ - coq::Expression::String(func.to_string()), - coq::Expression::List { - exprs: generic_tys - .iter() - .map(|generic_ty| generic_ty.to_coq()) - .collect_vec(), - }, - ]), + Expr::GetFunction { + func, + generic_tys, + generic_consts, + } => coq::Expression::just_name("M.get_function").apply_many(&[ + coq::Expression::String(func.to_string()), + coq::Expression::List { + exprs: generic_tys + .iter() + .map(|generic_ty| generic_ty.to_coq()) + .collect_vec(), + }, + coq::Expression::List { + exprs: generic_consts + .iter() + .map(|generic_const| generic_const.to_coq()) + .collect_vec(), + }, + ]), Expr::GetTraitMethod { trait_name, self_ty, trait_tys, + trait_consts, method_name, generic_tys, + generic_consts, } => coq::Expression::just_name("M.get_trait_method").apply_many(&[ coq::Expression::String(trait_name.to_string()), self_ty.to_coq(), @@ -719,15 +767,31 @@ impl Expr { .map(|trait_ty| trait_ty.to_coq()) .collect_vec(), }, + coq::Expression::List { + exprs: trait_consts + .iter() + .map(|trait_const| trait_const.to_coq()) + .collect_vec(), + }, coq::Expression::String(method_name.to_string()), coq::Expression::List { - exprs: generic_tys.iter().map(|ty| ty.to_coq()).collect_vec(), + exprs: generic_tys + .iter() + .map(|generic_ty| generic_ty.to_coq()) + .collect_vec(), + }, + coq::Expression::List { + exprs: generic_consts + .iter() + .map(|generic_const| generic_const.to_coq()) + .collect_vec(), }, ]), Expr::GetAssociatedFunction { ty, func, generic_tys, + generic_consts, } => coq::Expression::just_name("M.get_associated_function").apply_many(&[ ty.to_coq(), coq::Expression::String(func.to_string()), @@ -737,6 +801,12 @@ impl Expr { .map(|generic_ty| generic_ty.to_coq()) .collect(), }, + coq::Expression::List { + exprs: generic_consts + .iter() + .map(|generic_const| generic_const.to_coq()) + .collect(), + }, ]), Expr::Literal(literal) => literal.to_coq(), Expr::Call { func, args, kind } => match kind { diff --git a/lib/src/thir_expression.rs b/lib/src/thir_expression.rs index 85e7416fd..99989bd02 100644 --- a/lib/src/thir_expression.rs +++ b/lib/src/thir_expression.rs @@ -430,6 +430,59 @@ fn compile_literal_integer( } } +pub(crate) fn compile_const( + env: &Env, + span: &rustc_span::Span, + constant: &rustc_middle::ty::Const, +) -> Rc { + let ty = constant.ty(); + + match &ty.kind() { + rustc_middle::ty::TyKind::Int(int_ty) => { + let uint_value = constant.try_to_scalar().unwrap().assert_int(); + let int_value = uint_value.try_to_int(uint_value.size()).unwrap(); + + return Rc::new(Literal::Integer(LiteralInteger { + name: capitalize(&format!("{int_ty:?}")), + negative_sign: int_value < 0, + // The `unsigned_abs` method is necessary to get the minimal int128's + // absolute value. + value: int_value.unsigned_abs(), + })); + } + rustc_middle::ty::TyKind::Uint(uint_ty) => { + let uint_value = constant.try_to_scalar().unwrap().assert_int(); + + return Rc::new(Literal::Integer(LiteralInteger { + name: capitalize(&format!("{uint_ty:?}")), + negative_sign: false, + value: uint_value.assert_bits(uint_value.size()), + })); + } + rustc_middle::ty::TyKind::Bool => { + let bool_value = constant.try_to_scalar().unwrap().to_bool().unwrap(); + + return Rc::new(Literal::Bool(bool_value)); + } + rustc_middle::ty::TyKind::Char => { + let char_value = constant.try_to_scalar().unwrap().to_char().unwrap(); + + return Rc::new(Literal::Char(char_value)); + } + // TODO: handle the other kinds of constants + _ => {} + } + + emit_warning_with_note( + env, + span, + "This kind of literal is not yet supported.", + Some("We will work on it! 🪄"), + ); + + Rc::new(Literal::Error) +} + pub(crate) fn compile_expr<'a>( env: &Env<'a>, generics: &'a rustc_middle::ty::Generics, @@ -450,15 +503,17 @@ pub(crate) fn compile_expr<'a>( func: Rc::new(CoqType::Path { path: Rc::new(Path::new(&["alloc", "boxed", "Box"])), }), - args: vec![ + tys: vec![ value_ty, Rc::new(CoqType::Path { path: Rc::new(Path::new(&["alloc", "alloc", "Global"])), }), ], + consts: vec![], }), func: "new".to_string(), generic_tys: vec![], + generic_consts: vec![], }), args: vec![value], kind: CallKind::Closure, @@ -934,8 +989,8 @@ pub(crate) fn compile_expr<'a>( env.tcx.type_of(parent).instantiate(env.tcx, generic_args); let ty = compile_type(env, generics, &parent_type); let func = symbol.unwrap().to_string(); - // We remove [nb_parent_generics] elements from the start of [generic_args] - // as these are already inferred from the `Self` type. + // We remove [nb_parent_generics] elements from the start of + // [generic_args] as these are already inferred from the `Self` type. let generic_tys = generic_args .iter() .skip(nb_parent_generics) @@ -946,11 +1001,22 @@ pub(crate) fn compile_expr<'a>( .map(|ty| compile_type(env, generics, ty)) }) .collect(); + let generic_consts = generic_args + .iter() + .skip(nb_parent_generics) + .filter_map(|generic_arg| { + generic_arg + .as_const() + .as_ref() + .map(|constant| compile_const(env, &expr.span, constant)) + }) + .collect(); Rc::new(Expr::GetAssociatedFunction { ty, func, generic_tys, + generic_consts, }) .alloc() } @@ -972,6 +1038,16 @@ pub(crate) fn compile_expr<'a>( [self_ty, trait_tys @ ..] => (self_ty.clone(), trait_tys.to_vec()), _ => panic!("Expected at least one element"), }; + let trait_consts = generic_args + .iter() + .take(nb_parent_generics) + .filter_map(|generic_arg| { + generic_arg + .as_const() + .as_ref() + .map(|constant| compile_const(env, &expr.span, constant)) + }) + .collect::>(); let method_name = symbol.unwrap().to_string(); let generic_tys = generic_args .iter() @@ -983,13 +1059,25 @@ pub(crate) fn compile_expr<'a>( .map(|ty| compile_type(env, generics, ty)) }) .collect::>(); + let generic_consts = generic_args + .iter() + .skip(nb_parent_generics) + .filter_map(|generic_arg| { + generic_arg + .as_const() + .as_ref() + .map(|constant| compile_const(env, &expr.span, constant)) + }) + .collect::>(); Rc::new(Expr::GetTraitMethod { trait_name: parent_path, self_ty, trait_tys, + trait_consts, method_name, generic_tys, + generic_consts, }) .alloc() } @@ -1003,10 +1091,20 @@ pub(crate) fn compile_expr<'a>( .map(|ty| compile_type(env, generics, ty)) }) .collect::>(); + let generic_consts = generic_args + .iter() + .filter_map(|generic_arg| { + generic_arg + .as_const() + .as_ref() + .map(|constant| compile_const(env, &expr.span, constant)) + }) + .collect::>(); Rc::new(Expr::GetFunction { func: compile_def_id(env, *def_id), generic_tys, + generic_consts, }) .alloc() } @@ -1027,6 +1125,7 @@ pub(crate) fn compile_expr<'a>( ty: Rc::new(CoqType::Var("Self".to_string())), func: format!("{}.{}", symbol.unwrap(), parent_symbol), generic_tys: vec![], + generic_consts: vec![], }) .alloc() } @@ -1039,6 +1138,7 @@ pub(crate) fn compile_expr<'a>( Rc::new(Expr::GetFunction { func: Path { segments }, generic_tys: vec![], + generic_consts: vec![], }) .alloc() } diff --git a/lib/src/thir_pattern.rs b/lib/src/thir_pattern.rs index e15792b3e..6d140e2ab 100644 --- a/lib/src/thir_pattern.rs +++ b/lib/src/thir_pattern.rs @@ -1,8 +1,6 @@ use crate::env::*; -use crate::expression::*; use crate::path::*; use crate::pattern::*; -use crate::render::*; use rustc_middle::thir::{Pat, PatKind}; use rustc_type_ir::TyKind; use std::rc::Rc; @@ -99,53 +97,16 @@ pub(crate) fn compile_pattern(env: &Env, pat: &Pat) -> Rc { PatKind::Deref { subpattern } => Rc::new(Pattern::Deref(compile_pattern(env, subpattern))), PatKind::Constant { value } => { if let rustc_middle::mir::Const::Ty(constant) = value { - let ty = constant.ty(); - - match &ty.kind() { - rustc_middle::ty::TyKind::Int(int_ty) => { - let uint_value = constant.try_to_scalar().unwrap().assert_int(); - let int_value = uint_value.try_to_int(uint_value.size()).unwrap(); - - return Rc::new(Pattern::Literal(Rc::new(Literal::Integer( - LiteralInteger { - name: capitalize(&format!("{int_ty:?}")), - negative_sign: int_value < 0, - // The `unsigned_abs` method is necessary to get the minimal int128's - // absolute value. - value: int_value.unsigned_abs(), - }, - )))); - } - rustc_middle::ty::TyKind::Uint(uint_ty) => { - let uint_value = constant.try_to_scalar().unwrap().assert_int(); - - return Rc::new(Pattern::Literal(Rc::new(Literal::Integer( - LiteralInteger { - name: capitalize(&format!("{uint_ty:?}")), - negative_sign: false, - value: uint_value.assert_bits(uint_value.size()), - }, - )))); - } - rustc_middle::ty::TyKind::Bool => { - let bool_value = constant.try_to_scalar().unwrap().to_bool().unwrap(); - - return Rc::new(Pattern::Literal(Rc::new(Literal::Bool(bool_value)))); - } - rustc_middle::ty::TyKind::Char => { - let char_value = constant.try_to_scalar().unwrap().to_char().unwrap(); - - return Rc::new(Pattern::Literal(Rc::new(Literal::Char(char_value)))); - } - // TODO: handle other kinds of constants - _ => {} - } + return Rc::new(Pattern::Literal(crate::thir_expression::compile_const( + env, &pat.span, constant, + ))); } + emit_warning_with_note( env, &pat.span, - "This kind of constant in patterns is not yet supported.", - None, + "This kind of pattern is not yet supported.", + Some("We will work on it! 🐇"), ); Rc::new(Pattern::Wild) diff --git a/lib/src/thir_ty.rs b/lib/src/thir_ty.rs index d783f5b1f..cb1476971 100644 --- a/lib/src/thir_ty.rs +++ b/lib/src/thir_ty.rs @@ -1,5 +1,6 @@ use crate::env::*; use crate::path::*; +use crate::thir_expression::compile_const; use crate::ty::*; use rustc_middle::ty::GenericArgKind; use rustc_span::def_id::DefId; @@ -45,31 +46,46 @@ pub(crate) fn compile_type<'a>( } TyKind::Adt(adt_def, substs) => { let path = compile_def_id(env, adt_def.did()); - let args = substs + let tys = substs .iter() .filter_map(|subst| match &subst.unpack() { GenericArgKind::Type(ty) => Some(compile_type(env, generics, ty)), _ => None, }) .collect(); + let consts = substs + .iter() + .filter_map(|subst| match &subst.unpack() { + GenericArgKind::Const(constant) => Some(crate::thir_expression::compile_const( + env, + &rustc_span::DUMMY_SP, + constant, + )), + _ => None, + }) + .collect(); + Rc::new(CoqType::Application { func: Rc::new(CoqType::Path { path: Rc::new(path), }), - args, + tys, + consts, }) } TyKind::Foreign(def_id) => Rc::new(CoqType::Path { path: Rc::new(compile_def_id(env, *def_id)), }), TyKind::Str => CoqType::path(&["str"]), - TyKind::Array(ty, _) => Rc::new(CoqType::Application { + TyKind::Array(ty, length) => Rc::new(CoqType::Application { func: CoqType::path(&["array"]), - args: vec![compile_type(env, generics, ty)], + tys: vec![compile_type(env, generics, ty)], + consts: vec![compile_const(env, &rustc_span::DUMMY_SP, length)], }), TyKind::Slice(ty) => Rc::new(CoqType::Application { func: CoqType::path(&["slice"]), - args: vec![compile_type(env, generics, ty)], + tys: vec![compile_type(env, generics, ty)], + consts: vec![], }), TyKind::RawPtr(rustc_middle::ty::TypeAndMut { ty, mutbl }) => { let ptr_name = match mutbl { @@ -79,7 +95,8 @@ pub(crate) fn compile_type<'a>( Rc::new(CoqType::Application { func: CoqType::path(&[ptr_name]), - args: vec![compile_type(env, generics, ty)], + tys: vec![compile_type(env, generics, ty)], + consts: vec![], }) } TyKind::Ref(_, ty, mutbl) => CoqType::make_ref(mutbl, compile_type(env, generics, ty)), diff --git a/lib/src/top_level.rs b/lib/src/top_level.rs index 05e378ed5..1d6b7f6b3 100644 --- a/lib/src/top_level.rs +++ b/lib/src/top_level.rs @@ -1122,7 +1122,8 @@ impl DynNameGen { let ct = self.make_dyn_parm(arg); Rc::new(CoqType::Application { func: CoqType::path(&[&name]), - args: vec![ct], + tys: vec![ct], + consts: vec![], }) } else if let CoqType::Dyn(path) = arg.as_ref() { // We suppose `dyn` is only associated with one trait so we can directly extract the first element @@ -1602,32 +1603,34 @@ impl TopLevelItem { path, ty, ty_params, - } => vec![coq::TopLevelItem::Definition(coq::Definition::new( - name, - &coq::DefinitionKind::Axiom { - ty: coq::Expression::PiType { - args: vec![coq::ArgDecl::of_ty_params( - ty_params, - coq::ArgSpecKind::Explicit, - )], - image: Rc::new(coq::Expression::Equality { - lhs: Rc::new( - CoqType::Application { - func: Rc::new(CoqType::Path { - path: Rc::new(path.clone()), - }), - args: ty_params - .iter() - .map(|ty_param| Rc::new(CoqType::Var(ty_param.clone()))) - .collect(), - } - .to_coq(), - ), - rhs: Rc::new(ty.to_coq()), - }), + } => { + let lhs = CoqType::Application { + func: Rc::new(CoqType::Path { + path: Rc::new(path.clone()), + }), + tys: ty_params + .iter() + .map(|ty_param| Rc::new(CoqType::Var(ty_param.clone()))) + .collect(), + consts: vec![], + }; + + vec![coq::TopLevelItem::Definition(coq::Definition::new( + name, + &coq::DefinitionKind::Axiom { + ty: coq::Expression::PiType { + args: vec![coq::ArgDecl::of_ty_params( + ty_params, + coq::ArgSpecKind::Explicit, + )], + image: Rc::new(coq::Expression::Equality { + lhs: Rc::new(lhs.to_coq()), + rhs: Rc::new(ty.to_coq()), + }), + }, }, - }, - ))], + ))] + } TopLevelItem::TypeEnum { name, ty_params, diff --git a/lib/src/ty.rs b/lib/src/ty.rs index d582a049c..b8e9f8fb3 100644 --- a/lib/src/ty.rs +++ b/lib/src/ty.rs @@ -1,5 +1,6 @@ use crate::coq; use crate::env::*; +use crate::expression::*; use crate::path::*; use rustc_hir::{FnDecl, FnRetTy, Ty}; use std::rc::Rc; @@ -12,7 +13,8 @@ pub(crate) enum CoqType { }, Application { func: Rc, - args: Vec>, + tys: Vec>, + consts: Vec>, }, Function { /// We group together the arguments that are called together, as this @@ -50,18 +52,21 @@ impl CoqType { Rc::new(CoqType::Application { func: CoqType::path(&[ptr_name]), - args: vec![ty], + tys: vec![ty], + consts: vec![], }) } pub(crate) fn match_ref(self: Rc) -> Option<(String, Rc)> { - if let CoqType::Application { func, args } = &*self { - if let CoqType::Path { path, .. } = &**func { + if let CoqType::Application { func, tys, consts } = self.as_ref() { + if let CoqType::Path { path, .. } = func.as_ref() { let Path { segments } = path.as_ref(); - if segments.len() == 1 && args.len() == 1 { + + if segments.len() == 1 && tys.len() == 1 && consts.is_empty() { let name = segments.first().unwrap(); + if name == "&" || name == "&mut" { - return Some((name.clone(), args.first().unwrap().clone())); + return Some((name.clone(), tys.first().unwrap().clone())); } } } @@ -137,14 +142,17 @@ impl CoqType { CoqType::Var(name) => coq::Expression::just_name(name), CoqType::Path { path } => coq::Expression::just_name("Ty.path") .apply(&coq::Expression::String(path.to_string())), - CoqType::Application { func, args } => { - if args.is_empty() { + CoqType::Application { func, tys, consts } => { + if tys.is_empty() && consts.is_empty() { func.to_coq() } else { coq::Expression::just_name("Ty.apply").apply_many(&[ func.to_coq(), coq::Expression::List { - exprs: args.iter().map(|arg| arg.to_coq()).collect(), + exprs: tys.iter().map(|ty| ty.to_coq()).collect(), + }, + coq::Expression::List { + exprs: consts.iter().map(|constant| constant.to_coq()).collect(), }, ]) } @@ -186,11 +194,15 @@ impl CoqType { CoqType::Path { path, .. } => { path.to_name().replace('&', "ref_").replace('*', "pointer_") } - CoqType::Application { func, args } => { + CoqType::Application { func, tys, consts } => { let mut name = func.to_name(); - for arg in args { + for ty in tys { name.push('_'); - name.push_str(&arg.to_name()); + name.push_str(&ty.to_name()); + } + for constant in consts { + name.push('_'); + name.push_str(&constant.to_name()); } name }