From f9a646fd4299ec01c6b82183afee179a52243711 Mon Sep 17 00:00:00 2001 From: ssyram Date: Wed, 17 Sep 2025 21:46:37 +0800 Subject: [PATCH 01/10] Better unsized type * fixed ptr metadata fixed PtrMetadata & its obtainment * metadata type & fixation in index to function call * fixed transform_constant_expr * two todo for bug fix * new pass to fix metadata obtainment * fixed syntactic error in test * fixed `translate_ptr_metadata` & doc test bug fixed * fixed build for the merge for `insert_ptr_metadata` & `simplify_constants` * update Hax & ML gen & ML print fix * version updated * fixed `()` as ptr metadata Now the ptr metadata will not introduce new `RawConstantExpr::Adt` Also fixed for `simplify_constants` * tests * fixed get-metadata * debug: no ptr-metadata for non-final field access * pass for resolving sized ptr-metadata inheritance Update insert_ptr_metadata.rs * Update charon/src/bin/charon-driver/translate/translate_trait_objects.rs Co-authored-by: Nadrieril * Update charon/src/bin/charon-driver/translate/translate_types.rs Co-authored-by: Nadrieril * as advised * some change * more on merge * changes as per advice * per advice: from panic to TyErr * bug fix: vtable reference generic error * half fix of subslice operation * fixed subslice ptr-metadata * formatting * version * resolving PtrMetadata for Sized including code revision as advised --------- Co-authored-by: Nadrieril --- charon-ml/src/PrintExpressions.ml | 20 +- charon-ml/src/PrintTypes.ml | 16 +- .../src/generated/Generated_Expressions.ml | 19 +- .../src/generated/Generated_GAstOfJson.ml | 50 +- charon-ml/src/generated/Generated_Types.ml | 34 +- charon/src/ast/expressions.rs | 14 +- charon/src/ast/expressions_utils.rs | 13 +- charon/src/ast/types.rs | 33 +- charon/src/ast/types_utils.rs | 193 ++++ charon/src/ast/visitor.rs | 2 +- .../translate/translate_bodies.rs | 16 +- .../translate/translate_closures.rs | 7 +- .../translate/translate_items.rs | 2 +- .../translate/translate_trait_objects.rs | 3 +- .../translate/translate_types.rs | 63 +- charon/src/name_matcher/mod.rs | 1 + charon/src/pretty/fmt_with_ctx.rs | 29 +- charon/src/transform/ctx.rs | 15 + .../src/transform/index_to_function_calls.rs | 241 ++-- charon/src/transform/insert_ptr_metadata.rs | 287 +++++ charon/src/transform/mod.rs | 7 + charon/src/transform/remove_dynamic_checks.rs | 9 +- .../resolve_sized_ptr_metadata_inherit.rs | 60 + charon/src/transform/simplify_constants.rs | 56 +- charon/tests/cargo/dependencies.out | 49 +- charon/tests/cargo/toml.out | 5 +- charon/tests/cargo/unsafe_.out | 10 +- charon/tests/dynamic-sized-type-info.rs | 12 +- charon/tests/ptr-metadata.json | 26 +- charon/tests/ui/arrays.out | 980 +++++++++++----- charon/tests/ui/arrays_const_generics.out | 13 +- charon/tests/ui/associated-types.out | 5 +- charon/tests/ui/closure-as-fn.out | 10 +- charon/tests/ui/closures.out | 253 +++- charon/tests/ui/closures_with_where.out | 5 +- charon/tests/ui/comments.out | 69 +- charon/tests/ui/constants.out | 9 +- charon/tests/ui/copy_nonoverlapping.out | 10 +- charon/tests/ui/cross_compile_32_bit.out | 5 +- charon/tests/ui/demo.out | 197 +++- .../ui/dictionary_passing_style_woes.out | 10 +- charon/tests/ui/dyn-trait.out | 5 +- .../tests/ui/dyn-with-diamond-supertraits.out | 51 +- charon/tests/ui/external.out | 25 +- charon/tests/ui/gosim-demo.out | 58 +- charon/tests/ui/impl-trait.out | 45 +- .../ui/issue-120-bare-discriminant-read.out | 15 +- charon/tests/ui/issue-297-cfg.out | 146 ++- charon/tests/ui/issue-320-slice-pattern.out | 207 ++-- charon/tests/ui/issue-323-closure-borrow.out | 15 +- charon/tests/ui/issue-378-ctor-as-fn.out | 15 +- .../tests/ui/issue-394-rpit-with-lifetime.out | 5 +- .../tests/ui/issue-4-slice-try-into-array.out | 5 +- charon/tests/ui/issue-4-traits.out | 5 +- charon/tests/ui/issue-45-misc.out | 83 +- .../issue-70-override-provided-method.2.out | 65 +- .../issue-70-override-provided-method.3.out | 30 +- .../ui/issue-70-override-provided-method.out | 30 +- .../tests/ui/issue-72-hash-missing-impl.out | 15 +- .../issue-97-missing-parent-item-clause.out | 5 +- charon/tests/ui/iterator.out | 103 +- charon/tests/ui/loops.out | 122 +- .../tests/ui/method-impl-generalization.out | 45 +- charon/tests/ui/ml-name-matcher-tests.out | 25 +- .../ui/monomorphization/bound_lifetime.out | 15 +- .../tests/ui/monomorphization/closure-fn.out | 55 +- charon/tests/ui/monomorphization/closures.out | 35 +- .../ui/monomorphization/fn_ptr_generics.out | 13 +- .../ui/monomorphization/fndefs-casts.out | 65 +- .../monomorphization/global_with_generics.out | 9 +- .../tests/ui/monomorphization/trait_impls.out | 5 +- .../ui/monomorphization/trait_impls_ullbc.out | 10 +- charon/tests/ui/no_nested_borrows.out | 10 +- charon/tests/ui/opacity.out | 15 +- charon/tests/ui/opaque_attribute.out | 12 +- charon/tests/ui/panics.out | 62 +- charon/tests/ui/plain-panic-str.out | 10 +- charon/tests/ui/polonius_map.out | 57 +- .../ui/predicates-on-late-bound-vars.out | 15 +- charon/tests/ui/projection-index-from-end.out | 24 +- charon/tests/ui/ptr-offset.out | 18 +- charon/tests/ui/raw-boxes.out | 1015 +++++++++++------ ...e-inside-impl-with-bound-with-assoc-ty.out | 10 +- charon/tests/ui/remove-dynamic-checks.out | 64 +- charon/tests/ui/rename_attribute.out | 11 +- charon/tests/ui/result-unwrap.out | 6 +- charon/tests/ui/rvalues.out | 50 +- charon/tests/ui/simple-cmp.out | 15 +- charon/tests/ui/simple/array_index.out | 13 +- .../ui/simple/assoc-type-with-fn-bound.out | 5 +- charon/tests/ui/simple/box-into-inner.out | 5 +- .../simple/call-foreign-defaulted-method.out | 5 +- .../call-method-via-supertrait-bound.out | 5 +- .../ui/simple/closure-capture-ref-by-move.out | 15 +- charon/tests/ui/simple/closure-fn.out | 55 +- charon/tests/ui/simple/closure-fnmut.out | 15 +- .../tests/ui/simple/closure-inside-impl.out | 10 +- .../closure-uses-ambient-self-clause.out | 15 +- charon/tests/ui/simple/closure-with-drops.out | 10 +- charon/tests/ui/simple/const-subslice.out | 20 +- charon/tests/ui/simple/drop-string.out | 5 +- charon/tests/ui/simple/dyn-fn.out | 35 +- .../tests/ui/simple/gat-complex-lifetimes.out | 5 +- charon/tests/ui/simple/gat-implied-clause.out | 10 +- .../tests/ui/simple/generic-cast-to-dyn.out | 10 +- .../tests/ui/simple/lending-iterator-gat.out | 76 +- .../simple/mem-discriminant-from-derive.out | 34 +- charon/tests/ui/simple/multiple-promoteds.out | 48 +- .../ui/simple/nested-closure-trait-ref.out | 15 +- charon/tests/ui/simple/nested-closure.out | 85 +- charon/tests/ui/simple/pointee_metadata.out | 20 +- .../ui/simple/promoted-closure-no-warns.out | 42 +- charon/tests/ui/simple/promoted-closure.out | 42 +- .../ui/simple/promoted-in-generic-fn.out | 20 +- .../tests/ui/simple/promoted-inside-impl.out | 20 +- .../promoted-literal-addition-overflow.out | 31 +- .../ui/simple/promoted-literal-addition.out | 31 +- charon/tests/ui/simple/promoted-u32-slice.out | 27 +- charon/tests/ui/simple/ptr-from-raw-parts.out | 5 +- charon/tests/ui/simple/ptr_to_promoted.out | 27 +- charon/tests/ui/simple/ref-in-const.out | 34 +- charon/tests/ui/simple/slice_increment.out | 33 +- charon/tests/ui/simple/slice_index.out | 13 +- charon/tests/ui/simple/slice_index_range.out | 255 +++-- charon/tests/ui/simple/trait-alias.out | 5 +- charon/tests/ui/simple/vec-push.out | 21 +- charon/tests/ui/skip-borrowck.out | 48 +- charon/tests/ui/slice-index-range.out | 121 +- charon/tests/ui/statics.out | 140 ++- charon/tests/ui/string-literal.out | 25 +- charon/tests/ui/traits.out | 48 +- .../ui/type_inference_is_order_dependent.out | 30 +- charon/tests/ui/ullbc-control-flow.out | 30 +- charon/tests/ui/unsafe.out | 9 +- charon/tests/ui/unsize.out | 30 +- .../ui/unsupported/issue-79-bound-regions.out | 20 +- charon/tests/ui/vtables.out | 295 ++++- 137 files changed, 5631 insertions(+), 1866 deletions(-) create mode 100644 charon/src/transform/insert_ptr_metadata.rs create mode 100644 charon/src/transform/resolve_sized_ptr_metadata_inherit.rs diff --git a/charon-ml/src/PrintExpressions.ml b/charon-ml/src/PrintExpressions.ml index 02706a7c5..101c7d5ee 100644 --- a/charon-ml/src/PrintExpressions.ml +++ b/charon-ml/src/PrintExpressions.ml @@ -145,20 +145,22 @@ and operand_to_string (env : 'a fmt_env) (op : operand) : string = and rvalue_to_string (env : 'a fmt_env) (rv : rvalue) : string = match rv with | Use op -> operand_to_string env op - | RvRef (p, bk) -> begin + | RvRef (p, bk, op) -> begin + let op = operand_to_string env op in let p = place_to_string env p in match bk with - | BShared -> "&" ^ p - | BMut -> "&mut " ^ p - | BTwoPhaseMut -> "&two-phase " ^ p - | BUniqueImmutable -> "&uniq " ^ p - | BShallow -> "&shallow " ^ p + | BShared -> "&(" ^ p ^ ", " ^ op ^ ")" + | BMut -> "&mut (" ^ p ^ ", " ^ op ^ ")" + | BTwoPhaseMut -> "&two-phase (" ^ p ^ ", " ^ op ^ ")" + | BUniqueImmutable -> "&uniq (" ^ p ^ ", " ^ op ^ ")" + | BShallow -> "&shallow (" ^ p ^ ", " ^ op ^ ")" end - | RawPtr (p, pk) -> begin + | RawPtr (p, pk, op) -> begin + let op = operand_to_string env op in let p = place_to_string env p in match pk with - | RShared -> "&raw const " ^ p - | RMut -> "&raw mut " ^ p + | RShared -> "&raw const (" ^ p ^ ", " ^ op ^ ")" + | RMut -> "&raw mut (" ^ p ^ ", " ^ op ^ ")" end | NullaryOp (op, ty) -> nullop_to_string env op ^ "<" ^ ty_to_string env ty ^ ">" diff --git a/charon-ml/src/PrintTypes.ml b/charon-ml/src/PrintTypes.ml index 75be79649..9b08bde5f 100644 --- a/charon-ml/src/PrintTypes.ml +++ b/charon-ml/src/PrintTypes.ml @@ -289,7 +289,17 @@ and ty_to_string (env : 'a fmt_env) (ty : ty) : string = let env = fmt_env_push_regions env f.binder_regions in let fn = fn_ptr_to_string env f.binder_value in fn - | TDynTrait _ -> "dyn (TODO)" + | TDynTrait pred -> + let regions, clauses = + generic_params_to_strings env pred.binder.binder_params + in + let reg_str = + match regions with + | [] -> "" + | r :: _ -> " + " ^ r + in + "dyn (" ^ String.concat " + " clauses ^ reg_str ^ ")" + | TPtrMetadata ty -> "PtrMetadata(" ^ ty_to_string env ty ^ ")" | TError msg -> "type_error (\"" ^ msg ^ "\")" (** Return two lists: @@ -402,14 +412,14 @@ and raw_attribute_to_string (attr : raw_attribute) : string = in attr.path ^ args -let trait_param_to_string (env : 'a fmt_env) (clause : trait_param) : string = +and trait_param_to_string (env : 'a fmt_env) (clause : trait_param) : string = let clause_id = trait_clause_id_to_string env clause.clause_id in let trait = region_binder_to_string trait_decl_ref_to_string env clause.trait in "[" ^ clause_id ^ "]: " ^ trait -let generic_params_to_strings (env : 'a fmt_env) (generics : generic_params) : +and generic_params_to_strings (env : 'a fmt_env) (generics : generic_params) : string list * string list = let ({ regions; types; const_generics; trait_clauses; _ } : generic_params) = generics diff --git a/charon-ml/src/generated/Generated_Expressions.ml b/charon-ml/src/generated/Generated_Expressions.ml index bfe7abdfe..9e7e8322b 100644 --- a/charon-ml/src/generated/Generated_Expressions.ml +++ b/charon-ml/src/generated/Generated_Expressions.ml @@ -270,11 +270,24 @@ and projection_elem = "R" or "Rv", this would avoid collisions *) and rvalue = | Use of operand (** Lifts an operand as an rvalue. *) - | RvRef of place * borrow_kind (** Takes a reference to the given place. *) - | RawPtr of place * ref_kind + | RvRef of place * borrow_kind * operand + (** Takes a reference to the given place. The [Operand] refers to the init + value of the metadata, it is [()] if no metadata + + Fields: + - [place] + - [kind] + - [ptr_metadata] *) + | RawPtr of place * ref_kind * operand (** Takes a raw pointer with the given mutability to the given place. This is generated by pointer casts like [&v as *const _] or raw borrow - expressions like [&raw const v.] *) + expressions like [&raw const v.] Like [Ref], the [Operand] refers to + the init value of the metadata, it is [()] if no metadata. + + Fields: + - [place] + - [kind] + - [ptr_metadata] *) | BinaryOp of binop * operand * operand (** Binary operations (note that we merge "checked" and "unchecked" binops) *) diff --git a/charon-ml/src/generated/Generated_GAstOfJson.ml b/charon-ml/src/generated/Generated_GAstOfJson.ml index c7996ecb5..ae8127a53 100644 --- a/charon-ml/src/generated/Generated_GAstOfJson.ml +++ b/charon-ml/src/generated/Generated_GAstOfJson.ml @@ -1359,8 +1359,11 @@ and ptr_metadata_of_json (ctx : of_json_ctx) (js : json) : | `String "None" -> Ok NoMetadata | `String "Length" -> Ok Length | `Assoc [ ("VTable", v_table) ] -> - let* v_table = v_table_of_json ctx v_table in + let* v_table = type_decl_ref_of_json ctx v_table in Ok (VTable v_table) + | `Assoc [ ("InheritFrom", inherit_from) ] -> + let* inherit_from = ty_of_json ctx inherit_from in + Ok (InheritFrom inherit_from) | _ -> Error "") and raw_attribute_of_json (ctx : of_json_ctx) (js : json) : @@ -1431,14 +1434,30 @@ and rvalue_of_json (ctx : of_json_ctx) (js : json) : (rvalue, string) result = | `Assoc [ ("Use", use) ] -> let* use = operand_of_json ctx use in Ok (Use use) - | `Assoc [ ("Ref", `List [ x_0; x_1 ]) ] -> - let* x_0 = place_of_json ctx x_0 in - let* x_1 = borrow_kind_of_json ctx x_1 in - Ok (RvRef (x_0, x_1)) - | `Assoc [ ("RawPtr", `List [ x_0; x_1 ]) ] -> - let* x_0 = place_of_json ctx x_0 in - let* x_1 = ref_kind_of_json ctx x_1 in - Ok (RawPtr (x_0, x_1)) + | `Assoc + [ + ( "Ref", + `Assoc + [ + ("place", place); ("kind", kind); ("ptr_metadata", ptr_metadata); + ] ); + ] -> + let* place = place_of_json ctx place in + let* kind = borrow_kind_of_json ctx kind in + let* ptr_metadata = operand_of_json ctx ptr_metadata in + Ok (RvRef (place, kind, ptr_metadata)) + | `Assoc + [ + ( "RawPtr", + `Assoc + [ + ("place", place); ("kind", kind); ("ptr_metadata", ptr_metadata); + ] ); + ] -> + let* place = place_of_json ctx place in + let* kind = ref_kind_of_json ctx kind in + let* ptr_metadata = operand_of_json ctx ptr_metadata in + Ok (RawPtr (place, kind, ptr_metadata)) | `Assoc [ ("BinaryOp", `List [ x_0; x_1; x_2 ]) ] -> let* x_0 = binop_of_json ctx x_0 in let* x_1 = operand_of_json ctx x_1 in @@ -1866,6 +1885,9 @@ and ty_of_json (ctx : of_json_ctx) (js : json) : (ty, string) result = | `Assoc [ ("FnDef", fn_def) ] -> let* fn_def = region_binder_of_json fn_ptr_of_json ctx fn_def in Ok (TFnDef fn_def) + | `Assoc [ ("PtrMetadata", ptr_metadata) ] -> + let* ptr_metadata = ty_of_json ctx ptr_metadata in + Ok (TPtrMetadata ptr_metadata) | `Assoc [ ("Error", error) ] -> let* error = string_of_json ctx error in Ok (TError error) @@ -1891,9 +1913,7 @@ and type_decl_of_json (ctx : of_json_ctx) (js : json) : let* src = item_kind_of_json ctx src in let* kind = type_decl_kind_of_json ctx kind in let* layout = option_of_json layout_of_json ctx layout in - let* ptr_metadata = - option_of_json ptr_metadata_of_json ctx ptr_metadata - in + let* ptr_metadata = ptr_metadata_of_json ctx ptr_metadata in Ok ({ def_id; item_meta; generics; src; kind; layout; ptr_metadata } : type_decl) @@ -2009,12 +2029,6 @@ and unsizing_metadata_of_json (ctx : of_json_ctx) (js : json) : | `String "Unknown" -> Ok MetaUnknown | _ -> Error "") -and v_table_of_json (ctx : of_json_ctx) (js : json) : (v_table, string) result = - combine_error_msgs js __FUNCTION__ - (match js with - | `Null -> Ok () - | _ -> Error "") - and variant_of_json (ctx : of_json_ctx) (js : json) : (variant, string) result = combine_error_msgs js __FUNCTION__ (match js with diff --git a/charon-ml/src/generated/Generated_Types.ml b/charon-ml/src/generated/Generated_Types.ml index bc6e70a8e..25a69c25e 100644 --- a/charon-ml/src/generated/Generated_Types.ml +++ b/charon-ml/src/generated/Generated_Types.ml @@ -573,6 +573,9 @@ and ty = given that the type here is polymorpohic in the late-bound variables (those that could appear in a function pointer type like [for<'a> fn(&'a u32)]), we need to bind them here. *) + | TPtrMetadata of ty + (** As a marker of taking out metadata from a given type The internal type + is assumed to be a type variable *) | TError of string (** A type that could not be computed or was incorrect. *) (** Reference to a type declaration or builtin type. *) @@ -841,11 +844,18 @@ and path_elem = and ptr_metadata = | NoMetadata (** Types that need no metadata, namely [T: Sized] types. *) | Length - (** Metadata for [[T]], [str], and user-defined types that directly or - indirectly contain one of these two. *) - | VTable of v_table - (** Metadata for [dyn Trait] and user-defined types that directly or - indirectly contain a [dyn Trait]. *) + (** Metadata for [[T]] and [str], and user-defined types that directly or + indirectly contain one of the two. Of type [usize]. Notably, length + for [[T]] denotes the number of elements in the slice. While for [str] + it denotes the number of bytes in the string. *) + | VTable of type_decl_ref + (** Metadata for [dyn Trait], referring to the vtable struct, also for + user-defined types that directly or indirectly contain a [dyn Trait]. + Of type [&'static vtable] *) + | InheritFrom of ty + (** Unknown due to generics, but will inherit from the given type. This is + consistent with [::Metadata]. Of type + [TyKind::Metadata(Ty)]. *) (** Describes how we represent the active enum variant in memory. *) and tag_encoding = @@ -884,14 +894,8 @@ and type_decl = { (** The layout of the type. Information may be partial because of generics or dynamically- sized types. If rustc cannot compute a layout, it is [None]. *) - ptr_metadata : ptr_metadata option; - (** The metadata associated with a pointer to the type. This is [None] if - we could not compute it because of generics. The information is - *accurate* if it is [Some] while if it is [None], it may still be - theoretically computable but due to some limitation to be fixed, we - are unable to obtain the info. See - [translate_types::{impl ItemTransCtx}::translate_ptr_metadata] for - more details. *) + ptr_metadata : ptr_metadata; + (** The metadata associated with a pointer to the type. *) } and type_decl_kind = @@ -909,10 +913,6 @@ and type_decl_kind = (** Used if an error happened during the extraction, and we don't panic on error. *) -(** A placeholder for the vtable of a trait object. To be implemented in the - future when [dyn Trait] is fully supported. *) -and v_table = unit - and variant = { span : span; attr_info : attr_info; diff --git a/charon/src/ast/expressions.rs b/charon/src/ast/expressions.rs index a2f850118..102e203f0 100644 --- a/charon/src/ast/expressions.rs +++ b/charon/src/ast/expressions.rs @@ -581,11 +581,21 @@ pub enum Rvalue { /// Lifts an operand as an rvalue. Use(Operand), /// Takes a reference to the given place. + /// The `Operand` refers to the init value of the metadata, it is `()` if no metadata #[charon::rename("RvRef")] - Ref(Place, BorrowKind), + Ref { + place: Place, + kind: BorrowKind, + ptr_metadata: Operand, + }, /// Takes a raw pointer with the given mutability to the given place. This is generated by /// pointer casts like `&v as *const _` or raw borrow expressions like `&raw const v.` - RawPtr(Place, RefKind), + /// Like `Ref`, the `Operand` refers to the init value of the metadata, it is `()` if no metadata. + RawPtr { + place: Place, + kind: RefKind, + ptr_metadata: Operand, + }, /// Binary operations (note that we merge "checked" and "unchecked" binops) BinaryOp(BinOp, Operand, Operand), /// Unary operation (e.g. not, neg) diff --git a/charon/src/ast/expressions_utils.rs b/charon/src/ast/expressions_utils.rs index 5965c1ae8..d68969434 100644 --- a/charon/src/ast/expressions_utils.rs +++ b/charon/src/ast/expressions_utils.rs @@ -74,7 +74,7 @@ impl Place { tref.generics.types[0].clone() } Adt(..) | TypeVar(_) | Literal(_) | Never | TraitType(..) | DynTrait(..) - | FnPtr(..) | FnDef(..) | Error(..) => panic!("internal type error"), + | FnPtr(..) | FnDef(..) | PtrMetadata(..) | Error(..) => panic!("internal type error"), }; Place { ty: proj_ty, @@ -92,6 +92,15 @@ impl Place { } } +impl Operand { + pub fn mk_const_unit() -> Self { + Operand::Const(Box::new(ConstantExpr { + kind: ConstantExprKind::Adt(None, Vec::new()), + ty: Ty::mk_unit(), + })) + } +} + impl Rvalue { pub fn unit_value() -> Self { Rvalue::Aggregate( @@ -131,7 +140,7 @@ impl ProjectionElem { tref.generics.types[0].clone() } Adt(..) | TypeVar(_) | Literal(_) | Never | TraitType(..) | DynTrait(..) - | FnPtr(..) | FnDef(..) | Error(..) => { + | FnPtr(..) | FnDef(..) | PtrMetadata(..) | Error(..) => { // Type error return Err(()); } diff --git a/charon/src/ast/types.rs b/charon/src/ast/types.rs index 8dbe5fe48..64c811cef 100644 --- a/charon/src/ast/types.rs +++ b/charon/src/ast/types.rs @@ -381,11 +381,6 @@ pub struct Layout { pub variant_layouts: Vector, } -/// A placeholder for the vtable of a trait object. -/// To be implemented in the future when `dyn Trait` is fully supported. -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Drive, DriveMut)] -pub struct VTable; - /// The metadata stored in a pointer. That's the information stored in pointers alongside /// their address. It's empty for `Sized` types, and interesting for unsized /// aka dynamically-sized types. @@ -394,12 +389,20 @@ pub enum PtrMetadata { /// Types that need no metadata, namely `T: Sized` types. #[charon::rename("NoMetadata")] None, - /// Metadata for `[T]`, `str`, and user-defined types - /// that directly or indirectly contain one of these two. + /// Metadata for `[T]` and `str`, and user-defined types + /// that directly or indirectly contain one of the two. + /// Of type `usize`. + /// Notably, length for `[T]` denotes the number of elements in the slice. + /// While for `str` it denotes the number of bytes in the string. Length, - /// Metadata for `dyn Trait` and user-defined types - /// that directly or indirectly contain a `dyn Trait`. - VTable(VTable), + /// Metadata for `dyn Trait`, referring to the vtable struct, + /// also for user-defined types that directly or indirectly contain a `dyn Trait`. + /// Of type `&'static vtable` + VTable(TypeDeclRef), + /// Unknown due to generics, but will inherit from the given type. + /// This is consistent with `::Metadata`. + /// Of type `TyKind::Metadata(Ty)`. + InheritFrom(Ty), } /// A type declaration. @@ -430,12 +433,7 @@ pub struct TypeDecl { /// sized types. If rustc cannot compute a layout, it is `None`. pub layout: Option, /// The metadata associated with a pointer to the type. - /// This is `None` if we could not compute it because of generics. - /// The information is *accurate* if it is `Some` - /// while if it is `None`, it may still be theoretically computable - /// but due to some limitation to be fixed, we are unable to obtain the info. - /// See `translate_types::{impl ItemTransCtx}::translate_ptr_metadata` for more details. - pub ptr_metadata: Option, + pub ptr_metadata: PtrMetadata, } generate_index_type!(VariantId, "Variant"); @@ -822,6 +820,9 @@ pub enum TyKind { /// variables (those that could appear in a function pointer type like `for<'a> fn(&'a u32)`), /// we need to bind them here. FnDef(RegionBinder), + /// As a marker of taking out metadata from a given type + /// The internal type is assumed to be a type variable + PtrMetadata(Ty), /// A type that could not be computed or was incorrect. #[drive(skip)] Error(String), diff --git a/charon/src/ast/types_utils.rs b/charon/src/ast/types_utils.rs index 8df9a6203..c4453ab2f 100644 --- a/charon/src/ast/types_utils.rs +++ b/charon/src/ast/types_utils.rs @@ -1,6 +1,8 @@ //! This file groups everything which is linked to implementations about [crate::types] use crate::ast::*; +use crate::formatter::IntoFormatter; use crate::ids::Vector; +use crate::pretty::FmtWithCtx; use derive_generic_visitor::*; use itertools::Itertools; use std::collections::HashSet; @@ -640,6 +642,10 @@ impl Ty { Self::mk_tuple(vec![]) } + pub fn mk_usize() -> Ty { + TyKind::Literal(LiteralTy::UInt(UIntTy::Usize)).into() + } + pub fn mk_tuple(tys: Vec) -> Ty { TyKind::Adt(TypeDeclRef { id: TypeId::Tuple, @@ -696,6 +702,71 @@ impl Ty { } } + pub fn get_ptr_metadata(&self, translated: &TranslatedCrate) -> PtrMetadata { + let ref ty_decls = translated.type_decls; + match self.kind() { + TyKind::Adt(ty_ref) => { + // there are two cases: + // 1. if the declared type has a fixed metadata, just returns it + // 2. if it depends on some other types or the generic itself + match ty_ref.id { + TypeId::Adt(type_decl_id) => { + let Some(decl) = ty_decls.get(type_decl_id) else { + return PtrMetadata::InheritFrom(Ty::new(TyKind::Error(format!( + "Internal Error: type decl id not found during getting metadata: {type_decl_id}" + )))); + }; + match &decl.ptr_metadata { + // if it depends on some type, recursion with the binding env + PtrMetadata::InheritFrom(ty) => { + let ty = ty.clone().substitute(&ty_ref.generics); + ty.get_ptr_metadata(translated) + } + // otherwise, simply returns it + meta => meta.clone().substitute(&ty_ref.generics), + } + } + // the metadata of a tuple is simply the last field + TypeId::Tuple => { + match ty_ref.generics.types.iter().last() { + // `None` refers to the unit type `()` + None => PtrMetadata::None, + // Otherwise, simply recurse + Some(ty) => ty.get_ptr_metadata(translated), + } + } + // Box is a pointer like ref & raw ptr, hence no metadata + TypeId::Builtin(BuiltinTy::Box) => PtrMetadata::None, + // Array: `[T; N]` has no metadata + TypeId::Builtin(BuiltinTy::Array) => PtrMetadata::None, + // `[T]` & `str` all have metadata length + TypeId::Builtin(BuiltinTy::Slice) => PtrMetadata::Length, + TypeId::Builtin(BuiltinTy::Str) => PtrMetadata::Length, + } + } + TyKind::DynTrait(pred) => match pred.vtable_ref(translated) { + Some(vtable) => PtrMetadata::VTable(vtable), + None => PtrMetadata::InheritFrom( + TyKind::Error(format!( + "Vtable for dyn trait {} not found", + pred.with_ctx(&translated.into_fmt()) + )) + .into(), + ), + }, + TyKind::TraitType(..) | TyKind::TypeVar(_) => PtrMetadata::InheritFrom(self.clone()), + TyKind::Literal(_) + | TyKind::Never + | TyKind::Ref(..) + | TyKind::RawPtr(..) + | TyKind::FnPtr(..) + | TyKind::FnDef(..) + | TyKind::Error(_) => PtrMetadata::None, + // The metadata itself must be Sized, hence must with `PtrMetadata::None` + TyKind::PtrMetadata(_) => PtrMetadata::None, + } + } + pub fn as_array_or_slice(&self) -> Option<&Ty> { match self.kind() { TyKind::Adt(ty_ref) @@ -785,6 +856,19 @@ impl TraitRef { } } +impl PtrMetadata { + /// Substitute the type in `InheritFrom` with the given generic arguments. + pub fn substitute(&self, args: &GenericArgs) -> Self { + match self { + PtrMetadata::InheritFrom(ty) => PtrMetadata::InheritFrom(ty.clone().substitute(args)), + PtrMetadata::VTable(vtable_ref) => { + PtrMetadata::VTable(vtable_ref.clone().substitute(args)) + } + PtrMetadata::Length | PtrMetadata::None => self.clone(), + } + } +} + impl Field { /// The new name for this field, as suggested by the `#[charon::rename]` attribute. pub fn renamed_name(&self) -> Option<&str> { @@ -819,6 +903,115 @@ impl Variant { } } +impl DynPredicate { + /// Get the vtable declaration reference with current generics applied. + /// Matches associated types from the vtable's generics with the dyn predicates's constraints. + /// + /// Rustc guarantees all associated types are specified in a `dyn Trait` type. + pub fn vtable_ref(&self, translated: &TranslatedCrate) -> Option { + // Get vtable_ref's ID with trait-ref's generics from dyn-self applied. + // Add associated types in correct order following the vtable's generics. + + // 0. Prepare trait name for debug/error messages + let trait_name = self.binder.params.trait_clauses[0] + .trait_ + .skip_binder + .id + .with_ctx(&translated.into_fmt()) + .to_string(); + + // 1. Get vtable ref from trait declaration + // Provides: 1) final return ID, 2) correct order of associated types + // Firstly, get the trait declaration for the vtable ref it stores. + let Some(trait_decl) = translated + .trait_decls + .get(self.binder.params.trait_clauses[0].trait_.skip_binder.id) + else { + return None; + }; + + // Get vtable ref from definition for correct ID. + // Generics in vtable ref are placeholders but provide correct order of the associated types. + let Some(vtable_ref) = &trait_decl.vtable else { + panic!( + "Vtable for trait {} is None, meaning the trait is non-dyn-compatible!", + trait_name + ); + }; + + // 2. Get correct generics for vtable ref from `dyn_self_ty` + // The binder contains all target generics info. + let binder = &self.binder; + + // 3. Prepare "basic part" of generics from trait ref (without associated types) + // The trait ref `dyn Trait<_dyn, Arg1, ..., ArgN>`, no associated types. + // First trait clause is the target one for vtable, guaranteed by `DynPredicate`. + let trait_ref = binder.params.trait_clauses[0].trait_.clone().erase(); + // Type vars (except `_dyn`) are one level deeper, move out after removing `_dyn`. + trace!( + "Getting vtable ref with trait-decl-ref {}.", + trait_ref.with_ctx(&translated.into_fmt()) + ); + let mut generics = trait_ref.generics.clone(); + // Remove the first `_dyn` type argument + generics.types.remove_and_shift_ids(TypeVarId::ZERO); + // Move out of predicate binder for `_dyn` + generics = generics.move_from_under_binder().unwrap(); + + // 4. Prepare associated types part in same order as vtable's generics + // Utilise the vtable ref form: + // `{vtable}` + // + // Use trait ID + assoc name (`Trait::AssocTy`) to uniquely identify + let assoc_tys = vtable_ref + .generics + .types + .iter() + .filter_map(|ty| { + if let TyKind::TraitType(tref, name) = &ty.kind() { + Some((tref.trait_decl_ref.skip_binder.id, name.clone())) + } else { + None + } + }) + .collect_vec(); + + // Find correct type argument from dyn trait's constraints for each assoc type. + // TODO: use proper normalization here instead of doing it by hand + for (trait_id, assoc_name) in assoc_tys { + // Find it + let Some(assoc_ty) = binder.params.trait_type_constraints.iter().find_map(|c| { + let c = c.clone().erase(); + if c.trait_ref.trait_decl_ref.skip_binder.id == trait_id + && c.type_name == assoc_name + { + // Move potentially bounded type out of `_dyn` binder + Some(c.ty.clone().move_from_under_binder().unwrap()) + } else { + None + } + }) else { + let dyn_self_ty = Ty::new(TyKind::DynTrait(self.clone())); + panic!( + "Could not find associated type {}::{} for vtable of trait {} in dyn Trait type: {}", + trait_id.with_ctx(&translated.into_fmt()), + assoc_name, + trait_name, + dyn_self_ty.with_ctx(&translated.into_fmt()) + ); + }; + // Push it + generics.types.push(assoc_ty); + } + + // 5. Return vtable ref's ID with correct generics + Some(TypeDeclRef { + id: vtable_ref.id, + generics, + }) + } +} + impl RefKind { pub fn mutable(x: bool) -> Self { if x { Self::Mut } else { Self::Shared } diff --git a/charon/src/ast/visitor.rs b/charon/src/ast/visitor.rs index 7172ea192..51527f923 100644 --- a/charon/src/ast/visitor.rs +++ b/charon/src/ast/visitor.rs @@ -51,7 +51,7 @@ use indexmap::IndexMap; TranslatedCrate, TypeDeclKind, TypeId, TypeParam, TypeVarId, llbc_ast::StatementId, ullbc_ast::BlockData, ullbc_ast::BlockId, ullbc_ast::ExprBody, ullbc_ast::StatementKind, ullbc_ast::TerminatorKind, ullbc_ast::SwitchTargets, - UnOp, UnsizingMetadata, Local, Variant, VariantId, LocalId, CopyNonOverlapping, Layout, VariantLayout, PtrMetadata, VTable, + UnOp, UnsizingMetadata, Local, Variant, VariantId, LocalId, CopyNonOverlapping, Layout, VariantLayout, PtrMetadata, TraitAssocTy, TraitAssocConst, TraitMethod, TraitAssocTyImpl, for Box, for Option, diff --git a/charon/src/bin/charon-driver/translate/translate_bodies.rs b/charon/src/bin/charon-driver/translate/translate_bodies.rs index 43fbb3b89..de6ebc4b7 100644 --- a/charon/src/bin/charon-driver/translate/translate_bodies.rs +++ b/charon/src/bin/charon-driver/translate/translate_bodies.rs @@ -414,7 +414,13 @@ impl BodyTransCtx<'_, '_, '_> { hax::Rvalue::Ref(_region, borrow_kind, place) => { let place = self.translate_place(span, place)?; let borrow_kind = translate_borrow_kind(*borrow_kind); - Ok(Rvalue::Ref(place, borrow_kind)) + Ok(Rvalue::Ref { + place, + kind: borrow_kind, + // Use `()` as a placeholder now. + // Will be fixed by the cleanup pass `insert_ptr_metadata`. + ptr_metadata: Operand::mk_const_unit(), + }) } hax::Rvalue::RawPtr(mtbl, place) => { let mtbl = match mtbl { @@ -423,7 +429,13 @@ impl BodyTransCtx<'_, '_, '_> { hax::RawPtrKind::FakeForPtrMetadata => RefKind::Shared, }; let place = self.translate_place(span, place)?; - Ok(Rvalue::RawPtr(place, mtbl)) + Ok(Rvalue::RawPtr { + place, + kind: mtbl, + // Use `()` as a placeholder now. + // Will be fixed by the cleanup pass `insert_ptr_metadata`. + ptr_metadata: Operand::mk_const_unit(), + }) } hax::Rvalue::Len(place) => { let place = self.translate_place(span, place)?; diff --git a/charon/src/bin/charon-driver/translate/translate_closures.rs b/charon/src/bin/charon-driver/translate/translate_closures.rs index 37c042268..309a1ac5c 100644 --- a/charon/src/bin/charon-driver/translate/translate_closures.rs +++ b/charon/src/bin/charon-driver/translate/translate_closures.rs @@ -484,7 +484,12 @@ impl ItemTransCtx<'_, '_> { statements.push(mk_stt(StatementKind::Assign( reborrow.clone(), - Rvalue::Ref(deref_state, BorrowKind::Shared), + // the state must be Sized, hence `()` as ptr-metadata + Rvalue::Ref { + place: deref_state, + kind: BorrowKind::Shared, + ptr_metadata: Operand::mk_const_unit(), + }, ))); let start_block = blocks.reserve_slot(); diff --git a/charon/src/bin/charon-driver/translate/translate_items.rs b/charon/src/bin/charon-driver/translate/translate_items.rs index 56b4471a3..106c81349 100644 --- a/charon/src/bin/charon-driver/translate/translate_items.rs +++ b/charon/src/bin/charon-driver/translate/translate_items.rs @@ -344,7 +344,7 @@ impl ItemTransCtx<'_, '_> { Err(err) => TypeDeclKind::Error(err.msg), }; let layout = self.translate_layout(def.this()); - let ptr_metadata = self.translate_ptr_metadata(def.this()); + let ptr_metadata = self.translate_ptr_metadata(span, def.this())?; let type_def = TypeDecl { def_id: trans_id, item_meta, diff --git a/charon/src/bin/charon-driver/translate/translate_trait_objects.rs b/charon/src/bin/charon-driver/translate/translate_trait_objects.rs index 18442aba7..c65183aef 100644 --- a/charon/src/bin/charon-driver/translate/translate_trait_objects.rs +++ b/charon/src/bin/charon-driver/translate/translate_trait_objects.rs @@ -430,7 +430,8 @@ impl ItemTransCtx<'_, '_> { }, kind, layout: Some(layout), - ptr_metadata: None, + // A vtable struct is always sized + ptr_metadata: PtrMetadata::None, }) } } diff --git a/charon/src/bin/charon-driver/translate/translate_types.rs b/charon/src/bin/charon-driver/translate/translate_types.rs index 55709c495..212794102 100644 --- a/charon/src/bin/charon-driver/translate/translate_types.rs +++ b/charon/src/bin/charon-driver/translate/translate_types.rs @@ -361,7 +361,11 @@ impl<'tcx, 'ctx> ItemTransCtx<'tcx, 'ctx> { /// Translate a Dynamically Sized Type metadata kind. /// /// Returns `None` if the type is generic, or if it is not a DST. - pub fn translate_ptr_metadata(&self, item: &hax::ItemRef) -> Option { + pub fn translate_ptr_metadata( + &mut self, + span: Span, + item: &hax::ItemRef, + ) -> Result { // prepare the call to the method use rustc_middle::ty; let tcx = self.t_ctx.tcx; @@ -373,23 +377,46 @@ impl<'tcx, 'ctx> ItemTransCtx<'tcx, 'ctx> { .instantiate(tcx, item.rustc_args(hax_state)); // call the key method - match tcx - .struct_tail_raw( - ty, - |ty| tcx.try_normalize_erasing_regions(ty_env, ty).unwrap_or(ty), - || {}, - ) - .kind() - { - ty::Foreign(..) => Some(PtrMetadata::None), - ty::Str | ty::Slice(..) => Some(PtrMetadata::Length), - ty::Dynamic(..) => Some(PtrMetadata::VTable(VTable)), - // This is NOT accurate -- if there is no generic clause that states `?Sized` - // Then it will be safe to return `Some(PtrMetadata::None)`. - // TODO: inquire the generic clause to get the accurate info. - ty::Placeholder(..) | ty::Infer(..) | ty::Param(..) | ty::Bound(..) => None, - _ => Some(PtrMetadata::None), - } + let raw_ty = tcx.struct_tail_raw( + ty, + |ty| tcx.try_normalize_erasing_regions(ty_env, ty).unwrap_or(ty), + || {}, + ); + let hax_ty: &hax::Ty = &self.t_ctx.catch_sinto(hax_state, span, &raw_ty)?; + + let ret = match raw_ty.kind() { + ty::Foreign(..) => PtrMetadata::None, + ty::Str | ty::Slice(..) => PtrMetadata::Length, + ty::Dynamic(..) => match hax_ty.kind() { + hax::TyKind::Dynamic(_, preds, _) => { + let vtable = self + .translate_region_binder( + span, + &preds.predicates[0].0.kind, + |ctx, kind: &hax::ClauseKind| { + let hax::ClauseKind::Trait(trait_predicate) = kind else { + unreachable!() + }; + Ok(ctx + .translate_vtable_struct_ref(span, &trait_predicate.trait_ref)? + .unwrap()) + }, + )? + .erase(); + PtrMetadata::VTable(vtable) + } + _ => unreachable!("Unexpected hax type {hax_ty:?} for dynamic type: {ty:?}"), + }, + ty::Param(..) => PtrMetadata::InheritFrom(self.translate_ty(span, hax_ty)?), + ty::Placeholder(..) | ty::Infer(..) | ty::Bound(..) => { + panic!( + "We should never encounter a placeholder, infer, or bound type from ptr_metadata translation. Got: {raw_ty:?}" + ) + } + _ => PtrMetadata::None, + }; + + Ok(ret) } /// Translate a type layout. diff --git a/charon/src/name_matcher/mod.rs b/charon/src/name_matcher/mod.rs index f592fd10b..e47888efe 100644 --- a/charon/src/name_matcher/mod.rs +++ b/charon/src/name_matcher/mod.rs @@ -130,6 +130,7 @@ impl Pattern { | TyKind::DynTrait(..) | TyKind::FnPtr(..) | TyKind::FnDef(..) + | TyKind::PtrMetadata(..) | TyKind::Error(..) => false, } } diff --git a/charon/src/pretty/fmt_with_ctx.rs b/charon/src/pretty/fmt_with_ctx.rs index c450a709e..9b377b931 100644 --- a/charon/src/pretty/fmt_with_ctx.rs +++ b/charon/src/pretty/fmt_with_ctx.rs @@ -1199,7 +1199,11 @@ impl FmtWithCtx for Rvalue { fn fmt_with_ctx(&self, ctx: &C, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Rvalue::Use(x) => write!(f, "{}", x.with_ctx(ctx)), - Rvalue::Ref(place, borrow_kind) => { + Rvalue::Ref { + place, + kind: borrow_kind, + ptr_metadata, + } => { let borrow_kind = match borrow_kind { BorrowKind::Shared => "&", BorrowKind::Mut => "&mut ", @@ -1207,14 +1211,28 @@ impl FmtWithCtx for Rvalue { BorrowKind::UniqueImmutable => "&uniq ", BorrowKind::Shallow => "&shallow ", }; - write!(f, "{borrow_kind}{}", place.with_ctx(ctx)) + write!( + f, + "{borrow_kind}({}, {})", + place.with_ctx(ctx), + ptr_metadata.with_ctx(ctx) + ) } - Rvalue::RawPtr(place, mutability) => { + Rvalue::RawPtr { + place, + kind: mutability, + ptr_metadata, + } => { let ptr_kind = match mutability { RefKind::Shared => "&raw const ", RefKind::Mut => "&raw mut ", }; - write!(f, "{ptr_kind}{}", place.with_ctx(ctx)) + write!( + f, + "{ptr_kind}({}, {})", + place.with_ctx(ctx), + ptr_metadata.with_ctx(ctx) + ) } Rvalue::BinaryOp(binop, x, y) => { @@ -1817,6 +1835,9 @@ impl FmtWithCtx for Ty { }; write!(f, "{value}",) } + TyKind::PtrMetadata(ty) => { + write!(f, "PtrMetadata<{}>", ty.with_ctx(ctx)) + } TyKind::Error(msg) => write!(f, "type_error(\"{msg}\")"), } } diff --git a/charon/src/transform/ctx.rs b/charon/src/transform/ctx.rs index 65db1b0b2..a6bdeface 100644 --- a/charon/src/transform/ctx.rs +++ b/charon/src/transform/ctx.rs @@ -237,3 +237,18 @@ impl fmt::Display for TransformCtx { self.translated.fmt(f) } } + +/// A helper trait that captures the usual operation in body transformation. +pub trait BodyTransformCtx { + /// Create a local & return the place pointing to it + fn get_locals_mut(&mut self) -> &mut Locals; + fn insert_storage_live_stmt(&mut self, local: LocalId); + fn insert_storage_dead_stmt(&mut self, local: LocalId); + fn insert_assn_stmt(&mut self, place: Place, rvalue: Rvalue); + fn get_ctx(&self) -> &TransformCtx; + fn fresh_var(&mut self, name: Option, ty: Ty) -> Place { + let var = self.get_locals_mut().new_var(name, ty); + self.insert_storage_live_stmt(var.local_id().unwrap()); + var + } +} diff --git a/charon/src/transform/index_to_function_calls.rs b/charon/src/transform/index_to_function_calls.rs index eb6229ce9..42b9d17d2 100644 --- a/charon/src/transform/index_to_function_calls.rs +++ b/charon/src/transform/index_to_function_calls.rs @@ -1,5 +1,10 @@ //! Desugar array/slice index operations to function calls. + use crate::llbc_ast::*; +use crate::transform::ctx::BodyTransformCtx; +use crate::transform::insert_ptr_metadata::{ + place_ptr_metadata_operand, BodyTransformCtxWithParams, +}; use crate::transform::TransformCtx; use derive_generic_visitor::*; @@ -11,7 +16,7 @@ use super::ctx::LlbcPass; /// We accumulate the new assignments as statements in the visitor, and at the end we insert these /// statements before the one that was just explored. #[derive(Visitor)] -struct IndexVisitor<'a> { +struct IndexVisitor<'a, 'b> { locals: &'a mut Locals, /// Statements to prepend to the statement currently being explored. statements: Vec, @@ -22,18 +27,97 @@ struct IndexVisitor<'a> { place_mutability_stack: Vec, // Span of the statement. span: Span, + ctx: &'b TransformCtx, + params: &'a GenericParams, } -impl<'a> IndexVisitor<'a> { - fn fresh_var(&mut self, name: Option, ty: Ty) -> Place { - let var = self.locals.new_var(name, ty); - let live_kind = StatementKind::StorageLive(var.local_id().unwrap()); - self.statements.push(Statement::new(self.span, live_kind)); - var +impl BodyTransformCtx for IndexVisitor<'_, '_> { + fn get_locals_mut(&mut self) -> &mut Locals { + self.locals + } + + fn insert_storage_live_stmt(&mut self, local: LocalId) { + let statement = StatementKind::StorageLive(local); + self.statements.push(Statement::new(self.span, statement)); + } + + fn insert_assn_stmt(&mut self, place: Place, rvalue: Rvalue) { + let statement = StatementKind::Assign(place, rvalue); + self.statements.push(Statement::new(self.span, statement)); + } + + fn get_ctx(&self) -> &TransformCtx { + self.ctx + } + + fn insert_storage_dead_stmt(&mut self, local: LocalId) { + let statement = StatementKind::StorageDead(local); + self.statements.push(Statement::new(self.span, statement)); } +} +impl BodyTransformCtxWithParams for IndexVisitor<'_, '_> { + fn get_params(&self) -> &GenericParams { + self.params + } +} + +/// When `from_end` is true, we need to compute `len(p) - last_arg` instead of just using `last_arg`. +/// Otherwise, we simply return `last_arg`. +/// New local variables are created as needed. +/// +/// The `last_arg` is either the `offset` for `Index` or the `to` for `Subslice` for the projections. +pub fn compute_to_idx( + ctx: &mut T, + len_place: &Place, + last_arg: Operand, + from_end: bool, +) -> Operand { + if from_end { + // `storage_live(len_var)` + // `len_var = len(p)` + let len_var = ctx.fresh_var(None, Ty::mk_usize()); + ctx.insert_assn_stmt( + len_var.clone(), + Rvalue::Len( + len_place.clone(), + len_place.ty().clone(), + len_place + .ty() + .as_adt() + .unwrap() + .generics + .const_generics + .get(0.into()) + .cloned(), + ), + ); + + // `storage_live(index_var)` + // `index_var = len_var - last_arg` + // `storage_dead(len_var)` + let index_var = ctx.fresh_var(None, Ty::mk_usize()); + ctx.insert_assn_stmt( + index_var.clone(), + Rvalue::BinaryOp( + BinOp::Sub(OverflowMode::UB), + Operand::Copy(len_var.clone()), + last_arg, + ), + ); + ctx.insert_storage_dead_stmt(len_var.local_id().unwrap()); + Operand::Copy(index_var) + } else { + last_arg + } +} + +impl<'a, 'b> IndexVisitor<'a, 'b> { + /// transform `place: subplace[i]` into indexing function calls for `subplace` and `i` fn transform_place(&mut self, mut_access: bool, place: &mut Place) { use ProjectionElem::*; + // This function is naturally called recusively, so `subplace` cannot be another `Index` or `Subslice`. + // Hence, `subplace`, if still projecting, must be either a `Deref` or a `Field`. let Some((subplace, pe @ (Index { .. } | Subslice { .. }))) = place.as_projection() else { return; }; @@ -82,6 +166,9 @@ impl<'a> IndexVisitor<'a> { .into_ty() }; + // do something similar to the `input_var` below, but for the metadata. + let ptr_metadata = place_ptr_metadata_operand(self, subplace); + // Push the statements: // `storage_live(tmp0)` // `tmp0 = &{mut}p` @@ -89,7 +176,11 @@ impl<'a> IndexVisitor<'a> { let input_var = self.fresh_var(None, input_ty); let kind = StatementKind::Assign( input_var.clone(), - Rvalue::Ref(subplace.clone(), BorrowKind::mutable(mut_access)), + Rvalue::Ref { + place: subplace.clone(), + kind: BorrowKind::mutable(mut_access), + ptr_metadata, + }, ); self.statements.push(Statement::new(self.span, kind)); input_var @@ -111,40 +202,8 @@ impl<'a> IndexVisitor<'a> { } => (x.as_ref().clone(), *from_end), _ => unreachable!(), }; - if from_end { - // `storage_live(len_var)` - // `len_var = len(p)` - let usize_ty = TyKind::Literal(LiteralTy::UInt(UIntTy::Usize)).into_ty(); - let len_var = self.fresh_var(None, usize_ty.clone()); - let kind = StatementKind::Assign( - len_var.clone(), - Rvalue::Len( - subplace.clone(), - subplace.ty().clone(), - tref.generics.const_generics.get(0.into()).cloned(), - ), - ); - self.statements.push(Statement::new(self.span, kind)); - - // `storage_live(index_var)` - // `index_var = len_var - last_arg` - // `storage_dead(len_var)` - let index_var = self.fresh_var(None, usize_ty); - let kind = StatementKind::Assign( - index_var.clone(), - Rvalue::BinaryOp( - BinOp::Sub(OverflowMode::UB), - Operand::Copy(len_var.clone()), - last_arg, - ), - ); - self.statements.push(Statement::new(self.span, kind)); - let dead_kind = StatementKind::StorageDead(len_var.local_id().unwrap()); - self.statements.push(Statement::new(self.span, dead_kind)); - args.push(Operand::Copy(index_var)); - } else { - args.push(last_arg); - } + let to_idx = compute_to_idx(self, subplace, last_arg, from_end); + args.push(to_idx); // Call the indexing function: // `storage_live(tmp1)` @@ -182,8 +241,8 @@ impl<'a> IndexVisitor<'a> { } /// The visitor methods. -impl VisitBodyMut for IndexVisitor<'_> { - /// We explore places from the inside-out. +impl VisitBodyMut for IndexVisitor<'_, '_> { + /// We explore places from the inside-out --- recursion naturally happens here. fn exit_place(&mut self, place: &mut Place) { // We have intercepted every traversal that would reach a place and pushed the correct // mutability on the stack. @@ -215,12 +274,21 @@ impl VisitBodyMut for IndexVisitor<'_> { match x { // `UniqueImmutable` de facto gives mutable access and only shows up if there is nested // mutable access. - RawPtr(_, RefKind::Mut) - | Ref(_, BorrowKind::Mut | BorrowKind::TwoPhaseMut | BorrowKind::UniqueImmutable) => { - self.visit_inner_with_mutability(x, true) + RawPtr { + kind: RefKind::Mut, .. + } + | Ref { + kind: BorrowKind::Mut | BorrowKind::TwoPhaseMut | BorrowKind::UniqueImmutable, + .. + } => self.visit_inner_with_mutability(x, true), + RawPtr { + kind: RefKind::Shared, + .. + } + | Ref { + kind: BorrowKind::Shared | BorrowKind::Shallow, + .. } - RawPtr(_, RefKind::Shared) - | Ref(_, BorrowKind::Shared | BorrowKind::Shallow) | Discriminant(..) | Len(..) => self.visit_inner_with_mutability(x, false), @@ -236,6 +304,45 @@ impl VisitBodyMut for IndexVisitor<'_> { pub struct Transform; +impl Transform { + fn transform_body_with_param( + &self, + ctx: &mut TransformCtx, + b: &mut ExprBody, + params: &GenericParams, + ) { + b.body.transform(|st: &mut Statement| { + let mut visitor = IndexVisitor { + locals: &mut b.locals, + statements: Vec::new(), + place_mutability_stack: Vec::new(), + span: st.span, + ctx: &ctx, + params, + }; + use StatementKind::*; + match &mut st.kind { + Assign(..) + | SetDiscriminant(..) + | CopyNonOverlapping(_) + | Drop(..) + | Deinit(..) + | Call(..) => { + let _ = visitor.visit_inner_with_mutability(st, true); + } + Switch(..) => { + let _ = visitor.visit_inner_with_mutability(st, false); + } + Nop | Error(..) | Assert(..) | Abort(..) | StorageDead(..) | StorageLive(..) + | Return | Break(..) | Continue(..) | Loop(..) => { + let _ = st.drive_body_mut(&mut visitor); + } + } + visitor.statements + }); + } +} + /// We do the following. /// /// If `p` is a projection (for instance: `var`, `*var`, `var.f`, etc.), we @@ -295,33 +402,13 @@ pub struct Transform; /// *tmp1 = x /// ``` impl LlbcPass for Transform { - fn transform_body(&self, _ctx: &mut TransformCtx, b: &mut ExprBody) { - b.body.transform(|st: &mut Statement| { - let mut visitor = IndexVisitor { - locals: &mut b.locals, - statements: Vec::new(), - place_mutability_stack: Vec::new(), - span: st.span, - }; - use StatementKind::*; - match &mut st.kind { - Assign(..) - | SetDiscriminant(..) - | CopyNonOverlapping(_) - | Drop(..) - | Deinit(..) - | Call(..) => { - let _ = visitor.visit_inner_with_mutability(st, true); - } - Switch(..) => { - let _ = visitor.visit_inner_with_mutability(st, false); - } - Nop | Error(..) | Assert(..) | Abort(..) | StorageDead(..) | StorageLive(..) - | Return | Break(..) | Continue(..) | Loop(..) => { - let _ = st.drive_body_mut(&mut visitor); - } - } - visitor.statements - }); + fn transform_function(&self, ctx: &mut TransformCtx, decl: &mut FunDecl) { + if let Ok(body) = &mut decl.body { + self.transform_body_with_param( + ctx, + body.as_structured_mut().unwrap(), + &decl.signature.generics, + ) + } } } diff --git a/charon/src/transform/insert_ptr_metadata.rs b/charon/src/transform/insert_ptr_metadata.rs new file mode 100644 index 000000000..ab96b80e7 --- /dev/null +++ b/charon/src/transform/insert_ptr_metadata.rs @@ -0,0 +1,287 @@ +use crate::formatter::IntoFormatter; +use crate::pretty::FmtWithCtx; +use crate::transform::TransformCtx; +use crate::transform::ctx::BodyTransformCtx; +use crate::transform::index_to_function_calls::compute_to_idx; +use crate::{transform::ctx::UllbcPass, ullbc_ast::*}; +use derive_generic_visitor::*; + +#[derive(Visitor)] +struct BodyVisitor<'a, 'b> { + locals: &'a mut Locals, + /// Statements to prepend to the statement currently being explored. + statements: Vec, + span: Span, + ctx: &'b TransformCtx, + params: &'a GenericParams, +} + +fn is_last_field_of_ty_decl_id( + ctx: &TransformCtx, + type_decl_id: &TypeDeclId, + field: &FieldId, +) -> bool { + let type_decl = ctx.translated.type_decls.get(*type_decl_id).unwrap(); + match &type_decl.kind { + TypeDeclKind::Struct(vector) => vector.slot_count() - 1 == field.index(), + // `enum` does not have "last field" concept, also, it should not have metadata as per Rust rules + TypeDeclKind::Enum(..) => false, + // Same as `enum` above + TypeDeclKind::Union(..) => false, + TypeDeclKind::Opaque => panic!( + "Accessing the field {} of an opaque type {}! Cannot tell whether this is the last field. Please consider translating the opaque type definition by `--include`.", + field, + type_decl_id.with_ctx(&ctx.into_fmt()) + ), + TypeDeclKind::Alias(ty) => panic!( + "Alias type {} should have been resolved before this point! Found alias to {}.", + type_decl_id.with_ctx(&ctx.into_fmt()), + ty.with_ctx(&ctx.into_fmt()) + ), + TypeDeclKind::Error(_) => panic!("Accessing the field of an error type!"), + } +} + +fn is_last_field(ctx: &TransformCtx, proj_kind: &FieldProjKind, field: &FieldId) -> bool { + match proj_kind { + FieldProjKind::Adt(type_decl_id, _) => { + is_last_field_of_ty_decl_id(ctx, type_decl_id, field) + } + FieldProjKind::Tuple(arity) => arity - 1 == field.index(), + } +} + +/// Get the outmost deref of a place, if it exists. Returns the place that the deref happens upon and the derefed type. +/// Also check if the projection always performs on the last field, otherwise return None, +/// as it should never have metadata if it is not the last field. +fn outmost_deref_at_last_field( + ctx: &mut T, + place: &Place, +) -> Option<(Rvalue, Ty)> { + let (subplace, proj) = place.as_projection()?; + match proj { + // *subplace + // So that `subplace` is a pointer / reference type + // We will need to keep the derefed type to get the metadata type + ProjectionElem::Deref => Some(( + Rvalue::UnaryOp(UnOp::PtrMetadata, Operand::Copy(subplace.clone())), + place.ty().clone(), + )), + ProjectionElem::Field(proj_kind, field) + if is_last_field(ctx.get_ctx(), proj_kind, field) => + { + outmost_deref_at_last_field(ctx, subplace) + } + // This is not the last field, so it will never have metadata + ProjectionElem::Field(..) => None, + // Indexing for array & slice will only result in sized types, hence no metadata + ProjectionElem::Index { .. } => None, + // Subslice must have metadata length, compute the metadata here as `to` - `from` + ProjectionElem::Subslice { from, to, from_end } => { + let to_idx = compute_to_idx(ctx, subplace, *to.clone(), *from_end); + let diff_place = ctx.fresh_var(None, Ty::mk_usize()); + ctx.insert_assn_stmt( + diff_place.clone(), + // `to` cannot be less than `from` as per Rust rules, so panic + Rvalue::BinaryOp(BinOp::Sub(OverflowMode::UB), to_idx, *from.clone()), + ); + Some((Rvalue::Use(Operand::Copy(diff_place)), place.ty().clone())) + } + } +} + +fn is_sized_type_var(ctx: &mut T, ty: &Ty) -> bool { + match ty.kind() { + TyKind::TypeVar(..) => { + let params = ctx.get_params(); + for clause in ¶ms.trait_clauses { + let tref = clause.trait_.clone().erase(); + // Check if it is `Sized` + if tref.generics.types[0] == *ty + && ctx + .get_ctx() + .translated + .trait_decls + .get(tref.id) + .and_then(|decl| decl.item_meta.lang_item.clone()) + == Some("sized".into()) + { + return true; + } + } + false + } + _ => false, + } +} + +fn get_ptr_metadata_aux( + ctx: &mut T, + place: &Place, +) -> Option { + trace!( + "getting ptr metadata for place: {}", + place.with_ctx(&ctx.get_ctx().into_fmt()) + ); + let (rvalue, deref_ty) = outmost_deref_at_last_field(ctx, place)?; + let ty = match deref_ty.get_ptr_metadata(&ctx.get_ctx().translated) { + PtrMetadata::None => None, + PtrMetadata::Length => Some(Ty::new(TyKind::Literal(LiteralTy::UInt(UIntTy::Usize)))), + PtrMetadata::VTable(type_decl_ref) => Some(Ty::new(TyKind::Ref( + Region::Static, + Ty::new(TyKind::Adt(type_decl_ref)), + RefKind::Shared, + ))), + // If the type var is known to be `Sized`, then no metadata is needed + PtrMetadata::InheritFrom(ty) => { + if is_sized_type_var(ctx, &ty) { + None + } else { + Some(Ty::new(TyKind::PtrMetadata(ty))) + } + } + }?; + trace!( + "computed metadata type: {}", + ty.with_ctx(&ctx.get_ctx().into_fmt()) + ); + let new_place = ctx.fresh_var(None, ty); + // it is `Copy` because `place` is a deref, which means it is a pointer / ref + ctx.insert_assn_stmt(new_place.clone(), rvalue); + Some(Operand::Move(new_place)) +} + +/// No metadata, use unit, but as const ADT (for `()`) is not allowed +/// Introduce a new local to hold this +fn no_metadata(ctx: &mut T) -> Operand { + let new_place = ctx.fresh_var(None, Ty::mk_unit()); + ctx.insert_assn_stmt(new_place.clone(), Rvalue::unit_value()); + Operand::Move(new_place) +} + +/// When a place is to be referred to as a reference or a raw pointer, we compute the metadata required +/// for this operation and return it as an operand. +/// New locals & statements are to be inserted before the target place to keep the metadata. +pub fn place_ptr_metadata_operand( + ctx: &mut T, + place: &Place, +) -> Operand { + // add a shortcut here -- if the type is originally not a type with ptr-metadata, ignore it + match place.ty().get_ptr_metadata(&ctx.get_ctx().translated) { + PtrMetadata::None => return no_metadata(ctx), + _ => match get_ptr_metadata_aux(ctx, place) { + Some(metadata) => metadata, + None => no_metadata(ctx), + }, + } +} + +pub trait BodyTransformCtxWithParams: BodyTransformCtx { + fn get_params(&self) -> &GenericParams; +} + +impl BodyTransformCtxWithParams for BodyVisitor<'_, '_> { + fn get_params(&self) -> &GenericParams { + self.params + } +} + +impl BodyTransformCtx for BodyVisitor<'_, '_> { + fn get_locals_mut(&mut self) -> &mut Locals { + self.locals + } + + fn insert_storage_live_stmt(&mut self, local: LocalId) { + self.statements + .push(Statement::new(self.span, StatementKind::StorageLive(local))); + } + + fn insert_assn_stmt(&mut self, place: Place, rvalue: Rvalue) { + self.statements.push(Statement::new( + self.span, + StatementKind::Assign(place, rvalue), + )); + } + + fn get_ctx(&self) -> &TransformCtx { + self.ctx + } + + fn insert_storage_dead_stmt(&mut self, local: LocalId) { + self.statements + .push(Statement::new(self.span, StatementKind::StorageDead(local))); + } +} + +impl VisitBodyMut for BodyVisitor<'_, '_> { + fn visit_rvalue(&mut self, x: &mut Rvalue) -> ::std::ops::ControlFlow { + match x { + Rvalue::Ref { place, kind, .. } => { + let metadata = place_ptr_metadata_operand(self, &place); + *x = Rvalue::Ref { + place: place.clone(), + kind: *kind, + ptr_metadata: metadata, + }; + } + Rvalue::RawPtr { place, kind, .. } => { + let metadata = place_ptr_metadata_operand(self, &place); + *x = Rvalue::RawPtr { + place: place.clone(), + kind: *kind, + ptr_metadata: metadata, + }; + } + _ => {} + } + Continue(()) + } +} + +pub struct Transform; + +impl Transform { + fn transform_body_with_param( + &self, + ctx: &mut TransformCtx, + b: &mut ExprBody, + params: &GenericParams, + ) { + b.body.iter_mut().for_each(|data| { + data.transform(|st: &mut Statement| { + let mut visitor = BodyVisitor { + locals: &mut b.locals, + statements: Vec::new(), + span: st.span, + ctx: &ctx, + params, + }; + let _ = st.drive_body_mut(&mut visitor); + visitor.statements + }); + }); + } +} + +/// This pass computes the metadata for Rvalue, which is used to create references and raw pointers. +/// E.g., in cases like: +/// ```ignore +/// let x = &[mut] (*some_v).field; +/// ``` +/// If the `(*some_v).field` is a DST, like `[i32]`, we will need to fetch the metadata, i.e., the length of the slice, +/// and store it in a local variable, then we have: +/// ```ignore +/// let x = Rvalue::Ref { place:(*some_v).field, kind: [mut], ptr_metadata: PtrMetadata(some_v) }; +/// ``` +/// There should be a new local variable introduced to store `PtrMetadata(some_v)`. +impl UllbcPass for Transform { + fn transform_function(&self, ctx: &mut TransformCtx, decl: &mut FunDecl) { + if let Ok(body) = &mut decl.body { + self.transform_body_with_param( + ctx, + body.as_unstructured_mut().unwrap(), + &decl.signature.generics, + ) + } + } +} diff --git a/charon/src/transform/mod.rs b/charon/src/transform/mod.rs index 721ec9d97..be808b050 100644 --- a/charon/src/transform/mod.rs +++ b/charon/src/transform/mod.rs @@ -14,6 +14,7 @@ pub mod index_to_function_calls; pub mod inline_local_panic_functions; pub mod inline_promoted_consts; pub mod insert_assign_return_unit; +pub mod insert_ptr_metadata; pub mod insert_storage_lives; pub mod lift_associated_item_clauses; pub mod merge_goto_chains; @@ -32,6 +33,7 @@ pub mod remove_unused_locals; pub mod remove_unused_methods; pub mod remove_unused_self_clause; pub mod reorder_decls; +pub mod resolve_sized_ptr_metadata_inherit; pub mod simplify_constants; pub mod skip_trait_refs_when_known; pub mod ullbc_to_llbc; @@ -70,6 +72,11 @@ pub static INITIAL_CLEANUP_PASSES: &[Pass] = &[ // directly instead of going via a `TraitRef`. This is done before `reorder_decls` to remove // some sources of mutual recursion. UnstructuredBody(&skip_trait_refs_when_known::Transform), + // For the `PtrMetadata::InheritFrom` case in the type definitions + // If the given inherited type var is bounded by `Sized`, we resolve it to `None`. + NonBody(&resolve_sized_ptr_metadata_inherit::Transform), + // Compute the metadata & insert for Rvalue + UnstructuredBody(&insert_ptr_metadata::Transform), // Change trait associated types to be type parameters instead. See the module for details. NonBody(&expand_associated_types::Transform), ]; diff --git a/charon/src/transform/remove_dynamic_checks.rs b/charon/src/transform/remove_dynamic_checks.rs index c379bb41c..138f15acf 100644 --- a/charon/src/transform/remove_dynamic_checks.rs +++ b/charon/src/transform/remove_dynamic_checks.rs @@ -128,7 +128,14 @@ fn remove_dynamic_checks( // assert(move b == true) [ Statement { - kind: StatementKind::Assign(reborrow, Rvalue::RawPtr(_, RefKind::Shared)), + kind: + StatementKind::Assign( + reborrow, + Rvalue::RawPtr { + kind: RefKind::Shared, + .. + }, + ), .. }, Statement { diff --git a/charon/src/transform/resolve_sized_ptr_metadata_inherit.rs b/charon/src/transform/resolve_sized_ptr_metadata_inherit.rs new file mode 100644 index 000000000..16438ff33 --- /dev/null +++ b/charon/src/transform/resolve_sized_ptr_metadata_inherit.rs @@ -0,0 +1,60 @@ +use crate::{ast::*, formatter::IntoFormatter, pretty::FmtWithCtx}; + +use super::{TransformCtx, ctx::TransformPass}; + +pub struct Transform; + +impl TransformPass for Transform { + fn transform_ctx(&self, ctx: &mut TransformCtx) { + let trait_decls = &ctx.translated.trait_decls; + let mut metadata = vec![]; + for type_decl in &ctx.translated.type_decls { + let fmt = &ctx.into_fmt(); + let meta = match &type_decl.ptr_metadata { + PtrMetadata::InheritFrom(ty) => { + match ty.kind() { + TyKind::TypeVar(..) => { + let is_sized = type_decl.generics.trait_clauses.iter().any(|clause| { + let impl_trait = clause.trait_.clone().erase(); + impl_trait.generics.types[0] == *ty && { + let trait_decl = trait_decls.get(impl_trait.id).unwrap(); + matches!(trait_decl.item_meta.lang_item, Some("sized")) + } + }); + if is_sized { + trace!( + "Resolved ptr-metadata for type {}", + type_decl.def_id.with_ctx(fmt) + ); + PtrMetadata::None + } else { + trace!( + "Ptr-metadata for type {} inheriting from {} is not Sized, keep inheritance.", + type_decl.def_id.with_ctx(fmt), + ty.with_ctx(fmt) + ); + // Otherwise, it cannot be resolved + PtrMetadata::InheritFrom(ty.clone()) + } + } + // Will there be other cases? + _ => { + trace!( + "Non-type-var inheritance found for type: {}, inheriting from: {}", + type_decl.def_id.with_ctx(fmt), + ty.with_ctx(fmt) + ); + PtrMetadata::InheritFrom(ty.clone()) + } + } + } + x => x.clone(), + }; + metadata.push(meta); + } + let mut iter = metadata.into_iter(); + for type_decl in &mut ctx.translated.type_decls { + type_decl.ptr_metadata = iter.next().unwrap(); + } + } +} diff --git a/charon/src/transform/simplify_constants.rs b/charon/src/transform/simplify_constants.rs index 2d1851100..28e94ae9a 100644 --- a/charon/src/transform/simplify_constants.rs +++ b/charon/src/transform/simplify_constants.rs @@ -71,10 +71,18 @@ fn transform_constant_expr( } ConstantExprKind::Ref(bval) => { match bval.kind { - ConstantExprKind::Global(global_ref) => Operand::Move(new_var( - Rvalue::Ref(Place::new_global(global_ref, bval.ty), BorrowKind::Shared), - val.ty, - )), + ConstantExprKind::Global(global_ref) => { + let unit_metadata = new_var(Rvalue::unit_value(), Ty::mk_unit()); + Operand::Move(new_var( + // This is a reference to a global constant, which must be Sized, so no metadata + Rvalue::Ref { + place: Place::new_global(global_ref, bval.ty), + kind: BorrowKind::Shared, + ptr_metadata: Operand::Move(unit_metadata), + }, + val.ty, + )) + } _ => { // Recurse on the borrowed value let bval_ty = bval.ty.clone(); @@ -83,8 +91,18 @@ fn transform_constant_expr( // Evaluate the referenced value let bvar = new_var(Rvalue::Use(bval), bval_ty); + let unit_metadata = new_var(Rvalue::unit_value(), Ty::mk_unit()); + // Borrow the value - let ref_var = new_var(Rvalue::Ref(bvar, BorrowKind::Shared), val.ty); + // As the value is originally an argument, it must be Sized + let ref_var = new_var( + Rvalue::Ref { + place: bvar, + kind: BorrowKind::Shared, + ptr_metadata: Operand::Move(unit_metadata), + }, + val.ty, + ); Operand::Move(ref_var) } @@ -92,10 +110,18 @@ fn transform_constant_expr( } ConstantExprKind::Ptr(rk, bval) => { match bval.kind { - ConstantExprKind::Global(global_ref) => Operand::Move(new_var( - Rvalue::RawPtr(Place::new_global(global_ref, bval.ty), rk), - val.ty, - )), + ConstantExprKind::Global(global_ref) => { + let unit_metadata = new_var(Rvalue::unit_value(), Ty::mk_unit()); + Operand::Move(new_var( + // This is a raw pointer to a global constant, which must be Sized, so no metadata + Rvalue::RawPtr { + place: Place::new_global(global_ref, bval.ty), + kind: rk, + ptr_metadata: Operand::Move(unit_metadata), + }, + val.ty, + )) + } _ => { // Recurse on the borrowed value let bval_ty = bval.ty.clone(); @@ -104,8 +130,18 @@ fn transform_constant_expr( // Evaluate the referenced value let bvar = new_var(Rvalue::Use(bval), bval_ty); + let unit_metadata = new_var(Rvalue::unit_value(), Ty::mk_unit()); + // Borrow the value - let ref_var = new_var(Rvalue::RawPtr(bvar, rk), val.ty); + // As the value is originally an argument, it must be Sized, hence no metadata + let ref_var = new_var( + Rvalue::RawPtr { + place: bvar, + kind: rk, + ptr_metadata: Operand::Move(unit_metadata), + }, + val.ty, + ); Operand::Move(ref_var) } diff --git a/charon/tests/cargo/dependencies.out b/charon/tests/cargo/dependencies.out index 71b08e3fe..d95ca15d9 100644 --- a/charon/tests/cargo/dependencies.out +++ b/charon/tests/cargo/dependencies.out @@ -111,10 +111,13 @@ fn silly_incr<'_0>(@1: &'_0 mut (u32)) let @2: (); // anonymous local let @3: &'_ mut (u32); // anonymous local let @4: closure; // anonymous local + let @5: (); // anonymous local storage_live(@2) storage_live(@3) - @3 := &two-phase-mut *(x@1) + storage_live(@5) + @5 := () + @3 := &two-phase-mut (*(x@1), move (@5)) storage_live(@4) @4 := closure { } @2 := take<'_, u32, closure>[Sized, Sized, {impl FnOnce<(u32)> for closure}](move (@3), move (@4)) @@ -151,6 +154,14 @@ fn main() let @19: &'_ (u32); // anonymous local let @20: &'_ (u32); // anonymous local let @21: Option>[Sized>]; // anonymous local + let @22: (); // anonymous local + let @23: (); // anonymous local + let @24: (); // anonymous local + let @25: (); // anonymous local + let @26: (); // anonymous local + let @27: (); // anonymous local + let @28: (); // anonymous local + let @29: (); // anonymous local storage_live(kind@15) storage_live(@16) @@ -159,13 +170,21 @@ fn main() storage_live(@19) storage_live(@20) storage_live(@21) + storage_live(@26) + storage_live(@27) + storage_live(@28) + storage_live(@29) storage_live(x@1) x@1 := const (0 : u32) storage_live(@2) storage_live(@3) storage_live(@4) - @4 := &mut x@1 - @3 := &two-phase-mut *(@4) + storage_live(@23) + @23 := () + @4 := &mut (x@1, move (@23)) + storage_live(@22) + @22 := () + @3 := &two-phase-mut (*(@4), move (@22)) @2 := silly_incr<'_>(move (@3)) storage_dead(@3) storage_dead(@4) @@ -173,11 +192,15 @@ fn main() storage_live(@5) storage_live(@6) storage_live(@7) - @7 := &x@1 + storage_live(@25) + @25 := () + @7 := &(x@1, move (@25)) storage_live(@8) storage_live(@9) @9 := const (1 : u32) - @8 := &@9 + storage_live(@24) + @24 := () + @8 := &(@9, move (@24)) @6 := (move (@7), move (@8)) storage_dead(@8) storage_dead(@7) @@ -202,12 +225,20 @@ fn main() @16 := move (kind@15) storage_live(@17) storage_live(@18) - @18 := &*(left_val@10) - @17 := &*(@18) + storage_live(@29) + @29 := () + @18 := &(*(left_val@10), move (@29)) + storage_live(@28) + @28 := () + @17 := &(*(@18), move (@28)) storage_live(@19) storage_live(@20) - @20 := &*(right_val@11) - @19 := &*(@20) + storage_live(@27) + @27 := () + @20 := &(*(right_val@11), move (@27)) + storage_live(@26) + @26 := () + @19 := &(*(@20), move (@26)) storage_live(@21) @21 := Option::None { } panic(core::panicking::assert_failed) diff --git a/charon/tests/cargo/toml.out b/charon/tests/cargo/toml.out index a04bc3120..48334ad10 100644 --- a/charon/tests/cargo/toml.out +++ b/charon/tests/cargo/toml.out @@ -44,12 +44,15 @@ fn main() let @1: bool; // anonymous local let @2: &'_ (Option[Sized]); // anonymous local let @3: Option[Sized]; // anonymous local + let @4: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) @3 := Option::Some { 0: const (false) } - @2 := &@3 + storage_live(@4) + @4 := () + @2 := &(@3, move (@4)) @1 := is_some<'_, bool>[Sized](move (@2)) storage_dead(@2) storage_dead(@3) diff --git a/charon/tests/cargo/unsafe_.out b/charon/tests/cargo/unsafe_.out index 2251cda76..ca26a937a 100644 --- a/charon/tests/cargo/unsafe_.out +++ b/charon/tests/cargo/unsafe_.out @@ -22,6 +22,8 @@ fn main() let @4: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @5: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @6: Array<&'_ (Str), 1 : usize>; // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local storage_live(@1) storage_live(@2) @@ -30,8 +32,12 @@ fn main() storage_live(@5) storage_live(@6) @6 := [const ("Hello, world!\n")] - @5 := &@6 - @4 := &*(@5) + storage_live(@8) + @8 := () + @5 := &(@6, move (@8)) + storage_live(@7) + @7 := () + @4 := &(*(@5), move (@7)) @3 := new_const<'_, 1 : usize>(move (@4)) storage_dead(@4) @2 := _print<'_>(move (@3)) diff --git a/charon/tests/dynamic-sized-type-info.rs b/charon/tests/dynamic-sized-type-info.rs index 44eb21e4a..c4ae026a3 100644 --- a/charon/tests/dynamic-sized-type-info.rs +++ b/charon/tests/dynamic-sized-type-info.rs @@ -45,6 +45,10 @@ fn ptr_metadata() -> anyhow::Result<()> { x: u32, y: T, } + struct GenericWithUnsize { + x: u32, + y: T + } struct GenericNotLastField { x: u32, y: T, @@ -54,6 +58,10 @@ fn ptr_metadata() -> anyhow::Result<()> { x: u32, y: Box, } + struct GenericBehindIndirectionUnsized { + x: u32, + y: Box, + } // Charon doesn't recognize that we know the metadata in this case. That's ok. struct ThinGeneric { x: u32, @@ -62,12 +70,12 @@ fn ptr_metadata() -> anyhow::Result<()> { "#, &[], )?; - let meta_kinds: IndexMap> = crate_data + let meta_kinds: IndexMap = crate_data .type_decls .iter() .map(|td| { let name = repr_name(&crate_data, &td.item_meta.name); - (name, td.ptr_metadata.as_ref()) + (name, &td.ptr_metadata) }) .collect(); let str = serde_json::to_string_pretty(&meta_kinds)?; diff --git a/charon/tests/ptr-metadata.json b/charon/tests/ptr-metadata.json index 8e1dcc938..e4e326d66 100644 --- a/charon/tests/ptr-metadata.json +++ b/charon/tests/ptr-metadata.json @@ -6,13 +6,31 @@ "test_crate::MoreSliceDst": "Length", "test_crate::Embedded": "Length", "test_crate::DynTrait": { - "VTable": null + "VTable": { + "id": { + "Adt": 13 + }, + "generics": { + "regions": [], + "types": [], + "const_generics": [], + "trait_refs": [] + } + } + }, + "test_crate::GenericInLastField": "None", + "test_crate::GenericWithUnsize": { + "InheritFrom": { + "TypeVar": { + "Free": 0 + } + } }, - "test_crate::GenericInLastField": null, "test_crate::GenericNotLastField": "None", "test_crate::GenericBehindIndirection": "None", - "test_crate::ThinGeneric": null, - "test_crate::Showable::{vtable}": null, + "test_crate::GenericBehindIndirectionUnsized": "None", + "test_crate::ThinGeneric": "None", + "test_crate::Showable::{vtable}": "None", "alloc::alloc::Global": "None", "core::cmp::Ordering": "None", "core::option::Option": "None", diff --git a/charon/tests/ui/arrays.out b/charon/tests/ui/arrays.out index 16b06f3c9..c3b913070 100644 --- a/charon/tests/ui/arrays.out +++ b/charon/tests/ui/arrays.out @@ -297,9 +297,12 @@ where let @0: &'_ (Slice); // return let s@1: &'_ (Array); // arg #1 let @2: &'_ (Array); // anonymous local + let @3: (); // anonymous local storage_live(@2) - @2 := &*(s@1) + storage_live(@3) + @3 := () + @2 := &(*(s@1), move (@3)) @0 := @ArrayToSliceShared<'_, T, 32 : usize>(move (@2)) storage_dead(@2) return @@ -314,13 +317,19 @@ where let s@1: &'_ mut (Array); // arg #1 let @2: &'_ mut (Slice); // anonymous local let @3: &'_ mut (Array); // anonymous local + let @4: usize; // anonymous local + let @5: (); // anonymous local storage_live(@2) storage_live(@3) - @3 := &mut *(s@1) + storage_live(@5) + @5 := () + @3 := &mut (*(s@1), move (@5)) @2 := @ArrayToSliceMut<'_, T, 32 : usize>(move (@3)) storage_dead(@3) - @0 := &mut *(@2) + storage_live(@4) + @4 := ptr_metadata(copy (@2)) + @0 := &mut (*(@2), move (@4)) storage_dead(@2) return } @@ -334,10 +343,13 @@ where let s@1: Array; // arg #1 let @2: &'_ (Slice); // anonymous local let @3: &'_ (Array); // anonymous local + let @4: (); // anonymous local storage_live(@2) storage_live(@3) - @3 := &s@1 + storage_live(@4) + @4 := () + @3 := &(s@1, move (@4)) @2 := @ArrayToSliceShared<'_, T, 32 : usize>(move (@3)) storage_dead(@3) @0 := len<'_, T>[@TraitClause0](move (@2)) @@ -355,10 +367,13 @@ where let s@1: &'_ (Array); // arg #1 let @2: &'_ (Slice); // anonymous local let @3: &'_ (Array); // anonymous local + let @4: (); // anonymous local storage_live(@2) storage_live(@3) - @3 := &*(s@1) + storage_live(@4) + @4 := () + @3 := &(*(s@1), move (@4)) @2 := @ArrayToSliceShared<'_, T, 32 : usize>(move (@3)) storage_dead(@3) @0 := len<'_, T>[@TraitClause0](move (@2)) @@ -374,9 +389,12 @@ where let @0: usize; // return let s@1: &'_ (Slice); // arg #1 let @2: &'_ (Slice); // anonymous local + let @3: usize; // anonymous local storage_live(@2) - @2 := &*(s@1) + storage_live(@3) + @3 := ptr_metadata(copy (s@1)) + @2 := &(*(s@1), move (@3)) @0 := len<'_, T>[@TraitClause0](move (@2)) storage_dead(@2) return @@ -392,18 +410,27 @@ where let i@2: usize; // arg #2 let @3: &'_ (T); // anonymous local let @4: usize; // anonymous local - let @5: &'_ (Array); // anonymous local - let @6: &'_ (T); // anonymous local + let @5: (); // anonymous local + let @6: (); // anonymous local + let @7: (); // anonymous local + let @8: &'_ (Array); // anonymous local + let @9: &'_ (T); // anonymous local storage_live(@3) storage_live(@4) @4 := copy (i@2) - storage_live(@5) - @5 := &*(s@1) storage_live(@6) - @6 := @ArrayIndexShared<'_, T, 32 : usize>(move (@5), copy (@4)) - @3 := &*(@6) - @0 := &*(@3) + @6 := () + storage_live(@7) + @7 := () + storage_live(@8) + @8 := &(*(s@1), move (@7)) + storage_live(@9) + @9 := @ArrayIndexShared<'_, T, 32 : usize>(move (@8), copy (@4)) + @3 := &(*(@9), move (@6)) + storage_live(@5) + @5 := () + @0 := &(*(@3), move (@5)) storage_dead(@4) storage_dead(@3) return @@ -416,16 +443,19 @@ pub fn index_array_u32(@1: Array, @2: usize) -> u32 let s@1: Array; // arg #1 let i@2: usize; // arg #2 let @3: usize; // anonymous local - let @4: &'_ (Array); // anonymous local - let @5: &'_ (u32); // anonymous local + let @4: (); // anonymous local + let @5: &'_ (Array); // anonymous local + let @6: &'_ (u32); // anonymous local storage_live(@3) @3 := copy (i@2) storage_live(@4) - @4 := &s@1 + @4 := () storage_live(@5) - @5 := @ArrayIndexShared<'_, u32, 32 : usize>(move (@4), copy (@3)) - @0 := copy (*(@5)) + @5 := &(s@1, move (@4)) + storage_live(@6) + @6 := @ArrayIndexShared<'_, u32, 32 : usize>(move (@5), copy (@3)) + @0 := copy (*(@6)) storage_dead(@3) return } @@ -436,16 +466,19 @@ pub fn index_array_copy<'_0>(@1: &'_0 (Array)) -> u32 let @0: u32; // return let x@1: &'_ (Array); // arg #1 let @2: usize; // anonymous local - let @3: &'_ (Array); // anonymous local - let @4: &'_ (u32); // anonymous local + let @3: (); // anonymous local + let @4: &'_ (Array); // anonymous local + let @5: &'_ (u32); // anonymous local storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &*(x@1) + @3 := () storage_live(@4) - @4 := @ArrayIndexShared<'_, u32, 32 : usize>(move (@3), copy (@2)) - @0 := copy (*(@4)) + @4 := &(*(x@1), move (@3)) + storage_live(@5) + @5 := @ArrayIndexShared<'_, u32, 32 : usize>(move (@4), copy (@2)) + @0 := copy (*(@5)) storage_dead(@2) return } @@ -461,20 +494,32 @@ where let @3: &'_ mut (T); // anonymous local let @4: &'_ mut (T); // anonymous local let @5: usize; // anonymous local - let @6: &'_ mut (Array); // anonymous local - let @7: &'_ mut (T); // anonymous local + let @6: (); // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local + let @9: (); // anonymous local + let @10: &'_ mut (Array); // anonymous local + let @11: &'_ mut (T); // anonymous local storage_live(@3) storage_live(@4) storage_live(@5) @5 := copy (i@2) - storage_live(@6) - @6 := &mut *(s@1) + storage_live(@8) + @8 := () + storage_live(@9) + @9 := () + storage_live(@10) + @10 := &mut (*(s@1), move (@9)) + storage_live(@11) + @11 := @ArrayIndexMut<'_, T, 32 : usize>(move (@10), copy (@5)) + @4 := &mut (*(@11), move (@8)) storage_live(@7) - @7 := @ArrayIndexMut<'_, T, 32 : usize>(move (@6), copy (@5)) - @4 := &mut *(@7) - @3 := &mut *(@4) - @0 := &mut *(@3) + @7 := () + @3 := &mut (*(@4), move (@7)) + storage_live(@6) + @6 := () + @0 := &mut (*(@3), move (@6)) storage_dead(@5) storage_dead(@4) storage_dead(@3) @@ -491,18 +536,27 @@ where let i@2: usize; // arg #2 let @3: &'_ (T); // anonymous local let @4: usize; // anonymous local - let @5: &'_ (Slice); // anonymous local - let @6: &'_ (T); // anonymous local + let @5: (); // anonymous local + let @6: (); // anonymous local + let @7: usize; // anonymous local + let @8: &'_ (Slice); // anonymous local + let @9: &'_ (T); // anonymous local storage_live(@3) storage_live(@4) @4 := copy (i@2) - storage_live(@5) - @5 := &*(s@1) storage_live(@6) - @6 := @SliceIndexShared<'_, T>(move (@5), copy (@4)) - @3 := &*(@6) - @0 := &*(@3) + @6 := () + storage_live(@7) + @7 := ptr_metadata(copy (s@1)) + storage_live(@8) + @8 := &(*(s@1), move (@7)) + storage_live(@9) + @9 := @SliceIndexShared<'_, T>(move (@8), copy (@4)) + @3 := &(*(@9), move (@6)) + storage_live(@5) + @5 := () + @0 := &(*(@3), move (@5)) storage_dead(@4) storage_dead(@3) return @@ -519,20 +573,35 @@ where let @3: &'_ mut (T); // anonymous local let @4: &'_ mut (T); // anonymous local let @5: usize; // anonymous local - let @6: &'_ mut (Slice); // anonymous local - let @7: &'_ mut (T); // anonymous local + let @6: usize; // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local + let @9: (); // anonymous local + let @10: usize; // anonymous local + let @11: &'_ mut (Slice); // anonymous local + let @12: &'_ mut (T); // anonymous local storage_live(@3) storage_live(@4) storage_live(@5) @5 := copy (i@2) storage_live(@6) - @6 := &mut *(s@1) + @6 := ptr_metadata(copy (s@1)) + storage_live(@9) + @9 := () + storage_live(@10) + @10 := ptr_metadata(copy (s@1)) + storage_live(@11) + @11 := &mut (*(s@1), move (@10)) + storage_live(@12) + @12 := @SliceIndexMut<'_, T>(move (@11), copy (@5)) + @4 := &mut (*(@12), move (@9)) + storage_live(@8) + @8 := () + @3 := &mut (*(@4), move (@8)) storage_live(@7) - @7 := @SliceIndexMut<'_, T>(move (@6), copy (@5)) - @4 := &mut *(@7) - @3 := &mut *(@4) - @0 := &mut *(@3) + @7 := () + @0 := &mut (*(@3), move (@7)) storage_dead(@5) storage_dead(@4) storage_dead(@3) @@ -552,11 +621,16 @@ pub fn slice_subslice_shared_<'_0>(@1: &'_0 (Slice), @2: usize, @3: usize) let @7: Range[Sized]; // anonymous local let @8: usize; // anonymous local let @9: usize; // anonymous local + let @10: usize; // anonymous local + let @11: usize; // anonymous local + let @12: usize; // anonymous local storage_live(@4) storage_live(@5) storage_live(@6) - @6 := &*(x@1) + storage_live(@10) + @10 := ptr_metadata(copy (x@1)) + @6 := &(*(x@1), move (@10)) storage_live(@7) storage_live(@8) @8 := copy (y@2) @@ -568,8 +642,12 @@ pub fn slice_subslice_shared_<'_0>(@1: &'_0 (Slice), @2: usize, @3: usize) @5 := {impl Index for Slice}::index<'_, u32, Range[Sized], Slice>[Sized, Sized[Sized]>, {impl SliceIndex, Slice> for Range[Sized]}[Sized]](move (@6), move (@7)) storage_dead(@7) storage_dead(@6) - @4 := &*(@5) - @0 := &*(@4) + storage_live(@12) + @12 := ptr_metadata(copy (@5)) + @4 := &(*(@5), move (@12)) + storage_live(@11) + @11 := ptr_metadata(copy (@4)) + @0 := &(*(@4), move (@11)) storage_dead(@5) storage_dead(@4) return @@ -589,12 +667,18 @@ pub fn slice_subslice_mut_<'_0>(@1: &'_0 mut (Slice), @2: usize, @3: usize) let @8: Range[Sized]; // anonymous local let @9: usize; // anonymous local let @10: usize; // anonymous local + let @11: usize; // anonymous local + let @12: usize; // anonymous local + let @13: usize; // anonymous local + let @14: usize; // anonymous local storage_live(@4) storage_live(@5) storage_live(@6) storage_live(@7) - @7 := &mut *(x@1) + storage_live(@11) + @11 := ptr_metadata(copy (x@1)) + @7 := &mut (*(x@1), move (@11)) storage_live(@8) storage_live(@9) @9 := copy (y@2) @@ -606,9 +690,15 @@ pub fn slice_subslice_mut_<'_0>(@1: &'_0 mut (Slice), @2: usize, @3: usize) @6 := {impl IndexMut for Slice}::index_mut<'_, u32, Range[Sized], Slice>[Sized, Sized[Sized]>, {impl SliceIndex, Slice> for Range[Sized]}[Sized]](move (@7), move (@8)) storage_dead(@8) storage_dead(@7) - @5 := &mut *(@6) - @4 := &mut *(@5) - @0 := &mut *(@4) + storage_live(@14) + @14 := ptr_metadata(copy (@6)) + @5 := &mut (*(@6), move (@14)) + storage_live(@13) + @13 := ptr_metadata(copy (@5)) + @4 := &mut (*(@5), move (@13)) + storage_live(@12) + @12 := ptr_metadata(copy (@4)) + @0 := &mut (*(@4), move (@12)) storage_dead(@6) storage_dead(@5) storage_dead(@4) @@ -621,9 +711,12 @@ pub fn array_to_slice_shared_<'_0>(@1: &'_0 (Array)) -> &'_0 (S let @0: &'_ (Slice); // return let x@1: &'_ (Array); // arg #1 let @2: &'_ (Array); // anonymous local + let @3: (); // anonymous local storage_live(@2) - @2 := &*(x@1) + storage_live(@3) + @3 := () + @2 := &(*(x@1), move (@3)) @0 := @ArrayToSliceShared<'_, u32, 32 : usize>(move (@2)) storage_dead(@2) return @@ -636,13 +729,19 @@ pub fn array_to_slice_mut_<'_0>(@1: &'_0 mut (Array)) -> &'_0 m let x@1: &'_ mut (Array); // arg #1 let @2: &'_ mut (Slice); // anonymous local let @3: &'_ mut (Array); // anonymous local + let @4: usize; // anonymous local + let @5: (); // anonymous local storage_live(@2) storage_live(@3) - @3 := &mut *(x@1) + storage_live(@5) + @5 := () + @3 := &mut (*(x@1), move (@5)) @2 := @ArrayToSliceMut<'_, u32, 32 : usize>(move (@3)) storage_dead(@3) - @0 := &mut *(@2) + storage_live(@4) + @4 := ptr_metadata(copy (@2)) + @0 := &mut (*(@2), move (@4)) storage_dead(@2) return } @@ -660,11 +759,16 @@ pub fn array_subslice_shared_<'_0>(@1: &'_0 (Array), @2: usize, let @7: Range[Sized]; // anonymous local let @8: usize; // anonymous local let @9: usize; // anonymous local + let @10: (); // anonymous local + let @11: usize; // anonymous local + let @12: usize; // anonymous local storage_live(@4) storage_live(@5) storage_live(@6) - @6 := &*(x@1) + storage_live(@10) + @10 := () + @6 := &(*(x@1), move (@10)) storage_live(@7) storage_live(@8) @8 := copy (y@2) @@ -676,8 +780,12 @@ pub fn array_subslice_shared_<'_0>(@1: &'_0 (Array), @2: usize, @5 := {impl Index for Array}::index<'_, u32, Range[Sized], Slice, 32 : usize>[Sized, Sized[Sized]>, {impl Index for Slice}[Sized], Slice>[Sized, Sized[Sized]>, {impl SliceIndex, Slice> for Range[Sized]}[Sized]]](move (@6), move (@7)) storage_dead(@7) storage_dead(@6) - @4 := &*(@5) - @0 := &*(@4) + storage_live(@12) + @12 := ptr_metadata(copy (@5)) + @4 := &(*(@5), move (@12)) + storage_live(@11) + @11 := ptr_metadata(copy (@4)) + @0 := &(*(@4), move (@11)) storage_dead(@5) storage_dead(@4) return @@ -697,12 +805,18 @@ pub fn array_subslice_mut_<'_0>(@1: &'_0 mut (Array), @2: usize let @8: Range[Sized]; // anonymous local let @9: usize; // anonymous local let @10: usize; // anonymous local + let @11: (); // anonymous local + let @12: usize; // anonymous local + let @13: usize; // anonymous local + let @14: usize; // anonymous local storage_live(@4) storage_live(@5) storage_live(@6) storage_live(@7) - @7 := &mut *(x@1) + storage_live(@11) + @11 := () + @7 := &mut (*(x@1), move (@11)) storage_live(@8) storage_live(@9) @9 := copy (y@2) @@ -714,9 +828,15 @@ pub fn array_subslice_mut_<'_0>(@1: &'_0 mut (Array), @2: usize @6 := {impl IndexMut for Array}::index_mut<'_, u32, Range[Sized], Slice, 32 : usize>[Sized, Sized[Sized]>, {impl IndexMut for Slice}[Sized], Slice>[Sized, Sized[Sized]>, {impl SliceIndex, Slice> for Range[Sized]}[Sized]]](move (@7), move (@8)) storage_dead(@8) storage_dead(@7) - @5 := &mut *(@6) - @4 := &mut *(@5) - @0 := &mut *(@4) + storage_live(@14) + @14 := ptr_metadata(copy (@6)) + @5 := &mut (*(@6), move (@14)) + storage_live(@13) + @13 := ptr_metadata(copy (@5)) + @4 := &mut (*(@5), move (@13)) + storage_live(@12) + @12 := ptr_metadata(copy (@4)) + @0 := &mut (*(@4), move (@12)) storage_dead(@6) storage_dead(@5) storage_dead(@4) @@ -732,18 +852,27 @@ where let s@1: &'_ (Slice); // arg #1 let @2: &'_ (T); // anonymous local let @3: usize; // anonymous local - let @4: &'_ (Slice); // anonymous local - let @5: &'_ (T); // anonymous local + let @4: (); // anonymous local + let @5: (); // anonymous local + let @6: usize; // anonymous local + let @7: &'_ (Slice); // anonymous local + let @8: &'_ (T); // anonymous local storage_live(@2) storage_live(@3) @3 := const (0 : usize) - storage_live(@4) - @4 := &*(s@1) storage_live(@5) - @5 := @SliceIndexShared<'_, T>(move (@4), copy (@3)) - @2 := &*(@5) - @0 := &*(@2) + @5 := () + storage_live(@6) + @6 := ptr_metadata(copy (s@1)) + storage_live(@7) + @7 := &(*(s@1), move (@6)) + storage_live(@8) + @8 := @SliceIndexShared<'_, T>(move (@7), copy (@3)) + @2 := &(*(@8), move (@5)) + storage_live(@4) + @4 := () + @0 := &(*(@2), move (@4)) storage_dead(@3) storage_dead(@2) return @@ -758,18 +887,27 @@ where let s@1: &'_ (Array); // arg #1 let @2: &'_ (T); // anonymous local let @3: usize; // anonymous local - let @4: &'_ (Array); // anonymous local - let @5: &'_ (T); // anonymous local + let @4: (); // anonymous local + let @5: (); // anonymous local + let @6: (); // anonymous local + let @7: &'_ (Array); // anonymous local + let @8: &'_ (T); // anonymous local storage_live(@2) storage_live(@3) @3 := const (0 : usize) - storage_live(@4) - @4 := &*(s@1) storage_live(@5) - @5 := @ArrayIndexShared<'_, T, 32 : usize>(move (@4), copy (@3)) - @2 := &*(@5) - @0 := &*(@2) + @5 := () + storage_live(@6) + @6 := () + storage_live(@7) + @7 := &(*(s@1), move (@6)) + storage_live(@8) + @8 := @ArrayIndexShared<'_, T, 32 : usize>(move (@7), copy (@3)) + @2 := &(*(@8), move (@5)) + storage_live(@4) + @4 := () + @0 := &(*(@2), move (@4)) storage_dead(@3) storage_dead(@2) return @@ -784,24 +922,30 @@ pub fn index_index_array(@1: Array, 32 : usize>, @2: usiz let j@3: usize; // arg #3 let @4: usize; // anonymous local let @5: usize; // anonymous local - let @6: &'_ (Array, 32 : usize>); // anonymous local - let @7: &'_ (Array); // anonymous local + let @6: (); // anonymous local + let @7: &'_ (Array, 32 : usize>); // anonymous local let @8: &'_ (Array); // anonymous local - let @9: &'_ (u32); // anonymous local + let @9: (); // anonymous local + let @10: &'_ (Array); // anonymous local + let @11: &'_ (u32); // anonymous local storage_live(@4) @4 := copy (i@2) storage_live(@5) @5 := copy (j@3) storage_live(@6) - @6 := &s@1 + @6 := () storage_live(@7) - @7 := @ArrayIndexShared<'_, Array, 32 : usize>(move (@6), copy (@4)) + @7 := &(s@1, move (@6)) storage_live(@8) - @8 := &*(@7) + @8 := @ArrayIndexShared<'_, Array, 32 : usize>(move (@7), copy (@4)) storage_live(@9) - @9 := @ArrayIndexShared<'_, u32, 32 : usize>(move (@8), copy (@5)) - @0 := copy (*(@9)) + @9 := () + storage_live(@10) + @10 := &(*(@8), move (@9)) + storage_live(@11) + @11 := @ArrayIndexShared<'_, u32, 32 : usize>(move (@10), copy (@5)) + @0 := copy (*(@11)) storage_dead(@5) storage_dead(@4) return @@ -816,24 +960,30 @@ pub fn update_update_array(@1: Array, 32 : usize>, @2: us let j@3: usize; // arg #3 let @4: usize; // anonymous local let @5: usize; // anonymous local - let @6: &'_ mut (Array, 32 : usize>); // anonymous local - let @7: &'_ mut (Array); // anonymous local + let @6: (); // anonymous local + let @7: &'_ mut (Array, 32 : usize>); // anonymous local let @8: &'_ mut (Array); // anonymous local - let @9: &'_ mut (u32); // anonymous local + let @9: (); // anonymous local + let @10: &'_ mut (Array); // anonymous local + let @11: &'_ mut (u32); // anonymous local storage_live(@4) @4 := copy (i@2) storage_live(@5) @5 := copy (j@3) storage_live(@6) - @6 := &mut s@1 + @6 := () storage_live(@7) - @7 := @ArrayIndexMut<'_, Array, 32 : usize>(move (@6), copy (@4)) + @7 := &mut (s@1, move (@6)) storage_live(@8) - @8 := &mut *(@7) + @8 := @ArrayIndexMut<'_, Array, 32 : usize>(move (@7), copy (@4)) storage_live(@9) - @9 := @ArrayIndexMut<'_, u32, 32 : usize>(move (@8), copy (@5)) - *(@9) := const (0 : u32) + @9 := () + storage_live(@10) + @10 := &mut (*(@8), move (@9)) + storage_live(@11) + @11 := @ArrayIndexMut<'_, u32, 32 : usize>(move (@10), copy (@5)) + *(@11) := const (0 : u32) storage_dead(@5) storage_dead(@4) @0 := () @@ -848,24 +998,30 @@ pub fn incr_array_self<'_0>(@1: &'_0 mut (Array)) let s@1: &'_ mut (Array); // arg #1 let @2: usize; // anonymous local let @3: u32; // anonymous local - let @4: &'_ mut (Array); // anonymous local - let @5: &'_ mut (u32); // anonymous local - let @6: &'_ (Array); // anonymous local - let @7: &'_ (u32); // anonymous local + let @4: (); // anonymous local + let @5: &'_ mut (Array); // anonymous local + let @6: &'_ mut (u32); // anonymous local + let @7: (); // anonymous local + let @8: &'_ (Array); // anonymous local + let @9: &'_ (u32); // anonymous local storage_live(@3) storage_live(@2) @2 := const (0 : usize) - storage_live(@6) - @6 := &*(s@1) storage_live(@7) - @7 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@6), copy (@2)) - @3 := copy (*(@7)) panic.+ const (1 : u32) + @7 := () + storage_live(@8) + @8 := &(*(s@1), move (@7)) + storage_live(@9) + @9 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@8), copy (@2)) + @3 := copy (*(@9)) panic.+ const (1 : u32) storage_live(@4) - @4 := &mut *(s@1) + @4 := () storage_live(@5) - @5 := @ArrayIndexMut<'_, u32, 2 : usize>(move (@4), copy (@2)) - *(@5) := move (@3) + @5 := &mut (*(s@1), move (@4)) + storage_live(@6) + @6 := @ArrayIndexMut<'_, u32, 2 : usize>(move (@5), copy (@2)) + *(@6) := move (@3) storage_dead(@2) @0 := () @0 := () @@ -879,24 +1035,33 @@ pub fn incr_slice_self<'_0>(@1: &'_0 mut (Slice)) let s@1: &'_ mut (Slice); // arg #1 let @2: usize; // anonymous local let @3: u32; // anonymous local - let @4: &'_ mut (Slice); // anonymous local - let @5: &'_ mut (u32); // anonymous local - let @6: &'_ (Slice); // anonymous local - let @7: &'_ (u32); // anonymous local + let @4: usize; // anonymous local + let @5: usize; // anonymous local + let @6: &'_ mut (Slice); // anonymous local + let @7: &'_ mut (u32); // anonymous local + let @8: usize; // anonymous local + let @9: &'_ (Slice); // anonymous local + let @10: &'_ (u32); // anonymous local storage_live(@3) storage_live(@2) @2 := const (0 : usize) - storage_live(@6) - @6 := &*(s@1) - storage_live(@7) - @7 := @SliceIndexShared<'_, u32>(move (@6), copy (@2)) - @3 := copy (*(@7)) panic.+ const (1 : u32) storage_live(@4) - @4 := &mut *(s@1) + @4 := ptr_metadata(copy (s@1)) + storage_live(@8) + @8 := ptr_metadata(copy (s@1)) + storage_live(@9) + @9 := &(*(s@1), move (@8)) + storage_live(@10) + @10 := @SliceIndexShared<'_, u32>(move (@9), copy (@2)) + @3 := copy (*(@10)) panic.+ const (1 : u32) storage_live(@5) - @5 := @SliceIndexMut<'_, u32>(move (@4), copy (@2)) - *(@5) := move (@3) + @5 := ptr_metadata(copy (s@1)) + storage_live(@6) + @6 := &mut (*(s@1), move (@5)) + storage_live(@7) + @7 := @SliceIndexMut<'_, u32>(move (@6), copy (@2)) + *(@7) := move (@3) storage_dead(@2) @0 := () @0 := () @@ -979,14 +1144,20 @@ pub fn const_slice() let @2: &'_ (Array); // anonymous local let @3: &'_ (Array); // anonymous local let @4: Array; // anonymous local + let @5: (); // anonymous local + let @6: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := @ArrayRepeat<'_, u32, 2 : usize>(const (0 : u32)) - @3 := &@4 - @2 := &*(@3) + storage_live(@6) + @6 := () + @3 := &(@4, move (@6)) + storage_live(@5) + @5 := () + @2 := &(*(@3), move (@5)) @1 := @ArrayToSliceShared<'_, u32, 2 : usize>(move (@2)) storage_dead(@2) storage_dead(@3) @@ -1017,6 +1188,12 @@ pub fn take_all() let @14: &'_ mut (Slice); // anonymous local let @15: &'_ mut (Array); // anonymous local let @16: &'_ mut (Array); // anonymous local + let @17: (); // anonymous local + let @18: (); // anonymous local + let @19: (); // anonymous local + let @20: (); // anonymous local + let @21: (); // anonymous local + let @22: (); // anonymous local storage_live(x@1) x@1 := @ArrayRepeat<'_, u32, 2 : usize>(const (0 : u32)) @@ -1036,9 +1213,13 @@ pub fn take_all() storage_live(@6) storage_live(@7) storage_live(@8) + storage_live(@18) // x passed by address, there is a reborrow here - @8 := &x@1 - @7 := &*(@8) + @18 := () + @8 := &(x@1, move (@18)) + storage_live(@17) + @17 := () + @7 := &(*(@8), move (@17)) @6 := take_array_borrow<'_>(move (@7)) storage_dead(@7) storage_dead(@8) @@ -1047,9 +1228,13 @@ pub fn take_all() storage_live(@10) storage_live(@11) storage_live(@12) + storage_live(@20) // automatic cast from array to slice (spanning entire array) - @12 := &x@1 - @11 := &*(@12) + @20 := () + @12 := &(x@1, move (@20)) + storage_live(@19) + @19 := () + @11 := &(*(@12), move (@19)) @10 := @ArrayToSliceShared<'_, u32, 2 : usize>(move (@11)) storage_dead(@11) @9 := take_slice<'_>(move (@10)) @@ -1060,10 +1245,14 @@ pub fn take_all() storage_live(@14) storage_live(@15) storage_live(@16) + storage_live(@22) // note that both appear as SliceNew expressions, meaning the SliceNew UnOp is overloaded for // mut and non-mut cases - @16 := &mut x@1 - @15 := &mut *(@16) + @22 := () + @16 := &mut (x@1, move (@22)) + storage_live(@21) + @21 := () + @15 := &mut (*(@16), move (@21)) @14 := @ArrayToSliceMut<'_, u32, 2 : usize>(move (@15)) storage_dead(@15) @13 := take_mut_slice<'_>(move (@14)) @@ -1082,16 +1271,19 @@ pub fn index_array(@1: Array) -> u32 let @0: u32; // return let x@1: Array; // arg #1 let @2: usize; // anonymous local - let @3: &'_ (Array); // anonymous local - let @4: &'_ (u32); // anonymous local + let @3: (); // anonymous local + let @4: &'_ (Array); // anonymous local + let @5: &'_ (u32); // anonymous local storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &x@1 + @3 := () storage_live(@4) - @4 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@3), copy (@2)) - @0 := copy (*(@4)) + @4 := &(x@1, move (@3)) + storage_live(@5) + @5 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@4), copy (@2)) + @0 := copy (*(@5)) storage_dead(@2) return } @@ -1102,16 +1294,19 @@ pub fn index_array_borrow<'_0>(@1: &'_0 (Array)) -> u32 let @0: u32; // return let x@1: &'_ (Array); // arg #1 let @2: usize; // anonymous local - let @3: &'_ (Array); // anonymous local - let @4: &'_ (u32); // anonymous local + let @3: (); // anonymous local + let @4: &'_ (Array); // anonymous local + let @5: &'_ (u32); // anonymous local storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &*(x@1) + @3 := () storage_live(@4) - @4 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@3), copy (@2)) - @0 := copy (*(@4)) + @4 := &(*(x@1), move (@3)) + storage_live(@5) + @5 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@4), copy (@2)) + @0 := copy (*(@5)) storage_dead(@2) return } @@ -1122,16 +1317,19 @@ pub fn index_slice_u32_0<'_0>(@1: &'_0 (Slice)) -> u32 let @0: u32; // return let x@1: &'_ (Slice); // arg #1 let @2: usize; // anonymous local - let @3: &'_ (Slice); // anonymous local - let @4: &'_ (u32); // anonymous local + let @3: usize; // anonymous local + let @4: &'_ (Slice); // anonymous local + let @5: &'_ (u32); // anonymous local storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &*(x@1) + @3 := ptr_metadata(copy (x@1)) storage_live(@4) - @4 := @SliceIndexShared<'_, u32>(move (@3), copy (@2)) - @0 := copy (*(@4)) + @4 := &(*(x@1), move (@3)) + storage_live(@5) + @5 := @SliceIndexShared<'_, u32>(move (@4), copy (@2)) + @0 := copy (*(@5)) storage_dead(@2) return } @@ -1142,16 +1340,22 @@ pub fn index_mut_slice_u32_0<'_0>(@1: &'_0 mut (Slice)) -> u32 let @0: u32; // return let x@1: &'_ mut (Slice); // arg #1 let @2: usize; // anonymous local - let @3: &'_ (Slice); // anonymous local - let @4: &'_ (u32); // anonymous local + let @3: usize; // anonymous local + let @4: usize; // anonymous local + let @5: &'_ (Slice); // anonymous local + let @6: &'_ (u32); // anonymous local storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &*(x@1) + @3 := ptr_metadata(copy (x@1)) storage_live(@4) - @4 := @SliceIndexShared<'_, u32>(move (@3), copy (@2)) - @0 := copy (*(@4)) + @4 := ptr_metadata(copy (x@1)) + storage_live(@5) + @5 := &(*(x@1), move (@4)) + storage_live(@6) + @6 := @SliceIndexShared<'_, u32>(move (@5), copy (@2)) + @0 := copy (*(@6)) storage_dead(@2) return } @@ -1187,6 +1391,12 @@ pub fn index_all() -> u32 let @25: &'_ mut (Array); // anonymous local let @26: &'_ mut (Array); // anonymous local let @27: u32; // anonymous local + let @28: (); // anonymous local + let @29: (); // anonymous local + let @30: (); // anonymous local + let @31: (); // anonymous local + let @32: (); // anonymous local + let @33: (); // anonymous local storage_live(_y@4) storage_live(_z@5) @@ -1231,8 +1441,12 @@ pub fn index_all() -> u32 storage_live(@14) storage_live(@15) storage_live(@16) - @16 := &x@1 - @15 := &*(@16) + storage_live(@29) + @29 := () + @16 := &(x@1, move (@29)) + storage_live(@28) + @28 := () + @15 := &(*(@16), move (@28)) @14 := index_array_borrow<'_>(move (@15)) storage_dead(@15) @17 := copy (@8) panic.+ copy (@14) @@ -1243,8 +1457,12 @@ pub fn index_all() -> u32 storage_live(@19) storage_live(@20) storage_live(@21) - @21 := &x@1 - @20 := &*(@21) + storage_live(@31) + @31 := () + @21 := &(x@1, move (@31)) + storage_live(@30) + @30 := () + @20 := &(*(@21), move (@30)) @19 := @ArrayToSliceShared<'_, u32, 2 : usize>(move (@20)) storage_dead(@20) @18 := index_slice_u32_0<'_>(move (@19)) @@ -1257,8 +1475,12 @@ pub fn index_all() -> u32 storage_live(@24) storage_live(@25) storage_live(@26) - @26 := &mut x@1 - @25 := &mut *(@26) + storage_live(@33) + @33 := () + @26 := &mut (x@1, move (@33)) + storage_live(@32) + @32 := () + @25 := &mut (*(@26), move (@32)) @24 := @ArrayToSliceMut<'_, u32, 2 : usize>(move (@25)) storage_dead(@25) @23 := index_mut_slice_u32_0<'_>(move (@24)) @@ -1280,16 +1502,19 @@ pub fn update_array(@1: Array) let @0: (); // return let x@1: Array; // arg #1 let @2: usize; // anonymous local - let @3: &'_ mut (Array); // anonymous local - let @4: &'_ mut (u32); // anonymous local + let @3: (); // anonymous local + let @4: &'_ mut (Array); // anonymous local + let @5: &'_ mut (u32); // anonymous local storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &mut x@1 + @3 := () storage_live(@4) - @4 := @ArrayIndexMut<'_, u32, 2 : usize>(move (@3), copy (@2)) - *(@4) := const (1 : u32) + @4 := &mut (x@1, move (@3)) + storage_live(@5) + @5 := @ArrayIndexMut<'_, u32, 2 : usize>(move (@4), copy (@2)) + *(@5) := const (1 : u32) @0 := () storage_dead(@2) @0 := () @@ -1302,16 +1527,19 @@ pub fn update_array_mut_borrow<'_0>(@1: &'_0 mut (Array)) let @0: (); // return let x@1: &'_ mut (Array); // arg #1 let @2: usize; // anonymous local - let @3: &'_ mut (Array); // anonymous local - let @4: &'_ mut (u32); // anonymous local + let @3: (); // anonymous local + let @4: &'_ mut (Array); // anonymous local + let @5: &'_ mut (u32); // anonymous local storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &mut *(x@1) + @3 := () storage_live(@4) - @4 := @ArrayIndexMut<'_, u32, 2 : usize>(move (@3), copy (@2)) - *(@4) := const (1 : u32) + @4 := &mut (*(x@1), move (@3)) + storage_live(@5) + @5 := @ArrayIndexMut<'_, u32, 2 : usize>(move (@4), copy (@2)) + *(@5) := const (1 : u32) @0 := () storage_dead(@2) @0 := () @@ -1324,16 +1552,22 @@ pub fn update_mut_slice<'_0>(@1: &'_0 mut (Slice)) let @0: (); // return let x@1: &'_ mut (Slice); // arg #1 let @2: usize; // anonymous local - let @3: &'_ mut (Slice); // anonymous local - let @4: &'_ mut (u32); // anonymous local + let @3: usize; // anonymous local + let @4: usize; // anonymous local + let @5: &'_ mut (Slice); // anonymous local + let @6: &'_ mut (u32); // anonymous local storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &mut *(x@1) + @3 := ptr_metadata(copy (x@1)) storage_live(@4) - @4 := @SliceIndexMut<'_, u32>(move (@3), copy (@2)) - *(@4) := const (1 : u32) + @4 := ptr_metadata(copy (x@1)) + storage_live(@5) + @5 := &mut (*(x@1), move (@4)) + storage_live(@6) + @6 := @SliceIndexMut<'_, u32>(move (@5), copy (@2)) + *(@6) := const (1 : u32) @0 := () storage_dead(@2) @0 := () @@ -1356,6 +1590,10 @@ pub fn update_all() let @10: &'_ mut (Slice); // anonymous local let @11: &'_ mut (Array); // anonymous local let @12: &'_ mut (Array); // anonymous local + let @13: (); // anonymous local + let @14: (); // anonymous local + let @15: (); // anonymous local + let @16: (); // anonymous local storage_live(x@1) x@1 := @ArrayRepeat<'_, u32, 2 : usize>(const (0 : u32)) @@ -1374,8 +1612,12 @@ pub fn update_all() storage_live(@6) storage_live(@7) storage_live(@8) - @8 := &mut x@1 - @7 := &two-phase-mut *(@8) + storage_live(@14) + @14 := () + @8 := &mut (x@1, move (@14)) + storage_live(@13) + @13 := () + @7 := &two-phase-mut (*(@8), move (@13)) @6 := update_array_mut_borrow<'_>(move (@7)) storage_dead(@7) storage_dead(@8) @@ -1384,8 +1626,12 @@ pub fn update_all() storage_live(@10) storage_live(@11) storage_live(@12) - @12 := &mut x@1 - @11 := &mut *(@12) + storage_live(@16) + @16 := () + @12 := &mut (x@1, move (@16)) + storage_live(@15) + @15 := () + @11 := &mut (*(@12), move (@15)) @10 := @ArrayToSliceMut<'_, u32, 2 : usize>(move (@11)) storage_dead(@11) @9 := update_mut_slice<'_>(move (@10)) @@ -1409,6 +1655,9 @@ pub fn range_all() let @5: &'_ mut (Slice); // anonymous local let @6: &'_ mut (Array); // anonymous local let @7: Range[Sized]; // anonymous local + let @8: (); // anonymous local + let @9: usize; // anonymous local + let @10: usize; // anonymous local storage_live(x@1) x@1 := @ArrayRepeat<'_, u32, 4 : usize>(const (0 : u32)) @@ -1417,15 +1666,21 @@ pub fn range_all() storage_live(@4) storage_live(@5) storage_live(@6) + storage_live(@8) // CONFIRM: there is no way to shrink [T;N] into [T;M] with M for Array}::index_mut<'_, u32, Range[Sized], Slice, 4 : usize>[Sized, Sized[Sized]>, {impl IndexMut for Slice}[Sized], Slice>[Sized, Sized[Sized]>, {impl SliceIndex, Slice> for Range[Sized]}[Sized]]](move (@6), move (@7)) storage_dead(@7) storage_dead(@6) - @4 := &mut *(@5) - @3 := &two-phase-mut *(@4) + storage_live(@10) + @10 := ptr_metadata(copy (@5)) + @4 := &mut (*(@5), move (@10)) + storage_live(@9) + @9 := ptr_metadata(copy (@4)) + @3 := &two-phase-mut (*(@4), move (@9)) @2 := update_mut_slice<'_>(move (@3)) storage_dead(@3) storage_dead(@5) @@ -1444,18 +1699,21 @@ pub fn deref_array_borrow<'_0>(@1: &'_0 (Array)) -> u32 let x@1: &'_ (Array); // arg #1 let x@2: Array; // local let @3: usize; // anonymous local - let @4: &'_ (Array); // anonymous local - let @5: &'_ (u32); // anonymous local + let @4: (); // anonymous local + let @5: &'_ (Array); // anonymous local + let @6: &'_ (u32); // anonymous local storage_live(x@2) x@2 := copy (*(x@1)) storage_live(@3) @3 := const (0 : usize) storage_live(@4) - @4 := &x@2 + @4 := () storage_live(@5) - @5 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@4), copy (@3)) - @0 := copy (*(@5)) + @5 := &(x@2, move (@4)) + storage_live(@6) + @6 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@5), copy (@3)) + @0 := copy (*(@6)) storage_dead(x@2) storage_dead(@3) return @@ -1468,18 +1726,21 @@ pub fn deref_array_mut_borrow<'_0>(@1: &'_0 mut (Array)) -> u32 let x@1: &'_ mut (Array); // arg #1 let x@2: Array; // local let @3: usize; // anonymous local - let @4: &'_ (Array); // anonymous local - let @5: &'_ (u32); // anonymous local + let @4: (); // anonymous local + let @5: &'_ (Array); // anonymous local + let @6: &'_ (u32); // anonymous local storage_live(x@2) x@2 := copy (*(x@1)) storage_live(@3) @3 := const (0 : usize) storage_live(@4) - @4 := &x@2 + @4 := () storage_live(@5) - @5 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@4), copy (@3)) - @0 := copy (*(@5)) + @5 := &(x@2, move (@4)) + storage_live(@6) + @6 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@5), copy (@3)) + @0 := copy (*(@6)) storage_dead(x@2) storage_dead(@3) return @@ -1547,8 +1808,10 @@ pub fn sum<'_0>(@1: &'_0 (Slice)) -> u32 let @11: u32; // anonymous local let @12: usize; // anonymous local let @13: (); // anonymous local - let @14: &'_ (Slice); // anonymous local - let @15: &'_ (u32); // anonymous local + let @14: usize; // anonymous local + let @15: usize; // anonymous local + let @16: &'_ (Slice); // anonymous local + let @17: &'_ (u32); // anonymous local storage_live(@8) storage_live(@9) @@ -1557,6 +1820,8 @@ pub fn sum<'_0>(@1: &'_0 (Slice)) -> u32 storage_live(@12) storage_live(@14) storage_live(@15) + storage_live(@16) + storage_live(@17) storage_live(sum@2) sum@2 := const (0 : u32) storage_live(i@3) @@ -1568,7 +1833,9 @@ pub fn sum<'_0>(@1: &'_0 (Slice)) -> u32 @6 := copy (i@3) storage_live(@7) storage_live(@8) - @8 := &*(s@1) + storage_live(@14) + @14 := ptr_metadata(copy (s@1)) + @8 := &(*(s@1), move (@14)) @7 := len<'_, u32>[Sized](move (@8)) storage_dead(@8) @5 := move (@6) < move (@7) @@ -1582,11 +1849,13 @@ pub fn sum<'_0>(@1: &'_0 (Slice)) -> u32 storage_live(@9) storage_live(@10) @10 := copy (i@3) - storage_live(@14) - @14 := &*(s@1) storage_live(@15) - @15 := @SliceIndexShared<'_, u32>(move (@14), copy (@10)) - @9 := copy (*(@15)) + @15 := ptr_metadata(copy (s@1)) + storage_live(@16) + @16 := &(*(s@1), move (@15)) + storage_live(@17) + @17 := @SliceIndexShared<'_, u32>(move (@16), copy (@10)) + @9 := copy (*(@17)) @11 := copy (sum@2) panic.+ copy (@9) sum@2 := move (@11) storage_dead(@9) @@ -1636,10 +1905,15 @@ pub fn sum2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) -> u32 let @22: u32; // anonymous local let @23: usize; // anonymous local let @24: (); // anonymous local - let @25: &'_ (Slice); // anonymous local - let @26: &'_ (u32); // anonymous local - let @27: &'_ (Slice); // anonymous local - let @28: &'_ (u32); // anonymous local + let @25: usize; // anonymous local + let @26: usize; // anonymous local + let @27: usize; // anonymous local + let @28: usize; // anonymous local + let @29: &'_ (Slice); // anonymous local + let @30: &'_ (u32); // anonymous local + let @31: usize; // anonymous local + let @32: &'_ (Slice); // anonymous local + let @33: &'_ (u32); // anonymous local storage_live(@15) storage_live(@16) @@ -1650,22 +1924,29 @@ pub fn sum2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) -> u32 storage_live(@21) storage_live(@22) storage_live(@23) - storage_live(@25) - storage_live(@26) storage_live(@27) storage_live(@28) + storage_live(@29) + storage_live(@30) + storage_live(@31) + storage_live(@32) + storage_live(@33) storage_live(sum@3) sum@3 := const (0 : u32) storage_live(@4) storage_live(@5) storage_live(@6) storage_live(@7) - @7 := &*(s@1) + storage_live(@25) + @25 := ptr_metadata(copy (s@1)) + @7 := &(*(s@1), move (@25)) @6 := len<'_, u32>[Sized](move (@7)) storage_dead(@7) storage_live(@8) storage_live(@9) - @9 := &*(s2@2) + storage_live(@26) + @26 := ptr_metadata(copy (s2@2)) + @9 := &(*(s2@2), move (@26)) @8 := len<'_, u32>[Sized](move (@9)) storage_dead(@9) @5 := move (@6) == move (@8) @@ -1689,7 +1970,9 @@ pub fn sum2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) -> u32 @13 := copy (i@10) storage_live(@14) storage_live(@15) - @15 := &*(s@1) + storage_live(@27) + @27 := ptr_metadata(copy (s@1)) + @15 := &(*(s@1), move (@27)) @14 := len<'_, u32>[Sized](move (@15)) storage_dead(@15) @12 := move (@13) < move (@14) @@ -1704,19 +1987,23 @@ pub fn sum2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) -> u32 storage_live(@17) storage_live(@18) @18 := copy (i@10) - storage_live(@27) - @27 := &*(s@1) - storage_live(@28) - @28 := @SliceIndexShared<'_, u32>(move (@27), copy (@18)) - @17 := copy (*(@28)) + storage_live(@31) + @31 := ptr_metadata(copy (s@1)) + storage_live(@32) + @32 := &(*(s@1), move (@31)) + storage_live(@33) + @33 := @SliceIndexShared<'_, u32>(move (@32), copy (@18)) + @17 := copy (*(@33)) storage_live(@19) storage_live(@20) @20 := copy (i@10) - storage_live(@25) - @25 := &*(s2@2) - storage_live(@26) - @26 := @SliceIndexShared<'_, u32>(move (@25), copy (@20)) - @19 := copy (*(@26)) + storage_live(@28) + @28 := ptr_metadata(copy (s2@2)) + storage_live(@29) + @29 := &(*(s2@2), move (@28)) + storage_live(@30) + @30 := @SliceIndexShared<'_, u32>(move (@29), copy (@20)) + @19 := copy (*(@30)) @21 := copy (@17) panic.+ copy (@19) @16 := move (@21) storage_dead(@19) @@ -1752,26 +2039,38 @@ pub fn f0() let @3: &'_ mut (Array); // anonymous local let @4: Array; // anonymous local let @5: usize; // anonymous local - let @6: &'_ mut (Slice); // anonymous local - let @7: &'_ mut (u32); // anonymous local + let @6: usize; // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local + let @9: usize; // anonymous local + let @10: &'_ mut (Slice); // anonymous local + let @11: &'_ mut (u32); // anonymous local storage_live(s@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := [const (1 : u32), const (2 : u32)] - @3 := &mut @4 - @2 := &mut *(@3) + storage_live(@8) + @8 := () + @3 := &mut (@4, move (@8)) + storage_live(@7) + @7 := () + @2 := &mut (*(@3), move (@7)) s@1 := @ArrayToSliceMut<'_, u32, 2 : usize>(move (@2)) storage_dead(@2) storage_dead(@3) storage_live(@5) @5 := const (0 : usize) storage_live(@6) - @6 := &mut *(s@1) - storage_live(@7) - @7 := @SliceIndexMut<'_, u32>(move (@6), copy (@5)) - *(@7) := const (1 : u32) + @6 := ptr_metadata(copy (s@1)) + storage_live(@9) + @9 := ptr_metadata(copy (s@1)) + storage_live(@10) + @10 := &mut (*(s@1), move (@9)) + storage_live(@11) + @11 := @SliceIndexMut<'_, u32>(move (@10), copy (@5)) + *(@11) := const (1 : u32) storage_dead(@5) @0 := () storage_dead(@4) @@ -1786,18 +2085,21 @@ pub fn f1() let @0: (); // return let s@1: Array; // local let @2: usize; // anonymous local - let @3: &'_ mut (Array); // anonymous local - let @4: &'_ mut (u32); // anonymous local + let @3: (); // anonymous local + let @4: &'_ mut (Array); // anonymous local + let @5: &'_ mut (u32); // anonymous local storage_live(s@1) s@1 := [const (1 : u32), const (2 : u32)] storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &mut s@1 + @3 := () storage_live(@4) - @4 := @ArrayIndexMut<'_, u32, 2 : usize>(move (@3), copy (@2)) - *(@4) := const (1 : u32) + @4 := &mut (s@1, move (@3)) + storage_live(@5) + @5 := @ArrayIndexMut<'_, u32, 2 : usize>(move (@4), copy (@2)) + *(@5) := const (1 : u32) storage_dead(@2) @0 := () storage_dead(s@1) @@ -1829,11 +2131,16 @@ pub fn f4<'_0>(@1: &'_0 (Array), @2: usize, @3: usize) -> &'_0 let @7: Range[Sized]; // anonymous local let @8: usize; // anonymous local let @9: usize; // anonymous local + let @10: (); // anonymous local + let @11: usize; // anonymous local + let @12: usize; // anonymous local storage_live(@4) storage_live(@5) storage_live(@6) - @6 := &*(x@1) + storage_live(@10) + @10 := () + @6 := &(*(x@1), move (@10)) storage_live(@7) storage_live(@8) @8 := copy (y@2) @@ -1845,8 +2152,12 @@ pub fn f4<'_0>(@1: &'_0 (Array), @2: usize, @3: usize) -> &'_0 @5 := {impl Index for Array}::index<'_, u32, Range[Sized], Slice, 32 : usize>[Sized, Sized[Sized]>, {impl Index for Slice}[Sized], Slice>[Sized, Sized[Sized]>, {impl SliceIndex, Slice> for Range[Sized]}[Sized]]](move (@6), move (@7)) storage_dead(@7) storage_dead(@6) - @4 := &*(@5) - @0 := &*(@4) + storage_live(@12) + @12 := ptr_metadata(copy (@5)) + @4 := &(*(@5), move (@12)) + storage_live(@11) + @11 := ptr_metadata(copy (@4)) + @0 := &(*(@4), move (@11)) storage_dead(@5) storage_dead(@4) return @@ -1868,8 +2179,14 @@ pub fn f3() -> u32 let @10: &'_ (Slice); // anonymous local let @11: &'_ (Array); // anonymous local let @12: &'_ (Array); // anonymous local - let @13: &'_ (Array); // anonymous local - let @14: &'_ (u32); // anonymous local + let @13: (); // anonymous local + let @14: (); // anonymous local + let @15: (); // anonymous local + let @16: (); // anonymous local + let @17: usize; // anonymous local + let @18: (); // anonymous local + let @19: &'_ (Array); // anonymous local + let @20: &'_ (u32); // anonymous local storage_live(a@1) a@1 := [const (1 : u32), const (2 : u32)] @@ -1877,11 +2194,13 @@ pub fn f3() -> u32 storage_live(@3) storage_live(@4) @4 := const (0 : usize) - storage_live(@13) - @13 := &a@1 - storage_live(@14) - @14 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@13), copy (@4)) - @3 := copy (*(@14)) + storage_live(@18) + @18 := () + storage_live(@19) + @19 := &(a@1, move (@18)) + storage_live(@20) + @20 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@19), copy (@4)) + @3 := copy (*(@20)) @2 := f2(move (@3)) storage_dead(@3) storage_dead(@4) @@ -1891,18 +2210,28 @@ pub fn f3() -> u32 storage_live(@6) storage_live(@7) storage_live(@8) - @8 := &a@1 - @7 := &*(@8) + storage_live(@16) + @16 := () + @8 := &(a@1, move (@16)) + storage_live(@15) + @15 := () + @7 := &(*(@8), move (@15)) @6 := @ArrayToSliceShared<'_, u32, 2 : usize>(move (@7)) storage_dead(@7) storage_live(@9) storage_live(@10) storage_live(@11) storage_live(@12) - @12 := &b@5 - @11 := &*(@12) + storage_live(@14) + @14 := () + @12 := &(b@5, move (@14)) + storage_live(@13) + @13 := () + @11 := &(*(@12), move (@13)) @10 := f4<'_>(move (@11), const (16 : usize), const (18 : usize)) - @9 := &*(@10) + storage_live(@17) + @17 := ptr_metadata(copy (@10)) + @9 := &(*(@10), move (@17)) storage_dead(@11) @0 := sum2<'_, '_>(move (@6), move (@9)) storage_dead(@9) @@ -1933,16 +2262,19 @@ pub fn f5<'_0>(@1: &'_0 (Array)) -> u32 let @0: u32; // return let x@1: &'_ (Array); // arg #1 let @2: usize; // anonymous local - let @3: &'_ (Array); // anonymous local - let @4: &'_ (u32); // anonymous local + let @3: (); // anonymous local + let @4: &'_ (Array); // anonymous local + let @5: &'_ (u32); // anonymous local storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &*(x@1) + @3 := () storage_live(@4) - @4 := @ArrayIndexShared<'_, u32, 32 : usize>(move (@3), copy (@2)) - @0 := copy (*(@4)) + @4 := &(*(x@1), move (@3)) + storage_live(@5) + @5 := @ArrayIndexShared<'_, u32, 32 : usize>(move (@4), copy (@2)) + @0 := copy (*(@5)) storage_dead(@2) return } @@ -1962,6 +2294,10 @@ pub fn ite() let @9: &'_ mut (Slice); // anonymous local let @10: &'_ mut (Array); // anonymous local let @11: &'_ mut (Array); // anonymous local + let @12: (); // anonymous local + let @13: (); // anonymous local + let @14: (); // anonymous local + let @15: (); // anonymous local storage_live(y@3) storage_live(@4) @@ -1972,6 +2308,10 @@ pub fn ite() storage_live(@9) storage_live(@10) storage_live(@11) + storage_live(@12) + storage_live(@13) + storage_live(@14) + storage_live(@15) storage_live(x@1) x@1 := @ArrayRepeat<'_, u32, 2 : usize>(const (0 : u32)) storage_live(@2) @@ -1983,8 +2323,12 @@ pub fn ite() storage_live(@5) storage_live(@6) storage_live(@7) - @7 := &mut x@1 - @6 := &mut *(@7) + storage_live(@13) + @13 := () + @7 := &mut (x@1, move (@13)) + storage_live(@12) + @12 := () + @6 := &mut (*(@7), move (@12)) @5 := @ArrayToSliceMut<'_, u32, 2 : usize>(move (@6)) storage_dead(@6) @4 := index_mut_slice_u32_0<'_>(move (@5)) @@ -1995,8 +2339,12 @@ pub fn ite() storage_live(@9) storage_live(@10) storage_live(@11) - @11 := &mut y@3 - @10 := &mut *(@11) + storage_live(@15) + @15 := () + @11 := &mut (y@3, move (@15)) + storage_live(@14) + @14 := () + @10 := &mut (*(@11), move (@14)) @9 := @ArrayToSliceMut<'_, u32, 2 : usize>(move (@10)) storage_dead(@10) @8 := index_mut_slice_u32_0<'_>(move (@9)) @@ -2029,18 +2377,25 @@ pub fn zero_slice<'_0>(@1: &'_0 mut (Slice)) let @8: usize; // anonymous local let @9: usize; // anonymous local let @10: (); // anonymous local - let @11: &'_ mut (Slice); // anonymous local - let @12: &'_ mut (u8); // anonymous local + let @11: usize; // anonymous local + let @12: usize; // anonymous local + let @13: usize; // anonymous local + let @14: &'_ mut (Slice); // anonymous local + let @15: &'_ mut (u8); // anonymous local storage_live(@8) storage_live(@9) - storage_live(@11) storage_live(@12) + storage_live(@13) + storage_live(@14) + storage_live(@15) storage_live(i@2) i@2 := const (0 : usize) storage_live(len@3) storage_live(@4) - @4 := &*(a@1) + storage_live(@11) + @11 := ptr_metadata(copy (a@1)) + @4 := &(*(a@1), move (@11)) len@3 := len<'_, u8>[Sized](move (@4)) storage_dead(@4) loop { @@ -2055,11 +2410,15 @@ pub fn zero_slice<'_0>(@1: &'_0 mut (Slice)) storage_dead(@6) storage_live(@8) @8 := copy (i@2) - storage_live(@11) - @11 := &mut *(a@1) storage_live(@12) - @12 := @SliceIndexMut<'_, u8>(move (@11), copy (@8)) - *(@12) := const (0 : u8) + @12 := ptr_metadata(copy (a@1)) + storage_live(@13) + @13 := ptr_metadata(copy (a@1)) + storage_live(@14) + @14 := &mut (*(a@1), move (@13)) + storage_live(@15) + @15 := @SliceIndexMut<'_, u8>(move (@14), copy (@8)) + *(@15) := const (0 : u8) storage_dead(@8) @9 := copy (i@2) panic.+ const (1 : usize) i@2 := move (@9) @@ -2095,11 +2454,14 @@ pub fn iter_mut_slice<'_0>(@1: &'_0 mut (Slice)) let @7: usize; // anonymous local let @8: usize; // anonymous local let @9: (); // anonymous local + let @10: usize; // anonymous local storage_live(@8) storage_live(len@2) storage_live(@3) - @3 := &*(a@1) + storage_live(@10) + @10 := ptr_metadata(copy (a@1)) + @3 := &(*(a@1), move (@10)) len@2 := len<'_, u8>[Sized](move (@3)) storage_dead(@3) storage_live(i@4) @@ -2152,8 +2514,11 @@ pub fn sum_mut_slice<'_0>(@1: &'_0 mut (Slice)) -> u32 let @11: u32; // anonymous local let @12: usize; // anonymous local let @13: (); // anonymous local - let @14: &'_ (Slice); // anonymous local - let @15: &'_ (u32); // anonymous local + let @14: usize; // anonymous local + let @15: usize; // anonymous local + let @16: usize; // anonymous local + let @17: &'_ (Slice); // anonymous local + let @18: &'_ (u32); // anonymous local storage_live(@8) storage_live(@9) @@ -2162,6 +2527,9 @@ pub fn sum_mut_slice<'_0>(@1: &'_0 mut (Slice)) -> u32 storage_live(@12) storage_live(@14) storage_live(@15) + storage_live(@16) + storage_live(@17) + storage_live(@18) storage_live(i@2) i@2 := const (0 : usize) storage_live(s@3) @@ -2173,7 +2541,9 @@ pub fn sum_mut_slice<'_0>(@1: &'_0 mut (Slice)) -> u32 @6 := copy (i@2) storage_live(@7) storage_live(@8) - @8 := &*(a@1) + storage_live(@14) + @14 := ptr_metadata(copy (a@1)) + @8 := &(*(a@1), move (@14)) @7 := len<'_, u32>[Sized](move (@8)) storage_dead(@8) @5 := move (@6) < move (@7) @@ -2187,11 +2557,15 @@ pub fn sum_mut_slice<'_0>(@1: &'_0 mut (Slice)) -> u32 storage_live(@9) storage_live(@10) @10 := copy (i@2) - storage_live(@14) - @14 := &*(a@1) storage_live(@15) - @15 := @SliceIndexShared<'_, u32>(move (@14), copy (@10)) - @9 := copy (*(@15)) + @15 := ptr_metadata(copy (a@1)) + storage_live(@16) + @16 := ptr_metadata(copy (a@1)) + storage_live(@17) + @17 := &(*(a@1), move (@16)) + storage_live(@18) + @18 := @SliceIndexShared<'_, u32>(move (@17), copy (@10)) + @9 := copy (*(@18)) @11 := copy (s@3) panic.+ copy (@9) s@3 := move (@11) storage_dead(@9) @@ -2219,15 +2593,18 @@ fn slice_pattern_1(@1: Array<(), 1 : usize>) let @0: (); // return let x@1: Array<(), 1 : usize>; // arg #1 let _named@2: (); // local - let @3: &'_ (Array<(), 1 : usize>); // anonymous local - let @4: &'_ (()); // anonymous local + let @3: (); // anonymous local + let @4: &'_ (Array<(), 1 : usize>); // anonymous local + let @5: &'_ (()); // anonymous local storage_live(_named@2) storage_live(@3) - @3 := &x@1 + @3 := () storage_live(@4) - @4 := @ArrayIndexShared<'_, (), 1 : usize>(move (@3), const (0 : usize)) - _named@2 := copy (*(@4)) + @4 := &(x@1, move (@3)) + storage_live(@5) + @5 := @ArrayIndexShared<'_, (), 1 : usize>(move (@4), const (0 : usize)) + _named@2 := copy (*(@5)) @0 := () storage_dead(_named@2) @0 := () @@ -2244,31 +2621,40 @@ where let _a@2: &'_ mut (T); // local let _b@3: &'_ mut (T); // local let _c@4: &'_ mut (T); // local - let @5: &'_ mut (Array<&'_ mut (T), 3 : usize>); // anonymous local - let @6: &'_ mut (&'_ mut (T)); // anonymous local - let @7: &'_ mut (Array<&'_ mut (T), 3 : usize>); // anonymous local - let @8: &'_ mut (&'_ mut (T)); // anonymous local + let @5: (); // anonymous local + let @6: &'_ mut (Array<&'_ mut (T), 3 : usize>); // anonymous local + let @7: &'_ mut (&'_ mut (T)); // anonymous local + let @8: (); // anonymous local let @9: &'_ mut (Array<&'_ mut (T), 3 : usize>); // anonymous local let @10: &'_ mut (&'_ mut (T)); // anonymous local + let @11: (); // anonymous local + let @12: &'_ mut (Array<&'_ mut (T), 3 : usize>); // anonymous local + let @13: &'_ mut (&'_ mut (T)); // anonymous local storage_live(_a@2) - storage_live(@9) - @9 := &mut x@1 - storage_live(@10) - @10 := @ArrayIndexMut<'_, &'_ mut (T), 3 : usize>(move (@9), const (0 : usize)) - _a@2 := move (*(@10)) + storage_live(@11) + @11 := () + storage_live(@12) + @12 := &mut (x@1, move (@11)) + storage_live(@13) + @13 := @ArrayIndexMut<'_, &'_ mut (T), 3 : usize>(move (@12), const (0 : usize)) + _a@2 := move (*(@13)) storage_live(_b@3) - storage_live(@7) - @7 := &mut x@1 storage_live(@8) - @8 := @ArrayIndexMut<'_, &'_ mut (T), 3 : usize>(move (@7), const (1 : usize)) - _b@3 := move (*(@8)) + @8 := () + storage_live(@9) + @9 := &mut (x@1, move (@8)) + storage_live(@10) + @10 := @ArrayIndexMut<'_, &'_ mut (T), 3 : usize>(move (@9), const (1 : usize)) + _b@3 := move (*(@10)) storage_live(_c@4) storage_live(@5) - @5 := &mut x@1 + @5 := () storage_live(@6) - @6 := @ArrayIndexMut<'_, &'_ mut (T), 3 : usize>(move (@5), const (2 : usize)) - _c@4 := move (*(@6)) + @6 := &mut (x@1, move (@5)) + storage_live(@7) + @7 := @ArrayIndexMut<'_, &'_ mut (T), 3 : usize>(move (@6), const (2 : usize)) + _c@4 := move (*(@7)) @0 := () storage_dead(_c@4) storage_dead(_b@3) @@ -2283,15 +2669,21 @@ fn slice_pattern_3<'_0>(@1: &'_0 (Array<(), 1 : usize>)) let @0: (); // return let x@1: &'_ (Array<(), 1 : usize>); // arg #1 let _named@2: &'_ (()); // local - let @3: &'_ (Array<(), 1 : usize>); // anonymous local - let @4: &'_ (()); // anonymous local + let @3: (); // anonymous local + let @4: (); // anonymous local + let @5: &'_ (Array<(), 1 : usize>); // anonymous local + let @6: &'_ (()); // anonymous local storage_live(_named@2) storage_live(@3) - @3 := &*(x@1) + @3 := () storage_live(@4) - @4 := @ArrayIndexShared<'_, (), 1 : usize>(move (@3), const (0 : usize)) - _named@2 := &*(@4) + @4 := () + storage_live(@5) + @5 := &(*(x@1), move (@4)) + storage_live(@6) + @6 := @ArrayIndexShared<'_, (), 1 : usize>(move (@5), const (0 : usize)) + _named@2 := &(*(@6), move (@3)) @0 := () storage_dead(_named@2) @0 := () @@ -2307,8 +2699,10 @@ fn slice_pattern_4<'_0>(@1: &'_0 (Slice<()>)) let @3: usize; // anonymous local let @4: bool; // anonymous local let _named@5: &'_ (()); // local - let @6: &'_ (Slice<()>); // anonymous local - let @7: &'_ (()); // anonymous local + let @6: (); // anonymous local + let @7: usize; // anonymous local + let @8: &'_ (Slice<()>); // anonymous local + let @9: &'_ (()); // anonymous local storage_live(@2) storage_live(@3) @@ -2325,10 +2719,14 @@ fn slice_pattern_4<'_0>(@1: &'_0 (Slice<()>)) } storage_live(_named@5) storage_live(@6) - @6 := &*(x@1) + @6 := () storage_live(@7) - @7 := @SliceIndexShared<'_, ()>(move (@6), const (0 : usize)) - _named@5 := &*(@7) + @7 := ptr_metadata(copy (x@1)) + storage_live(@8) + @8 := &(*(x@1), move (@7)) + storage_live(@9) + @9 := @SliceIndexShared<'_, ()>(move (@8), const (0 : usize)) + _named@5 := &(*(@9), move (@6)) @0 := () storage_dead(_named@5) @0 := () diff --git a/charon/tests/ui/arrays_const_generics.out b/charon/tests/ui/arrays_const_generics.out index aaf89da4f..78af2aaa8 100644 --- a/charon/tests/ui/arrays_const_generics.out +++ b/charon/tests/ui/arrays_const_generics.out @@ -7,16 +7,19 @@ pub fn index_array_generic(@1: Array, @2: let s@1: Array; // arg #1 let i@2: usize; // arg #2 let @3: usize; // anonymous local - let @4: &'_ (Array); // anonymous local - let @5: &'_ (u32); // anonymous local + let @4: (); // anonymous local + let @5: &'_ (Array); // anonymous local + let @6: &'_ (u32); // anonymous local storage_live(@3) @3 := copy (i@2) storage_live(@4) - @4 := &s@1 + @4 := () storage_live(@5) - @5 := @ArrayIndexShared<'_, u32, const N : usize>(move (@4), copy (@3)) - @0 := copy (*(@5)) + @5 := &(s@1, move (@4)) + storage_live(@6) + @6 := @ArrayIndexShared<'_, u32, const N : usize>(move (@5), copy (@3)) + @0 := copy (*(@6)) storage_dead(@3) return } diff --git a/charon/tests/ui/associated-types.out b/charon/tests/ui/associated-types.out index 6258d21eb..1fac15b55 100644 --- a/charon/tests/ui/associated-types.out +++ b/charon/tests/ui/associated-types.out @@ -269,13 +269,16 @@ where let @2: &'_ (Clause1_Item); // anonymous local let @3: Clause1_Item; // anonymous local let @4: Clause1_Item; // anonymous local + let @5: (); // anonymous local storage_live(@2) storage_live(@3) storage_live(@4) @4 := copy (x@1) @3 := @TraitClause1::use_item_provided[@TraitClause2](move (@4)) - @2 := &@3 + storage_live(@5) + @5 := () + @2 := &(@3, move (@5)) storage_dead(@4) @0 := @TraitClause2::parent_clause1::parent_clause1::clone<'_>(move (@2)) storage_dead(@2) diff --git a/charon/tests/ui/closure-as-fn.out b/charon/tests/ui/closure-as-fn.out index 28981feac..850b16263 100644 --- a/charon/tests/ui/closure-as-fn.out +++ b/charon/tests/ui/closure-as-fn.out @@ -109,9 +109,12 @@ fn {impl FnMut<()> for closure}::call_mut<'_0>(@1: &'_0 mut (closure), @2: ()) let state@1: &'_0 mut (closure); // arg #1 let args@2: (); // arg #2 let @3: &'_ (closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<()> for closure}::call<'_>(move (@3), move (args@2)) @0 := () return @@ -124,9 +127,12 @@ fn {impl FnOnce<()> for closure}::call_once(@1: closure, @2: ()) let @1: closure; // arg #1 let @2: (); // arg #2 let @3: &'_ mut (closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<()> for closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 @0 := () diff --git a/charon/tests/ui/closures.out b/charon/tests/ui/closures.out index f85a55196..3f9da7cad 100644 --- a/charon/tests/ui/closures.out +++ b/charon/tests/ui/closures.out @@ -178,12 +178,14 @@ where let @5: &'_ (F); // anonymous local let @6: (T); // anonymous local let @7: T; // anonymous local + let @8: (); // anonymous local storage_live(x@3) storage_live(@4) storage_live(@5) storage_live(@6) storage_live(@7) + storage_live(@8) match x@1 { Option::None => { @0 := Option::None { } @@ -193,7 +195,9 @@ where x@3 := move ((x@1 as variant Option::Some).0) storage_live(@4) storage_live(@5) - @5 := &f@2 + storage_live(@8) + @8 := () + @5 := &(f@2, move (@8)) storage_live(@6) storage_live(@7) @7 := move (x@3) @@ -228,22 +232,30 @@ where let @4: T; // anonymous local let @5: fn<'_0>(&'_0_0 (T)) -> T; // anonymous local let @6: &'_ (T); // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local storage_live(x@3) storage_live(@4) storage_live(@5) storage_live(@6) + storage_live(@7) + storage_live(@8) match *(x@1) { Option::None => { }, Option::Some => { storage_live(x@3) - x@3 := &(*(x@1) as variant Option::Some).0 + storage_live(@8) + @8 := () + x@3 := &((*(x@1) as variant Option::Some).0, move (@8)) storage_live(@4) storage_live(@5) @5 := copy (f@2) storage_live(@6) - @6 := &*(x@3) + storage_live(@7) + @7 := () + @6 := &(*(x@3), move (@7)) @4 := (move @5)(move (@6)) storage_dead(@6) storage_dead(@5) @@ -295,9 +307,12 @@ fn {impl FnMut<(u32), u32> for test_crate::test_closure_u32::closure}::call_mut< let state@1: &'_0 mut (test_crate::test_closure_u32::closure); // arg #1 let args@2: (u32); // arg #2 let @3: &'_ (test_crate::test_closure_u32::closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<(u32), u32> for test_crate::test_closure_u32::closure}::call<'_>(move (@3), move (args@2)) return } @@ -309,9 +324,12 @@ fn {impl FnOnce<(u32), u32> for test_crate::test_closure_u32::closure}::call_onc let @1: test_crate::test_closure_u32::closure; // arg #1 let @2: (u32); // arg #2 let @3: &'_ mut (test_crate::test_closure_u32::closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(u32), u32> for test_crate::test_closure_u32::closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return @@ -425,9 +443,12 @@ fn {impl FnMut<(u32, u32), u32> for test_crate::test_closure_u32s::closure}::cal let state@1: &'_0 mut (test_crate::test_closure_u32s::closure); // arg #1 let args@2: (u32, u32); // arg #2 let @3: &'_ (test_crate::test_closure_u32s::closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<(u32, u32), u32> for test_crate::test_closure_u32s::closure}::call<'_>(move (@3), move (args@2)) return } @@ -439,9 +460,12 @@ fn {impl FnOnce<(u32, u32), u32> for test_crate::test_closure_u32s::closure}::ca let @1: test_crate::test_closure_u32s::closure; // arg #1 let @2: (u32, u32); // arg #2 let @3: &'_ mut (test_crate::test_closure_u32s::closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(u32, u32), u32> for test_crate::test_closure_u32s::closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return @@ -546,9 +570,12 @@ fn {impl FnMut<(&'_ (u32)), &'_ (u32)> for test_crate::test_closure_ref_u32::clo let state@1: &'_1 mut (test_crate::test_closure_ref_u32::closure); // arg #1 let args@2: (&'_0 (u32)); // arg #2 let @3: &'_ (test_crate::test_closure_ref_u32::closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<(&'_ (u32)), &'_ (u32)> for test_crate::test_closure_ref_u32::closure}::call<'_0, '_>(move (@3), move (args@2)) return } @@ -560,9 +587,12 @@ fn {impl FnOnce<(&'_ (u32)), &'_ (u32)> for test_crate::test_closure_ref_u32::cl let @1: test_crate::test_closure_ref_u32::closure; // arg #1 let @2: (&'_ (u32)); // arg #2 let @3: &'_ mut (test_crate::test_closure_ref_u32::closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(&'_ (u32)), &'_ (u32)> for test_crate::test_closure_ref_u32::closure}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop] @1 return @@ -593,6 +623,8 @@ pub fn test_closure_ref_u32<'a>(@1: &'a (u32)) -> &'a (u32) let @4: &'_ (u32); // anonymous local let @5: fn<'_0>(&'_0_0 (u32)) -> &'_0_0 (u32); // anonymous local let @6: &'_ (u32); // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local storage_live(f@2) storage_live(@3) @@ -603,9 +635,13 @@ pub fn test_closure_ref_u32<'a>(@1: &'a (u32)) -> &'a (u32) storage_live(@5) @5 := copy (f@2) storage_live(@6) - @6 := &*(x@1) + storage_live(@7) + @7 := () + @6 := &(*(x@1), move (@7)) @4 := (move @5)(move (@6)) - @0 := &*(@4) + storage_live(@8) + @8 := () + @0 := &(*(@4), move (@8)) storage_dead(@6) storage_dead(@5) storage_dead(f@2) @@ -673,9 +709,12 @@ where let state@1: &'_1 mut (test_crate::test_closure_ref_param::closure[@TraitClause0]); // arg #1 let args@2: (&'_0 (T)); // arg #2 let @3: &'_ (test_crate::test_closure_ref_param::closure[@TraitClause0]); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<(&'_ (T)), &'_ (T)> for test_crate::test_closure_ref_param::closure[@TraitClause0]}::call<'_0, '_, T>[@TraitClause0](move (@3), move (args@2)) return } @@ -689,9 +728,12 @@ where let @1: test_crate::test_closure_ref_param::closure[@TraitClause0]; // arg #1 let @2: (&'_ (T)); // arg #2 let @3: &'_ mut (test_crate::test_closure_ref_param::closure[@TraitClause0]); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(&'_ (T)), &'_ (T)> for test_crate::test_closure_ref_param::closure[@TraitClause0]}::call_mut<'_0, '_, T>[@TraitClause0](move (@3), move (@2)) drop[Drop[@TraitClause0]>] @1 return @@ -726,6 +768,8 @@ where let @4: &'_ (T); // anonymous local let @5: fn<'_0>(&'_0_0 (T)) -> &'_0_0 (T); // anonymous local let @6: &'_ (T); // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local storage_live(f@2) storage_live(@3) @@ -736,9 +780,13 @@ where storage_live(@5) @5 := copy (f@2) storage_live(@6) - @6 := &*(x@1) + storage_live(@7) + @7 := () + @6 := &(*(x@1), move (@7)) @4 := (move @5)(move (@6)) - @0 := &*(@4) + storage_live(@8) + @8 := () + @0 := &(*(@4), move (@8)) storage_dead(@6) storage_dead(@5) storage_dead(f@2) @@ -825,9 +873,12 @@ where let state@1: &'_2 mut (test_crate::test_closure_ref_early_bound::closure<'_, T>[@TraitClause0, @TraitClause1]); // arg #1 let args@2: (&'_1 (T)); // arg #2 let @3: &'_ (test_crate::test_closure_ref_early_bound::closure<'_, T>[@TraitClause0, @TraitClause1]); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<(&'_ (T)), &'_ (T)> for test_crate::test_closure_ref_early_bound::closure<'_, T>[@TraitClause0, @TraitClause1]}::call<'_, '_1, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) return } @@ -842,9 +893,12 @@ where let @1: test_crate::test_closure_ref_early_bound::closure<'_, T>[@TraitClause0, @TraitClause1]; // arg #1 let @2: (&'_ (T)); // arg #2 let @3: &'_ mut (test_crate::test_closure_ref_early_bound::closure<'_, T>[@TraitClause0, @TraitClause1]); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(&'_ (T)), &'_ (T)> for test_crate::test_closure_ref_early_bound::closure<'_, T>[@TraitClause0, @TraitClause1]}::call_mut<'_, '_1, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0, @TraitClause1]>] @1 return @@ -881,6 +935,8 @@ where let @4: &'_ (T); // anonymous local let @5: fn<'_0>(&'_0_0 (T)) -> &'_0_0 (T); // anonymous local let @6: &'_ (T); // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local storage_live(f@2) storage_live(@3) @@ -891,9 +947,13 @@ where storage_live(@5) @5 := copy (f@2) storage_live(@6) - @6 := &*(x@1) + storage_live(@7) + @7 := () + @6 := &(*(x@1), move (@7)) @4 := (move @5)(move (@6)) - @0 := &*(@4) + storage_live(@8) + @8 := () + @0 := &(*(@4), move (@8)) storage_dead(@6) storage_dead(@5) storage_dead(f@2) @@ -973,9 +1033,12 @@ fn {impl FnMut<(u32), u32> for test_crate::test_map_option2::closure}::call_mut< let state@1: &'_0 mut (test_crate::test_map_option2::closure); // arg #1 let args@2: (u32); // arg #2 let @3: &'_ (test_crate::test_map_option2::closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<(u32), u32> for test_crate::test_map_option2::closure}::call<'_>(move (@3), move (args@2)) return } @@ -987,9 +1050,12 @@ fn {impl FnOnce<(u32), u32> for test_crate::test_map_option2::closure}::call_onc let @1: test_crate::test_map_option2::closure; // arg #1 let @2: (u32); // arg #2 let @3: &'_ mut (test_crate::test_map_option2::closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(u32), u32> for test_crate::test_map_option2::closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return @@ -1124,9 +1190,12 @@ where let @0: T; // return let x@1: T; // arg #1 let @2: &'_ (T); // anonymous local + let @3: (); // anonymous local storage_live(@2) - @2 := &x@1 + storage_live(@3) + @3 := () + @2 := &(x@1, move (@3)) @0 := @TraitClause1::clone<'_>(move (@2)) storage_dead(@2) drop[Drop] x@1 @@ -1225,9 +1294,12 @@ fn {impl FnMut<(u32), u32> for test_crate::test_map_option3::closure}::call_mut< let state@1: &'_0 mut (test_crate::test_map_option3::closure); // arg #1 let args@2: (u32); // arg #2 let @3: &'_ (test_crate::test_map_option3::closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<(u32), u32> for test_crate::test_map_option3::closure}::call<'_>(move (@3), move (args@2)) return } @@ -1239,9 +1311,12 @@ fn {impl FnOnce<(u32), u32> for test_crate::test_map_option3::closure}::call_onc let @1: test_crate::test_map_option3::closure; // arg #1 let @2: (u32); // arg #2 let @3: &'_ mut (test_crate::test_map_option3::closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(u32), u32> for test_crate::test_map_option3::closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return @@ -1321,16 +1396,25 @@ pub fn test_regions<'a>(@1: &'a (u32)) -> u32 let @4: (&'_ (&'_ (u32))); // anonymous local let @5: &'_ (&'_ (u32)); // anonymous local let @6: &'_ (&'_ (u32)); // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local + let @9: (); // anonymous local storage_live(f@2) f@2 := test_crate::test_regions::closure { } storage_live(@3) - @3 := &f@2 + storage_live(@9) + @9 := () + @3 := &(f@2, move (@9)) storage_live(@4) storage_live(@5) storage_live(@6) - @6 := &x@1 - @5 := &*(@6) + storage_live(@8) + @8 := () + @6 := &(x@1, move (@8)) + storage_live(@7) + @7 := () + @5 := &(*(@6), move (@7)) @4 := (move (@5)) @0 := {impl Fn<(&'_ (&'_ (u32))), u32> for test_crate::test_regions::closure}::call<'_, '_>(move (@3), move (@4)) storage_dead(@5) @@ -1348,9 +1432,12 @@ fn {impl FnMut<(&'_ (&'_ (u32))), u32> for test_crate::test_regions::closure}::c let state@1: &'_1 mut (test_crate::test_regions::closure); // arg #1 let args@2: (&'_0 (&'_ (u32))); // arg #2 let @3: &'_ (test_crate::test_regions::closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<(&'_ (&'_ (u32))), u32> for test_crate::test_regions::closure}::call<'_0, '_>(move (@3), move (args@2)) return } @@ -1362,9 +1449,12 @@ fn {impl FnOnce<(&'_ (&'_ (u32))), u32> for test_crate::test_regions::closure}:: let @1: test_crate::test_regions::closure; // arg #1 let @2: (&'_ (&'_ (u32))); // arg #2 let @3: &'_ mut (test_crate::test_regions::closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(&'_ (&'_ (u32))), u32> for test_crate::test_regions::closure}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop] @1 return @@ -1423,9 +1513,12 @@ fn {impl FnMut<(&'_ (&'_ (u32))), u32> for test_crate::test_regions_casted::clos let state@1: &'_1 mut (test_crate::test_regions_casted::closure); // arg #1 let args@2: (&'_0 (&'_ (u32))); // arg #2 let @3: &'_ (test_crate::test_regions_casted::closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<(&'_ (&'_ (u32))), u32> for test_crate::test_regions_casted::closure}::call<'_0, '_>(move (@3), move (args@2)) return } @@ -1437,9 +1530,12 @@ fn {impl FnOnce<(&'_ (&'_ (u32))), u32> for test_crate::test_regions_casted::clo let @1: test_crate::test_regions_casted::closure; // arg #1 let @2: (&'_ (&'_ (u32))); // arg #2 let @3: &'_ mut (test_crate::test_regions_casted::closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(&'_ (&'_ (u32))), u32> for test_crate::test_regions_casted::closure}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop] @1 return @@ -1470,6 +1566,8 @@ pub fn test_regions_casted<'a>(@1: &'a (u32)) -> u32 let @4: fn<'_0>(&'_0_0 (&'_ (u32))) -> u32; // anonymous local let @5: &'_ (&'_ (u32)); // anonymous local let @6: &'_ (&'_ (u32)); // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local storage_live(f@2) storage_live(@3) @@ -1480,8 +1578,12 @@ pub fn test_regions_casted<'a>(@1: &'a (u32)) -> u32 @4 := copy (f@2) storage_live(@5) storage_live(@6) - @6 := &x@1 - @5 := &*(@6) + storage_live(@8) + @8 := () + @6 := &(x@1, move (@8)) + storage_live(@7) + @7 := () + @5 := &(*(@6), move (@7)) @0 := (move @4)(move (@5)) storage_dead(@5) storage_dead(@4) @@ -1573,19 +1675,31 @@ pub fn test_closure_capture(@1: u32, @2: u32) -> u32 let @6: &'_ (u32); // anonymous local let @7: &'_ (test_crate::test_closure_capture::closure<'_, '_>); // anonymous local let @8: (u32); // anonymous local + let @9: (); // anonymous local + let @10: (); // anonymous local + let @11: (); // anonymous local + let @12: (); // anonymous local storage_live(f@3) storage_live(@4) storage_live(@5) - @5 := &x@1 + storage_live(@12) + @12 := () + @5 := &(x@1, move (@12)) storage_live(@6) - @6 := &y@2 + storage_live(@11) + @11 := () + @6 := &(y@2, move (@11)) @4 := test_crate::test_closure_capture::closure { 0: move (@5), 1: move (@6) } storage_dead(@6) storage_dead(@5) - f@3 := &@4 + storage_live(@10) + @10 := () + f@3 := &(@4, move (@10)) storage_live(@7) - @7 := &*(f@3) + storage_live(@9) + @9 := () + @7 := &(*(f@3), move (@9)) storage_live(@8) @8 := (const (0 : u32)) @0 := {impl Fn<(u32), u32> for test_crate::test_closure_capture::closure<'_0, '_1>}::call<'_, '_, '_>(move (@7), move (@8)) @@ -1603,9 +1717,12 @@ fn {impl FnMut<(u32), u32> for test_crate::test_closure_capture::closure<'_0, '_ let state@1: &'_2 mut (test_crate::test_closure_capture::closure<'_0, '_1>); // arg #1 let args@2: (u32); // arg #2 let @3: &'_ (test_crate::test_closure_capture::closure<'_0, '_1>); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<(u32), u32> for test_crate::test_closure_capture::closure<'_0, '_1>}::call<'_0, '_1, '_>(move (@3), move (args@2)) return } @@ -1617,9 +1734,12 @@ fn {impl FnOnce<(u32), u32> for test_crate::test_closure_capture::closure<'_0, ' let @1: test_crate::test_closure_capture::closure<'_0, '_1>; // arg #1 let @2: (u32); // arg #2 let @3: &'_ mut (test_crate::test_closure_capture::closure<'_0, '_1>); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(u32), u32> for test_crate::test_closure_capture::closure<'_0, '_1>}::call_mut<'_0, '_1, '_>(move (@3), move (@2)) drop[Drop>] @1 return @@ -1672,11 +1792,14 @@ where let tupled_args@2: (T); // arg #2 let x@3: T; // local let @4: &'_ (T); // anonymous local + let @5: (); // anonymous local storage_live(x@3) x@3 := move ((tupled_args@2).0) storage_live(@4) - @4 := &x@3 + storage_live(@5) + @5 := () + @4 := &(x@3, move (@5)) @0 := @TraitClause1::clone<'_>(move (@4)) storage_dead(@4) drop[Drop] x@3 @@ -1696,13 +1819,19 @@ where let @4: &'_ (test_crate::test_closure_clone::closure[@TraitClause0, @TraitClause1]); // anonymous local let @5: (T); // anonymous local let @6: T; // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local storage_live(f@2) f@2 := test_crate::test_closure_clone::closure { } storage_live(@3) storage_live(@4) - @4 := &f@2 - @3 := &*(@4) + storage_live(@8) + @8 := () + @4 := &(f@2, move (@8)) + storage_live(@7) + @7 := () + @3 := &(*(@4), move (@7)) storage_live(@5) storage_live(@6) @6 := move (x@1) @@ -1728,9 +1857,12 @@ where let state@1: &'_0 mut (test_crate::test_closure_clone::closure[@TraitClause0, @TraitClause1]); // arg #1 let args@2: (T); // arg #2 let @3: &'_ (test_crate::test_closure_clone::closure[@TraitClause0, @TraitClause1]); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<(T), T> for test_crate::test_closure_clone::closure[@TraitClause0, @TraitClause1]}::call<'_, T>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) return } @@ -1745,9 +1877,12 @@ where let @1: test_crate::test_closure_clone::closure[@TraitClause0, @TraitClause1]; // arg #1 let @2: (T); // arg #2 let @3: &'_ mut (test_crate::test_closure_clone::closure[@TraitClause0, @TraitClause1]); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(T), T> for test_crate::test_closure_clone::closure[@TraitClause0, @TraitClause1]}::call_mut<'_, T>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0, @TraitClause1]>] @1 return @@ -1818,9 +1953,12 @@ fn {impl FnOnce<(i32), i32> for test_crate::test_array_map::closure}::call_once( let @1: test_crate::test_array_map::closure; // arg #1 let @2: (i32); // arg #2 let @3: &'_ mut (test_crate::test_array_map::closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(i32), i32> for test_crate::test_array_map::closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return @@ -1904,24 +2042,36 @@ fn test_fnmut_with_ref() let @7: &'_ (usize); // anonymous local let @8: &'_ (usize); // anonymous local let @9: usize; // anonymous local + let @10: (); // anonymous local + let @11: (); // anonymous local + let @12: (); // anonymous local + let @13: (); // anonymous local storage_live(sum@1) sum@1 := const (0 : usize) storage_live(closure@2) storage_live(@3) - @3 := &mut sum@1 + storage_live(@13) + @13 := () + @3 := &mut (sum@1, move (@13)) closure@2 := test_crate::test_fnmut_with_ref::closure { 0: move (@3) } storage_dead(@3) storage_live(@4) storage_live(@5) - @5 := &mut closure@2 + storage_live(@12) + @12 := () + @5 := &mut (closure@2, move (@12)) storage_live(@6) storage_live(@7) storage_live(@8) storage_live(@9) @9 := const (15 : usize) - @8 := &@9 - @7 := &*(@8) + storage_live(@11) + @11 := () + @8 := &(@9, move (@11)) + storage_live(@10) + @10 := () + @7 := &(*(@8), move (@10)) @6 := (move (@7)) @4 := {impl FnMut<(&'_ (usize)), ()> for test_crate::test_fnmut_with_ref::closure<'_0>}::call_mut<'_, '_, '_>(move (@5), move (@6)) storage_dead(@7) @@ -1944,9 +2094,12 @@ fn {impl FnOnce<(&'_ (usize)), ()> for test_crate::test_fnmut_with_ref::closure< let @1: test_crate::test_fnmut_with_ref::closure<'_0>; // arg #1 let @2: (&'_ (usize)); // arg #2 let @3: &'_ mut (test_crate::test_fnmut_with_ref::closure<'_0>); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(&'_ (usize)), ()> for test_crate::test_fnmut_with_ref::closure<'_0>}::call_mut<'_0, '_1, '_>(move (@3), move (@2)) drop[Drop>] @1 @0 := () diff --git a/charon/tests/ui/closures_with_where.out b/charon/tests/ui/closures_with_where.out index 25ee8b690..c7c3715cc 100644 --- a/charon/tests/ui/closures_with_where.out +++ b/charon/tests/ui/closures_with_where.out @@ -126,9 +126,12 @@ where let @1: closure[@TraitClause0, @TraitClause1]; // arg #1 let @2: (usize); // arg #2 let @3: &'_ mut (closure[@TraitClause0, @TraitClause1]); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(usize)> for closure[@TraitClause0, @TraitClause1]}::call_mut<'_, T, const K : usize>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0, @TraitClause1]>] @1 return diff --git a/charon/tests/ui/comments.out b/charon/tests/ui/comments.out index ace98cb42..b5b4fb48a 100644 --- a/charon/tests/ui/comments.out +++ b/charon/tests/ui/comments.out @@ -120,8 +120,10 @@ pub fn sum<'_0>(@1: &'_0 (Slice)) -> u32 let @24: u32; // anonymous local let @25: u32; // anonymous local let @26: u32; // anonymous local - let @27: &'_ (Slice); // anonymous local - let @28: &'_ (u32); // anonymous local + let @27: usize; // anonymous local + let @28: usize; // anonymous local + let @29: &'_ (Slice); // anonymous local + let @30: &'_ (u32); // anonymous local storage_live(@7) storage_live(@12) @@ -134,6 +136,8 @@ pub fn sum<'_0>(@1: &'_0 (Slice)) -> u32 storage_live(@26) storage_live(@27) storage_live(@28) + storage_live(@29) + storage_live(@30) storage_live(sum@2) // `let sum` sum@2 := const (0 : u32) @@ -161,7 +165,9 @@ pub fn sum<'_0>(@1: &'_0 (Slice)) -> u32 @10 := copy (i@3) storage_live(@11) storage_live(@12) - @12 := &*(s@1) + storage_live(@27) + @27 := ptr_metadata(copy (s@1)) + @12 := &(*(s@1), move (@27)) @11 := len<'_, u32>[Sized](move (@12)) storage_dead(@12) @9 := move (@10) < move (@11) @@ -176,11 +182,13 @@ pub fn sum<'_0>(@1: &'_0 (Slice)) -> u32 storage_live(@14) // Add to running sum @14 := copy (i@3) - storage_live(@27) - @27 := &*(s@1) storage_live(@28) - @28 := @SliceIndexShared<'_, u32>(move (@27), copy (@14)) - @13 := copy (*(@28)) + @28 := ptr_metadata(copy (s@1)) + storage_live(@29) + @29 := &(*(s@1), move (@28)) + storage_live(@30) + @30 := @SliceIndexShared<'_, u32>(move (@29), copy (@14)) + @13 := copy (*(@30)) @15 := copy (sum@2) panic.+ copy (@13) sum@2 := move (@15) storage_dead(@13) @@ -350,8 +358,15 @@ fn foo() let @31: &'_ (u32); // anonymous local let @32: &'_ (u32); // anonymous local let @33: Option>[Sized>]; // anonymous local - let @34: &'_ (Array); // anonymous local - let @35: &'_ (u32); // anonymous local + let @34: (); // anonymous local + let @35: (); // anonymous local + let @36: (); // anonymous local + let @37: (); // anonymous local + let @38: (); // anonymous local + let @39: (); // anonymous local + let @40: (); // anonymous local + let @41: &'_ (Array); // anonymous local + let @42: &'_ (u32); // anonymous local storage_live(kind@27) storage_live(@28) @@ -360,6 +375,10 @@ fn foo() storage_live(@31) storage_live(@32) storage_live(@33) + storage_live(@36) + storage_live(@37) + storage_live(@38) + storage_live(@39) storage_live(@3) // Call `default` and destructure the result @3 := {impl Default for Foo}::default() @@ -413,15 +432,21 @@ fn foo() storage_live(@19) // `assert_eq` @19 := const (9 : usize) - storage_live(@34) - @34 := &a@15 storage_live(@35) - @35 := @ArrayIndexShared<'_, u32, 10 : usize>(move (@34), copy (@19)) - @18 := &*(@35) + @35 := () + storage_live(@40) + @40 := () + storage_live(@41) + @41 := &(a@15, move (@40)) + storage_live(@42) + @42 := @ArrayIndexShared<'_, u32, 10 : usize>(move (@41), copy (@19)) + @18 := &(*(@42), move (@35)) storage_live(@20) storage_live(@21) @21 := const (9 : u32) - @20 := &@21 + storage_live(@34) + @34 := () + @20 := &(@21, move (@34)) @17 := (move (@18), move (@20)) storage_dead(@20) storage_dead(@18) @@ -446,12 +471,20 @@ fn foo() @28 := move (kind@27) storage_live(@29) storage_live(@30) - @30 := &*(left_val@22) - @29 := &*(@30) + storage_live(@39) + @39 := () + @30 := &(*(left_val@22), move (@39)) + storage_live(@38) + @38 := () + @29 := &(*(@30), move (@38)) storage_live(@31) storage_live(@32) - @32 := &*(right_val@23) - @31 := &*(@32) + storage_live(@37) + @37 := () + @32 := &(*(right_val@23), move (@37)) + storage_live(@36) + @36 := () + @31 := &(*(@32), move (@36)) storage_live(@33) @33 := Option::None { } panic(core::panicking::assert_failed) diff --git a/charon/tests/ui/constants.out b/charon/tests/ui/constants.out index 5c7a90ebf..0eaf38534 100644 --- a/charon/tests/ui/constants.out +++ b/charon/tests/ui/constants.out @@ -374,13 +374,16 @@ pub fn S2() -> u32 let @0: u32; // return let @1: u32; // anonymous local let @2: &'_ (u32); // anonymous local - let @3: &'_ (u32); // anonymous local + let @3: (); // anonymous local + let @4: &'_ (u32); // anonymous local storage_live(@3) + storage_live(@4) storage_live(@1) storage_live(@2) - @3 := &S1 - @2 := move (@3) + @3 := () + @4 := &(S1, move (@3)) + @2 := move (@4) @1 := copy (*(@2)) @0 := incr(move (@1)) storage_dead(@2) diff --git a/charon/tests/ui/copy_nonoverlapping.out b/charon/tests/ui/copy_nonoverlapping.out index 70b60c550..1bd51cedc 100644 --- a/charon/tests/ui/copy_nonoverlapping.out +++ b/charon/tests/ui/copy_nonoverlapping.out @@ -72,12 +72,18 @@ where let @3: (); // anonymous local let @4: *const T; // anonymous local let @5: *mut T; // anonymous local + let @6: (); // anonymous local + let @7: (); // anonymous local storage_live(@3) storage_live(@4) - @4 := &raw const *(y@2) + storage_live(@7) + @7 := () + @4 := &raw const (*(y@2), move (@7)) storage_live(@5) - @5 := &raw mut *(x@1) + storage_live(@6) + @6 := () + @5 := &raw mut (*(x@1), move (@6)) @3 := copy_nonoverlapping[@TraitClause0](move (@4), move (@5), const (1 : usize)) storage_dead(@5) storage_dead(@4) diff --git a/charon/tests/ui/cross_compile_32_bit.out b/charon/tests/ui/cross_compile_32_bit.out index 122064a40..e31e4a7e9 100644 --- a/charon/tests/ui/cross_compile_32_bit.out +++ b/charon/tests/ui/cross_compile_32_bit.out @@ -32,6 +32,7 @@ fn main() let a@7: HasPointerNiche; // local let @8: NonNull; // anonymous local let @9: *mut usize; // anonymous local + let @10: (); // anonymous local storage_live(@6) storage_live(x@1) @@ -50,7 +51,9 @@ fn main() storage_live(a@7) storage_live(@8) storage_live(@9) - @9 := &raw mut x@1 + storage_live(@10) + @10 := () + @9 := &raw mut (x@1, move (@10)) @8 := new_unchecked(move (@9)) storage_dead(@9) a@7 := HasPointerNiche::Second { 0: move (@8) } diff --git a/charon/tests/ui/demo.out b/charon/tests/ui/demo.out index 90e4b2c36..f04112ad8 100644 --- a/charon/tests/ui/demo.out +++ b/charon/tests/ui/demo.out @@ -29,24 +29,42 @@ where let @5: &'_ mut (T); // anonymous local let @6: bool; // anonymous local let @7: &'_ mut (T); // anonymous local + let @8: (); // anonymous local + let @9: (); // anonymous local + let @10: (); // anonymous local + let @11: (); // anonymous local + let @12: (); // anonymous local storage_live(@7) + storage_live(@8) + storage_live(@9) + storage_live(@10) storage_live(@4) storage_live(@5) storage_live(@6) @6 := copy (b@1) if move (@6) { storage_live(@7) - @7 := &mut *(x@2) - @5 := &mut *(@7) + storage_live(@9) + @9 := () + @7 := &mut (*(x@2), move (@9)) + storage_live(@8) + @8 := () + @5 := &mut (*(@7), move (@8)) storage_dead(@7) } else { - @5 := &mut *(y@3) + storage_live(@10) + @10 := () + @5 := &mut (*(y@3), move (@10)) } - @4 := &mut *(@5) + storage_live(@12) + @12 := () + @4 := &mut (*(@5), move (@12)) storage_dead(@6) - @0 := &mut *(@4) + storage_live(@11) + @11 := () + @0 := &mut (*(@4), move (@11)) storage_dead(@5) storage_dead(@4) return @@ -134,14 +152,24 @@ pub fn use_incr() let @8: (); // anonymous local let @9: &'_ mut (u32); // anonymous local let @10: &'_ mut (u32); // anonymous local + let @11: (); // anonymous local + let @12: (); // anonymous local + let @13: (); // anonymous local + let @14: (); // anonymous local + let @15: (); // anonymous local + let @16: (); // anonymous local storage_live(x@1) x@1 := const (0 : u32) storage_live(@2) storage_live(@3) storage_live(@4) - @4 := &mut x@1 - @3 := &two-phase-mut *(@4) + storage_live(@12) + @12 := () + @4 := &mut (x@1, move (@12)) + storage_live(@11) + @11 := () + @3 := &two-phase-mut (*(@4), move (@11)) @2 := test_crate::incr<'_>(move (@3)) storage_dead(@3) storage_dead(@4) @@ -149,8 +177,12 @@ pub fn use_incr() storage_live(@5) storage_live(@6) storage_live(@7) - @7 := &mut x@1 - @6 := &two-phase-mut *(@7) + storage_live(@14) + @14 := () + @7 := &mut (x@1, move (@14)) + storage_live(@13) + @13 := () + @6 := &two-phase-mut (*(@7), move (@13)) @5 := test_crate::incr<'_>(move (@6)) storage_dead(@6) storage_dead(@7) @@ -158,8 +190,12 @@ pub fn use_incr() storage_live(@8) storage_live(@9) storage_live(@10) - @10 := &mut x@1 - @9 := &two-phase-mut *(@10) + storage_live(@16) + @16 := () + @10 := &mut (x@1, move (@16)) + storage_live(@15) + @15 := () + @9 := &two-phase-mut (*(@10), move (@15)) @8 := test_crate::incr<'_>(move (@9)) storage_dead(@9) storage_dead(@10) @@ -196,12 +232,20 @@ where let @9: u32; // anonymous local let @10: u32; // anonymous local let @11: u32; // anonymous local + let @12: (); // anonymous local + let @13: (); // anonymous local + let @14: (); // anonymous local + let @15: (); // anonymous local + let @16: (); // anonymous local storage_live(@7) storage_live(@8) storage_live(@9) storage_live(@10) storage_live(@11) + storage_live(@14) + storage_live(@15) + storage_live(@16) match *(l@1) { CList::CCons => { }, @@ -210,22 +254,30 @@ where }, } storage_live(x@3) - x@3 := &(*(l@1) as variant CList::CCons).0 + storage_live(@13) + @13 := () + x@3 := &((*(l@1) as variant CList::CCons).0, move (@13)) storage_live(tl@4) - tl@4 := &(*(l@1) as variant CList::CCons).1 + storage_live(@12) + @12 := () + tl@4 := &((*(l@1) as variant CList::CCons).1, move (@12)) storage_live(@5) storage_live(@6) @6 := copy (i@2) @5 := move (@6) == const (0 : u32) if move (@5) { storage_dead(@6) - @0 := &*(x@3) + storage_live(@14) + @14 := () + @0 := &(*(x@3), move (@14)) } else { storage_dead(@6) storage_live(@7) storage_live(@8) - @8 := &*(*(tl@4)) + storage_live(@15) + @15 := () + @8 := &(*(*(tl@4)), move (@15)) storage_live(@9) storage_live(@10) @10 := copy (i@2) @@ -233,7 +285,9 @@ where @9 := move (@11) storage_dead(@10) @7 := list_nth<'_, T>[@TraitClause0](move (@8), move (@9)) - @0 := &*(@7) + storage_live(@16) + @16 := () + @0 := &(*(@7), move (@16)) storage_dead(@9) storage_dead(@8) storage_dead(@7) @@ -266,6 +320,16 @@ where let @14: u32; // anonymous local let @15: u32; // anonymous local let @16: u32; // anonymous local + let @17: (); // anonymous local + let @18: (); // anonymous local + let @19: (); // anonymous local + let @20: (); // anonymous local + let @21: (); // anonymous local + let @22: (); // anonymous local + let @23: (); // anonymous local + let @24: (); // anonymous local + let @25: (); // anonymous local + let @26: (); // anonymous local storage_live(@11) storage_live(@12) @@ -273,6 +337,10 @@ where storage_live(@14) storage_live(@15) storage_live(@16) + storage_live(@19) + storage_live(@20) + storage_live(@21) + storage_live(@26) storage_live(@3) storage_live(@4) match *(l@1) { @@ -283,9 +351,13 @@ where }, } storage_live(x@5) - x@5 := &mut (*(l@1) as variant CList::CCons).0 + storage_live(@18) + @18 := () + x@5 := &mut ((*(l@1) as variant CList::CCons).0, move (@18)) storage_live(tl@6) - tl@6 := &mut (*(l@1) as variant CList::CCons).1 + storage_live(@17) + @17 := () + tl@6 := &mut ((*(l@1) as variant CList::CCons).1, move (@17)) storage_live(@7) storage_live(@8) storage_live(@9) @@ -295,15 +367,21 @@ where if move (@9) { storage_dead(@10) storage_live(@11) - @11 := &mut *(x@5) - @8 := &mut *(@11) + storage_live(@20) + @20 := () + @11 := &mut (*(x@5), move (@20)) + storage_live(@19) + @19 := () + @8 := &mut (*(@11), move (@19)) storage_dead(@11) } else { storage_dead(@10) storage_live(@12) storage_live(@13) - @13 := &two-phase-mut *(*(tl@6)) + storage_live(@21) + @21 := () + @13 := &two-phase-mut (*(*(tl@6)), move (@21)) storage_live(@14) storage_live(@15) @15 := copy (i@2) @@ -311,20 +389,30 @@ where @14 := move (@16) storage_dead(@15) @12 := list_nth_mut<'_, T>[@TraitClause0](move (@13), move (@14)) - @8 := &mut *(@12) + storage_live(@26) + @26 := () + @8 := &mut (*(@12), move (@26)) storage_dead(@14) storage_dead(@13) storage_dead(@12) } - @7 := &mut *(@8) + storage_live(@25) + @25 := () + @7 := &mut (*(@8), move (@25)) storage_dead(@9) - @4 := &mut *(@7) + storage_live(@24) + @24 := () + @4 := &mut (*(@7), move (@24)) storage_dead(@8) storage_dead(@7) storage_dead(tl@6) storage_dead(x@5) - @3 := &mut *(@4) - @0 := &mut *(@3) + storage_live(@23) + @23 := () + @3 := &mut (*(@4), move (@23)) + storage_live(@22) + @22 := () + @0 := &mut (*(@3), move (@22)) storage_dead(@4) storage_dead(@3) return @@ -347,6 +435,10 @@ where let @9: u32; // anonymous local let @10: &'_ mut (CList[@TraitClause0]); // anonymous local let @11: (); // anonymous local + let @12: (); // anonymous local + let @13: (); // anonymous local + let @14: (); // anonymous local + let @15: (); // anonymous local storage_live(x@4) storage_live(tl@5) @@ -356,14 +448,22 @@ where storage_live(@9) storage_live(@10) storage_live(@11) + storage_live(@12) + storage_live(@13) + storage_live(@14) + storage_live(@15) storage_live(@3) loop { match *(l@1) { CList::CCons => { storage_live(x@4) - x@4 := &mut (*(l@1) as variant CList::CCons).0 + storage_live(@13) + @13 := () + x@4 := &mut ((*(l@1) as variant CList::CCons).0, move (@13)) storage_live(tl@5) - tl@5 := &mut (*(l@1) as variant CList::CCons).1 + storage_live(@12) + @12 := () + tl@5 := &mut ((*(l@1) as variant CList::CCons).1, move (@12)) storage_live(@6) storage_live(@7) storage_live(@8) @@ -378,7 +478,9 @@ where @9 := copy (i@2) panic.- const (1 : u32) i@2 := move (@9) storage_live(@10) - @10 := &mut *(*(tl@5)) + storage_live(@15) + @15 := () + @10 := &mut (*(*(tl@5)), move (@15)) l@1 := move (@10) storage_dead(@10) storage_dead(tl@5) @@ -386,7 +488,9 @@ where continue 0 } storage_dead(@8) - @0 := &mut *(x@4) + storage_live(@14) + @14 := () + @0 := &mut (*(x@4), move (@14)) storage_dead(@7) storage_dead(@6) storage_dead(tl@5) @@ -461,21 +565,35 @@ where let tl@4: &'_ mut (alloc::boxed::Box[@TraitClause0]>[MetaSized[@TraitClause0]>, Sized]); // local let @5: &'_ mut (CList[@TraitClause0]); // anonymous local let @6: &'_ mut (CList[@TraitClause0]); // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local + let @9: (); // anonymous local + let @10: (); // anonymous local + let @11: (); // anonymous local storage_live(tl@4) storage_live(@5) storage_live(@6) + storage_live(@7) + storage_live(@8) + storage_live(@11) storage_live(@2) storage_live(@3) match *(l@1) { CList::CCons => { storage_live(tl@4) - tl@4 := &mut (*(l@1) as variant CList::CCons).1 + storage_live(@8) + @8 := () + tl@4 := &mut ((*(l@1) as variant CList::CCons).1, move (@8)) storage_live(@5) storage_live(@6) - @6 := &two-phase-mut *(*(tl@4)) + storage_live(@7) + @7 := () + @6 := &two-phase-mut (*(*(tl@4)), move (@7)) @5 := list_tail<'_, T>[@TraitClause0](move (@6)) - @3 := &mut *(@5) + storage_live(@11) + @11 := () + @3 := &mut (*(@5), move (@11)) storage_dead(@6) storage_dead(@5) storage_dead(tl@4) @@ -484,8 +602,12 @@ where @3 := move (l@1) }, } - @2 := &mut *(@3) - @0 := &mut *(@2) + storage_live(@10) + @10 := () + @2 := &mut (*(@3), move (@10)) + storage_live(@9) + @9 := () + @0 := &mut (*(@2), move (@9)) storage_dead(@3) storage_dead(@2) return @@ -537,9 +659,12 @@ where let @0: usize; // return let cnt@1: &'_ mut (T); // arg #1 let @2: &'_ mut (T); // anonymous local + let @3: (); // anonymous local storage_live(@2) - @2 := &two-phase-mut *(cnt@1) + storage_live(@3) + @3 := () + @2 := &two-phase-mut (*(cnt@1), move (@3)) @0 := @TraitClause1::incr<'_>(move (@2)) storage_dead(@2) return diff --git a/charon/tests/ui/dictionary_passing_style_woes.out b/charon/tests/ui/dictionary_passing_style_woes.out index 60ad2b1f2..5f4deea98 100644 --- a/charon/tests/ui/dictionary_passing_style_woes.out +++ b/charon/tests/ui/dictionary_passing_style_woes.out @@ -161,9 +161,12 @@ where let @0: Clause1_Clause1_Assoc; // return let x@1: T; // arg #1 let @2: &'_ (T); // anonymous local + let @3: (); // anonymous local storage_live(@2) - @2 := &x@1 + storage_live(@3) + @3 := () + @2 := &(x@1, move (@3)) @0 := @TraitClause1::parent_clause1::method<'_>(move (@2)) storage_dead(@2) drop[Drop] x@1 @@ -179,9 +182,12 @@ where let @0: Clause1_Clause1_Assoc; // return let x@1: T; // arg #1 let @2: &'_ (T); // anonymous local + let @3: (); // anonymous local storage_live(@2) - @2 := &x@1 + storage_live(@3) + @3 := () + @2 := &(x@1, move (@3)) @0 := @TraitClause1::parent_clause1::method<'_>(move (@2)) storage_dead(@2) drop[Drop] x@1 diff --git a/charon/tests/ui/dyn-trait.out b/charon/tests/ui/dyn-trait.out index c113a4024..fa4764c4d 100644 --- a/charon/tests/ui/dyn-trait.out +++ b/charon/tests/ui/dyn-trait.out @@ -199,9 +199,12 @@ fn destruct<'_0>(@1: &'_0 ((dyn exists<_dyn> [@TraitClause0]: Display<_dyn> + _d let @0: String; // return let x@1: &'_ ((dyn exists<_dyn> [@TraitClause0]: Display<_dyn> + _dyn : '_)); // arg #1 let @2: &'_ ((dyn exists<_dyn> [@TraitClause0]: Display<_dyn> + _dyn : '_)); // anonymous local + let @3: &'static (core::fmt::Display::{vtable}); // anonymous local storage_live(@2) - @2 := &*(x@1) + storage_live(@3) + @3 := ptr_metadata(copy (x@1)) + @2 := &(*(x@1), move (@3)) @0 := {impl ToString for T}::to_string<'_, (dyn exists<_dyn> [@TraitClause0]: Display<_dyn> + _dyn : '_)>[MetaSized<(dyn exists<_dyn> [@TraitClause0]: Display<_dyn> + _dyn : '_)>, Display<(dyn exists<_dyn> [@TraitClause0]: Display<_dyn> + _dyn : '_)>](move (@2)) storage_dead(@2) return diff --git a/charon/tests/ui/dyn-with-diamond-supertraits.out b/charon/tests/ui/dyn-with-diamond-supertraits.out index cd74f1daa..ae7c6c623 100644 --- a/charon/tests/ui/dyn-with-diamond-supertraits.out +++ b/charon/tests/ui/dyn-with-diamond-supertraits.out @@ -221,6 +221,8 @@ fn {impl Right for i32}::right_method<'_0>(@1: &'_0 (i32)) -> i32 let @9: i32; // anonymous local let @10: &'_ (i32); // anonymous local let @11: i32; // anonymous local + let @12: (); // anonymous local + let @13: (); // anonymous local storage_live(@5) storage_live(@8) @@ -234,7 +236,9 @@ fn {impl Right for i32}::right_method<'_0>(@1: &'_0 (i32)) -> i32 storage_dead(@4) storage_live(@6) storage_live(@7) - @7 := &*(self@1) + storage_live(@12) + @12 := () + @7 := &(*(self@1), move (@12)) @6 := {impl Internal for i32}::internal_method<'_>(move (@7)) storage_dead(@7) @8 := copy (@3) panic.+ copy (@6) @@ -243,7 +247,9 @@ fn {impl Right for i32}::right_method<'_0>(@1: &'_0 (i32)) -> i32 storage_dead(@3) storage_live(@9) storage_live(@10) - @10 := &*(self@1) + storage_live(@13) + @13 := () + @10 := &(*(self@1), move (@13)) @9 := {impl Super for i32}::super_method<'_>(move (@10), const (10 : i32)) storage_dead(@10) @11 := copy (@2) panic.+ copy (@9) @@ -274,15 +280,21 @@ fn {impl Join for i32}::join_method<'_0>(@1: &'_0 (i32)) -> (i32, i32) let @3: &'_ (i32); // anonymous local let @4: i32; // anonymous local let @5: &'_ (i32); // anonymous local + let @6: (); // anonymous local + let @7: (); // anonymous local storage_live(@2) storage_live(@3) - @3 := &*(self@1) + storage_live(@6) + @6 := () + @3 := &(*(self@1), move (@6)) @2 := {impl Left for i32}::left_method<'_>(move (@3)) storage_dead(@3) storage_live(@4) storage_live(@5) - @5 := &*(self@1) + storage_live(@7) + @7 := () + @5 := &(*(self@1), move (@7)) @4 := {impl Right for i32}::right_method<'_>(move (@5)) storage_dead(@5) @0 := (move (@2), move (@4)) @@ -295,14 +307,20 @@ fn {impl Join for i32}::join_method<'_0>(@1: &'_0 (i32)) -> (i32, i32) fn {impl Join for i32}::{vtable}() -> test_crate::Join::{vtable} { let ret@0: test_crate::Join::{vtable}; // return - let @1: &'static (test_crate::Left::{vtable} [@TraitClause0]: Join<_dyn, i32> + _dyn : '_ + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause2::Right = i32 + @TraitClause1_0::parent_clause1::Left = i32), i32>::parent_clause1::Left, Join<(dyn exists<_dyn> [@TraitClause0]: Join<_dyn, i32> + _dyn : '_ + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause2::Right = i32 + @TraitClause1_0::parent_clause1::Left = i32), i32>::parent_clause1::parent_clause1::Internal>); // anonymous local - let @2: &'static (test_crate::Right::{vtable} [@TraitClause0]: Join<_dyn, i32> + _dyn : '_ + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause2::Right = i32 + @TraitClause1_0::parent_clause1::Left = i32), i32>::parent_clause2::Right, Join<(dyn exists<_dyn> [@TraitClause0]: Join<_dyn, i32> + _dyn : '_ + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause2::Right = i32 + @TraitClause1_0::parent_clause1::Left = i32), i32>::parent_clause1::parent_clause1::Internal>); // anonymous local + let @1: (); // anonymous local + let @2: &'static (test_crate::Left::{vtable} [@TraitClause0]: Join<_dyn, i32> + _dyn : '_ + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause2::Right = i32 + @TraitClause1_0::parent_clause1::Left = i32), i32>::parent_clause1::Left, Join<(dyn exists<_dyn> [@TraitClause0]: Join<_dyn, i32> + _dyn : '_ + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause2::Right = i32 + @TraitClause1_0::parent_clause1::Left = i32), i32>::parent_clause1::parent_clause1::Internal>); // anonymous local + let @3: (); // anonymous local + let @4: &'static (test_crate::Right::{vtable} [@TraitClause0]: Join<_dyn, i32> + _dyn : '_ + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause2::Right = i32 + @TraitClause1_0::parent_clause1::Left = i32), i32>::parent_clause2::Right, Join<(dyn exists<_dyn> [@TraitClause0]: Join<_dyn, i32> + _dyn : '_ + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause2::Right = i32 + @TraitClause1_0::parent_clause1::Left = i32), i32>::parent_clause1::parent_clause1::Internal>); // anonymous local storage_live(@1) storage_live(@2) - @1 := &{impl Left for i32}::{vtable} - @2 := &{impl Right for i32}::{vtable} - ret@0 := test_crate::Join::{vtable} { size: const (Opaque(unknown size)), align: const (Opaque(unknown align)), drop: const (Opaque(unknown drop)), method_join_method: const ({impl Join for i32}::join_method), super_trait_0: const (Opaque(missing supertrait vtable)), super_trait_1: move (@1), super_trait_2: move (@2) } + storage_live(@3) + storage_live(@4) + @1 := () + @2 := &({impl Left for i32}::{vtable}, move (@1)) + @3 := () + @4 := &({impl Right for i32}::{vtable}, move (@3)) + ret@0 := test_crate::Join::{vtable} { size: const (Opaque(unknown size)), align: const (Opaque(unknown align)), drop: const (Opaque(unknown drop)), method_join_method: const ({impl Join for i32}::join_method), super_trait_0: const (Opaque(missing supertrait vtable)), super_trait_1: move (@2), super_trait_2: move (@4) } return } @@ -329,20 +347,29 @@ fn main() let @4: i32; // anonymous local let @5: (i32, i32); // anonymous local let @6: &'_ ((dyn exists<_dyn> [@TraitClause0]: Join<_dyn, i32> + _dyn : '_ + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause2::Right = i32 + @TraitClause1_0::parent_clause1::Left = i32)); // anonymous local + let @7: &'static (test_crate::Join::{vtable}); // anonymous local + let @8: (); // anonymous local + let @9: (); // anonymous local storage_live(v@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := const (97 : i32) - @3 := &@4 - @2 := &*(@3) + storage_live(@9) + @9 := () + @3 := &(@4, move (@9)) + storage_live(@8) + @8 := () + @2 := &(*(@3), move (@8)) v@1 := unsize_cast<&'_ (i32), &'_ ((dyn exists<_dyn> [@TraitClause0]: Join<_dyn, i32> + _dyn : '_ + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause2::Right = i32 + @TraitClause1_0::parent_clause1::Left = i32)), {impl Join for i32}>(move (@2)) storage_dead(@2) storage_dead(@3) storage_live(@5) storage_live(@6) - @6 := &*(v@1) + storage_live(@7) + @7 := ptr_metadata(copy (v@1)) + @6 := &(*(v@1), move (@7)) @5 := Join<(dyn exists<_dyn> [@TraitClause0]: Join<_dyn, i32> + _dyn : '_ + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause2::Right = i32 + @TraitClause1_0::parent_clause1::Left = i32), i32>::join_method<'_>(move (@6)) storage_dead(@6) storage_dead(@5) diff --git a/charon/tests/ui/external.out b/charon/tests/ui/external.out index 9c2bfe922..e8ffec531 100644 --- a/charon/tests/ui/external.out +++ b/charon/tests/ui/external.out @@ -227,11 +227,17 @@ where let y@2: &'_ mut (T); // arg #2 let @3: &'_ mut (T); // anonymous local let @4: &'_ mut (T); // anonymous local + let @5: (); // anonymous local + let @6: (); // anonymous local storage_live(@3) - @3 := &two-phase-mut *(x@1) + storage_live(@6) + @6 := () + @3 := &two-phase-mut (*(x@1), move (@6)) storage_live(@4) - @4 := &two-phase-mut *(y@2) + storage_live(@5) + @5 := () + @4 := &two-phase-mut (*(y@2), move (@5)) @0 := core::mem::swap<'_, '_, T>[@TraitClause0](move (@3), move (@4)) storage_dead(@4) storage_dead(@3) @@ -264,12 +270,15 @@ pub fn test_vec_push() let v@1: Vec[Sized, Sized]; // local let @2: (); // anonymous local let @3: &'_ mut (Vec[Sized, Sized]); // anonymous local + let @4: (); // anonymous local storage_live(v@1) v@1 := alloc::vec::{Vec[@TraitClause0, Sized]}::new[Sized]() storage_live(@2) storage_live(@3) - @3 := &two-phase-mut v@1 + storage_live(@4) + @4 := () + @3 := &two-phase-mut (v@1, move (@4)) @2 := push<'_, u32, Global>[Sized, Sized](move (@3), const (0 : u32)) storage_dead(@3) storage_dead(@2) @@ -286,9 +295,12 @@ pub fn use_get<'_0>(@1: &'_0 (Cell[MetaSized])) -> u32 let @0: u32; // return let rc@1: &'_ (Cell[MetaSized]); // arg #1 let @2: &'_ (Cell[MetaSized]); // anonymous local + let @3: (); // anonymous local storage_live(@2) - @2 := &*(rc@1) + storage_live(@3) + @3 := () + @2 := &(*(rc@1), move (@3)) @0 := get<'_, u32>[Sized, {impl Copy for u32}](move (@2)) storage_dead(@2) return @@ -302,11 +314,14 @@ pub fn incr<'_0>(@1: &'_0 mut (Cell[MetaSized])) let @2: &'_ mut (u32); // anonymous local let @3: &'_ mut (Cell[MetaSized]); // anonymous local let @4: u32; // anonymous local + let @5: (); // anonymous local storage_live(@4) storage_live(@2) storage_live(@3) - @3 := &two-phase-mut *(rc@1) + storage_live(@5) + @5 := () + @3 := &two-phase-mut (*(rc@1), move (@5)) @2 := get_mut<'_, u32>[MetaSized](move (@3)) storage_dead(@3) @4 := copy (*(@2)) panic.+ const (1 : u32) diff --git a/charon/tests/ui/gosim-demo.out b/charon/tests/ui/gosim-demo.out index 32bfecab0..351bad86c 100644 --- a/charon/tests/ui/gosim-demo.out +++ b/charon/tests/ui/gosim-demo.out @@ -518,6 +518,14 @@ where let @19: Array<&'_ (Str), 2 : usize>; // anonymous local let @20: &'_ (Array, 1 : usize>); // anonymous local let @21: &'_ (Array, 1 : usize>); // anonymous local + let @22: (); // anonymous local + let @23: (); // anonymous local + let @24: (); // anonymous local + let @25: (); // anonymous local + let @26: (); // anonymous local + let @27: (); // anonymous local + let @28: (); // anonymous local + let @29: (); // anonymous local storage_live(@7) storage_live(x@9) @@ -533,6 +541,14 @@ where storage_live(@19) storage_live(@20) storage_live(@21) + storage_live(@22) + storage_live(@23) + storage_live(@24) + storage_live(@25) + storage_live(@26) + storage_live(@27) + storage_live(@28) + storage_live(@29) storage_live(@2) storage_live(@3) @3 := copy (slice@1) @@ -545,8 +561,12 @@ where storage_live(@6) storage_live(@7) storage_live(@8) - @8 := &mut iter@4 - @7 := &two-phase-mut *(@8) + storage_live(@23) + @23 := () + @8 := &mut (iter@4, move (@23)) + storage_live(@22) + @22 := () + @7 := &two-phase-mut (*(@8), move (@22)) @6 := {impl Iterator for Iter<'a, T>[@TraitClause0]}::next<'_, '_, T>[@TraitClause0](move (@7)) storage_dead(@7) match @6 { @@ -563,8 +583,12 @@ where storage_live(@14) storage_live(@15) storage_live(@16) - @16 := &x@9 - @15 := &*(@16) + storage_live(@25) + @25 := () + @16 := &(x@9, move (@25)) + storage_live(@24) + @24 := () + @15 := &(*(@16), move (@24)) @14 := new_debug<'_, '_, &'_ (T)>[Sized<&'_ (T)>, {impl Debug for &'_0 (T)}<'_, T>[@TraitClause1]](move (@15)) storage_dead(@15) args@13 := [move (@14)] @@ -573,12 +597,20 @@ where storage_live(@18) storage_live(@19) @19 := [const ("- "), const ("\n")] - @18 := &@19 - @17 := &*(@18) + storage_live(@29) + @29 := () + @18 := &(@19, move (@29)) + storage_live(@28) + @28 := () + @17 := &(*(@18), move (@28)) storage_live(@20) storage_live(@21) - @21 := &args@13 - @20 := &*(@21) + storage_live(@27) + @27 := () + @21 := &(args@13, move (@27)) + storage_live(@26) + @26 := () + @20 := &(*(@21), move (@26)) @12 := new_v1<'_, 2 : usize, 1 : usize>(move (@17), move (@20)) storage_dead(@21) storage_dead(@20) @@ -618,6 +650,8 @@ fn main() let @3: &'_ (Array); // anonymous local let @4: &'_ (Array); // anonymous local let @5: Array; // anonymous local + let @6: (); // anonymous local + let @7: (); // anonymous local storage_live(@1) storage_live(@2) @@ -625,8 +659,12 @@ fn main() storage_live(@4) storage_live(@5) @5 := [const (0 : i32), const (1 : i32), const (2 : i32)] - @4 := &@5 - @3 := &*(@4) + storage_live(@7) + @7 := () + @4 := &(@5, move (@7)) + storage_live(@6) + @6 := () + @3 := &(*(@4), move (@6)) @2 := @ArrayToSliceShared<'_, i32, 3 : usize>(move (@3)) storage_dead(@3) @1 := debug_slice<'_, i32>[Sized, {impl Debug for i32}](move (@2)) diff --git a/charon/tests/ui/impl-trait.out b/charon/tests/ui/impl-trait.out index f61eaa900..07f7b5a05 100644 --- a/charon/tests/ui/impl-trait.out +++ b/charon/tests/ui/impl-trait.out @@ -116,12 +116,18 @@ pub fn {impl Foo for ()}::get_ty<'_0>(@1: &'_0 (())) -> &'_0 (u32) let self@1: &'_ (()); // arg #1 let @2: &'_ (u32); // anonymous local let @3: u32; // anonymous local + let @4: (); // anonymous local + let @5: (); // anonymous local storage_live(@2) storage_live(@3) @3 := const (42 : u32) - @2 := &@3 - @0 := &*(@2) + storage_live(@5) + @5 := () + @2 := &(@3, move (@5)) + storage_live(@4) + @4 := () + @0 := &(*(@2), move (@4)) storage_dead(@3) storage_dead(@2) return @@ -156,6 +162,8 @@ fn use_foo() let @3: &'_ (u32); // anonymous local let @4: &'_ (u32); // anonymous local let @5: &'_ (()); // anonymous local + let @6: (); // anonymous local + let @7: (); // anonymous local storage_live(foo@1) foo@1 := mk_foo() @@ -163,9 +171,13 @@ fn use_foo() storage_live(@3) storage_live(@4) storage_live(@5) - @5 := &foo@1 + storage_live(@6) + @6 := () + @5 := &(foo@1, move (@6)) @4 := {impl Foo for ()}::get_ty<'_>(move (@5)) - @3 := &*(@4) + storage_live(@7) + @7 := () + @3 := &(*(@4), move (@7)) storage_dead(@5) @2 := {impl Clone for u32}::clone<'_>(move (@3)) storage_dead(@3) @@ -233,6 +245,8 @@ where let @3: &'_ (@TraitClause1::parent_clause2::Type); // anonymous local let @4: &'_ (@TraitClause1::parent_clause2::Type); // anonymous local let @5: &'_ (@TraitClause1::); // anonymous local + let @6: (); // anonymous local + let @7: PtrMetadata<@TraitClause1::parent_clause2::Type>; // anonymous local storage_live(foo@1) foo@1 := @TraitClause1::make_foo() @@ -240,9 +254,13 @@ where storage_live(@3) storage_live(@4) storage_live(@5) - @5 := &foo@1 + storage_live(@6) + @6 := () + @5 := &(foo@1, move (@6)) @4 := @TraitClause1::parent_clause2::get_ty<'_>(move (@5)) - @3 := &*(@4) + storage_live(@7) + @7 := ptr_metadata(copy (@4)) + @3 := &(*(@4), move (@7)) storage_dead(@5) @2 := @TraitClause1::parent_clause2::parent_clause2::clone<'_>(move (@3)) storage_dead(@3) @@ -292,11 +310,14 @@ where let tupled_args@2: (&'_0 (U)); // arg #2 let x@3: &'_ (U); // local let @4: &'_ (U); // anonymous local + let @5: (); // anonymous local storage_live(x@3) x@3 := move ((tupled_args@2).0) storage_live(@4) - @4 := &*(x@3) + storage_live(@5) + @5 := () + @4 := &(*(x@3), move (@5)) @0 := WrapClone { 0: move (@4) } storage_dead(@4) return @@ -327,6 +348,8 @@ pub fn use_wrap() let @5: &'_ (u32); // anonymous local let @6: &'_ (u32); // anonymous local let @7: u32; // anonymous local + let @8: (); // anonymous local + let @9: (); // anonymous local storage_live(f@1) f@1 := wrap[Sized]() @@ -338,8 +361,12 @@ pub fn use_wrap() storage_live(@6) storage_live(@7) @7 := const (42 : u32) - @6 := &@7 - @5 := &*(@6) + storage_live(@9) + @9 := () + @6 := &(@7, move (@9)) + storage_live(@8) + @8 := () + @5 := &(*(@6), move (@8)) @4 := (move (@5)) @2 := {impl FnOnce<(&'_ (U))> for closure[@TraitClause0]}::call_once<'_, u32>[Sized](move (@3), move (@4)) storage_dead(@5) diff --git a/charon/tests/ui/issue-120-bare-discriminant-read.out b/charon/tests/ui/issue-120-bare-discriminant-read.out index 9ae0f000e..956e56ea3 100644 --- a/charon/tests/ui/issue-120-bare-discriminant-read.out +++ b/charon/tests/ui/issue-120-bare-discriminant-read.out @@ -58,9 +58,12 @@ where let @0: isize; // return let opt@1: &'_ (Option[@TraitClause0]); // arg #1 let @2: &'_ (Option[@TraitClause0]); // anonymous local + let @3: (); // anonymous local storage_live(@2) - @2 := &*(opt@1) + storage_live(@3) + @3 := () + @2 := &(*(opt@1), move (@3)) @0 := @discriminant(*(@2)) storage_dead(@2) return @@ -76,12 +79,18 @@ where let @2: isize; // anonymous local let @3: &'_ (Option[@TraitClause0]); // anonymous local let @4: &'_ (Option[@TraitClause0]); // anonymous local + let @5: (); // anonymous local + let @6: (); // anonymous local storage_live(@2) storage_live(@3) storage_live(@4) - @4 := &opt@1 - @3 := &*(@4) + storage_live(@6) + @6 := () + @4 := &(opt@1, move (@6)) + storage_live(@5) + @5 := () + @3 := &(*(@4), move (@5)) @2 := discriminant_value<'_, T>[@TraitClause0](move (@3)) storage_dead(@3) @0 := move (@2) != const (0 : isize) diff --git a/charon/tests/ui/issue-297-cfg.out b/charon/tests/ui/issue-297-cfg.out index f7cd8f1b1..22394989e 100644 --- a/charon/tests/ui/issue-297-cfg.out +++ b/charon/tests/ui/issue-297-cfg.out @@ -440,10 +440,12 @@ fn f1<'_0>(@1: &'_0 (Slice)) -> usize let @9: usize; // anonymous local let @10: usize; // anonymous local let @11: usize; // anonymous local - let @12: &'_ (Slice); // anonymous local - let @13: &'_ (u8); // anonymous local - let @14: &'_ (Slice); // anonymous local - let @15: &'_ (u8); // anonymous local + let @12: usize; // anonymous local + let @13: &'_ (Slice); // anonymous local + let @14: &'_ (u8); // anonymous local + let @15: usize; // anonymous local + let @16: &'_ (Slice); // anonymous local + let @17: &'_ (u8); // anonymous local storage_live(@8) storage_live(@9) @@ -451,6 +453,7 @@ fn f1<'_0>(@1: &'_0 (Slice)) -> usize storage_live(@11) storage_live(@12) storage_live(@13) + storage_live(@14) storage_live(sampled@2) sampled@2 := const (0 : usize) storage_live(@3) @@ -458,11 +461,13 @@ fn f1<'_0>(@1: &'_0 (Slice)) -> usize storage_live(@5) storage_live(@6) @6 := const (0 : usize) - storage_live(@14) - @14 := &*(a@1) storage_live(@15) - @15 := @SliceIndexShared<'_, u8>(move (@14), copy (@6)) - @5 := copy (*(@15)) + @15 := ptr_metadata(copy (a@1)) + storage_live(@16) + @16 := &(*(a@1), move (@15)) + storage_live(@17) + @17 := @SliceIndexShared<'_, u8>(move (@16), copy (@6)) + @5 := copy (*(@17)) @4 := move (@5) < const (42 : u8) if move (@4) { storage_dead(@6) @@ -472,10 +477,12 @@ fn f1<'_0>(@1: &'_0 (Slice)) -> usize storage_live(@9) @9 := const (1 : usize) storage_live(@12) - @12 := &*(a@1) + @12 := ptr_metadata(copy (a@1)) storage_live(@13) - @13 := @SliceIndexShared<'_, u8>(move (@12), copy (@9)) - @8 := copy (*(@13)) + @13 := &(*(a@1), move (@12)) + storage_live(@14) + @14 := @SliceIndexShared<'_, u8>(move (@13), copy (@9)) + @8 := copy (*(@14)) @7 := move (@8) < const (16 : u8) if move (@7) { storage_dead(@9) @@ -565,16 +572,26 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize let @45: i16; // anonymous local let @46: usize; // anonymous local let @47: usize; // anonymous local - let @48: &'_ mut (Slice); // anonymous local - let @49: &'_ mut (i16); // anonymous local - let @50: &'_ mut (Slice); // anonymous local - let @51: &'_ mut (i16); // anonymous local - let @52: &'_ (Slice); // anonymous local - let @53: &'_ (u8); // anonymous local - let @54: &'_ (Slice); // anonymous local - let @55: &'_ (u8); // anonymous local - let @56: &'_ (Slice); // anonymous local - let @57: &'_ (u8); // anonymous local + let @48: usize; // anonymous local + let @49: (); // anonymous local + let @50: (); // anonymous local + let @51: usize; // anonymous local + let @52: usize; // anonymous local + let @53: usize; // anonymous local + let @54: &'_ mut (Slice); // anonymous local + let @55: &'_ mut (i16); // anonymous local + let @56: usize; // anonymous local + let @57: &'_ mut (Slice); // anonymous local + let @58: &'_ mut (i16); // anonymous local + let @59: usize; // anonymous local + let @60: &'_ (Slice); // anonymous local + let @61: &'_ (u8); // anonymous local + let @62: usize; // anonymous local + let @63: &'_ (Slice); // anonymous local + let @64: &'_ (u8); // anonymous local + let @65: usize; // anonymous local + let @66: &'_ (Slice); // anonymous local + let @67: &'_ (u8); // anonymous local storage_live(@11) storage_live(bytes@13) @@ -612,7 +629,6 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@45) storage_live(@46) storage_live(@47) - storage_live(@48) storage_live(@49) storage_live(@50) storage_live(@51) @@ -622,13 +638,25 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@55) storage_live(@56) storage_live(@57) + storage_live(@58) + storage_live(@59) + storage_live(@60) + storage_live(@61) + storage_live(@62) + storage_live(@63) + storage_live(@64) + storage_live(@65) + storage_live(@66) + storage_live(@67) storage_live(sampled@3) sampled@3 := const (0 : usize) storage_live(@4) storage_live(@5) storage_live(@6) storage_live(@7) - @7 := &*(a@1) + storage_live(@48) + @48 := ptr_metadata(copy (a@1)) + @7 := &(*(a@1), move (@48)) @6 := chunks<'_, u8>[Sized](move (@7), const (3 : usize)) storage_dead(@7) @5 := {impl IntoIterator for I}::into_iter[Sized]>[Sized[Sized]>, {impl Iterator for Chunks<'a, T>[@TraitClause0]}<'_, u8>[Sized]](move (@6)) @@ -640,8 +668,12 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@10) storage_live(@11) storage_live(@12) - @12 := &mut iter@8 - @11 := &two-phase-mut *(@12) + storage_live(@50) + @50 := () + @12 := &mut (iter@8, move (@50)) + storage_live(@49) + @49 := () + @11 := &two-phase-mut (*(@12), move (@49)) @10 := {impl Iterator for Chunks<'a, T>[@TraitClause0]}::next<'_, '_, u8>[Sized](move (@11)) storage_dead(@11) match @10 { @@ -655,11 +687,13 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@15) storage_live(@16) @16 := const (0 : usize) - storage_live(@56) - @56 := &*(bytes@13) - storage_live(@57) - @57 := @SliceIndexShared<'_, u8>(move (@56), copy (@16)) - @15 := copy (*(@57)) + storage_live(@65) + @65 := ptr_metadata(copy (bytes@13)) + storage_live(@66) + @66 := &(*(bytes@13), move (@65)) + storage_live(@67) + @67 := @SliceIndexShared<'_, u8>(move (@66), copy (@16)) + @15 := copy (*(@67)) b1@14 := cast(move (@15)) storage_dead(@15) storage_dead(@16) @@ -667,11 +701,13 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@18) storage_live(@19) @19 := const (1 : usize) - storage_live(@54) - @54 := &*(bytes@13) - storage_live(@55) - @55 := @SliceIndexShared<'_, u8>(move (@54), copy (@19)) - @18 := copy (*(@55)) + storage_live(@62) + @62 := ptr_metadata(copy (bytes@13)) + storage_live(@63) + @63 := &(*(bytes@13), move (@62)) + storage_live(@64) + @64 := @SliceIndexShared<'_, u8>(move (@63), copy (@19)) + @18 := copy (*(@64)) b2@17 := cast(move (@18)) storage_dead(@18) storage_dead(@19) @@ -679,11 +715,13 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@21) storage_live(@22) @22 := const (2 : usize) - storage_live(@52) - @52 := &*(bytes@13) - storage_live(@53) - @53 := @SliceIndexShared<'_, u8>(move (@52), copy (@22)) - @21 := copy (*(@53)) + storage_live(@59) + @59 := ptr_metadata(copy (bytes@13)) + storage_live(@60) + @60 := &(*(bytes@13), move (@59)) + storage_live(@61) + @61 := @SliceIndexShared<'_, u8>(move (@60), copy (@22)) + @21 := copy (*(@61)) b3@20 := cast(move (@21)) storage_dead(@21) storage_dead(@22) @@ -732,11 +770,15 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize @38 := copy (d1@23) storage_live(@39) @39 := copy (sampled@3) - storage_live(@48) - @48 := &mut *(result@2) - storage_live(@49) - @49 := @SliceIndexMut<'_, i16>(move (@48), copy (@39)) - *(@49) := move (@38) + storage_live(@51) + @51 := ptr_metadata(copy (result@2)) + storage_live(@53) + @53 := ptr_metadata(copy (result@2)) + storage_live(@54) + @54 := &mut (*(result@2), move (@53)) + storage_live(@55) + @55 := @SliceIndexMut<'_, i16>(move (@54), copy (@39)) + *(@55) := move (@38) storage_dead(@38) storage_dead(@39) @40 := copy (sampled@3) panic.+ const (1 : usize) @@ -768,11 +810,15 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize @45 := copy (d2@28) storage_live(@46) @46 := copy (sampled@3) - storage_live(@50) - @50 := &mut *(result@2) - storage_live(@51) - @51 := @SliceIndexMut<'_, i16>(move (@50), copy (@46)) - *(@51) := move (@45) + storage_live(@52) + @52 := ptr_metadata(copy (result@2)) + storage_live(@56) + @56 := ptr_metadata(copy (result@2)) + storage_live(@57) + @57 := &mut (*(result@2), move (@56)) + storage_live(@58) + @58 := @SliceIndexMut<'_, i16>(move (@57), copy (@46)) + *(@58) := move (@45) storage_dead(@45) storage_dead(@46) @47 := copy (sampled@3) panic.+ const (1 : usize) diff --git a/charon/tests/ui/issue-320-slice-pattern.out b/charon/tests/ui/issue-320-slice-pattern.out index 5994175aa..230a274fb 100644 --- a/charon/tests/ui/issue-320-slice-pattern.out +++ b/charon/tests/ui/issue-320-slice-pattern.out @@ -8,33 +8,42 @@ fn slice_pat1() let _a@2: i32; // local let _b@3: Array; // local let _c@4: i32; // local - let @5: &'_ (Array); // anonymous local - let @6: &'_ (i32); // anonymous local - let @7: &'_ (Array); // anonymous local - let @8: &'_ (Slice); // anonymous local + let @5: (); // anonymous local + let @6: &'_ (Array); // anonymous local + let @7: &'_ (i32); // anonymous local + let @8: (); // anonymous local let @9: &'_ (Array); // anonymous local - let @10: &'_ (i32); // anonymous local + let @10: &'_ (Slice); // anonymous local + let @11: (); // anonymous local + let @12: &'_ (Array); // anonymous local + let @13: &'_ (i32); // anonymous local storage_live(array@1) array@1 := @ArrayRepeat<'_, i32, 4 : usize>(const (0 : i32)) storage_live(_a@2) - storage_live(@9) - @9 := &array@1 - storage_live(@10) - @10 := @ArrayIndexShared<'_, i32, 4 : usize>(move (@9), const (0 : usize)) - _a@2 := copy (*(@10)) + storage_live(@11) + @11 := () + storage_live(@12) + @12 := &(array@1, move (@11)) + storage_live(@13) + @13 := @ArrayIndexShared<'_, i32, 4 : usize>(move (@12), const (0 : usize)) + _a@2 := copy (*(@13)) storage_live(_b@3) - storage_live(@7) - @7 := &array@1 storage_live(@8) - @8 := @ArraySubSliceShared<'_, i32, 4 : usize>(move (@7), const (1 : usize), const (3 : usize)) - _b@3 := copy (*(@8)) + @8 := () + storage_live(@9) + @9 := &(array@1, move (@8)) + storage_live(@10) + @10 := @ArraySubSliceShared<'_, i32, 4 : usize>(move (@9), const (1 : usize), const (3 : usize)) + _b@3 := copy (*(@10)) storage_live(_c@4) storage_live(@5) - @5 := &array@1 + @5 := () storage_live(@6) - @6 := @ArrayIndexShared<'_, i32, 4 : usize>(move (@5), const (3 : usize)) - _c@4 := copy (*(@6)) + @6 := &(array@1, move (@5)) + storage_live(@7) + @7 := @ArrayIndexShared<'_, i32, 4 : usize>(move (@6), const (3 : usize)) + _c@4 := copy (*(@7)) @0 := () storage_dead(_c@4) storage_dead(_b@3) @@ -54,38 +63,62 @@ fn slice_pat2() let _a@4: &'_ (i32); // local let _b@5: &'_ (Array); // local let _c@6: &'_ (i32); // local - let @7: &'_ (Array); // anonymous local - let @8: &'_ (i32); // anonymous local - let @9: &'_ (Array); // anonymous local - let @10: &'_ (Slice); // anonymous local - let @11: &'_ (Array); // anonymous local - let @12: &'_ (i32); // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local + let @9: (); // anonymous local + let @10: (); // anonymous local + let @11: (); // anonymous local + let @12: (); // anonymous local + let @13: &'_ (Array); // anonymous local + let @14: &'_ (i32); // anonymous local + let @15: (); // anonymous local + let @16: &'_ (Array); // anonymous local + let @17: &'_ (Slice); // anonymous local + let @18: (); // anonymous local + let @19: &'_ (Array); // anonymous local + let @20: &'_ (i32); // anonymous local storage_live(array_ref@1) storage_live(@2) storage_live(@3) @3 := @ArrayRepeat<'_, i32, 4 : usize>(const (0 : i32)) - @2 := &@3 - array_ref@1 := &*(@2) + storage_live(@11) + @11 := () + @2 := &(@3, move (@11)) + storage_live(@10) + @10 := () + array_ref@1 := &(*(@2), move (@10)) storage_dead(@2) storage_live(_a@4) - storage_live(@11) - @11 := &*(array_ref@1) - storage_live(@12) - @12 := @ArrayIndexShared<'_, i32, 4 : usize>(move (@11), const (0 : usize)) - _a@4 := &*(@12) - storage_live(_b@5) storage_live(@9) - @9 := &*(array_ref@1) - storage_live(@10) - @10 := @ArraySubSliceShared<'_, i32, 4 : usize>(move (@9), const (1 : usize), const (3 : usize)) - _b@5 := &*(@10) + @9 := () + storage_live(@18) + @18 := () + storage_live(@19) + @19 := &(*(array_ref@1), move (@18)) + storage_live(@20) + @20 := @ArrayIndexShared<'_, i32, 4 : usize>(move (@19), const (0 : usize)) + _a@4 := &(*(@20), move (@9)) + storage_live(_b@5) + storage_live(@8) + @8 := () + storage_live(@15) + @15 := () + storage_live(@16) + @16 := &(*(array_ref@1), move (@15)) + storage_live(@17) + @17 := @ArraySubSliceShared<'_, i32, 4 : usize>(move (@16), const (1 : usize), const (3 : usize)) + _b@5 := &(*(@17), move (@8)) storage_live(_c@6) storage_live(@7) - @7 := &*(array_ref@1) - storage_live(@8) - @8 := @ArrayIndexShared<'_, i32, 4 : usize>(move (@7), const (3 : usize)) - _c@6 := &*(@8) + @7 := () + storage_live(@12) + @12 := () + storage_live(@13) + @13 := &(*(array_ref@1), move (@12)) + storage_live(@14) + @14 := @ArrayIndexShared<'_, i32, 4 : usize>(move (@13), const (3 : usize)) + _c@6 := &(*(@14), move (@7)) @0 := () storage_dead(_c@6) storage_dead(_b@5) @@ -110,16 +143,27 @@ fn slice_pat3() let @8: usize; // anonymous local let @9: usize; // anonymous local let @10: bool; // anonymous local - let @11: &'_ (Slice); // anonymous local - let @12: usize; // anonymous local - let @13: usize; // anonymous local - let @14: &'_ (i32); // anonymous local - let @15: &'_ (Slice); // anonymous local + let @11: (); // anonymous local + let @12: (); // anonymous local + let @13: (); // anonymous local + let @14: usize; // anonymous local + let @15: usize; // anonymous local let @16: usize; // anonymous local let @17: usize; // anonymous local - let @18: &'_ (Slice); // anonymous local - let @19: &'_ (Slice); // anonymous local - let @20: &'_ (i32); // anonymous local + let @18: (); // anonymous local + let @19: usize; // anonymous local + let @20: &'_ (Slice); // anonymous local + let @21: usize; // anonymous local + let @22: usize; // anonymous local + let @23: &'_ (i32); // anonymous local + let @24: usize; // anonymous local + let @25: &'_ (Slice); // anonymous local + let @26: usize; // anonymous local + let @27: usize; // anonymous local + let @28: &'_ (Slice); // anonymous local + let @29: usize; // anonymous local + let @30: &'_ (Slice); // anonymous local + let @31: &'_ (i32); // anonymous local storage_live(@8) storage_live(@9) @@ -129,8 +173,12 @@ fn slice_pat3() storage_live(@3) storage_live(@4) @4 := @ArrayRepeat<'_, i32, 4 : usize>(const (0 : i32)) - @3 := &@4 - @2 := &*(@3) + storage_live(@12) + @12 := () + @3 := &(@4, move (@12)) + storage_live(@11) + @11 := () + @2 := &(*(@3), move (@11)) slice@1 := @ArrayToSliceShared<'_, i32, 4 : usize>(move (@2)) storage_dead(@2) storage_dead(@3) @@ -148,31 +196,50 @@ fn slice_pat3() storage_dead(_a@5) panic(core::panicking::panic_explicit) } - storage_live(@19) - @19 := &*(slice@1) - storage_live(@20) - @20 := @SliceIndexShared<'_, i32>(move (@19), const (0 : usize)) - _a@5 := &*(@20) + storage_live(@18) + @18 := () + storage_live(@29) + @29 := ptr_metadata(copy (slice@1)) + storage_live(@30) + @30 := &(*(slice@1), move (@29)) + storage_live(@31) + @31 := @SliceIndexShared<'_, i32>(move (@30), const (0 : usize)) + _a@5 := &(*(@31), move (@18)) + storage_live(@14) + @14 := len(*(slice@1)) storage_live(@15) - @15 := &*(slice@1) + @15 := copy (@14) ub.- const (1 : usize) + storage_dead(@14) storage_live(@16) - @16 := len(*(slice@1)) + @16 := copy (@15) ub.- const (1 : usize) storage_live(@17) - @17 := copy (@16) ub.- const (1 : usize) - storage_dead(@16) - storage_live(@18) - @18 := @SliceSubSliceShared<'_, i32>(move (@15), const (1 : usize), copy (@17)) - _b@6 := &*(@18) - storage_live(@11) - @11 := &*(slice@1) - storage_live(@12) - @12 := len(*(slice@1)) + @17 := copy (@16) + storage_live(@24) + @24 := ptr_metadata(copy (slice@1)) + storage_live(@25) + @25 := &(*(slice@1), move (@24)) + storage_live(@26) + @26 := len(*(slice@1)) + storage_live(@27) + @27 := copy (@26) ub.- const (1 : usize) + storage_dead(@26) + storage_live(@28) + @28 := @SliceSubSliceShared<'_, i32>(move (@25), const (1 : usize), copy (@27)) + _b@6 := &(*(@28), move (@17)) storage_live(@13) - @13 := copy (@12) ub.- const (1 : usize) - storage_dead(@12) - storage_live(@14) - @14 := @SliceIndexShared<'_, i32>(move (@11), copy (@13)) - _c@7 := &*(@14) + @13 := () + storage_live(@19) + @19 := ptr_metadata(copy (slice@1)) + storage_live(@20) + @20 := &(*(slice@1), move (@19)) + storage_live(@21) + @21 := len(*(slice@1)) + storage_live(@22) + @22 := copy (@21) ub.- const (1 : usize) + storage_dead(@21) + storage_live(@23) + @23 := @SliceIndexShared<'_, i32>(move (@20), copy (@22)) + _c@7 := &(*(@23), move (@13)) @0 := () storage_dead(_c@7) storage_dead(_b@6) diff --git a/charon/tests/ui/issue-323-closure-borrow.out b/charon/tests/ui/issue-323-closure-borrow.out index 56fcacc86..8f66211db 100644 --- a/charon/tests/ui/issue-323-closure-borrow.out +++ b/charon/tests/ui/issue-323-closure-borrow.out @@ -93,10 +93,13 @@ fn new<'_0>(@1: &'_0 mut (Rng)) let rng@1: &'_ mut (Rng); // arg #1 let @2: closure<'_>; // anonymous local let @3: &'_ mut (Rng); // anonymous local + let @4: (); // anonymous local storage_live(@2) storage_live(@3) - @3 := &uniq *(rng@1) + storage_live(@4) + @4 := () + @3 := &uniq (*(rng@1), move (@4)) @2 := closure { 0: move (@3) } storage_dead(@3) storage_dead(@2) @@ -113,10 +116,13 @@ fn {impl FnMut<()> for closure<'_0>}::call_mut<'_0, '_1>(@1: &'_1 mut (closure<' let tupled_args@2: (); // arg #2 let @3: (); // anonymous local let @4: &'_ mut (Rng); // anonymous local + let @5: (); // anonymous local storage_live(@3) storage_live(@4) - @4 := &two-phase-mut *((*(@1)).0) + storage_live(@5) + @5 := () + @4 := &two-phase-mut (*((*(@1)).0), move (@5)) @3 := next_u64<'_>(move (@4)) storage_dead(@4) storage_dead(@3) @@ -132,9 +138,12 @@ fn {impl FnOnce<()> for closure<'_0>}::call_once<'_0>(@1: closure<'_0>, @2: ()) let @1: closure<'_0>; // arg #1 let @2: (); // arg #2 let @3: &'_ mut (closure<'_0>); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<()> for closure<'_0>}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop>] @1 @0 := () diff --git a/charon/tests/ui/issue-378-ctor-as-fn.out b/charon/tests/ui/issue-378-ctor-as-fn.out index 2113484ef..948c72dc8 100644 --- a/charon/tests/ui/issue-378-ctor-as-fn.out +++ b/charon/tests/ui/issue-378-ctor-as-fn.out @@ -82,9 +82,12 @@ fn {impl Drop for Foo}::drop<'_0>(@1: &'_0 mut (Foo)) let @0: (); // return let @1: *mut Foo; // arg #1 let @2: &'_ mut (Foo); // anonymous local + let @3: (); // anonymous local storage_live(@2) - @2 := &mut *(@1) + storage_live(@3) + @3 := () + @2 := &mut (*(@1), move (@3)) drop[{impl Drop for String}] (*(@2)).1 @0 := () return @@ -151,6 +154,8 @@ fn main() let @15: &'_ (i32); // anonymous local let @16: &'_ (i32); // anonymous local let @17: i32; // anonymous local + let @18: (); // anonymous local + let @19: (); // anonymous local storage_live(f@1) f@1 := const (Some[Sized]) @@ -192,8 +197,12 @@ fn main() storage_live(@16) storage_live(@17) @17 := const (42 : i32) - @16 := &@17 - @15 := &*(@16) + storage_live(@19) + @19 := () + @16 := &(@17, move (@19)) + storage_live(@18) + @18 := () + @15 := &(*(@16), move (@18)) @13 := Variant<'_, i32>[Sized](move (@15)) storage_dead(@15) storage_dead(@14) diff --git a/charon/tests/ui/issue-394-rpit-with-lifetime.out b/charon/tests/ui/issue-394-rpit-with-lifetime.out index 10bf2aeaf..f03c63ec7 100644 --- a/charon/tests/ui/issue-394-rpit-with-lifetime.out +++ b/charon/tests/ui/issue-394-rpit-with-lifetime.out @@ -111,9 +111,12 @@ fn {impl FnOnce<()> for closure<'_>}::call_once<'a>(@1: closure<'_>, @2: ()) -> let @1: closure<'_>; // arg #1 let @2: (); // arg #2 let @3: &'_ mut (closure<'_>); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<()> for closure<'_>}::call_mut<'_, '_>(move (@3), move (@2)) drop[Drop>] @1 return diff --git a/charon/tests/ui/issue-4-slice-try-into-array.out b/charon/tests/ui/issue-4-slice-try-into-array.out index 9e424494a..4da2692a2 100644 --- a/charon/tests/ui/issue-4-slice-try-into-array.out +++ b/charon/tests/ui/issue-4-slice-try-into-array.out @@ -188,11 +188,14 @@ pub fn trait_error<'_0>(@1: &'_0 (Slice)) let _array@2: Array; // local let @3: Result, TryFromSliceError>[Sized>, Sized]; // anonymous local let @4: &'_ (Slice); // anonymous local + let @5: usize; // anonymous local storage_live(_array@2) storage_live(@3) storage_live(@4) - @4 := &*(s@1) + storage_live(@5) + @5 := ptr_metadata(copy (s@1)) + @4 := &(*(s@1), move (@5)) @3 := {impl TryInto for T}::try_into<&'_ (Slice), Array>[Sized<&'_ (Slice)>, Sized>, {impl TryFrom<&'_0 (Slice)> for Array}<'_, u8, 4 : usize>[Sized, {impl Copy for u8}]](move (@4)) storage_dead(@4) _array@2 := unwrap, TryFromSliceError>[Sized>, Sized, {impl Debug for TryFromSliceError}](move (@3)) diff --git a/charon/tests/ui/issue-4-traits.out b/charon/tests/ui/issue-4-traits.out index d5f8eea75..2d79436f0 100644 --- a/charon/tests/ui/issue-4-traits.out +++ b/charon/tests/ui/issue-4-traits.out @@ -188,11 +188,14 @@ fn trait_error<'_0>(@1: &'_0 (Slice)) let _array@2: Array; // local let @3: Result, TryFromSliceError>[Sized>, Sized]; // anonymous local let @4: &'_ (Slice); // anonymous local + let @5: usize; // anonymous local storage_live(_array@2) storage_live(@3) storage_live(@4) - @4 := &*(s@1) + storage_live(@5) + @5 := ptr_metadata(copy (s@1)) + @4 := &(*(s@1), move (@5)) @3 := {impl TryInto for T}::try_into<&'_ (Slice), Array>[Sized<&'_ (Slice)>, Sized>, {impl TryFrom<&'_0 (Slice)> for Array}<'_, u8, 4 : usize>[Sized, {impl Copy for u8}]](move (@4)) storage_dead(@4) _array@2 := unwrap, TryFromSliceError>[Sized>, Sized, {impl Debug for TryFromSliceError}](move (@3)) diff --git a/charon/tests/ui/issue-45-misc.out b/charon/tests/ui/issue-45-misc.out index eda42f771..a02702182 100644 --- a/charon/tests/ui/issue-45-misc.out +++ b/charon/tests/ui/issue-45-misc.out @@ -560,9 +560,12 @@ fn {impl FnOnce<(i32)> for closure}::call_once(@1: closure, @2: (i32)) -> i32 let @1: closure; // arg #1 let @2: (i32); // arg #2 let @3: &'_ mut (closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(i32)> for closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return @@ -630,8 +633,11 @@ fn cbd(@1: Array) let i@9: u8; // local let @10: u8; // anonymous local let @11: usize; // anonymous local - let @12: &'_ mut (Array); // anonymous local - let @13: &'_ mut (u8); // anonymous local + let @12: (); // anonymous local + let @13: (); // anonymous local + let @14: (); // anonymous local + let @15: &'_ mut (Array); // anonymous local + let @16: &'_ mut (u8); // anonymous local storage_live(@7) storage_live(i@9) @@ -639,6 +645,9 @@ fn cbd(@1: Array) storage_live(@11) storage_live(@12) storage_live(@13) + storage_live(@14) + storage_live(@15) + storage_live(@16) storage_live(@2) storage_live(@3) @3 := Range { start: const (0 : u8), end: const (3 : u8) } @@ -651,8 +660,12 @@ fn cbd(@1: Array) storage_live(@6) storage_live(@7) storage_live(@8) - @8 := &mut iter@4 - @7 := &two-phase-mut *(@8) + storage_live(@13) + @13 := () + @8 := &mut (iter@4, move (@13)) + storage_live(@12) + @12 := () + @7 := &two-phase-mut (*(@8), move (@12)) @6 := {impl Iterator for Range[@TraitClause0]}::next<'_, u8>[Sized, {impl Step for u8}](move (@7)) storage_dead(@7) match @6 { @@ -666,11 +679,13 @@ fn cbd(@1: Array) @10 := copy (i@9) storage_live(@11) @11 := const (0 : usize) - storage_live(@12) - @12 := &mut prf_input@1 - storage_live(@13) - @13 := @ArrayIndexMut<'_, u8, 33 : usize>(move (@12), copy (@11)) - *(@13) := move (@10) + storage_live(@14) + @14 := () + storage_live(@15) + @15 := &mut (prf_input@1, move (@14)) + storage_live(@16) + @16 := @ArrayIndexMut<'_, u8, 33 : usize>(move (@15), copy (@11)) + *(@16) := move (@10) storage_dead(@10) storage_dead(@11) storage_dead(i@9) @@ -719,6 +734,14 @@ fn select<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) let @22: &'_ (usize); // anonymous local let @23: &'_ (usize); // anonymous local let @24: Option>[Sized>]; // anonymous local + let @25: usize; // anonymous local + let @26: usize; // anonymous local + let @27: (); // anonymous local + let @28: (); // anonymous local + let @29: (); // anonymous local + let @30: (); // anonymous local + let @31: (); // anonymous local + let @32: (); // anonymous local storage_live(@5) storage_live(@6) @@ -740,6 +763,14 @@ fn select<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) storage_live(@22) storage_live(@23) storage_live(@24) + storage_live(@25) + storage_live(@26) + storage_live(@27) + storage_live(@28) + storage_live(@29) + storage_live(@30) + storage_live(@31) + storage_live(@32) storage_live(@3) storage_live(@4) @4 := const (true) @@ -749,17 +780,25 @@ fn select<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) storage_live(@7) storage_live(@8) storage_live(@9) - @9 := &*(lhs@1) + storage_live(@25) + @25 := ptr_metadata(copy (lhs@1)) + @9 := &(*(lhs@1), move (@25)) @8 := core::slice::{Slice}::len<'_, u8>[Sized](move (@9)) storage_dead(@9) - @7 := &@8 + storage_live(@27) + @27 := () + @7 := &(@8, move (@27)) storage_live(@10) storage_live(@11) storage_live(@12) - @12 := &*(rhs@2) + storage_live(@26) + @26 := ptr_metadata(copy (rhs@2)) + @12 := &(*(rhs@2), move (@26)) @11 := core::slice::{Slice}::len<'_, u8>[Sized](move (@12)) storage_dead(@12) - @10 := &@11 + storage_live(@28) + @28 := () + @10 := &(@11, move (@28)) @6 := (move (@7), move (@10)) storage_dead(@10) storage_dead(@7) @@ -784,12 +823,20 @@ fn select<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) @19 := move (kind@18) storage_live(@20) storage_live(@21) - @21 := &*(left_val@13) - @20 := &*(@21) + storage_live(@32) + @32 := () + @21 := &(*(left_val@13), move (@32)) + storage_live(@31) + @31 := () + @20 := &(*(@21), move (@31)) storage_live(@22) storage_live(@23) - @23 := &*(right_val@14) - @22 := &*(@23) + storage_live(@30) + @30 := () + @23 := &(*(right_val@14), move (@30)) + storage_live(@29) + @29 := () + @22 := &(*(@23), move (@29)) storage_live(@24) @24 := Option::None { } panic(core::panicking::assert_failed) diff --git a/charon/tests/ui/issue-70-override-provided-method.2.out b/charon/tests/ui/issue-70-override-provided-method.2.out index 80b1f88cb..615b8e36a 100644 --- a/charon/tests/ui/issue-70-override-provided-method.2.out +++ b/charon/tests/ui/issue-70-override-provided-method.2.out @@ -28,16 +28,22 @@ where let @3: &'_ (Self); // anonymous local let @4: (); // anonymous local let @5: &'_ (Self); // anonymous local + let @6: PtrMetadata; // anonymous local + let @7: PtrMetadata; // anonymous local storage_live(@2) storage_live(@3) - @3 := &*(self@1) + storage_live(@6) + @6 := ptr_metadata(copy (self@1)) + @3 := &(*(self@1), move (@6)) @2 := @TraitClause0::required<'_>(move (@3)) storage_dead(@3) storage_dead(@2) storage_live(@4) storage_live(@5) - @5 := &*(self@1) + storage_live(@7) + @7 := ptr_metadata(copy (self@1)) + @5 := &(*(self@1), move (@7)) @4 := @TraitClause0::provided2<'_>(move (@5)) storage_dead(@5) storage_dead(@4) @@ -57,16 +63,22 @@ where let @3: &'_ (Self); // anonymous local let @4: (); // anonymous local let @5: &'_ (Self); // anonymous local + let @6: PtrMetadata; // anonymous local + let @7: PtrMetadata; // anonymous local storage_live(@2) storage_live(@3) - @3 := &*(self@1) + storage_live(@6) + @6 := ptr_metadata(copy (self@1)) + @3 := &(*(self@1), move (@6)) @2 := @TraitClause0::required<'_>(move (@3)) storage_dead(@3) storage_dead(@2) storage_live(@4) storage_live(@5) - @5 := &*(self@1) + storage_live(@7) + @7 := ptr_metadata(copy (self@1)) + @5 := &(*(self@1), move (@7)) @4 := @TraitClause0::provided1<'_>(move (@5)) storage_dead(@5) storage_dead(@4) @@ -85,10 +97,13 @@ fn {impl Trait for Foo}::required<'_0>(@1: &'_0 (Foo)) let self@1: &'_ (Foo); // arg #1 let @2: (); // anonymous local let @3: &'_ (Foo); // anonymous local + let @4: (); // anonymous local storage_live(@2) storage_live(@3) - @3 := &*(self@1) + storage_live(@4) + @4 := () + @3 := &(*(self@1), move (@4)) @2 := test_crate::{impl Trait for Foo}::provided1<'_>(move (@3)) storage_dead(@3) storage_dead(@2) @@ -105,16 +120,22 @@ fn test_crate::{impl Trait for Foo}::provided1<'_0>(@1: &'_0 (Foo)) let @3: &'_ (Foo); // anonymous local let @4: (); // anonymous local let @5: &'_ (Foo); // anonymous local + let @6: (); // anonymous local + let @7: (); // anonymous local storage_live(@2) storage_live(@3) - @3 := &*(self@1) + storage_live(@6) + @6 := () + @3 := &(*(self@1), move (@6)) @2 := {impl Trait for Foo}::required<'_>(move (@3)) storage_dead(@3) storage_dead(@2) storage_live(@4) storage_live(@5) - @5 := &*(self@1) + storage_live(@7) + @7 := () + @5 := &(*(self@1), move (@7)) @4 := test_crate::{impl Trait for Foo}::provided2<'_>(move (@5)) storage_dead(@5) storage_dead(@4) @@ -131,16 +152,22 @@ fn test_crate::{impl Trait for Foo}::provided2<'_0>(@1: &'_0 (Foo)) let @3: &'_ (Foo); // anonymous local let @4: (); // anonymous local let @5: &'_ (Foo); // anonymous local + let @6: (); // anonymous local + let @7: (); // anonymous local storage_live(@2) storage_live(@3) - @3 := &*(self@1) + storage_live(@6) + @6 := () + @3 := &(*(self@1), move (@6)) @2 := {impl Trait for Foo}::required<'_>(move (@3)) storage_dead(@3) storage_dead(@2) storage_live(@4) storage_live(@5) - @5 := &*(self@1) + storage_live(@7) + @7 := () + @5 := &(*(self@1), move (@7)) @4 := test_crate::{impl Trait for Foo}::provided1<'_>(move (@5)) storage_dead(@5) storage_dead(@4) @@ -168,10 +195,13 @@ fn {impl Trait for Bar}::required<'_0>(@1: &'_0 (Bar)) let self@1: &'_ (Bar); // arg #1 let @2: (); // anonymous local let @3: &'_ (Bar); // anonymous local + let @4: (); // anonymous local storage_live(@2) storage_live(@3) - @3 := &*(self@1) + storage_live(@4) + @4 := () + @3 := &(*(self@1), move (@4)) @2 := test_crate::{impl Trait for Bar}::provided2<'_>(move (@3)) storage_dead(@3) storage_dead(@2) @@ -187,10 +217,13 @@ fn {impl Trait for Bar}::provided1<'_0>(@1: &'_0 (Bar)) let self@1: &'_ (Bar); // arg #1 let @2: (); // anonymous local let @3: &'_ (Bar); // anonymous local + let @4: (); // anonymous local storage_live(@2) storage_live(@3) - @3 := &*(self@1) + storage_live(@4) + @4 := () + @3 := &(*(self@1), move (@4)) @2 := test_crate::{impl Trait for Bar}::provided2<'_>(move (@3)) storage_dead(@3) storage_dead(@2) @@ -207,16 +240,22 @@ fn test_crate::{impl Trait for Bar}::provided2<'_0>(@1: &'_0 (Bar)) let @3: &'_ (Bar); // anonymous local let @4: (); // anonymous local let @5: &'_ (Bar); // anonymous local + let @6: (); // anonymous local + let @7: (); // anonymous local storage_live(@2) storage_live(@3) - @3 := &*(self@1) + storage_live(@6) + @6 := () + @3 := &(*(self@1), move (@6)) @2 := {impl Trait for Bar}::required<'_>(move (@3)) storage_dead(@3) storage_dead(@2) storage_live(@4) storage_live(@5) - @5 := &*(self@1) + storage_live(@7) + @7 := () + @5 := &(*(self@1), move (@7)) @4 := {impl Trait for Bar}::provided1<'_>(move (@5)) storage_dead(@5) storage_dead(@4) diff --git a/charon/tests/ui/issue-70-override-provided-method.3.out b/charon/tests/ui/issue-70-override-provided-method.3.out index 3ca404614..da08d6f1f 100644 --- a/charon/tests/ui/issue-70-override-provided-method.3.out +++ b/charon/tests/ui/issue-70-override-provided-method.3.out @@ -125,12 +125,18 @@ where let @3: bool; // anonymous local let @4: &'_ (U); // anonymous local let @5: &'_ (T); // anonymous local + let @6: (); // anonymous local + let @7: (); // anonymous local storage_live(@3) storage_live(@4) - @4 := &y@2 + storage_live(@7) + @7 := () + @4 := &(y@2, move (@7)) storage_live(@5) - @5 := &x@1 + storage_live(@6) + @6 := () + @5 := &(x@1, move (@6)) @3 := @TraitClause2::eq<'_, '_>(move (@4), move (@5)) if move (@3) { storage_dead(@5) @@ -184,12 +190,18 @@ where let @3: bool; // anonymous local let @4: &'_ (U); // anonymous local let @5: &'_ (Option[@TraitClause0]); // anonymous local + let @6: (); // anonymous local + let @7: (); // anonymous local storage_live(@3) storage_live(@4) - @4 := &y@2 + storage_live(@7) + @7 := () + @4 := &(y@2, move (@7)) storage_live(@5) - @5 := &x@1 + storage_live(@6) + @6 := () + @5 := &(x@1, move (@6)) @3 := @TraitClause3::eq<'_, '_>(move (@4), move (@5)) if move (@3) { storage_dead(@5) @@ -255,12 +267,18 @@ where let @3: bool; // anonymous local let @4: &'_ (U); // anonymous local let @5: &'_ (Option[@TraitClause0]); // anonymous local + let @6: (); // anonymous local + let @7: (); // anonymous local storage_live(@3) storage_live(@4) - @4 := &y@2 + storage_live(@7) + @7 := () + @4 := &(y@2, move (@7)) storage_live(@5) - @5 := &x@1 + storage_live(@6) + @6 := () + @5 := &(x@1, move (@6)) @3 := @TraitClause3::eq<'_, '_>(move (@4), move (@5)) if move (@3) { storage_dead(@5) diff --git a/charon/tests/ui/issue-70-override-provided-method.out b/charon/tests/ui/issue-70-override-provided-method.out index 6de30d14d..9354ae94d 100644 --- a/charon/tests/ui/issue-70-override-provided-method.out +++ b/charon/tests/ui/issue-70-override-provided-method.out @@ -118,16 +118,22 @@ fn main() let @3: Option[Sized]; // anonymous local let @4: &'_ (Option[Sized]); // anonymous local let @5: Option[Sized]; // anonymous local + let @6: (); // anonymous local + let @7: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) @3 := Option::Some { 0: const (1 : i32) } - @2 := &@3 + storage_live(@7) + @7 := () + @2 := &(@3, move (@7)) storage_live(@4) storage_live(@5) @5 := Option::Some { 0: const (1 : i32) } - @4 := &@5 + storage_live(@6) + @6 := () + @4 := &(@5, move (@6)) @1 := {impl PartialEq[@TraitClause0]> for Option[@TraitClause0]}::eq<'_, '_, i32>[Sized, {impl PartialEq for i32}](move (@2), move (@4)) storage_dead(@4) storage_dead(@2) @@ -185,15 +191,27 @@ pub fn {impl PartialOrd for Foo}::partial_cmp<'_0, '_1>(@1: &'_0 (Foo), @2: let @4: &'_ (u32); // anonymous local let @5: &'_ (u32); // anonymous local let @6: &'_ (u32); // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local + let @9: (); // anonymous local + let @10: (); // anonymous local storage_live(@3) storage_live(@4) - @4 := &(*(self@1)).0 - @3 := &*(@4) + storage_live(@10) + @10 := () + @4 := &((*(self@1)).0, move (@10)) + storage_live(@9) + @9 := () + @3 := &(*(@4), move (@9)) storage_live(@5) storage_live(@6) - @6 := &(*(other@2)).0 - @5 := &*(@6) + storage_live(@8) + @8 := () + @6 := &((*(other@2)).0, move (@8)) + storage_live(@7) + @7 := () + @5 := &(*(@6), move (@7)) @0 := {impl PartialOrd for u32}::partial_cmp<'_, '_>(move (@3), move (@5)) storage_dead(@6) storage_dead(@5) diff --git a/charon/tests/ui/issue-72-hash-missing-impl.out b/charon/tests/ui/issue-72-hash-missing-impl.out index 9774f72a0..dcc450ec0 100644 --- a/charon/tests/ui/issue-72-hash-missing-impl.out +++ b/charon/tests/ui/issue-72-hash-missing-impl.out @@ -74,6 +74,9 @@ fn main() let @4: u32; // anonymous local let @5: &'_ mut (DefaultHasher); // anonymous local let @6: &'_ mut (DefaultHasher); // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local + let @9: (); // anonymous local storage_live(hasher@1) hasher@1 := DefaultHasher { } @@ -81,11 +84,17 @@ fn main() storage_live(@3) storage_live(@4) @4 := const (0 : u32) - @3 := &@4 + storage_live(@9) + @9 := () + @3 := &(@4, move (@9)) storage_live(@5) storage_live(@6) - @6 := &mut hasher@1 - @5 := &two-phase-mut *(@6) + storage_live(@8) + @8 := () + @6 := &mut (hasher@1, move (@8)) + storage_live(@7) + @7 := () + @5 := &two-phase-mut (*(@6), move (@7)) @2 := {impl Hash for u32}::hash<'_, '_, DefaultHasher>[Sized, {impl Hasher for DefaultHasher}](move (@3), move (@5)) storage_dead(@5) storage_dead(@3) diff --git a/charon/tests/ui/issue-97-missing-parent-item-clause.out b/charon/tests/ui/issue-97-missing-parent-item-clause.out index d69aad815..b36092498 100644 --- a/charon/tests/ui/issue-97-missing-parent-item-clause.out +++ b/charon/tests/ui/issue-97-missing-parent-item-clause.out @@ -52,10 +52,13 @@ pub fn test(@1: AVLTree[Sized]) let tree@1: AVLTree[Sized]; // arg #1 let @2: (); // anonymous local let @3: &'_ mut (AVLTree[Sized]); // anonymous local + let @4: (); // anonymous local storage_live(@2) storage_live(@3) - @3 := &two-phase-mut tree@1 + storage_live(@4) + @4 := () + @3 := &two-phase-mut (tree@1, move (@4)) @2 := insert<'_, u32>[Sized, {impl Ord for u32}](move (@3)) storage_dead(@3) storage_dead(@2) diff --git a/charon/tests/ui/iterator.out b/charon/tests/ui/iterator.out index 11853ce9b..5809ff644 100644 --- a/charon/tests/ui/iterator.out +++ b/charon/tests/ui/iterator.out @@ -4570,6 +4570,24 @@ fn main() let @65: &'_ (i32); // anonymous local let @66: &'_ (i32); // anonymous local let @67: Option>[Sized>]; // anonymous local + let @68: (); // anonymous local + let @69: (); // anonymous local + let @70: (); // anonymous local + let @71: (); // anonymous local + let @72: (); // anonymous local + let @73: (); // anonymous local + let @74: (); // anonymous local + let @75: (); // anonymous local + let @76: (); // anonymous local + let @77: (); // anonymous local + let @78: (); // anonymous local + let @79: (); // anonymous local + let @80: (); // anonymous local + let @81: (); // anonymous local + let @82: (); // anonymous local + let @83: (); // anonymous local + let @84: (); // anonymous local + let @85: (); // anonymous local storage_live(@10) storage_live(v@12) @@ -4591,6 +4609,19 @@ fn main() storage_live(@65) storage_live(@66) storage_live(@67) + storage_live(@68) + storage_live(@69) + storage_live(@71) + storage_live(@72) + storage_live(@73) + storage_live(@75) + storage_live(@76) + storage_live(@78) + storage_live(@79) + storage_live(@82) + storage_live(@83) + storage_live(@84) + storage_live(@85) storage_live(a@1) a@1 := [const (0 : i32), const (1 : i32), const (2 : i32), const (3 : i32), const (4 : i32), const (5 : i32), const (6 : i32)] storage_live(i@2) @@ -4611,8 +4642,12 @@ fn main() storage_live(@9) storage_live(@10) storage_live(@11) - @11 := &mut iter@7 - @10 := &two-phase-mut *(@11) + storage_live(@69) + @69 := () + @11 := &mut (iter@7, move (@69)) + storage_live(@68) + @68 := () + @10 := &two-phase-mut (*(@11), move (@68)) @9 := {impl Iterator for IntoIter[@TraitClause0]}::next<'_, i32, 7 : usize>[Sized](move (@10)) storage_dead(@10) match @9 { @@ -4648,7 +4683,9 @@ fn main() storage_live(@17) storage_live(@18) storage_live(@19) - @19 := &a@1 + storage_live(@70) + @70 := () + @19 := &(a@1, move (@70)) @18 := @ArrayToSliceShared<'_, i32, 7 : usize>(move (@19)) storage_dead(@19) @17 := iter<'_, i32>[Sized](move (@18)) @@ -4662,8 +4699,12 @@ fn main() storage_live(@22) storage_live(@23) storage_live(@24) - @24 := &mut iter@20 - @23 := &two-phase-mut *(@24) + storage_live(@72) + @72 := () + @24 := &mut (iter@20, move (@72)) + storage_live(@71) + @71 := () + @23 := &two-phase-mut (*(@24), move (@71)) @22 := {impl Iterator for Iter<'a, T>[@TraitClause0]}::next<'_, '_, i32>[Sized](move (@23)) storage_dead(@23) match @22 { @@ -4675,7 +4716,9 @@ fn main() v@25 := copy ((@22 as variant Option::Some).0) storage_live(@26) storage_live(@27) - @27 := &two-phase-mut i@2 + storage_live(@73) + @73 := () + @27 := &two-phase-mut (i@2, move (@73)) storage_live(@28) @28 := copy (v@25) @26 := {impl AddAssign<&'_0 (i32)> for i32}::add_assign<'_, '_>(move (@27), move (@28)) @@ -4701,7 +4744,9 @@ fn main() storage_live(@31) storage_live(@32) storage_live(@33) - @33 := &a@1 + storage_live(@74) + @74 := () + @33 := &(a@1, move (@74)) @32 := @ArrayToSliceShared<'_, i32, 7 : usize>(move (@33)) storage_dead(@33) @31 := chunks<'_, i32>[Sized](move (@32), const (2 : usize)) @@ -4715,8 +4760,12 @@ fn main() storage_live(@36) storage_live(@37) storage_live(@38) - @38 := &mut iter@34 - @37 := &two-phase-mut *(@38) + storage_live(@76) + @76 := () + @38 := &mut (iter@34, move (@76)) + storage_live(@75) + @75 := () + @37 := &two-phase-mut (*(@38), move (@75)) @36 := {impl Iterator for Chunks<'a, T>[@TraitClause0]}::next<'_, '_, i32>[Sized](move (@37)) storage_dead(@37) match @36 { @@ -4744,7 +4793,9 @@ fn main() storage_live(@42) storage_live(@43) storage_live(@44) - @44 := &a@1 + storage_live(@77) + @77 := () + @44 := &(a@1, move (@77)) @43 := @ArrayToSliceShared<'_, i32, 7 : usize>(move (@44)) storage_dead(@44) @42 := chunks_exact<'_, i32>[Sized](move (@43), const (2 : usize)) @@ -4758,8 +4809,12 @@ fn main() storage_live(@47) storage_live(@48) storage_live(@49) - @49 := &mut iter@45 - @48 := &two-phase-mut *(@49) + storage_live(@79) + @79 := () + @49 := &mut (iter@45, move (@79)) + storage_live(@78) + @78 := () + @48 := &two-phase-mut (*(@49), move (@78)) @47 := {impl Iterator for ChunksExact<'a, T>[@TraitClause0]}::next<'_, '_, i32>[Sized](move (@48)) storage_dead(@48) match @47 { @@ -4787,9 +4842,13 @@ fn main() storage_live(@52) storage_live(@53) storage_live(@54) - @54 := &i@2 + storage_live(@81) + @81 := () + @54 := &(i@2, move (@81)) storage_live(@55) - @55 := &expected@51 + storage_live(@80) + @80 := () + @55 := &(expected@51, move (@80)) @53 := (move (@54), move (@55)) storage_dead(@55) storage_dead(@54) @@ -4814,12 +4873,20 @@ fn main() @62 := move (kind@61) storage_live(@63) storage_live(@64) - @64 := &*(left_val@56) - @63 := &*(@64) + storage_live(@85) + @85 := () + @64 := &(*(left_val@56), move (@85)) + storage_live(@84) + @84 := () + @63 := &(*(@64), move (@84)) storage_live(@65) storage_live(@66) - @66 := &*(right_val@57) - @65 := &*(@66) + storage_live(@83) + @83 := () + @66 := &(*(right_val@57), move (@83)) + storage_live(@82) + @82 := () + @65 := &(*(@66), move (@82)) storage_live(@67) @67 := Option::None { } panic(core::panicking::assert_failed) diff --git a/charon/tests/ui/loops.out b/charon/tests/ui/loops.out index 058d7c675..fcbe668d0 100644 --- a/charon/tests/ui/loops.out +++ b/charon/tests/ui/loops.out @@ -1725,6 +1725,12 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize let @28: &'_ mut (Range[Sized]); // anonymous local let @29: &'_ mut (Range[Sized]); // anonymous local let @30: usize; // anonymous local + let @31: (); // anonymous local + let @32: (); // anonymous local + let @33: (); // anonymous local + let @34: (); // anonymous local + let @35: (); // anonymous local + let @36: (); // anonymous local storage_live(@10) storage_live(@12) @@ -1738,6 +1744,12 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize storage_live(@28) storage_live(@29) storage_live(@30) + storage_live(@31) + storage_live(@32) + storage_live(@33) + storage_live(@34) + storage_live(@35) + storage_live(@36) storage_live(s@3) s@3 := const (0 : usize) storage_live(@4) @@ -1753,8 +1765,12 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize storage_live(@9) storage_live(@10) storage_live(@11) - @11 := &mut iter@7 - @10 := &two-phase-mut *(@11) + storage_live(@32) + @32 := () + @11 := &mut (iter@7, move (@32)) + storage_live(@31) + @31 := () + @10 := &two-phase-mut (*(@11), move (@31)) @9 := {impl Iterator for Range[@TraitClause0]}::next<'_, i32>[Sized, {impl Step for i32}](move (@10)) storage_dead(@10) match @9 { @@ -1793,8 +1809,12 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize storage_live(@19) storage_live(@20) storage_live(@21) - @21 := &mut iter@17 - @20 := &two-phase-mut *(@21) + storage_live(@34) + @34 := () + @21 := &mut (iter@17, move (@34)) + storage_live(@33) + @33 := () + @20 := &two-phase-mut (*(@21), move (@33)) @19 := {impl Iterator for Range[@TraitClause0]}::next<'_, usize>[Sized, {impl Step for usize}](move (@20)) storage_dead(@20) match @19 { @@ -1817,8 +1837,12 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize storage_live(@27) storage_live(@28) storage_live(@29) - @29 := &mut iter@25 - @28 := &two-phase-mut *(@29) + storage_live(@36) + @36 := () + @29 := &mut (iter@25, move (@36)) + storage_live(@35) + @35 := () + @28 := &two-phase-mut (*(@29), move (@35)) @27 := {impl Iterator for Range[@TraitClause0]}::next<'_, usize>[Sized, {impl Step for usize}](move (@28)) storage_dead(@28) match @27 { @@ -1878,6 +1902,8 @@ pub fn loop_inside_if(@1: bool, @2: u32) -> u32 let i@14: u32; // local let @15: u32; // anonymous local let @16: u32; // anonymous local + let @17: (); // anonymous local + let @18: (); // anonymous local storage_live(s@4) storage_live(@5) @@ -1892,6 +1918,8 @@ pub fn loop_inside_if(@1: bool, @2: u32) -> u32 storage_live(i@14) storage_live(@15) storage_live(@16) + storage_live(@17) + storage_live(@18) storage_live(@3) @3 := copy (b@1) if move (@3) { @@ -1913,8 +1941,12 @@ pub fn loop_inside_if(@1: bool, @2: u32) -> u32 storage_live(@11) storage_live(@12) storage_live(@13) - @13 := &mut iter@9 - @12 := &two-phase-mut *(@13) + storage_live(@18) + @18 := () + @13 := &mut (iter@9, move (@18)) + storage_live(@17) + @17 := () + @12 := &two-phase-mut (*(@13), move (@17)) @11 := {impl Iterator for Range[@TraitClause0]}::next<'_, u32>[Sized, {impl Step for u32}](move (@12)) storage_dead(@12) match @11 { @@ -2031,8 +2063,9 @@ pub fn sum_array(@1: Array) -> u32 let @9: u32; // anonymous local let @10: usize; // anonymous local let @11: (); // anonymous local - let @12: &'_ (Array); // anonymous local - let @13: &'_ (u32); // anonymous local + let @12: (); // anonymous local + let @13: &'_ (Array); // anonymous local + let @14: &'_ (u32); // anonymous local storage_live(@7) storage_live(@8) @@ -2040,6 +2073,7 @@ pub fn sum_array(@1: Array) -> u32 storage_live(@10) storage_live(@12) storage_live(@13) + storage_live(@14) storage_live(i@2) i@2 := const (0 : usize) storage_live(s@3) @@ -2056,10 +2090,12 @@ pub fn sum_array(@1: Array) -> u32 storage_live(@8) @8 := copy (i@2) storage_live(@12) - @12 := &a@1 + @12 := () storage_live(@13) - @13 := @ArrayIndexShared<'_, u32, const N : usize>(move (@12), copy (@8)) - @7 := copy (*(@13)) + @13 := &(a@1, move (@12)) + storage_live(@14) + @14 := @ArrayIndexShared<'_, u32, const N : usize>(move (@13), copy (@8)) + @7 := copy (*(@14)) @9 := copy (s@3) panic.+ copy (@7) s@3 := move (@9) storage_dead(@7) @@ -2099,12 +2135,16 @@ pub fn clear<'_0>(@1: &'_0 mut (Vec[Sized, Sized])) let @9: usize; // anonymous local let @10: usize; // anonymous local let @11: (); // anonymous local + let @12: (); // anonymous local + let @13: (); // anonymous local storage_live(@6) storage_live(@7) storage_live(@8) storage_live(@9) storage_live(@10) + storage_live(@12) + storage_live(@13) storage_live(i@2) i@2 := const (0 : usize) loop { @@ -2113,7 +2153,9 @@ pub fn clear<'_0>(@1: &'_0 mut (Vec[Sized, Sized])) @4 := copy (i@2) storage_live(@5) storage_live(@6) - @6 := &*(v@1) + storage_live(@12) + @12 := () + @6 := &(*(v@1), move (@12)) @5 := alloc::vec::{Vec[@TraitClause0, @TraitClause1]}::len<'_, u32, Global>[Sized, Sized](move (@6)) storage_dead(@6) @3 := move (@4) < move (@5) @@ -2126,7 +2168,9 @@ pub fn clear<'_0>(@1: &'_0 mut (Vec[Sized, Sized])) storage_dead(@4) storage_live(@7) storage_live(@8) - @8 := &mut *(v@1) + storage_live(@13) + @13 := () + @8 := &mut (*(v@1), move (@13)) storage_live(@9) @9 := copy (i@2) @7 := {impl IndexMut for Vec[@TraitClause0, @TraitClause2]}::index_mut<'_, u32, usize, Global>[Sized, Sized, Sized, {impl SliceIndex> for usize}[Sized]](move (@8), move (@9)) @@ -2171,6 +2215,10 @@ pub fn get_elem_mut<'_0>(@1: &'_0 mut (List[Sized]), @2: usize) -> let @6: usize; // anonymous local let @7: usize; // anonymous local let @8: &'_ mut (List[Sized]); // anonymous local + let @9: (); // anonymous local + let @10: (); // anonymous local + let @11: (); // anonymous local + let @12: (); // anonymous local storage_live(y@3) storage_live(tl@4) @@ -2178,13 +2226,21 @@ pub fn get_elem_mut<'_0>(@1: &'_0 mut (List[Sized]), @2: usize) -> storage_live(@6) storage_live(@7) storage_live(@8) + storage_live(@9) + storage_live(@10) + storage_live(@11) + storage_live(@12) loop { match *(ls@1) { List::Cons => { storage_live(y@3) - y@3 := &mut (*(ls@1) as variant List::Cons).0 + storage_live(@10) + @10 := () + y@3 := &mut ((*(ls@1) as variant List::Cons).0, move (@10)) storage_live(tl@4) - tl@4 := &mut (*(ls@1) as variant List::Cons).1 + storage_live(@9) + @9 := () + tl@4 := &mut ((*(ls@1) as variant List::Cons).1, move (@9)) storage_live(@5) storage_live(@6) @6 := copy (*(y@3)) @@ -2197,7 +2253,9 @@ pub fn get_elem_mut<'_0>(@1: &'_0 mut (List[Sized]), @2: usize) -> storage_dead(@7) storage_dead(@6) storage_live(@8) - @8 := &mut *(*(tl@4)) + storage_live(@12) + @12 := () + @8 := &mut (*(*(tl@4)), move (@12)) ls@1 := move (@8) storage_dead(@8) storage_dead(@5) @@ -2207,7 +2265,9 @@ pub fn get_elem_mut<'_0>(@1: &'_0 mut (List[Sized]), @2: usize) -> } storage_dead(@7) storage_dead(@6) - @0 := &mut *(y@3) + storage_live(@11) + @11 := () + @0 := &mut (*(y@3), move (@11)) storage_dead(@5) storage_dead(tl@4) storage_dead(y@3) @@ -2236,6 +2296,10 @@ where let @8: &'_ mut (List[@TraitClause0]); // anonymous local let @9: u32; // anonymous local let @10: (); // anonymous local + let @11: (); // anonymous local + let @12: (); // anonymous local + let @13: (); // anonymous local + let @14: (); // anonymous local storage_live(x@4) storage_live(tl@5) @@ -2244,14 +2308,22 @@ where storage_live(@8) storage_live(@9) storage_live(@10) + storage_live(@11) + storage_live(@12) + storage_live(@13) + storage_live(@14) storage_live(@3) loop { match *(ls@1) { List::Cons => { storage_live(x@4) - x@4 := &mut (*(ls@1) as variant List::Cons).0 + storage_live(@12) + @12 := () + x@4 := &mut ((*(ls@1) as variant List::Cons).0, move (@12)) storage_live(tl@5) - tl@5 := &mut (*(ls@1) as variant List::Cons).1 + storage_live(@11) + @11 := () + tl@5 := &mut ((*(ls@1) as variant List::Cons).1, move (@11)) storage_live(@6) storage_live(@7) @7 := copy (i@2) @@ -2261,7 +2333,9 @@ where else { storage_dead(@7) storage_live(@8) - @8 := &mut *(*(tl@5)) + storage_live(@14) + @14 := () + @8 := &mut (*(*(tl@5)), move (@14)) ls@1 := move (@8) storage_dead(@8) @9 := copy (i@2) panic.- const (1 : u32) @@ -2272,7 +2346,9 @@ where continue 0 } storage_dead(@7) - @0 := &mut *(x@4) + storage_live(@13) + @13 := () + @0 := &mut (*(x@4), move (@13)) storage_dead(@6) storage_dead(tl@5) storage_dead(x@4) diff --git a/charon/tests/ui/method-impl-generalization.out b/charon/tests/ui/method-impl-generalization.out index 20a424073..da2bc708f 100644 --- a/charon/tests/ui/method-impl-generalization.out +++ b/charon/tests/ui/method-impl-generalization.out @@ -158,6 +158,11 @@ fn main() let @9: &'_ (()); // anonymous local let @10: &'_ (()); // anonymous local let @11: (); // anonymous local + let @12: (); // anonymous local + let @13: (); // anonymous local + let @14: (); // anonymous local + let @15: (); // anonymous local + let @16: (); // anonymous local storage_live(@1) storage_live(@2) @@ -166,8 +171,12 @@ fn main() storage_live(@4) storage_live(@5) @5 := const (1 : u32) - @4 := &@5 - @3 := &*(@4) + storage_live(@13) + @13 := () + @4 := &(@5, move (@13)) + storage_live(@12) + @12 := () + @3 := &(*(@4), move (@12)) @1 := {impl Trait for ()}::method1(move (@2), move (@3)) storage_dead(@3) storage_dead(@2) @@ -182,13 +191,19 @@ fn main() // Not allowed to use the more precise signature. // let _ = ().method2(String::new()); @8 := () - @7 := &@8 + storage_live(@16) + @16 := () + @7 := &(@8, move (@16)) storage_live(@9) storage_live(@10) storage_live(@11) @11 := () - @10 := &@11 - @9 := &*(@10) + storage_live(@15) + @15 := () + @10 := &(@11, move (@15)) + storage_live(@14) + @14 := () + @9 := &(*(@10), move (@14)) @6 := {impl MyCompare<&'a (())> for &'a (())}::compare<'_>(move (@7), move (@9)) storage_dead(@9) storage_dead(@7) @@ -241,19 +256,31 @@ fn call_foo<'e>(@1: &'e (())) -> &'e (()) let @4: &'_ (()); // anonymous local let @5: &'_ (()); // anonymous local let @6: (); // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local + let @9: (); // anonymous local + let @10: (); // anonymous local storage_live(@2) storage_live(@3) + storage_live(@9) // Calls have erased lifetimes so we can't notice the discrepancy if there is one. - @3 := &*(x@1) + @9 := () + @3 := &(*(x@1), move (@9)) storage_live(@4) storage_live(@5) storage_live(@6) @6 := () - @5 := &@6 - @4 := &*(@5) + storage_live(@8) + @8 := () + @5 := &(@6, move (@8)) + storage_live(@7) + @7 := () + @4 := &(*(@5), move (@7)) @2 := {impl Foo for ()}::foo<'_, '_>(move (@3), move (@4)) - @0 := &*(@2) + storage_live(@10) + @10 := () + @0 := &(*(@2), move (@10)) storage_dead(@4) storage_dead(@3) storage_dead(@6) diff --git a/charon/tests/ui/ml-name-matcher-tests.out b/charon/tests/ui/ml-name-matcher-tests.out index 2c2e015c8..1521f5454 100644 --- a/charon/tests/ui/ml-name-matcher-tests.out +++ b/charon/tests/ui/ml-name-matcher-tests.out @@ -271,12 +271,19 @@ fn foo() let @9: &'_ (Slice); // anonymous local let @10: &'_ (Slice); // anonymous local let @11: RangeFrom[Sized]; // anonymous local + let @12: (); // anonymous local + let @13: usize; // anonymous local + let @14: (); // anonymous local + let @15: (); // anonymous local + let @16: usize; // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) @3 := Option::Some { 0: const (0 : i32) } - @2 := &@3 + storage_live(@12) + @12 := () + @2 := &(@3, move (@12)) @1 := is_some<'_, i32>[Sized](move (@2)) storage_dead(@2) storage_dead(@3) @@ -286,21 +293,29 @@ fn foo() storage_live(@6) storage_live(@7) @7 := [const (false)] - @6 := &@7 - @5 := &*(@6) + storage_live(@15) + @15 := () + @6 := &(@7, move (@15)) + storage_live(@14) + @14 := () + @5 := &(*(@6), move (@14)) slice@4 := @ArrayToSliceShared<'_, bool, 1 : usize>(move (@5)) storage_dead(@5) storage_dead(@6) storage_live(@8) storage_live(@9) storage_live(@10) - @10 := &*(slice@4) + storage_live(@13) + @13 := ptr_metadata(copy (slice@4)) + @10 := &(*(slice@4), move (@13)) storage_live(@11) @11 := RangeFrom { start: const (1 : usize) } @9 := {impl Index for Slice}::index<'_, bool, RangeFrom[Sized]>[Sized, Sized[Sized]>, {impl SliceIndex> for RangeFrom[Sized]}[Sized]](move (@10), move (@11)) storage_dead(@11) storage_dead(@10) - @8 := &*(@9) + storage_live(@16) + @16 := ptr_metadata(copy (@9)) + @8 := &(*(@9), move (@16)) storage_dead(@8) @0 := () storage_dead(@9) diff --git a/charon/tests/ui/monomorphization/bound_lifetime.out b/charon/tests/ui/monomorphization/bound_lifetime.out index 64fc21d03..a51779581 100644 --- a/charon/tests/ui/monomorphization/bound_lifetime.out +++ b/charon/tests/ui/monomorphization/bound_lifetime.out @@ -25,9 +25,12 @@ fn foo<'_0>(@1: &'_0 (u32)) -> Option::<&'_ (u32)> let @0: Option::<&'_ (u32)>; // return let x@1: &'_ (u32); // arg #1 let @2: &'_ (u32); // anonymous local + let @3: (); // anonymous local storage_live(@2) - @2 := &*(x@1) + storage_live(@3) + @3 := () + @2 := &(*(x@1), move (@3)) @0 := Option::<&'_ (u32)>::Some { 0: move (@2) } storage_dead(@2) return @@ -41,14 +44,20 @@ fn main() let @2: &'_ (u32); // anonymous local let @3: &'_ (u32); // anonymous local let @4: u32; // anonymous local + let @5: (); // anonymous local + let @6: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := const (42 : u32) - @3 := &@4 - @2 := &*(@3) + storage_live(@6) + @6 := () + @3 := &(@4, move (@6)) + storage_live(@5) + @5 := () + @2 := &(*(@3), move (@5)) @1 := foo<'_>(move (@2)) storage_dead(@2) storage_dead(@4) diff --git a/charon/tests/ui/monomorphization/closure-fn.out b/charon/tests/ui/monomorphization/closure-fn.out index 5ac030516..ef35aed5f 100644 --- a/charon/tests/ui/monomorphization/closure-fn.out +++ b/charon/tests/ui/monomorphization/closure-fn.out @@ -154,9 +154,12 @@ fn apply_to::><'_0>(@1: &'_0 (closure<'_, '_>)) -> u8 let f@1: &'_ (closure<'_, '_>); // arg #1 let @2: &'_ (closure<'_, '_>); // anonymous local let @3: (u8, u8); // anonymous local + let @4: (); // anonymous local storage_live(@2) - @2 := &*(f@1) + storage_live(@4) + @4 := () + @2 := &(*(f@1), move (@4)) storage_live(@3) @3 := (const (10 : u8), const (20 : u8)) @0 := {impl Fn::, (u8, u8)>}::call<'_, '_, '_>(move (@2), move (@3)) @@ -172,9 +175,12 @@ fn {impl FnMut::, (u8, u8)>}::call_mut<'_0, '_1, '_2>(@1: &'_2 m let state@1: &'_2 mut (closure<'_0, '_1>); // arg #1 let args@2: (u8, u8); // arg #2 let @3: &'_ (closure<'_0, '_1>); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn::, (u8, u8)>}::call<'_0, '_1, '_>(move (@3), move (args@2)) return } @@ -186,9 +192,12 @@ fn apply_to_mut::><'_0>(@1: &'_0 mut (closure<'_, '_>)) -> u8 let f@1: &'_ mut (closure<'_, '_>); // arg #1 let @2: &'_ mut (closure<'_, '_>); // anonymous local let @3: (u8, u8); // anonymous local + let @4: (); // anonymous local storage_live(@2) - @2 := &mut *(f@1) + storage_live(@4) + @4 := () + @2 := &mut (*(f@1), move (@4)) storage_live(@3) @3 := (const (10 : u8), const (20 : u8)) @0 := {impl FnMut::, (u8, u8)>}::call_mut<'_, '_, '_>(move (@2), move (@3)) @@ -204,9 +213,12 @@ fn {impl FnOnce::, (u8, u8)>}::call_once<'_0, '_1>(@1: closure<' let @1: closure<'_0, '_1>; // arg #1 let @2: (u8, u8); // arg #2 let @3: &'_ mut (closure<'_0, '_1>); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut::, (u8, u8)>}::call_mut<'_0, '_1, '_>(move (@3), move (@2)) drop[Drop::>] @1 return @@ -251,6 +263,13 @@ fn main() let @14: &'_ mut (closure<'_, '_>); // anonymous local let @15: u8; // anonymous local let @16: closure<'_, '_>; // anonymous local + let @17: (); // anonymous local + let @18: (); // anonymous local + let @19: (); // anonymous local + let @20: (); // anonymous local + let @21: (); // anonymous local + let @22: (); // anonymous local + let @23: (); // anonymous local storage_live(v@1) v@1 := const (5 : u8) @@ -258,15 +277,21 @@ fn main() z@2 := const (1 : u8) storage_live(f@3) storage_live(@4) - @4 := &v@1 + storage_live(@19) + @19 := () + @4 := &(v@1, move (@19)) storage_live(@5) - @5 := &z@2 + storage_live(@18) + @18 := () + @5 := &(z@2, move (@18)) f@3 := closure { 0: move (@4), 1: move (@5) } storage_dead(@5) storage_dead(@4) storage_live(@6) storage_live(@7) - @7 := &f@3 + storage_live(@17) + @17 := () + @7 := &(f@3, move (@17)) storage_live(@8) @8 := (const (10 : u8), const (20 : u8)) @6 := {impl Fn::, (u8, u8)>}::call<'_, '_, '_>(move (@7), move (@8)) @@ -276,8 +301,12 @@ fn main() storage_live(@9) storage_live(@10) storage_live(@11) - @11 := &f@3 - @10 := &*(@11) + storage_live(@21) + @21 := () + @11 := &(f@3, move (@21)) + storage_live(@20) + @20 := () + @10 := &(*(@11), move (@20)) @9 := apply_to::><'_>(move (@10)) storage_dead(@10) storage_dead(@11) @@ -285,8 +314,12 @@ fn main() storage_live(@12) storage_live(@13) storage_live(@14) - @14 := &mut f@3 - @13 := &two-phase-mut *(@14) + storage_live(@23) + @23 := () + @14 := &mut (f@3, move (@23)) + storage_live(@22) + @22 := () + @13 := &two-phase-mut (*(@14), move (@22)) @12 := apply_to_mut::><'_>(move (@13)) storage_dead(@13) storage_dead(@14) diff --git a/charon/tests/ui/monomorphization/closures.out b/charon/tests/ui/monomorphization/closures.out index 517a55a57..e6f8db60b 100644 --- a/charon/tests/ui/monomorphization/closures.out +++ b/charon/tests/ui/monomorphization/closures.out @@ -240,9 +240,12 @@ fn apply_to_zero::>(@1: test_crate::main::closure< let f@1: test_crate::main::closure<'_>; // arg #1 let @2: &'_ (test_crate::main::closure<'_>); // anonymous local let @3: (u8); // anonymous local + let @4: (); // anonymous local storage_live(@2) - @2 := &f@1 + storage_live(@4) + @4 := () + @2 := &(f@1, move (@4)) storage_live(@3) @3 := (const (0 : u8)) @0 := {impl Fn::, (u8)>}::call<'_, '_>(move (@2), move (@3)) @@ -288,9 +291,12 @@ fn apply_to_zero_mut::>(@1: test_crate::main::cl let f@1: test_crate::main::closure#1<'_>; // arg #1 let @2: &'_ mut (test_crate::main::closure#1<'_>); // anonymous local let @3: (u8); // anonymous local + let @4: (); // anonymous local storage_live(@2) - @2 := &mut f@1 + storage_live(@4) + @4 := () + @2 := &mut (f@1, move (@4)) storage_live(@3) @3 := (const (0 : u8)) @0 := {impl FnMut::, (u8)>}::call_mut<'_, '_>(move (@2), move (@3)) @@ -363,13 +369,17 @@ fn main() let z@9: Thing; // local let @10: u8; // anonymous local let @11: test_crate::main::closure#2; // anonymous local + let @12: (); // anonymous local + let @13: (); // anonymous local storage_live(z@1) z@1 := const (1 : u8) storage_live(@2) storage_live(@3) storage_live(@4) - @4 := &z@1 + storage_live(@12) + @12 := () + @4 := &(z@1, move (@12)) @3 := test_crate::main::closure { 0: move (@4) } storage_dead(@4) @2 := apply_to_zero::>(move (@3)) @@ -380,7 +390,9 @@ fn main() storage_live(@6) storage_live(@7) storage_live(@8) - @8 := &mut z@5 + storage_live(@13) + @13 := () + @8 := &mut (z@5, move (@13)) @7 := test_crate::main::closure#1 { 0: move (@8) } storage_dead(@8) @6 := apply_to_zero_mut::>(move (@7)) @@ -409,9 +421,12 @@ fn {impl FnMut::, (u8)>}::call_mut<'_0, '_1>(@1: & let state@1: &'_1 mut (test_crate::main::closure<'_0>); // arg #1 let args@2: (u8); // arg #2 let @3: &'_ (test_crate::main::closure<'_0>); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn::, (u8)>}::call<'_0, '_>(move (@3), move (args@2)) return } @@ -423,9 +438,12 @@ fn {impl FnOnce::, (u8)>}::call_once<'_0>(@1: test let @1: test_crate::main::closure<'_0>; // arg #1 let @2: (u8); // arg #2 let @3: &'_ mut (test_crate::main::closure<'_0>); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut::, (u8)>}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop::>] @1 return @@ -467,9 +485,12 @@ fn {impl FnOnce::, (u8)>}::call_once<'_0>(@1: te let @1: test_crate::main::closure#1<'_0>; // arg #1 let @2: (u8); // arg #2 let @3: &'_ mut (test_crate::main::closure#1<'_0>); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut::, (u8)>}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop::>] @1 return diff --git a/charon/tests/ui/monomorphization/fn_ptr_generics.out b/charon/tests/ui/monomorphization/fn_ptr_generics.out index eade5f1bd..0134a172a 100644 --- a/charon/tests/ui/monomorphization/fn_ptr_generics.out +++ b/charon/tests/ui/monomorphization/fn_ptr_generics.out @@ -27,8 +27,9 @@ fn init_option() let @2: Option::; // anonymous local let b@3: Option::; // local let @4: usize; // anonymous local - let @5: &'_ (Array, 6 : usize>); // anonymous local - let @6: &'_ (Option::); // anonymous local + let @5: (); // anonymous local + let @6: &'_ (Array, 6 : usize>); // anonymous local + let @7: &'_ (Option::); // anonymous local storage_live(a@1) storage_live(@2) @@ -39,10 +40,12 @@ fn init_option() storage_live(@4) @4 := const (0 : usize) storage_live(@5) - @5 := &a@1 + @5 := () storage_live(@6) - @6 := @ArrayIndexShared<'_, Option::, 6 : usize>(move (@5), copy (@4)) - b@3 := copy (*(@6)) + @6 := &(a@1, move (@5)) + storage_live(@7) + @7 := @ArrayIndexShared<'_, Option::, 6 : usize>(move (@6), copy (@4)) + b@3 := copy (*(@7)) storage_dead(@4) @0 := () storage_dead(b@3) diff --git a/charon/tests/ui/monomorphization/fndefs-casts.out b/charon/tests/ui/monomorphization/fndefs-casts.out index 7ca3cf3cd..a38ee9594 100644 --- a/charon/tests/ui/monomorphization/fndefs-casts.out +++ b/charon/tests/ui/monomorphization/fndefs-casts.out @@ -182,16 +182,25 @@ fn takes_closure:: foo::<'_0>>(@1: for<'_0> foo::<'_0_0>) let @4: &'_ (u32); // anonymous local let @5: &'_ (u32); // anonymous local let @6: u32; // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local + let @9: (); // anonymous local storage_live(@2) - @2 := &c@1 + storage_live(@9) + @9 := () + @2 := &(c@1, move (@9)) storage_live(@3) storage_live(@4) storage_live(@5) storage_live(@6) @6 := const (13 : u32) - @5 := &@6 - @4 := &*(@5) + storage_live(@8) + @8 := () + @5 := &(@6, move (@8)) + storage_live(@7) + @7 := () + @4 := &(*(@5), move (@7)) @3 := (move (@4)) @0 := Fn:: foo::<'_0_0>, (&'_ (u32))>::call<'_>(move (@2), move (@3)) storage_dead(@4) @@ -235,6 +244,16 @@ fn main() let @25: &'_ (char); // anonymous local let @26: char; // anonymous local let @27: (); // anonymous local + let @28: (); // anonymous local + let @29: (); // anonymous local + let @30: (); // anonymous local + let @31: (); // anonymous local + let @32: (); // anonymous local + let @33: (); // anonymous local + let @34: (); // anonymous local + let @35: (); // anonymous local + let @36: (); // anonymous local + let @37: (); // anonymous local storage_live(fooint1@1) fooint1@1 := cast foo::<'_0_0>, fn<'_0>(&'_0_0 (u8))>(const (foo::<'_>)) @@ -249,8 +268,12 @@ fn main() @6 := copy (fooint1@1) storage_live(@7) storage_live(@8) - @8 := &a@4 - @7 := &*(@8) + storage_live(@29) + @29 := () + @8 := &(a@4, move (@29)) + storage_live(@28) + @28 := () + @7 := &(*(@8), move (@28)) @5 := (move @6)(move (@7)) storage_dead(@7) storage_dead(@6) @@ -263,8 +286,12 @@ fn main() @11 := copy (fooint1@1) storage_live(@12) storage_live(@13) - @13 := &a@4 - @12 := &*(@13) + storage_live(@31) + @31 := () + @13 := &(a@4, move (@31)) + storage_live(@30) + @30 := () + @12 := &(*(@13), move (@30)) @10 := (move @11)(move (@12)) storage_dead(@12) storage_dead(@11) @@ -275,8 +302,12 @@ fn main() @15 := copy (fooint1@1) storage_live(@16) storage_live(@17) - @17 := &b@9 - @16 := &*(@17) + storage_live(@33) + @33 := () + @17 := &(b@9, move (@33)) + storage_live(@32) + @32 := () + @16 := &(*(@17), move (@32)) @14 := (move @15)(move (@16)) storage_dead(@16) storage_dead(@15) @@ -287,8 +318,12 @@ fn main() @19 := copy (fooint2@2) storage_live(@20) storage_live(@21) - @21 := &b@9 - @20 := &*(@21) + storage_live(@35) + @35 := () + @21 := &(b@9, move (@35)) + storage_live(@34) + @34 := () + @20 := &(*(@21), move (@34)) @18 := (move @19)(move (@20)) storage_dead(@20) storage_dead(@19) @@ -301,8 +336,12 @@ fn main() storage_live(@25) storage_live(@26) @26 := const (x) - @25 := &@26 - @24 := &*(@25) + storage_live(@37) + @37 := () + @25 := &(@26, move (@37)) + storage_live(@36) + @36 := () + @24 := &(*(@25), move (@36)) @22 := (move @23)(move (@24)) storage_dead(@24) storage_dead(@23) diff --git a/charon/tests/ui/monomorphization/global_with_generics.out b/charon/tests/ui/monomorphization/global_with_generics.out index 666cfd690..776f5c754 100644 --- a/charon/tests/ui/monomorphization/global_with_generics.out +++ b/charon/tests/ui/monomorphization/global_with_generics.out @@ -64,13 +64,16 @@ fn main() let @0: (); // return let _b@1: bool; // local let @2: &'_ (Foo::); // anonymous local - let @3: &'_ (Foo::); // anonymous local + let @3: (); // anonymous local + let @4: &'_ (Foo::); // anonymous local storage_live(@3) + storage_live(@4) storage_live(_b@1) storage_live(@2) - @3 := &FooBool - @2 := move (@3) + @3 := () + @4 := &(FooBool, move (@3)) + @2 := move (@4) _b@1 := copy ((*(@2)).value) storage_dead(@2) @0 := () diff --git a/charon/tests/ui/monomorphization/trait_impls.out b/charon/tests/ui/monomorphization/trait_impls.out index 6236f595d..125e5cd29 100644 --- a/charon/tests/ui/monomorphization/trait_impls.out +++ b/charon/tests/ui/monomorphization/trait_impls.out @@ -60,9 +60,12 @@ fn do_test::(@1: bool) let @0: (); // return let x@1: bool; // arg #1 let @2: &'_ (bool); // anonymous local + let @3: (); // anonymous local storage_live(@2) - @2 := &x@1 + storage_live(@3) + @3 := () + @2 := &(x@1, move (@3)) @0 := {impl Trait::}::method<'_>(move (@2)) storage_dead(@2) drop[Drop::] x@1 diff --git a/charon/tests/ui/monomorphization/trait_impls_ullbc.out b/charon/tests/ui/monomorphization/trait_impls_ullbc.out index 809bb8412..aac4de7d6 100644 --- a/charon/tests/ui/monomorphization/trait_impls_ullbc.out +++ b/charon/tests/ui/monomorphization/trait_impls_ullbc.out @@ -71,14 +71,20 @@ fn do_test::(@1: bool, @2: bool) let @4: bool; // anonymous local let @5: &'_ (bool); // anonymous local let @6: &'_ (bool); // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local bb0: { storage_live(@3); storage_live(@4); storage_live(@5); - @5 := &expected@2; + storage_live(@8); + @8 := (); + @5 := &(expected@2, move (@8)); storage_live(@6); - @6 := &init@1; + storage_live(@7); + @7 := (); + @6 := &(init@1, move (@7)); @4 := {impl PartialEq::}::eq<'_, '_>(move (@5), move (@6)) -> bb1 (unwind: bb2); } diff --git a/charon/tests/ui/no_nested_borrows.out b/charon/tests/ui/no_nested_borrows.out index a93cf75a0..9a8dd2d45 100644 --- a/charon/tests/ui/no_nested_borrows.out +++ b/charon/tests/ui/no_nested_borrows.out @@ -459,18 +459,24 @@ pub fn test_box1() let @6: (); // anonymous local let @7: bool; // anonymous local let @8: i32; // anonymous local + let @9: (); // anonymous local + let @10: (); // anonymous local storage_live(b@1) b@1 := @BoxNew[Sized](const (0 : i32)) storage_live(x@2) storage_live(@3) - @3 := &two-phase-mut b@1 + storage_live(@9) + @9 := () + @3 := &two-phase-mut (b@1, move (@9)) x@2 := {impl DerefMut for alloc::boxed::Box[@TraitClause0, @TraitClause1]}::deref_mut<'_, i32, Global>[MetaSized, Sized](move (@3)) storage_dead(@3) *(x@2) := const (1 : i32) storage_live(x@4) storage_live(@5) - @5 := &b@1 + storage_live(@10) + @10 := () + @5 := &(b@1, move (@10)) x@4 := {impl Deref for alloc::boxed::Box[@TraitClause0, @TraitClause1]}::deref<'_, i32, Global>[MetaSized, Sized](move (@5)) storage_dead(@5) storage_live(@6) diff --git a/charon/tests/ui/opacity.out b/charon/tests/ui/opacity.out index cd7194378..77d0ef985 100644 --- a/charon/tests/ui/opacity.out +++ b/charon/tests/ui/opacity.out @@ -123,12 +123,17 @@ fn foo() let @6: &'_ (i32); // anonymous local let @7: &'_ (i32); // anonymous local let @8: i32; // anonymous local + let @9: (); // anonymous local + let @10: (); // anonymous local + let @11: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) @3 := Option::Some { 0: const (0 : i32) } - @2 := &@3 + storage_live(@9) + @9 := () + @2 := &(@3, move (@9)) @1 := is_some<'_, i32>[Sized](move (@2)) storage_dead(@2) storage_dead(@3) @@ -141,8 +146,12 @@ fn foo() storage_live(@7) storage_live(@8) @8 := const (0 : i32) - @7 := &@8 - @6 := &*(@7) + storage_live(@11) + @11 := () + @7 := &(@8, move (@11)) + storage_live(@10) + @10 := () + @6 := &(*(@7), move (@10)) @5 := from_ref<'_, i32>[Sized](move (@6)) storage_dead(@6) storage_dead(@8) diff --git a/charon/tests/ui/opaque_attribute.out b/charon/tests/ui/opaque_attribute.out index aeb7d8425..7a459eac8 100644 --- a/charon/tests/ui/opaque_attribute.out +++ b/charon/tests/ui/opaque_attribute.out @@ -61,17 +61,25 @@ where let self@1: &'_ (Option[@TraitClause0]); // arg #1 let x@2: &'_ (T); // local let @3: &'_ (T); // anonymous local + let @4: (); // anonymous local + let @5: (); // anonymous local storage_live(x@2) storage_live(@3) + storage_live(@4) + storage_live(@5) match *(self@1) { Option::None => { }, Option::Some => { storage_live(x@2) - x@2 := &(*(self@1) as variant Option::Some).0 + storage_live(@5) + @5 := () + x@2 := &((*(self@1) as variant Option::Some).0, move (@5)) storage_live(@3) - @3 := &*(x@2) + storage_live(@4) + @4 := () + @3 := &(*(x@2), move (@4)) @0 := @TraitClause1::get_bool<'_>(move (@3)) storage_dead(@3) storage_dead(x@2) diff --git a/charon/tests/ui/panics.out b/charon/tests/ui/panics.out index eaf14e2cd..67ca6aa31 100644 --- a/charon/tests/ui/panics.out +++ b/charon/tests/ui/panics.out @@ -32,14 +32,20 @@ fn panic2() let @2: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @3: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @4: Array<&'_ (Str), 1 : usize>; // anonymous local + let @5: (); // anonymous local + let @6: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := [const ("O no!")] - @3 := &@4 - @2 := &*(@3) + storage_live(@6) + @6 := () + @3 := &(@4, move (@6)) + storage_live(@5) + @5 := () + @2 := &(*(@3), move (@5)) @1 := new_const<'_, 1 : usize>(move (@2)) storage_dead(@2) panic(core::panicking::panic_fmt) @@ -56,20 +62,32 @@ fn panic3() let @5: &'_ (Array, 0 : usize>); // anonymous local let @6: &'_ (Array, 0 : usize>); // anonymous local let @7: Array, 0 : usize>; // anonymous local + let @8: (); // anonymous local + let @9: (); // anonymous local + let @10: (); // anonymous local + let @11: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := [const ("O no!")] - @3 := &@4 - @2 := &*(@3) + storage_live(@11) + @11 := () + @3 := &(@4, move (@11)) + storage_live(@10) + @10 := () + @2 := &(*(@3), move (@10)) storage_live(@5) storage_live(@6) storage_live(@7) @7 := [] - @6 := &@7 - @5 := &*(@6) + storage_live(@9) + @9 := () + @6 := &(@7, move (@9)) + storage_live(@8) + @8 := () + @5 := &(*(@6), move (@8)) @1 := new_v1<'_, 1 : usize, 0 : usize>(move (@2), move (@5)) storage_dead(@5) storage_dead(@2) @@ -104,11 +122,15 @@ fn panic5() let @4: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @5: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @6: Array<&'_ (Str), 1 : usize>; // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local storage_live(@3) storage_live(@4) storage_live(@5) storage_live(@6) + storage_live(@7) + storage_live(@8) storage_live(@1) storage_live(@2) @2 := const (false) @@ -120,8 +142,12 @@ fn panic5() storage_live(@5) storage_live(@6) @6 := [const ("assert failed")] - @5 := &@6 - @4 := &*(@5) + storage_live(@8) + @8 := () + @5 := &(@6, move (@8)) + storage_live(@7) + @7 := () + @4 := &(*(@5), move (@7)) @3 := new_const<'_, 1 : usize>(move (@4)) storage_dead(@4) panic(core::panicking::panic_fmt) @@ -152,20 +178,32 @@ fn panic7() let @5: &'_ (Array, 0 : usize>); // anonymous local let @6: &'_ (Array, 0 : usize>); // anonymous local let @7: Array, 0 : usize>; // anonymous local + let @8: (); // anonymous local + let @9: (); // anonymous local + let @10: (); // anonymous local + let @11: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := [const ("internal error: entered unreachable code: can't reach this")] - @3 := &@4 - @2 := &*(@3) + storage_live(@11) + @11 := () + @3 := &(@4, move (@11)) + storage_live(@10) + @10 := () + @2 := &(*(@3), move (@10)) storage_live(@5) storage_live(@6) storage_live(@7) @7 := [] - @6 := &@7 - @5 := &*(@6) + storage_live(@9) + @9 := () + @6 := &(@7, move (@9)) + storage_live(@8) + @8 := () + @5 := &(*(@6), move (@8)) @1 := new_v1<'_, 1 : usize, 0 : usize>(move (@2), move (@5)) storage_dead(@5) storage_dead(@2) diff --git a/charon/tests/ui/plain-panic-str.out b/charon/tests/ui/plain-panic-str.out index 29150cee9..82e7f043f 100644 --- a/charon/tests/ui/plain-panic-str.out +++ b/charon/tests/ui/plain-panic-str.out @@ -17,14 +17,20 @@ fn main() let @2: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @3: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @4: Array<&'_ (Str), 1 : usize>; // anonymous local + let @5: (); // anonymous local + let @6: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := [const ("O no")] - @3 := &@4 - @2 := &*(@3) + storage_live(@6) + @6 := () + @3 := &(@4, move (@6)) + storage_live(@5) + @5 := () + @2 := &(*(@3), move (@5)) @1 := new_const<'_, 1 : usize>(move (@2)) storage_dead(@2) panic(core::panicking::panic_fmt) diff --git a/charon/tests/ui/polonius_map.out b/charon/tests/ui/polonius_map.out index 4f5f8107a..53f91be0a 100644 --- a/charon/tests/ui/polonius_map.out +++ b/charon/tests/ui/polonius_map.out @@ -284,6 +284,16 @@ pub fn get_or_insert<'_0>(@1: &'_0 mut (HashMap[Sized(@1: &'_0 mut (HashMap[Sized[Sized, Sized, Sized, {impl Eq for u32}, {impl Hash for u32}, {impl BuildHasher for RandomState}, MetaSized, {impl Borrow for T}[MetaSized], {impl Hash for u32}, {impl Eq for u32}](move (@3), move (@4)) storage_dead(@4) storage_dead(@3) @@ -310,25 +333,37 @@ pub fn get_or_insert<'_0>(@1: &'_0 mut (HashMap[Sized { storage_live(@8) storage_live(@9) - @9 := &two-phase-mut *(map@1) + storage_live(@19) + @19 := () + @9 := &two-phase-mut (*(map@1), move (@19)) @8 := insert<'_, u32, u32, RandomState>[Sized, Sized, Sized, {impl Eq for u32}, {impl Hash for u32}, {impl BuildHasher for RandomState}](move (@9), const (22 : u32), const (33 : u32)) storage_dead(@9) storage_dead(@8) storage_live(@10) storage_live(@11) storage_live(@12) - @12 := &*(map@1) + storage_live(@22) + @22 := () + @12 := &(*(map@1), move (@22)) storage_live(@13) storage_live(@14) storage_live(@15) @15 := const (22 : u32) - @14 := &@15 - @13 := &*(@14) + storage_live(@21) + @21 := () + @14 := &(@15, move (@21)) + storage_live(@20) + @20 := () + @13 := &(*(@14), move (@20)) @11 := {impl Index<&'_0 (Q)> for HashMap[@TraitClause0, @TraitClause2, @TraitClause3]}::index<'_, '_, u32, u32, u32, RandomState>[Sized, MetaSized, Sized, Sized, {impl Eq for u32}, {impl Hash for u32}, {impl Borrow for T}[MetaSized], {impl Eq for u32}, {impl Hash for u32}, {impl BuildHasher for RandomState}](move (@12), move (@13)) storage_dead(@13) storage_dead(@12) - @10 := &*(@11) - @0 := &*(@10) + storage_live(@25) + @25 := () + @10 := &(*(@11), move (@25)) + storage_live(@24) + @24 := () + @0 := &(*(@10), move (@24)) storage_dead(@15) storage_dead(@14) storage_dead(@11) @@ -337,7 +372,9 @@ pub fn get_or_insert<'_0>(@1: &'_0 mut (HashMap[Sized { storage_live(v@7) v@7 := copy ((@2 as variant Option::Some).0) - @0 := &*(v@7) + storage_live(@23) + @23 := () + @0 := &(*(v@7), move (@23)) storage_dead(v@7) }, } diff --git a/charon/tests/ui/predicates-on-late-bound-vars.out b/charon/tests/ui/predicates-on-late-bound-vars.out index fe940d74c..a1cf39993 100644 --- a/charon/tests/ui/predicates-on-late-bound-vars.out +++ b/charon/tests/ui/predicates-on-late-bound-vars.out @@ -118,9 +118,12 @@ fn wrap<'a>(@1: &'a (u32)) -> Option<&'a (u32)>[Sized<&'a (u32)>] let @0: Option<&'_ (u32)>[Sized<&'_ (u32)>]; // return let x@1: &'_ (u32); // arg #1 let @2: &'_ (u32); // anonymous local + let @3: (); // anonymous local storage_live(@2) - @2 := &*(x@1) + storage_live(@3) + @3 := () + @2 := &(*(x@1), move (@3)) @0 := Option::Some { 0: move (@2) } storage_dead(@2) return @@ -134,9 +137,12 @@ where let @0: Option<&'_ (u32)>[Sized<&'_ (u32)>]; // return let x@1: &'_ (u32); // arg #1 let @2: &'_ (u32); // anonymous local + let @3: (); // anonymous local storage_live(@2) - @2 := &*(x@1) + storage_live(@3) + @3 := () + @2 := &(*(x@1), move (@3)) @0 := Option::Some { 0: move (@2) } storage_dead(@2) return @@ -149,13 +155,16 @@ fn foo() let ref_b@1: RefCell[MetaSized]; // local let @2: Result[MetaSized], BorrowError>[Sized[MetaSized]>, Sized]; // anonymous local let @3: &'_ (RefCell[MetaSized]); // anonymous local + let @4: (); // anonymous local storage_live(ref_b@1) ref_b@1 := new[Sized](const (false)) storage_live(@2) storage_live(@3) + storage_live(@4) // `try_borrow` has a type that includes predicates on late bound regions. - @3 := &ref_b@1 + @4 := () + @3 := &(ref_b@1, move (@4)) @2 := try_borrow<'_, bool>[MetaSized](move (@3)) storage_dead(@3) drop[{impl Drop for Result[@TraitClause0, @TraitClause1]}[MetaSized], BorrowError>[Sized[MetaSized]>, Sized]] @2 diff --git a/charon/tests/ui/projection-index-from-end.out b/charon/tests/ui/projection-index-from-end.out index 640694ac7..0d5ecd03d 100644 --- a/charon/tests/ui/projection-index-from-end.out +++ b/charon/tests/ui/projection-index-from-end.out @@ -9,10 +9,12 @@ fn slice_pattern_end<'_0>(@1: &'_0 (Slice<()>)) let @3: usize; // anonymous local let @4: bool; // anonymous local let _named@5: &'_ (()); // local - let @6: &'_ (Slice<()>); // anonymous local + let @6: (); // anonymous local let @7: usize; // anonymous local - let @8: usize; // anonymous local - let @9: &'_ (()); // anonymous local + let @8: &'_ (Slice<()>); // anonymous local + let @9: usize; // anonymous local + let @10: usize; // anonymous local + let @11: &'_ (()); // anonymous local storage_live(@2) storage_live(@3) @@ -29,15 +31,19 @@ fn slice_pattern_end<'_0>(@1: &'_0 (Slice<()>)) } storage_live(_named@5) storage_live(@6) - @6 := &*(x@1) + @6 := () storage_live(@7) - @7 := len(*(x@1)) + @7 := ptr_metadata(copy (x@1)) storage_live(@8) - @8 := copy (@7) ub.- const (1 : usize) - storage_dead(@7) + @8 := &(*(x@1), move (@7)) storage_live(@9) - @9 := @SliceIndexShared<'_, ()>(move (@6), copy (@8)) - _named@5 := &*(@9) + @9 := len(*(x@1)) + storage_live(@10) + @10 := copy (@9) ub.- const (1 : usize) + storage_dead(@9) + storage_live(@11) + @11 := @SliceIndexShared<'_, ()>(move (@8), copy (@10)) + _named@5 := &(*(@11), move (@6)) @0 := () storage_dead(_named@5) @0 := () diff --git a/charon/tests/ui/ptr-offset.out b/charon/tests/ui/ptr-offset.out index 4433464b2..a8460bc38 100644 --- a/charon/tests/ui/ptr-offset.out +++ b/charon/tests/ui/ptr-offset.out @@ -85,7 +85,8 @@ fn precondition_check(@1: *const (), @2: isize, @3: usize) let @24: u64; // anonymous local let @25: &'_ (Slice<&'_ (Str)>); // anonymous local let @26: &'_ (Slice>); // anonymous local - let @27: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @27: (); // anonymous local + let @28: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@5) storage_live(pieces@7) @@ -98,7 +99,7 @@ fn precondition_check(@1: *const (), @2: isize, @3: usize) storage_live(@22) storage_live(@23) storage_live(@24) - storage_live(@27) + storage_live(@28) storage_live(@4) storage_live(overflow@19) storage_live(rhs@9) @@ -162,13 +163,15 @@ fn precondition_check(@1: *const (), @2: isize, @3: usize) storage_live(@6) storage_live(@8) @8 := [const ("unsafe precondition(s) violated: ptr::offset requires the address calculation to not overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@7 := &@8 + storage_live(@27) + @27 := () + pieces@7 := &(@8, move (@27)) storage_live(@25) @25 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@7)) storage_live(@26) @26 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(copy ({promoted_const}<'_, 1 : usize>)) - @27 := Option::None { } - @6 := Arguments { 0: move (@25), 1: move (@27), 2: move (@26) } + @28 := Option::None { } + @6 := Arguments { 0: move (@25), 1: move (@28), 2: move (@26) } storage_dead(@26) storage_dead(@25) @5 := panic_nounwind_fmt<'_>(move (@6), const (false)) @@ -225,13 +228,16 @@ fn main() let @7: i32; // anonymous local let @8: *const i32; // anonymous local let @9: *const i32; // anonymous local + let @10: (); // anonymous local storage_live(s@1) s@1 := [const (11 : i32), const (42 : i32)] storage_live(ptr@2) storage_live(@3) storage_live(@4) - @4 := &s@1 + storage_live(@10) + @10 := () + @4 := &(s@1, move (@10)) @3 := @ArrayToSliceShared<'_, i32, 2 : usize>(move (@4)) storage_dead(@4) ptr@2 := as_ptr<'_, i32>[Sized](move (@3)) diff --git a/charon/tests/ui/raw-boxes.out b/charon/tests/ui/raw-boxes.out index cf21957bb..445c7fe4d 100644 --- a/charon/tests/ui/raw-boxes.out +++ b/charon/tests/ui/raw-boxes.out @@ -299,9 +299,11 @@ fn core::ptr::alignment::{Alignment}::new_unchecked::precondition_check(@1: usiz let @6: u32; // anonymous local let @7: &'_ (Slice<&'_ (Str)>); // anonymous local let @8: &'_ (Slice>); // anonymous local - let @9: &'_ (Array, 0 : usize>); // anonymous local - let @10: Array, 0 : usize>; // anonymous local - let @11: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @9: (); // anonymous local + let @10: &'_ (Array, 0 : usize>); // anonymous local + let @11: Array, 0 : usize>; // anonymous local + let @12: (); // anonymous local + let @13: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@2) storage_live(@3) @@ -312,25 +314,31 @@ fn core::ptr::alignment::{Alignment}::new_unchecked::precondition_check(@1: usiz storage_live(@9) storage_live(@10) storage_live(@11) + storage_live(@12) + storage_live(@13) storage_live(@6) @6 := ctpop[Sized, {impl Copy for usize}](move (align@1)) switch move (@6) { 1 : u32 => { }, _ => { - @10 := [] - @9 := &@10 + @11 := [] + storage_live(@12) + @12 := () + @10 := &(@11, move (@12)) storage_dead(@6) storage_live(@3) storage_live(@5) @5 := [const ("unsafe precondition(s) violated: Alignment::new_unchecked requires a power of two\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@4 := &@5 + storage_live(@9) + @9 := () + pieces@4 := &(@5, move (@9)) storage_live(@7) @7 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@4)) storage_live(@8) - @8 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@9)) - @11 := Option::None { } - @3 := Arguments { pieces: move (@7), fmt: move (@11), args: move (@8) } + @8 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@10)) + @13 := Option::None { } + @3 := Arguments { pieces: move (@7), fmt: move (@13), args: move (@8) } storage_dead(@8) storage_dead(@7) @2 := panic_nounwind_fmt<'_>(move (@3), const (false)) @@ -536,14 +544,18 @@ fn core::ptr::write_bytes::precondition_check(@1: *const (), @2: usize, @3: bool let @16: &'_ (Slice>); // anonymous local let @17: &'_ (Slice<&'_ (Str)>); // anonymous local let @18: &'_ (Slice>); // anonymous local - let @19: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local - let @20: Array<&'_ (Str), 1 : usize>; // anonymous local - let @21: &'_ (Array, 0 : usize>); // anonymous local - let @22: Array, 0 : usize>; // anonymous local + let @19: (); // anonymous local + let @20: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local + let @21: Array<&'_ (Str), 1 : usize>; // anonymous local + let @22: (); // anonymous local let @23: &'_ (Array, 0 : usize>); // anonymous local let @24: Array, 0 : usize>; // anonymous local - let @25: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local - let @26: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @25: (); // anonymous local + let @26: &'_ (Array, 0 : usize>); // anonymous local + let @27: Array, 0 : usize>; // anonymous local + let @28: (); // anonymous local + let @29: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @30: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@5) storage_live(pieces@7) @@ -551,7 +563,6 @@ fn core::ptr::write_bytes::precondition_check(@1: *const (), @2: usize, @3: bool storage_live(@10) storage_live(@15) storage_live(@16) - storage_live(@19) storage_live(@20) storage_live(@21) storage_live(@22) @@ -559,6 +570,9 @@ fn core::ptr::write_bytes::precondition_check(@1: *const (), @2: usize, @3: bool storage_live(@24) storage_live(@25) storage_live(@26) + storage_live(@27) + storage_live(@29) + storage_live(@30) storage_live(@4) storage_live(@12) storage_live(@14) @@ -567,18 +581,22 @@ fn core::ptr::write_bytes::precondition_check(@1: *const (), @2: usize, @3: bool 1 : u32 => { }, _ => { - @20 := [const ("is_aligned_to: align is not a power-of-two")] - @19 := &@20 - @22 := [] - @21 := &@22 + @21 := [const ("is_aligned_to: align is not a power-of-two")] + storage_live(@22) + @22 := () + @20 := &(@21, move (@22)) + @24 := [] + storage_live(@25) + @25 := () + @23 := &(@24, move (@25)) storage_dead(@14) storage_live(@10) storage_live(@15) - @15 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@19)) + @15 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@20)) storage_live(@16) - @16 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@21)) - @25 := Option::None { } - @10 := Arguments { pieces: move (@15), fmt: move (@25), args: move (@16) } + @16 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@23)) + @29 := Option::None { } + @10 := Arguments { pieces: move (@15), fmt: move (@29), args: move (@16) } storage_dead(@16) storage_dead(@15) panic(core::panicking::panic_fmt) @@ -620,18 +638,22 @@ fn core::ptr::write_bytes::precondition_check(@1: *const (), @2: usize, @3: bool storage_dead(@12) }, } - @24 := [] - @23 := &@24 + @27 := [] + storage_live(@28) + @28 := () + @26 := &(@27, move (@28)) storage_live(@6) storage_live(@8) @8 := [const ("unsafe precondition(s) violated: ptr::write_bytes requires that the destination pointer is aligned and non-null\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@7 := &@8 + storage_live(@19) + @19 := () + pieces@7 := &(@8, move (@19)) storage_live(@17) @17 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@7)) storage_live(@18) - @18 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@23)) - @26 := Option::None { } - @6 := Arguments { pieces: move (@17), fmt: move (@26), args: move (@18) } + @18 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@26)) + @30 := Option::None { } + @6 := Arguments { pieces: move (@17), fmt: move (@30), args: move (@18) } storage_dead(@18) storage_dead(@17) @5 := panic_nounwind_fmt<'_>(move (@6), const (false)) @@ -763,19 +785,22 @@ pub fn new_const<'a, const N : usize>(@1: &'a (Array<&'static (Str), const N : u let @3: &'_ (Slice>); // anonymous local let @4: &'_ (Array, 0 : usize>); // anonymous local let @5: Array, 0 : usize>; // anonymous local - let @6: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @6: (); // anonymous local + let @7: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@4) storage_live(@5) - storage_live(@6) + storage_live(@7) @5 := [] - @4 := &@5 + storage_live(@6) + @6 := () + @4 := &(@5, move (@6)) storage_live(@2) @2 := @ArrayToSliceShared<'_, &'_ (Str), const N : usize>(copy (pieces@1)) storage_live(@3) @3 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@4)) - @6 := Option::None { } - @0 := Arguments { pieces: move (@2), fmt: move (@6), args: move (@3) } + @7 := Option::None { } + @0 := Arguments { pieces: move (@2), fmt: move (@7), args: move (@3) } storage_dead(@3) storage_dead(@2) return @@ -793,6 +818,8 @@ pub fn panic_nounwind(@1: &'static (Str)) -> ! let @5: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @6: Array<&'_ (Str), 1 : usize>; // anonymous local let @7: &'_ (Str); // anonymous local + let @8: (); // anonymous local + let @9: (); // anonymous local storage_live(@2) storage_live(@3) @@ -803,8 +830,12 @@ pub fn panic_nounwind(@1: &'static (Str)) -> ! @7 := copy (expr@1) @6 := [move (@7)] storage_dead(@7) - @5 := &@6 - @4 := &*(@5) + storage_live(@9) + @9 := () + @5 := &(@6, move (@9)) + storage_live(@8) + @8 := () + @4 := &(*(@5), move (@8)) @3 := new_const<'_, 1 : usize>(move (@4)) storage_dead(@4) @2 := panic_nounwind_fmt<'_>(move (@3), const (false)) @@ -942,19 +973,25 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () let @32: &'_ (Slice>); // anonymous local let @33: &'_ (Slice<&'_ (Str)>); // anonymous local let @34: &'_ (Slice>); // anonymous local - let @35: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local - let @36: Array<&'_ (Str), 1 : usize>; // anonymous local - let @37: &'_ (Array, 0 : usize>); // anonymous local - let @38: Array, 0 : usize>; // anonymous local + let @35: (); // anonymous local + let @36: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local + let @37: Array<&'_ (Str), 1 : usize>; // anonymous local + let @38: (); // anonymous local let @39: &'_ (Array, 0 : usize>); // anonymous local let @40: Array, 0 : usize>; // anonymous local - let @41: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local - let @42: Array<&'_ (Str), 1 : usize>; // anonymous local - let @43: &'_ (Array, 0 : usize>); // anonymous local - let @44: Array, 0 : usize>; // anonymous local - let @45: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local - let @46: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local - let @47: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @41: (); // anonymous local + let @42: &'_ (Array, 0 : usize>); // anonymous local + let @43: Array, 0 : usize>; // anonymous local + let @44: (); // anonymous local + let @45: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local + let @46: Array<&'_ (Str), 1 : usize>; // anonymous local + let @47: (); // anonymous local + let @48: &'_ (Array, 0 : usize>); // anonymous local + let @49: Array, 0 : usize>; // anonymous local + let @50: (); // anonymous local + let @51: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @52: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @53: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@11) storage_live(ptr@12) @@ -973,7 +1010,6 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_live(@30) storage_live(@31) storage_live(@32) - storage_live(@35) storage_live(@36) storage_live(@37) storage_live(@38) @@ -982,10 +1018,15 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_live(@41) storage_live(@42) storage_live(@43) - storage_live(@44) storage_live(@45) storage_live(@46) storage_live(@47) + storage_live(@48) + storage_live(@49) + storage_live(@50) + storage_live(@51) + storage_live(@52) + storage_live(@53) storage_live(@6) storage_live(zero_size@7) switch copy (count@5) { @@ -1005,18 +1046,22 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () 1 : u32 => { }, _ => { - @36 := [const ("is_aligned_to: align is not a power-of-two")] - @35 := &@36 - @38 := [] - @37 := &@38 + @37 := [const ("is_aligned_to: align is not a power-of-two")] + storage_live(@38) + @38 := () + @36 := &(@37, move (@38)) + @40 := [] + storage_live(@41) + @41 := () + @39 := &(@40, move (@41)) storage_dead(@23) storage_live(@19) storage_live(@24) - @24 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@35)) + @24 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@36)) storage_live(@25) - @25 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@37)) - @45 := Option::None { } - @19 := Arguments { pieces: move (@24), fmt: move (@45), args: move (@25) } + @25 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) + @51 := Option::None { } + @19 := Arguments { pieces: move (@24), fmt: move (@51), args: move (@25) } storage_dead(@25) storage_dead(@24) panic(core::panicking::panic_fmt) @@ -1045,18 +1090,22 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () 1 : u32 => { }, _ => { - @42 := [const ("is_aligned_to: align is not a power-of-two")] - @41 := &@42 - @44 := [] - @43 := &@44 + @46 := [const ("is_aligned_to: align is not a power-of-two")] + storage_live(@47) + @47 := () + @45 := &(@46, move (@47)) + @49 := [] + storage_live(@50) + @50 := () + @48 := &(@49, move (@50)) storage_dead(@30) storage_live(@27) storage_live(@31) - @31 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@41)) + @31 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@45)) storage_live(@32) - @32 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@43)) - @47 := Option::None { } - @27 := Arguments { pieces: move (@31), fmt: move (@47), args: move (@32) } + @32 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@48)) + @53 := Option::None { } + @27 := Arguments { pieces: move (@31), fmt: move (@53), args: move (@32) } storage_dead(@32) storage_dead(@31) panic(core::panicking::panic_fmt) @@ -1082,18 +1131,22 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () return } else { - @40 := [] - @39 := &@40 + @43 := [] + storage_live(@44) + @44 := () + @42 := &(@43, move (@44)) storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@16 := &@17 + storage_live(@35) + @35 := () + pieces@16 := &(@17, move (@35)) storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) - @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) - @46 := Option::None { } - @15 := Arguments { pieces: move (@33), fmt: move (@46), args: move (@34) } + @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@42)) + @52 := Option::None { } + @15 := Arguments { pieces: move (@33), fmt: move (@52), args: move (@34) } storage_dead(@34) storage_dead(@33) @14 := panic_nounwind_fmt<'_>(move (@15), const (false)) @@ -1117,18 +1170,22 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () return } else { - @40 := [] - @39 := &@40 + @43 := [] + storage_live(@44) + @44 := () + @42 := &(@43, move (@44)) storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@16 := &@17 + storage_live(@35) + @35 := () + pieces@16 := &(@17, move (@35)) storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) - @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) - @46 := Option::None { } - @15 := Arguments { pieces: move (@33), fmt: move (@46), args: move (@34) } + @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@42)) + @52 := Option::None { } + @15 := Arguments { pieces: move (@33), fmt: move (@52), args: move (@34) } storage_dead(@34) storage_dead(@33) @14 := panic_nounwind_fmt<'_>(move (@15), const (false)) @@ -1139,18 +1196,22 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_dead(@11) storage_dead(@8) storage_dead(zero_size@7) - @40 := [] - @39 := &@40 + @43 := [] + storage_live(@44) + @44 := () + @42 := &(@43, move (@44)) storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@16 := &@17 + storage_live(@35) + @35 := () + pieces@16 := &(@17, move (@35)) storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) - @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) - @46 := Option::None { } - @15 := Arguments { pieces: move (@33), fmt: move (@46), args: move (@34) } + @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@42)) + @52 := Option::None { } + @15 := Arguments { pieces: move (@33), fmt: move (@52), args: move (@34) } storage_dead(@34) storage_dead(@33) @14 := panic_nounwind_fmt<'_>(move (@15), const (false)) @@ -1164,18 +1225,22 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_dead(@11) storage_dead(@8) storage_dead(zero_size@7) - @40 := [] - @39 := &@40 + @43 := [] + storage_live(@44) + @44 := () + @42 := &(@43, move (@44)) storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@16 := &@17 + storage_live(@35) + @35 := () + pieces@16 := &(@17, move (@35)) storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) - @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) - @46 := Option::None { } - @15 := Arguments { pieces: move (@33), fmt: move (@46), args: move (@34) } + @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@42)) + @52 := Option::None { } + @15 := Arguments { pieces: move (@33), fmt: move (@52), args: move (@34) } storage_dead(@34) storage_dead(@33) @14 := panic_nounwind_fmt<'_>(move (@15), const (false)) @@ -1202,18 +1267,22 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () 1 : u32 => { }, _ => { - @42 := [const ("is_aligned_to: align is not a power-of-two")] - @41 := &@42 - @44 := [] - @43 := &@44 + @46 := [const ("is_aligned_to: align is not a power-of-two")] + storage_live(@47) + @47 := () + @45 := &(@46, move (@47)) + @49 := [] + storage_live(@50) + @50 := () + @48 := &(@49, move (@50)) storage_dead(@30) storage_live(@27) storage_live(@31) - @31 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@41)) + @31 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@45)) storage_live(@32) - @32 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@43)) - @47 := Option::None { } - @27 := Arguments { pieces: move (@31), fmt: move (@47), args: move (@32) } + @32 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@48)) + @53 := Option::None { } + @27 := Arguments { pieces: move (@31), fmt: move (@53), args: move (@32) } storage_dead(@32) storage_dead(@31) panic(core::panicking::panic_fmt) @@ -1239,18 +1308,22 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () return } else { - @40 := [] - @39 := &@40 + @43 := [] + storage_live(@44) + @44 := () + @42 := &(@43, move (@44)) storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@16 := &@17 + storage_live(@35) + @35 := () + pieces@16 := &(@17, move (@35)) storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) - @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) - @46 := Option::None { } - @15 := Arguments { pieces: move (@33), fmt: move (@46), args: move (@34) } + @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@42)) + @52 := Option::None { } + @15 := Arguments { pieces: move (@33), fmt: move (@52), args: move (@34) } storage_dead(@34) storage_dead(@33) @14 := panic_nounwind_fmt<'_>(move (@15), const (false)) @@ -1274,18 +1347,22 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () return } else { - @40 := [] - @39 := &@40 + @43 := [] + storage_live(@44) + @44 := () + @42 := &(@43, move (@44)) storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@16 := &@17 + storage_live(@35) + @35 := () + pieces@16 := &(@17, move (@35)) storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) - @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) - @46 := Option::None { } - @15 := Arguments { pieces: move (@33), fmt: move (@46), args: move (@34) } + @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@42)) + @52 := Option::None { } + @15 := Arguments { pieces: move (@33), fmt: move (@52), args: move (@34) } storage_dead(@34) storage_dead(@33) @14 := panic_nounwind_fmt<'_>(move (@15), const (false)) @@ -1296,18 +1373,22 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_dead(@11) storage_dead(@8) storage_dead(zero_size@7) - @40 := [] - @39 := &@40 + @43 := [] + storage_live(@44) + @44 := () + @42 := &(@43, move (@44)) storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@16 := &@17 + storage_live(@35) + @35 := () + pieces@16 := &(@17, move (@35)) storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) - @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) - @46 := Option::None { } - @15 := Arguments { pieces: move (@33), fmt: move (@46), args: move (@34) } + @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@42)) + @52 := Option::None { } + @15 := Arguments { pieces: move (@33), fmt: move (@52), args: move (@34) } storage_dead(@34) storage_dead(@33) @14 := panic_nounwind_fmt<'_>(move (@15), const (false)) @@ -1321,18 +1402,22 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_dead(@11) storage_dead(@8) storage_dead(zero_size@7) - @40 := [] - @39 := &@40 + @43 := [] + storage_live(@44) + @44 := () + @42 := &(@43, move (@44)) storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@16 := &@17 + storage_live(@35) + @35 := () + pieces@16 := &(@17, move (@35)) storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) - @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) - @46 := Option::None { } - @15 := Arguments { pieces: move (@33), fmt: move (@46), args: move (@34) } + @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@42)) + @52 := Option::None { } + @15 := Arguments { pieces: move (@33), fmt: move (@52), args: move (@34) } storage_dead(@34) storage_dead(@33) @14 := panic_nounwind_fmt<'_>(move (@15), const (false)) @@ -1345,18 +1430,22 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_dead(@11) storage_dead(@8) storage_dead(zero_size@7) - @40 := [] - @39 := &@40 + @43 := [] + storage_live(@44) + @44 := () + @42 := &(@43, move (@44)) storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@16 := &@17 + storage_live(@35) + @35 := () + pieces@16 := &(@17, move (@35)) storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) - @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) - @46 := Option::None { } - @15 := Arguments { pieces: move (@33), fmt: move (@46), args: move (@34) } + @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@42)) + @52 := Option::None { } + @15 := Arguments { pieces: move (@33), fmt: move (@52), args: move (@34) } storage_dead(@34) storage_dead(@33) @14 := panic_nounwind_fmt<'_>(move (@15), const (false)) @@ -1371,18 +1460,22 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_dead(@11) storage_dead(@8) storage_dead(zero_size@7) - @40 := [] - @39 := &@40 + @43 := [] + storage_live(@44) + @44 := () + @42 := &(@43, move (@44)) storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@16 := &@17 + storage_live(@35) + @35 := () + pieces@16 := &(@17, move (@35)) storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) - @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) - @46 := Option::None { } - @15 := Arguments { pieces: move (@33), fmt: move (@46), args: move (@34) } + @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@42)) + @52 := Option::None { } + @15 := Arguments { pieces: move (@33), fmt: move (@52), args: move (@34) } storage_dead(@34) storage_dead(@33) @14 := panic_nounwind_fmt<'_>(move (@15), const (false)) @@ -1403,18 +1496,22 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () 1 : u32 => { }, _ => { - @36 := [const ("is_aligned_to: align is not a power-of-two")] - @35 := &@36 - @38 := [] - @37 := &@38 + @37 := [const ("is_aligned_to: align is not a power-of-two")] + storage_live(@38) + @38 := () + @36 := &(@37, move (@38)) + @40 := [] + storage_live(@41) + @41 := () + @39 := &(@40, move (@41)) storage_dead(@23) storage_live(@19) storage_live(@24) - @24 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@35)) + @24 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@36)) storage_live(@25) - @25 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@37)) - @45 := Option::None { } - @19 := Arguments { pieces: move (@24), fmt: move (@45), args: move (@25) } + @25 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) + @51 := Option::None { } + @19 := Arguments { pieces: move (@24), fmt: move (@51), args: move (@25) } storage_dead(@25) storage_dead(@24) panic(core::panicking::panic_fmt) @@ -1442,18 +1539,22 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () 1 : u32 => { }, _ => { - @42 := [const ("is_aligned_to: align is not a power-of-two")] - @41 := &@42 - @44 := [] - @43 := &@44 + @46 := [const ("is_aligned_to: align is not a power-of-two")] + storage_live(@47) + @47 := () + @45 := &(@46, move (@47)) + @49 := [] + storage_live(@50) + @50 := () + @48 := &(@49, move (@50)) storage_dead(@30) storage_live(@27) storage_live(@31) - @31 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@41)) + @31 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@45)) storage_live(@32) - @32 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@43)) - @47 := Option::None { } - @27 := Arguments { pieces: move (@31), fmt: move (@47), args: move (@32) } + @32 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@48)) + @53 := Option::None { } + @27 := Arguments { pieces: move (@31), fmt: move (@53), args: move (@32) } storage_dead(@32) storage_dead(@31) panic(core::panicking::panic_fmt) @@ -1529,18 +1630,22 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_dead(zero_size@7) }, } - @40 := [] - @39 := &@40 + @43 := [] + storage_live(@44) + @44 := () + @42 := &(@43, move (@44)) storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@16 := &@17 + storage_live(@35) + @35 := () + pieces@16 := &(@17, move (@35)) storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) - @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) - @46 := Option::None { } - @15 := Arguments { pieces: move (@33), fmt: move (@46), args: move (@34) } + @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@42)) + @52 := Option::None { } + @15 := Arguments { pieces: move (@33), fmt: move (@52), args: move (@34) } storage_dead(@34) storage_dead(@33) @14 := panic_nounwind_fmt<'_>(move (@15), const (false)) @@ -1570,8 +1675,9 @@ where let @17: *const (); // anonymous local let @18: *mut (); // anonymous local let @19: bool; // anonymous local - let @20: AllocError; // anonymous local - let @21: Result>, AllocError>[Sized>>, Sized]; // anonymous local + let @20: (); // anonymous local + let @21: AllocError; // anonymous local + let @22: Result>, AllocError>[Sized>>, Sized]; // anonymous local storage_live(new_ptr@7) storage_live(@12) @@ -1579,8 +1685,8 @@ where storage_live(@16) storage_live(@17) storage_live(@18) - storage_live(@20) storage_live(@21) + storage_live(@22) storage_live(@5) storage_live(self@6) self@6 := @TraitClause0::allocate<'_>(copy (self@1), move (new_layout@4)) @@ -1593,9 +1699,9 @@ where storage_dead(v@14) storage_dead(@13) storage_dead(self@6) - @20 := AllocError { } - @21 := Result::Err { 0: move (@20) } - @0 := move (@21) + @21 := AllocError { } + @22 := Result::Err { 0: move (@21) } + @0 := move (@22) storage_dead(@5) return }, @@ -1614,7 +1720,9 @@ where dst@9 := cast<*mut Slice, *mut u8>(copy (@15)) storage_live(count@10) storage_live(self@11) - self@11 := &old_layout@3 + storage_live(@20) + @20 := () + self@11 := &(old_layout@3, move (@20)) count@10 := copy ((old_layout@3).size) storage_dead(self@11) storage_live(@19) @@ -1664,8 +1772,9 @@ where let @17: *const (); // anonymous local let @18: *mut (); // anonymous local let @19: bool; // anonymous local - let @20: AllocError; // anonymous local - let @21: Result>, AllocError>[Sized>>, Sized]; // anonymous local + let @20: (); // anonymous local + let @21: AllocError; // anonymous local + let @22: Result>, AllocError>[Sized>>, Sized]; // anonymous local storage_live(new_ptr@7) storage_live(@12) @@ -1673,8 +1782,8 @@ where storage_live(@16) storage_live(@17) storage_live(@18) - storage_live(@20) storage_live(@21) + storage_live(@22) storage_live(@5) storage_live(self@6) self@6 := @TraitClause0::allocate_zeroed<'_>(copy (self@1), move (new_layout@4)) @@ -1687,9 +1796,9 @@ where storage_dead(v@14) storage_dead(@13) storage_dead(self@6) - @20 := AllocError { } - @21 := Result::Err { 0: move (@20) } - @0 := move (@21) + @21 := AllocError { } + @22 := Result::Err { 0: move (@21) } + @0 := move (@22) storage_dead(@5) return }, @@ -1708,7 +1817,9 @@ where dst@9 := cast<*mut Slice, *mut u8>(copy (@15)) storage_live(count@10) storage_live(self@11) - self@11 := &old_layout@3 + storage_live(@20) + @20 := () + self@11 := &(old_layout@3, move (@20)) count@10 := copy ((old_layout@3).size) storage_dead(self@11) storage_live(@19) @@ -1758,8 +1869,9 @@ where let @17: *const (); // anonymous local let @18: *mut (); // anonymous local let @19: bool; // anonymous local - let @20: AllocError; // anonymous local - let @21: Result>, AllocError>[Sized>>, Sized]; // anonymous local + let @20: (); // anonymous local + let @21: AllocError; // anonymous local + let @22: Result>, AllocError>[Sized>>, Sized]; // anonymous local storage_live(new_ptr@7) storage_live(@12) @@ -1767,8 +1879,8 @@ where storage_live(@16) storage_live(@17) storage_live(@18) - storage_live(@20) storage_live(@21) + storage_live(@22) storage_live(@5) storage_live(self@6) self@6 := @TraitClause0::allocate<'_>(copy (self@1), copy (new_layout@4)) @@ -1781,9 +1893,9 @@ where storage_dead(v@14) storage_dead(@13) storage_dead(self@6) - @20 := AllocError { } - @21 := Result::Err { 0: move (@20) } - @0 := move (@21) + @21 := AllocError { } + @22 := Result::Err { 0: move (@21) } + @0 := move (@22) storage_dead(@5) return }, @@ -1802,7 +1914,9 @@ where dst@9 := cast<*mut Slice, *mut u8>(copy (@15)) storage_live(count@10) storage_live(self@11) - self@11 := &new_layout@4 + storage_live(@20) + @20 := () + self@11 := &(new_layout@4, move (@20)) count@10 := copy ((new_layout@4).size) storage_dead(self@11) storage_live(@19) @@ -2013,15 +2127,17 @@ fn core::ptr::non_null::{NonNull}::new_unchecked::precondition_check(@1: *mut let @6: usize; // anonymous local let @7: &'_ (Slice<&'_ (Str)>); // anonymous local let @8: &'_ (Slice>); // anonymous local - let @9: &'_ (Array, 0 : usize>); // anonymous local - let @10: Array, 0 : usize>; // anonymous local - let @11: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @9: (); // anonymous local + let @10: &'_ (Array, 0 : usize>); // anonymous local + let @11: Array, 0 : usize>; // anonymous local + let @12: (); // anonymous local + let @13: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@2) storage_live(pieces@4) - storage_live(@9) storage_live(@10) storage_live(@11) + storage_live(@13) storage_live(@6) @6 := transmute<*mut (), usize>(copy (ptr@1)) switch move (@6) { @@ -2033,19 +2149,23 @@ fn core::ptr::non_null::{NonNull}::new_unchecked::precondition_check(@1: *mut return }, } - @10 := [] - @9 := &@10 + @11 := [] + storage_live(@12) + @12 := () + @10 := &(@11, move (@12)) storage_dead(@6) storage_live(@3) storage_live(@5) @5 := [const ("unsafe precondition(s) violated: NonNull::new_unchecked requires that the pointer is non-null\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@4 := &@5 + storage_live(@9) + @9 := () + pieces@4 := &(@5, move (@9)) storage_live(@7) @7 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@4)) storage_live(@8) - @8 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@9)) - @11 := Option::None { } - @3 := Arguments { pieces: move (@7), fmt: move (@11), args: move (@8) } + @8 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@10)) + @13 := Option::None { } + @3 := Arguments { pieces: move (@7), fmt: move (@13), args: move (@8) } storage_dead(@8) storage_dead(@7) @2 := panic_nounwind_fmt<'_>(move (@3), const (false)) @@ -2061,9 +2181,11 @@ fn core::hint::assert_unchecked::precondition_check(@1: bool) let @5: Array<&'_ (Str), 1 : usize>; // anonymous local let @6: &'_ (Slice<&'_ (Str)>); // anonymous local let @7: &'_ (Slice>); // anonymous local - let @8: &'_ (Array, 0 : usize>); // anonymous local - let @9: Array, 0 : usize>; // anonymous local - let @10: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @8: (); // anonymous local + let @9: &'_ (Array, 0 : usize>); // anonymous local + let @10: Array, 0 : usize>; // anonymous local + let @11: (); // anonymous local + let @12: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@2) storage_live(@3) @@ -2074,21 +2196,27 @@ fn core::hint::assert_unchecked::precondition_check(@1: bool) storage_live(@8) storage_live(@9) storage_live(@10) + storage_live(@11) + storage_live(@12) if copy (cond@1) { } else { - @9 := [] - @8 := &@9 + @10 := [] + storage_live(@11) + @11 := () + @9 := &(@10, move (@11)) storage_live(@3) storage_live(@5) @5 := [const ("unsafe precondition(s) violated: hint::assert_unchecked must never be called when the condition is false\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@4 := &@5 + storage_live(@8) + @8 := () + pieces@4 := &(@5, move (@8)) storage_live(@6) @6 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@4)) storage_live(@7) - @7 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@8)) - @10 := Option::None { } - @3 := Arguments { pieces: move (@6), fmt: move (@10), args: move (@7) } + @7 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@9)) + @12 := Option::None { } + @3 := Arguments { pieces: move (@6), fmt: move (@12), args: move (@7) } storage_dead(@7) storage_dead(@6) @2 := panic_nounwind_fmt<'_>(move (@3), const (false)) @@ -2109,9 +2237,11 @@ fn core::alloc::layout::{Layout}::from_size_align_unchecked::precondition_check( let @7: Array<&'_ (Str), 1 : usize>; // anonymous local let @8: &'_ (Slice<&'_ (Str)>); // anonymous local let @9: &'_ (Slice>); // anonymous local - let @10: &'_ (Array, 0 : usize>); // anonymous local - let @11: Array, 0 : usize>; // anonymous local - let @12: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @10: (); // anonymous local + let @11: &'_ (Array, 0 : usize>); // anonymous local + let @12: Array, 0 : usize>; // anonymous local + let @13: (); // anonymous local + let @14: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@4) storage_live(@5) @@ -2122,23 +2252,29 @@ fn core::alloc::layout::{Layout}::from_size_align_unchecked::precondition_check( storage_live(@10) storage_live(@11) storage_live(@12) + storage_live(@13) + storage_live(@14) storage_live(@3) @3 := is_size_align_valid(move (size@1), move (align@2)) if move (@3) { } else { - @11 := [] - @10 := &@11 + @12 := [] + storage_live(@13) + @13 := () + @11 := &(@12, move (@13)) storage_live(@5) storage_live(@7) @7 := [const ("unsafe precondition(s) violated: Layout::from_size_align_unchecked requires that align is a power of 2 and the rounded-up allocation size does not exceed isize::MAX\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@6 := &@7 + storage_live(@10) + @10 := () + pieces@6 := &(@7, move (@10)) storage_live(@8) @8 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@6)) storage_live(@9) - @9 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@10)) - @12 := Option::None { } - @5 := Arguments { pieces: move (@8), fmt: move (@12), args: move (@9) } + @9 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@11)) + @14 := Option::None { } + @5 := Arguments { pieces: move (@8), fmt: move (@14), args: move (@9) } storage_dead(@9) storage_dead(@8) @4 := panic_nounwind_fmt<'_>(move (@5), const (false)) @@ -2231,11 +2367,17 @@ fn alloc_impl<'_0>(@1: &'_0 (Global), @2: Layout, @3: bool) -> Result; // anonymous local let @60: bool; // anonymous local - let @61: Option>[Sized>]; // anonymous local - let @62: AllocError; // anonymous local - let @63: Result, AllocError>[Sized>, Sized]; // anonymous local - let @64: AllocError; // anonymous local - let @65: Result>, AllocError>[Sized>>, Sized]; // anonymous local + let @61: (); // anonymous local + let @62: (); // anonymous local + let @63: (); // anonymous local + let @64: (); // anonymous local + let @65: (); // anonymous local + let @66: (); // anonymous local + let @67: Option>[Sized>]; // anonymous local + let @68: AllocError; // anonymous local + let @69: Result, AllocError>[Sized>, Sized]; // anonymous local + let @70: AllocError; // anonymous local + let @71: Result>, AllocError>[Sized>>, Sized]; // anonymous local storage_live(size@4) storage_live(raw_ptr@9) @@ -2284,13 +2426,19 @@ fn alloc_impl<'_0>(@1: &'_0 (Global), @2: Layout, @3: bool) -> Result(@1: &'_0 (Global), @2: Layout, @3: bool) -> Result(@1: &'_0 (Global), @2: Layout, @3: bool) -> Result(@1: &'_0 (Global), @2: Layout, @3: bool) -> Result(@1: &'_0 (Global), @2: Layout, @3: bool) -> Result[Sized, {impl ZeroablePrimitive for usize}]>(copy (@19)) @@ -2583,13 +2741,26 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay let layout@82: Layout; // local let self@83: &'_ (Layout); // local let self@84: &'_ (Layout); // local - let @85: AllocError; // anonymous local - let @86: Result>, AllocError>[Sized>>, Sized]; // anonymous local - let @87: Option>[Sized>]; // anonymous local - let @88: AllocError; // anonymous local - let @89: Result, AllocError>[Sized>, Sized]; // anonymous local - let @90: AllocError; // anonymous local - let @91: Result>, AllocError>[Sized>>, Sized]; // anonymous local + let @85: (); // anonymous local + let @86: (); // anonymous local + let @87: (); // anonymous local + let @88: (); // anonymous local + let @89: (); // anonymous local + let @90: (); // anonymous local + let @91: (); // anonymous local + let @92: (); // anonymous local + let @93: (); // anonymous local + let @94: (); // anonymous local + let @95: (); // anonymous local + let @96: (); // anonymous local + let @97: (); // anonymous local + let @98: AllocError; // anonymous local + let @99: Result>, AllocError>[Sized>>, Sized]; // anonymous local + let @100: Option>[Sized>]; // anonymous local + let @101: AllocError; // anonymous local + let @102: Result, AllocError>[Sized>, Sized]; // anonymous local + let @103: AllocError; // anonymous local + let @104: Result>, AllocError>[Sized>>, Sized]; // anonymous local storage_live(old_size@6) storage_live(old_size@8) @@ -2669,15 +2840,29 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_live(layout@82) storage_live(self@83) storage_live(self@84) - storage_live(@85) storage_live(@86) storage_live(@87) storage_live(@88) storage_live(@89) storage_live(@90) storage_live(@91) + storage_live(@92) + storage_live(@93) + storage_live(@94) + storage_live(@95) + storage_live(@96) + storage_live(@97) + storage_live(@98) + storage_live(@99) + storage_live(@100) + storage_live(@101) + storage_live(@102) + storage_live(@103) + storage_live(@104) storage_live(self@7) - self@7 := &old_layout@3 + storage_live(@85) + @85 := () + self@7 := &(old_layout@3, move (@85)) old_size@6 := copy ((old_layout@3).size) storage_dead(self@7) switch copy (old_size@6) { @@ -2685,10 +2870,14 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay }, _ => { storage_live(old_size@8) - old_size@8 := &old_size@6 + storage_live(@88) + @88 := () + old_size@8 := &(old_size@6, move (@88)) storage_live(@9) storage_live(self@11) - self@11 := &old_layout@3 + storage_live(@87) + @87 := () + self@11 := &(old_layout@3, move (@87)) @41 := copy ((old_layout@3).align) @42 := copy ((@41).0) @43 := @discriminant(@42) @@ -2700,7 +2889,9 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_dead(self@11) storage_live(@12) storage_live(self@13) - self@13 := &new_layout@4 + storage_live(@86) + @86 := () + self@13 := &(new_layout@4, move (@86)) storage_live(@47) @47 := copy ((new_layout@4).align) storage_live(@49) @@ -2741,9 +2932,9 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_dead(v@75) storage_dead(@74) storage_dead(self@34) - @85 := AllocError { } - @86 := Result::Err { 0: move (@85) } - @0 := move (@86) + @98 := AllocError { } + @99 := Result::Err { 0: move (@98) } + @0 := move (@99) storage_dead(@33) return }, @@ -2781,7 +2972,9 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_live(layout@40) layout@40 := copy (old_layout@3) storage_live(self@81) - self@81 := &layout@40 + storage_live(@95) + @95 := () + self@81 := &(layout@40, move (@95)) storage_dead(self@81) switch copy (old_size@6) { 0 : usize => { @@ -2790,10 +2983,14 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_live(layout@82) layout@82 := copy (old_layout@3) storage_live(self@83) - self@83 := &layout@82 + storage_live(@97) + @97 := () + self@83 := &(layout@82, move (@97)) storage_dead(self@83) storage_live(self@84) - self@84 := &layout@82 + storage_live(@96) + @96 := () + self@84 := &(layout@82, move (@96)) assert(copy (@46) == true) storage_dead(self@84) @39 := __rust_dealloc(move (ptr@37), copy (old_size@6), move (@10)) @@ -2807,12 +3004,16 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_dead(@12) storage_dead(@9) storage_live(self@15) - self@15 := &new_layout@4 + storage_live(@90) + @90 := () + self@15 := &(new_layout@4, move (@90)) new_size@14 := copy ((new_layout@4).size) storage_dead(self@15) storage_live(cond@16) storage_live(self@17) - self@17 := &old_layout@3 + storage_live(@89) + @89 := () + self@17 := &(old_layout@3, move (@89)) storage_dead(self@17) cond@16 := copy (new_size@14) >= copy (old_size@6) @54 := ub_checks @@ -2830,10 +3031,14 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_live(new_size@22) new_size@22 := copy (new_size@14) storage_live(self@55) - self@55 := &layout@21 + storage_live(@94) + @94 := () + self@55 := &(layout@21, move (@94)) storage_dead(self@55) storage_live(self@56) - self@56 := &layout@21 + storage_live(@93) + @93 := () + self@56 := &(layout@21, move (@93)) assert(copy (@46) == true) storage_dead(self@56) raw_ptr@18 := __rust_realloc(move (ptr@19), copy (old_size@6), move (@10), copy (new_size@14)) @@ -2851,8 +3056,8 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay switch move (@59) { 0 : usize => { storage_dead(@59) - @87 := Option::None { } - self@25 := move (@87) + @100 := Option::None { } + self@25 := move (@100) }, _ => { storage_dead(@59) @@ -2880,10 +3085,14 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_live(new_size@22) new_size@22 := copy (new_size@14) storage_live(self@55) - self@55 := &layout@21 + storage_live(@92) + @92 := () + self@55 := &(layout@21, move (@92)) storage_dead(self@55) storage_live(self@56) - self@56 := &layout@21 + storage_live(@91) + @91 := () + self@56 := &(layout@21, move (@91)) assert(copy (@46) == true) storage_dead(self@56) raw_ptr@18 := __rust_realloc(move (ptr@19), copy (old_size@6), move (@10), copy (new_size@14)) @@ -2901,8 +3110,8 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay switch move (@59) { 0 : usize => { storage_dead(@59) - @87 := Option::None { } - self@25 := move (@87) + @100 := Option::None { } + self@25 := move (@100) }, _ => { storage_dead(@59) @@ -2926,9 +3135,9 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_live(v@63) match self@25 { Option::None => { - @88 := AllocError { } - @89 := Result::Err { 0: move (@88) } - self@24 := move (@89) + @101 := AllocError { } + @102 := Result::Err { 0: move (@101) } + self@24 := move (@102) }, Option::Some => { v@63 := move ((self@25 as variant Option::Some).0) @@ -2947,9 +3156,9 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_dead(v@65) storage_dead(@64) storage_dead(self@24) - @90 := AllocError { } - @91 := Result::Err { 0: move (@90) } - @0 := move (@91) + @103 := AllocError { } + @104 := Result::Err { 0: move (@103) } + @0 := move (@104) storage_dead(@23) storage_dead(old_size@8) return @@ -3058,6 +3267,9 @@ pub unsafe fn {impl Allocator for Global}::deallocate<'_0>(@1: &'_0 (Global), @2 let @14: bool; // anonymous local let @15: bool; // anonymous local let @16: bool; // anonymous local + let @17: (); // anonymous local + let @18: (); // anonymous local + let @19: (); // anonymous local storage_live(@4) storage_live(ptr@6) @@ -3071,8 +3283,12 @@ pub unsafe fn {impl Allocator for Global}::deallocate<'_0>(@1: &'_0 (Global), @2 storage_live(@14) storage_live(@15) storage_live(@16) + storage_live(@18) + storage_live(@19) storage_live(self@5) - self@5 := &layout@3 + storage_live(@17) + @17 := () + self@5 := &(layout@3, move (@17)) @4 := copy ((layout@3).size) storage_dead(self@5) switch move (@4) { @@ -3084,11 +3300,15 @@ pub unsafe fn {impl Allocator for Global}::deallocate<'_0>(@1: &'_0 (Global), @2 storage_live(layout@7) layout@7 := copy (layout@3) storage_live(self@8) - self@8 := &layout@7 + storage_live(@19) + @19 := () + self@8 := &(layout@7, move (@19)) storage_dead(self@8) storage_live(@9) storage_live(self@10) - self@10 := &layout@7 + storage_live(@18) + @18 := () + self@10 := &(layout@7, move (@18)) storage_live(@11) @11 := copy ((layout@3).align) storage_live(@13) @@ -3255,19 +3475,35 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No let layout@101: Layout; // local let self@102: &'_ (Layout); // local let self@103: &'_ (Layout); // local - let @104: AllocError; // anonymous local - let @105: Result[Sized, Sized]; // anonymous local - let @106: ControlFlow[Sized, Sized], NonNull>>[Sized[Sized, Sized]>, Sized>>]; // anonymous local - let @107: Option>[Sized>]; // anonymous local - let @108: AllocError; // anonymous local - let @109: Result>, AllocError>[Sized>>, Sized]; // anonymous local - let @110: AllocError; // anonymous local - let @111: Result, AllocError>[Sized>, Sized]; // anonymous local - let @112: AllocError; // anonymous local - let @113: Result[Sized, Sized]; // anonymous local - let @114: ControlFlow[Sized, Sized], NonNull>[Sized[Sized, Sized]>, Sized>]; // anonymous local - let @115: AllocError; // anonymous local - let @116: Result>, AllocError>[Sized>>, Sized]; // anonymous local + let @104: (); // anonymous local + let @105: (); // anonymous local + let @106: (); // anonymous local + let @107: (); // anonymous local + let @108: (); // anonymous local + let @109: (); // anonymous local + let @110: (); // anonymous local + let @111: (); // anonymous local + let @112: (); // anonymous local + let @113: (); // anonymous local + let @114: (); // anonymous local + let @115: (); // anonymous local + let @116: (); // anonymous local + let @117: (); // anonymous local + let @118: (); // anonymous local + let @119: (); // anonymous local + let @120: AllocError; // anonymous local + let @121: Result[Sized, Sized]; // anonymous local + let @122: ControlFlow[Sized, Sized], NonNull>>[Sized[Sized, Sized]>, Sized>>]; // anonymous local + let @123: Option>[Sized>]; // anonymous local + let @124: AllocError; // anonymous local + let @125: Result>, AllocError>[Sized>>, Sized]; // anonymous local + let @126: AllocError; // anonymous local + let @127: Result, AllocError>[Sized>, Sized]; // anonymous local + let @128: AllocError; // anonymous local + let @129: Result[Sized, Sized]; // anonymous local + let @130: ControlFlow[Sized, Sized], NonNull>[Sized[Sized, Sized]>, Sized>]; // anonymous local + let @131: AllocError; // anonymous local + let @132: Result>, AllocError>[Sized>>, Sized]; // anonymous local storage_live(new_size@5) storage_live(@7) @@ -3355,12 +3591,9 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(layout@101) storage_live(self@102) storage_live(self@103) - storage_live(@104) - storage_live(@105) storage_live(@106) storage_live(@107) storage_live(@108) - storage_live(@109) storage_live(@110) storage_live(@111) storage_live(@112) @@ -3368,8 +3601,26 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(@114) storage_live(@115) storage_live(@116) + storage_live(@117) + storage_live(@118) + storage_live(@119) + storage_live(@120) + storage_live(@121) + storage_live(@122) + storage_live(@123) + storage_live(@124) + storage_live(@125) + storage_live(@126) + storage_live(@127) + storage_live(@128) + storage_live(@129) + storage_live(@130) + storage_live(@131) + storage_live(@132) storage_live(self@6) - self@6 := &new_layout@4 + storage_live(@104) + @104 := () + self@6 := &(new_layout@4, move (@104)) new_size@5 := copy ((new_layout@4).size) storage_dead(self@6) switch copy (new_size@5) { @@ -3377,10 +3628,14 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No }, _ => { storage_live(new_size@12) - new_size@12 := &new_size@5 + storage_live(@108) + @108 := () + new_size@12 := &(new_size@5, move (@108)) storage_live(@13) storage_live(self@15) - self@15 := &old_layout@3 + storage_live(@107) + @107 := () + self@15 := &(old_layout@3, move (@107)) @40 := copy ((old_layout@3).align) @41 := copy ((@40).0) @42 := @discriminant(@41) @@ -3392,7 +3647,9 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_dead(self@15) storage_live(@16) storage_live(self@17) - self@17 := &new_layout@4 + storage_live(@106) + @106 := () + self@17 := &(new_layout@4, move (@106)) storage_live(@68) @68 := copy ((new_layout@4).align) storage_live(@70) @@ -3420,7 +3677,9 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_dead(@13) storage_live(cond@18) storage_live(self@20) - self@20 := &old_layout@3 + storage_live(@112) + @112 := () + self@20 := &(old_layout@3, move (@112)) @19 := copy ((old_layout@3).size) storage_dead(self@20) cond@18 := copy (new_size@5) <= copy (@19) @@ -3439,10 +3698,14 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(new_size@25) new_size@25 := copy (new_size@5) storage_live(self@76) - self@76 := &layout@24 + storage_live(@116) + @116 := () + self@76 := &(layout@24, move (@116)) storage_dead(self@76) storage_live(self@77) - self@77 := &layout@24 + storage_live(@115) + @115 := () + self@77 := &(layout@24, move (@115)) assert(copy (@45) == true) storage_dead(self@77) raw_ptr@21 := __rust_realloc(move (ptr@22), move (@19), move (@14), copy (new_size@5)) @@ -3460,8 +3723,8 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No switch move (@80) { 0 : usize => { storage_dead(@80) - @107 := Option::None { } - self@28 := move (@107) + @123 := Option::None { } + self@28 := move (@123) }, _ => { storage_dead(@80) @@ -3489,10 +3752,14 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(new_size@25) new_size@25 := copy (new_size@5) storage_live(self@76) - self@76 := &layout@24 + storage_live(@114) + @114 := () + self@76 := &(layout@24, move (@114)) storage_dead(self@76) storage_live(self@77) - self@77 := &layout@24 + storage_live(@113) + @113 := () + self@77 := &(layout@24, move (@113)) assert(copy (@45) == true) storage_dead(self@77) raw_ptr@21 := __rust_realloc(move (ptr@22), move (@19), move (@14), copy (new_size@5)) @@ -3510,8 +3777,8 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No switch move (@80) { 0 : usize => { storage_dead(@80) - @107 := Option::None { } - self@28 := move (@107) + @123 := Option::None { } + self@28 := move (@123) }, _ => { storage_dead(@80) @@ -3535,9 +3802,9 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(v@84) match self@28 { Option::None => { - @110 := AllocError { } - @111 := Result::Err { 0: move (@110) } - self@27 := move (@111) + @126 := AllocError { } + @127 := Result::Err { 0: move (@126) } + self@27 := move (@127) storage_dead(v@84) storage_dead(@83) storage_dead(self@28) @@ -3579,9 +3846,9 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No return }, ControlFlow::Break => { - @115 := AllocError { } - @116 := Result::Err { 0: move (@115) } - @0 := move (@116) + @131 := AllocError { } + @132 := Result::Err { 0: move (@131) } + @0 := move (@132) storage_dead(@26) storage_dead(new_size@12) return @@ -3589,10 +3856,10 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No } }, Result::Err => { - @112 := AllocError { } - @113 := Result::Err { 0: move (@112) } - @114 := ControlFlow::Break { 0: move (@113) } - @26 := move (@114) + @128 := AllocError { } + @129 := Result::Err { 0: move (@128) } + @130 := ControlFlow::Break { 0: move (@129) } + @26 := move (@130) storage_dead(v@86) storage_dead(@85) storage_dead(self@27) @@ -3625,9 +3892,9 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No return }, ControlFlow::Break => { - @115 := AllocError { } - @116 := Result::Err { 0: move (@115) } - @0 := move (@116) + @131 := AllocError { } + @132 := Result::Err { 0: move (@131) } + @0 := move (@132) storage_dead(@26) storage_dead(new_size@12) return @@ -3680,9 +3947,9 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No return }, ControlFlow::Break => { - @115 := AllocError { } - @116 := Result::Err { 0: move (@115) } - @0 := move (@116) + @131 := AllocError { } + @132 := Result::Err { 0: move (@131) } + @0 := move (@132) storage_dead(@26) storage_dead(new_size@12) return @@ -3690,10 +3957,10 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No } }, Result::Err => { - @112 := AllocError { } - @113 := Result::Err { 0: move (@112) } - @114 := ControlFlow::Break { 0: move (@113) } - @26 := move (@114) + @128 := AllocError { } + @129 := Result::Err { 0: move (@128) } + @130 := ControlFlow::Break { 0: move (@129) } + @26 := move (@130) storage_dead(v@86) storage_dead(@85) storage_dead(self@27) @@ -3726,9 +3993,9 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No return }, ControlFlow::Break => { - @115 := AllocError { } - @116 := Result::Err { 0: move (@115) } - @0 := move (@116) + @131 := AllocError { } + @132 := Result::Err { 0: move (@131) } + @0 := move (@132) storage_dead(@26) storage_dead(new_size@12) return @@ -3786,7 +4053,9 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No layout@39 := copy (old_layout@3) storage_live(@99) storage_live(self@100) - self@100 := &layout@39 + storage_live(@117) + @117 := () + self@100 := &(layout@39, move (@117)) @99 := copy ((old_layout@3).size) storage_dead(self@100) switch move (@99) { @@ -3796,10 +4065,14 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(layout@101) layout@101 := copy (old_layout@3) storage_live(self@102) - self@102 := &layout@101 + storage_live(@119) + @119 := () + self@102 := &(layout@101, move (@119)) storage_dead(self@102) storage_live(self@103) - self@103 := &layout@101 + storage_live(@118) + @118 := () + self@103 := &(layout@101, move (@118)) assert(copy (@45) == true) storage_dead(self@103) @38 := __rust_dealloc(move (ptr@36), move (@99), move (@14)) @@ -3812,19 +4085,19 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No return }, ControlFlow::Break => { - @108 := AllocError { } - @109 := Result::Err { 0: move (@108) } - @0 := move (@109) + @124 := AllocError { } + @125 := Result::Err { 0: move (@124) } + @0 := move (@125) storage_dead(@32) return }, } }, Result::Err => { - @104 := AllocError { } - @105 := Result::Err { 0: move (@104) } - @106 := ControlFlow::Break { 0: move (@105) } - @32 := move (@106) + @120 := AllocError { } + @121 := Result::Err { 0: move (@120) } + @122 := ControlFlow::Break { 0: move (@121) } + @32 := move (@122) storage_dead(v@93) storage_dead(@92) storage_dead(self@33) @@ -3859,7 +4132,9 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No layout@39 := copy (old_layout@3) storage_live(@99) storage_live(self@100) - self@100 := &layout@39 + storage_live(@117) + @117 := () + self@100 := &(layout@39, move (@117)) @99 := copy ((old_layout@3).size) storage_dead(self@100) switch move (@99) { @@ -3869,10 +4144,14 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(layout@101) layout@101 := copy (old_layout@3) storage_live(self@102) - self@102 := &layout@101 + storage_live(@119) + @119 := () + self@102 := &(layout@101, move (@119)) storage_dead(self@102) storage_live(self@103) - self@103 := &layout@101 + storage_live(@118) + @118 := () + self@103 := &(layout@101, move (@118)) assert(copy (@45) == true) storage_dead(self@103) @38 := __rust_dealloc(move (ptr@36), move (@99), move (@14)) @@ -3885,9 +4164,9 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No return }, ControlFlow::Break => { - @108 := AllocError { } - @109 := Result::Err { 0: move (@108) } - @0 := move (@109) + @124 := AllocError { } + @125 := Result::Err { 0: move (@124) } + @0 := move (@125) storage_dead(@32) return }, @@ -3902,7 +4181,9 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No layout@8 := copy (old_layout@3) storage_live(@46) storage_live(self@47) - self@47 := &layout@8 + storage_live(@105) + @105 := () + self@47 := &(layout@8, move (@105)) @46 := copy ((old_layout@3).size) storage_dead(self@47) switch move (@46) { @@ -3914,11 +4195,15 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(layout@49) layout@49 := copy (old_layout@3) storage_live(self@50) - self@50 := &layout@49 + storage_live(@111) + @111 := () + self@50 := &(layout@49, move (@111)) storage_dead(self@50) storage_live(@51) storage_live(self@52) - self@52 := &layout@49 + storage_live(@110) + @110 := () + self@52 := &(layout@49, move (@110)) storage_live(@53) @53 := copy ((old_layout@3).align) storage_live(@55) @@ -3951,7 +4236,9 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(@9) storage_live(data@10) storage_live(self@11) - self@11 := &new_layout@4 + storage_live(@109) + @109 := () + self@11 := &(new_layout@4, move (@109)) storage_live(@60) @60 := copy ((new_layout@4).align) @59 := transmute[Sized, {impl ZeroablePrimitive for usize}]>(copy (@60)) @@ -4021,20 +4308,29 @@ fn ct_error(@1: Layout) -> ! let @3: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @4: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @5: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local - let @6: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local - let @7: Array<&'_ (Str), 1 : usize>; // anonymous local + let @6: (); // anonymous local + let @7: (); // anonymous local + let @8: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local + let @9: Array<&'_ (Str), 1 : usize>; // anonymous local + let @10: (); // anonymous local storage_live(@5) - storage_live(@6) - storage_live(@7) - @7 := [const ("allocation failed")] - @6 := &@7 + storage_live(@8) + storage_live(@9) + @9 := [const ("allocation failed")] + storage_live(@10) + @10 := () + @8 := &(@9, move (@10)) storage_live(@2) storage_live(@3) storage_live(@4) - @5 := move (@6) - @4 := &*(@5) - @3 := &*(@4) + @5 := move (@8) + storage_live(@7) + @7 := () + @4 := &(*(@5), move (@7)) + storage_live(@6) + @6 := () + @3 := &(*(@4), move (@6)) @2 := new_const<'_, 1 : usize>(move (@3)) storage_dead(@3) panic(core::panicking::panic_fmt) @@ -4073,6 +4369,7 @@ unsafe fn exchange_malloc(@1: usize, @2: usize) -> *mut u8 let @10: *mut Slice; // anonymous local let @11: &'_ (Global); // anonymous local let @12: Global; // anonymous local + let @13: (); // anonymous local storage_live(layout@3) storage_live(ptr@5) @@ -4088,7 +4385,9 @@ unsafe fn exchange_malloc(@1: usize, @2: usize) -> *mut u8 else { } @12 := Global { } - @11 := &@12 + storage_live(@13) + @13 := () + @11 := &(@12, move (@13)) storage_dead(@7) storage_live(@9) @9 := transmute(copy (align@2)) @@ -4205,6 +4504,7 @@ where let @2: ManuallyDrop[@TraitClause0, Sized, {impl Allocator for Global}]>[MetaSized[@TraitClause0, Sized, {impl Allocator for Global}]>]; // anonymous local let @3: Box[@TraitClause0, Sized, {impl Allocator for Global}]; // anonymous local let @4: *const T; // anonymous local + let @5: PtrMetadata; // anonymous local storage_live(@3) storage_live(@4) @@ -4212,7 +4512,9 @@ where @2 := ManuallyDrop { value: copy (b@1) } @3 := copy ((@2).value) @4 := transmute, *const T>(copy (((@3).0).pointer)) - @0 := &raw mut *(@4) + storage_live(@5) + @5 := ptr_metadata(copy (@4)) + @0 := &raw mut (*(@4), move (@5)) storage_dead(@2) return } @@ -4230,16 +4532,22 @@ where let @2: *mut T; // anonymous local let @3: *const T; // anonymous local let @4: NonNull; // anonymous local + let @5: PtrMetadata; // anonymous local + let @6: PtrMetadata; // anonymous local storage_live(@2) storage_live(@4) storage_live(@3) @4 := copy (((b@1).0).pointer) @3 := transmute, *const T>(copy (@4)) - @2 := &raw mut *(@3) + storage_live(@6) + @6 := ptr_metadata(copy (@3)) + @2 := &raw mut (*(@3), move (@6)) storage_dead(@3) storage_dead(@4) - @0 := &mut *(@2) + storage_live(@5) + @5 := ptr_metadata(copy (@2)) + @0 := &mut (*(@2), move (@5)) return } @@ -4267,6 +4575,8 @@ where let @14: *const u8; // anonymous local let ptr@15: NonNull; // local let ptr@16: PhantomData; // local + let @17: (); // anonymous local + let @18: (); // anonymous local storage_live(layout@2) storage_live(@4) @@ -4277,6 +4587,7 @@ where storage_live(unique@13) storage_live(@14) storage_live(ptr@15) + storage_live(@18) storage_live(ptr@16) ptr@15 := copy (((*(self@1)).0).pointer) ptr@16 := copy (((*(self@1)).0)._marker) @@ -4301,14 +4612,18 @@ where storage_dead(align@9) storage_dead(t@3) storage_live(self@5) - self@5 := &layout@2 + storage_live(@17) + @17 := () + self@5 := &(layout@2, move (@17)) storage_dead(self@5) switch move (size@8) { 0 : usize => { }, _ => { storage_live(@7) - @7 := &(*(self@1)).1 + storage_live(@18) + @18 := () + @7 := &((*(self@1)).1, move (@18)) storage_live(@14) @14 := cast<*mut T, *const u8>(copy (@4)) unique@13 := NonNull { pointer: move (@14) } diff --git a/charon/tests/ui/regressions/closure-inside-impl-with-bound-with-assoc-ty.out b/charon/tests/ui/regressions/closure-inside-impl-with-bound-with-assoc-ty.out index a9d7dabf8..c84fd9e0e 100644 --- a/charon/tests/ui/regressions/closure-inside-impl-with-bound-with-assoc-ty.out +++ b/charon/tests/ui/regressions/closure-inside-impl-with-bound-with-assoc-ty.out @@ -150,9 +150,12 @@ where let state@1: &'_0 mut (closure[@TraitClause0, @TraitClause1]); // arg #1 let args@2: (()); // arg #2 let @3: &'_ (closure[@TraitClause0, @TraitClause1]); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<(()), ()> for closure[@TraitClause0, @TraitClause1]}::call<'_, F, Clause1_Repr>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) @0 := () return @@ -168,9 +171,12 @@ where let @1: closure[@TraitClause0, @TraitClause1]; // arg #1 let @2: (()); // arg #2 let @3: &'_ mut (closure[@TraitClause0, @TraitClause1]); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(()), ()> for closure[@TraitClause0, @TraitClause1]}::call_mut<'_, F, Clause1_Repr>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0, @TraitClause1]>] @1 @0 := () diff --git a/charon/tests/ui/remove-dynamic-checks.out b/charon/tests/ui/remove-dynamic-checks.out index 7f2fe44e7..a0aa2f30c 100644 --- a/charon/tests/ui/remove-dynamic-checks.out +++ b/charon/tests/ui/remove-dynamic-checks.out @@ -799,18 +799,24 @@ fn div_unsigned_to_slice<'_0>(@1: &'_0 mut (Slice), @2: u32) let x@2: u32; // arg #2 let @3: u32; // anonymous local let @4: usize; // anonymous local - let @5: &'_ mut (Slice); // anonymous local - let @6: &'_ mut (u32); // anonymous local + let @5: usize; // anonymous local + let @6: usize; // anonymous local + let @7: &'_ mut (Slice); // anonymous local + let @8: &'_ mut (u32); // anonymous local storage_live(@3) @3 := copy (x@2) storage_live(@4) @4 := const (0 : usize) storage_live(@5) - @5 := &mut *(result@1) + @5 := ptr_metadata(copy (result@1)) storage_live(@6) - @6 := @SliceIndexMut<'_, u32>(move (@5), copy (@4)) - *(@6) := move (@3) panic./ const (3329 : u32) + @6 := ptr_metadata(copy (result@1)) + storage_live(@7) + @7 := &mut (*(result@1), move (@6)) + storage_live(@8) + @8 := @SliceIndexMut<'_, u32>(move (@7), copy (@4)) + *(@8) := move (@3) panic./ const (3329 : u32) storage_dead(@3) storage_dead(@4) @0 := () @@ -826,18 +832,24 @@ fn div_signed_to_slice<'_0>(@1: &'_0 mut (Slice), @2: i32) let x@2: i32; // arg #2 let @3: i32; // anonymous local let @4: usize; // anonymous local - let @5: &'_ mut (Slice); // anonymous local - let @6: &'_ mut (i32); // anonymous local + let @5: usize; // anonymous local + let @6: usize; // anonymous local + let @7: &'_ mut (Slice); // anonymous local + let @8: &'_ mut (i32); // anonymous local storage_live(@3) @3 := copy (x@2) storage_live(@4) @4 := const (0 : usize) storage_live(@5) - @5 := &mut *(result@1) + @5 := ptr_metadata(copy (result@1)) storage_live(@6) - @6 := @SliceIndexMut<'_, i32>(move (@5), copy (@4)) - *(@6) := move (@3) panic./ const (3329 : i32) + @6 := ptr_metadata(copy (result@1)) + storage_live(@7) + @7 := &mut (*(result@1), move (@6)) + storage_live(@8) + @8 := @SliceIndexMut<'_, i32>(move (@7), copy (@4)) + *(@8) := move (@3) panic./ const (3329 : i32) storage_dead(@3) storage_dead(@4) @0 := () @@ -854,8 +866,10 @@ fn add_to_slice<'_0>(@1: &'_0 mut (Slice), @2: u32) let @3: u32; // anonymous local let @4: u32; // anonymous local let @5: usize; // anonymous local - let @6: &'_ mut (Slice); // anonymous local - let @7: &'_ mut (u32); // anonymous local + let @6: usize; // anonymous local + let @7: usize; // anonymous local + let @8: &'_ mut (Slice); // anonymous local + let @9: &'_ mut (u32); // anonymous local storage_live(@4) storage_live(@3) @@ -864,10 +878,14 @@ fn add_to_slice<'_0>(@1: &'_0 mut (Slice), @2: u32) storage_live(@5) @5 := const (0 : usize) storage_live(@6) - @6 := &mut *(result@1) + @6 := ptr_metadata(copy (result@1)) storage_live(@7) - @7 := @SliceIndexMut<'_, u32>(move (@6), copy (@5)) - *(@7) := move (@4) + @7 := ptr_metadata(copy (result@1)) + storage_live(@8) + @8 := &mut (*(result@1), move (@7)) + storage_live(@9) + @9 := @SliceIndexMut<'_, u32>(move (@8), copy (@5)) + *(@9) := move (@4) storage_dead(@3) storage_dead(@5) @0 := () @@ -887,8 +905,10 @@ fn add_to_slice2<'_0>(@1: &'_0 mut (Slice), @2: usize, @3: u8) let @6: usize; // anonymous local let @7: usize; // anonymous local let @8: usize; // anonymous local - let @9: &'_ mut (Slice); // anonymous local - let @10: &'_ mut (u8); // anonymous local + let @9: usize; // anonymous local + let @10: usize; // anonymous local + let @11: &'_ mut (Slice); // anonymous local + let @12: &'_ mut (u8); // anonymous local storage_live(@5) storage_live(@8) @@ -902,10 +922,14 @@ fn add_to_slice2<'_0>(@1: &'_0 mut (Slice), @2: usize, @3: u8) @6 := move (@8) storage_dead(@7) storage_live(@9) - @9 := &mut *(result@1) + @9 := ptr_metadata(copy (result@1)) storage_live(@10) - @10 := @SliceIndexMut<'_, u8>(move (@9), copy (@6)) - *(@10) := move (@5) + @10 := ptr_metadata(copy (result@1)) + storage_live(@11) + @11 := &mut (*(result@1), move (@10)) + storage_live(@12) + @12 := @SliceIndexMut<'_, u8>(move (@11), copy (@6)) + *(@12) := move (@5) storage_dead(@4) storage_dead(@6) @0 := () diff --git a/charon/tests/ui/rename_attribute.out b/charon/tests/ui/rename_attribute.out index 5186c2b14..2a85711a2 100644 --- a/charon/tests/ui/rename_attribute.out +++ b/charon/tests/ui/rename_attribute.out @@ -74,16 +74,23 @@ where let @2: bool; // anonymous local let @3: &'_ (bool); // anonymous local let @4: &'_ (bool); // anonymous local + let @5: (); // anonymous local + let @6: (); // anonymous local storage_live(@4) + storage_live(@6) storage_live(@2) storage_live(@3) - @3 := &x@1 + storage_live(@5) + @5 := () + @3 := &(x@1, move (@5)) @2 := {impl BoolTrait for bool}::get_bool<'_>(move (@3)) if move (@2) { storage_dead(@3) storage_live(@4) - @4 := &x@1 + storage_live(@6) + @6 := () + @4 := &(x@1, move (@6)) @0 := test_crate::{impl BoolTrait for bool}::ret_true<'_>(move (@4)) storage_dead(@4) } diff --git a/charon/tests/ui/result-unwrap.out b/charon/tests/ui/result-unwrap.out index 2cda8b548..98457e861 100644 --- a/charon/tests/ui/result-unwrap.out +++ b/charon/tests/ui/result-unwrap.out @@ -216,11 +216,13 @@ where let @3: !; // anonymous local let @4: &'_ ((dyn exists<_dyn> [@TraitClause0]: Debug<_dyn> + _dyn : '_)); // anonymous local let @5: &'_ (E); // anonymous local + let @6: (); // anonymous local storage_live(e@2) storage_live(@3) storage_live(@4) storage_live(@5) + storage_live(@6) match self@1 { Result::Ok => { }, @@ -228,7 +230,9 @@ where storage_live(e@2) e@2 := move ((self@1 as variant Result::Err).0) storage_live(@4) - @5 := &e@2 + storage_live(@6) + @6 := () + @5 := &(e@2, move (@6)) @4 := unsize_cast<&'_ (E), &'_ ((dyn exists<_dyn> [@TraitClause0]: Debug<_dyn> + _dyn : '_)), @TraitClause2>(copy (@5)) @3 := unwrap_failed<'_, '_>(const ("called `Result::unwrap()` on an `Err` value"), move (@4)) }, diff --git a/charon/tests/ui/rvalues.out b/charon/tests/ui/rvalues.out index 7a8ed7288..92bdeacf1 100644 --- a/charon/tests/ui/rvalues.out +++ b/charon/tests/ui/rvalues.out @@ -140,20 +140,32 @@ fn addr_of() let @3: &'_ (u32); // anonymous local let @4: *const u32; // anonymous local let @5: *mut u32; // anonymous local + let @6: (); // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local + let @9: (); // anonymous local storage_live(x@1) x@1 := const (0 : u32) storage_live(@2) storage_live(@3) - @3 := &x@1 - @2 := &raw const *(@3) + storage_live(@9) + @9 := () + @3 := &(x@1, move (@9)) + storage_live(@8) + @8 := () + @2 := &raw const (*(@3), move (@8)) storage_dead(@3) storage_dead(@2) storage_live(@4) - @4 := &raw const x@1 + storage_live(@7) + @7 := () + @4 := &raw const (x@1, move (@7)) storage_dead(@4) storage_live(@5) - @5 := &raw mut x@1 + storage_live(@6) + @6 := () + @5 := &raw mut (x@1, move (@6)) storage_dead(@5) @0 := () storage_dead(x@1) @@ -221,13 +233,21 @@ fn ptr_casts() let @15: *const u8; // anonymous local let @16: *const u8; // anonymous local let @17: fn(); // anonymous local + let @18: (); // anonymous local + let @19: (); // anonymous local + let @20: (); // anonymous local + let @21: (); // anonymous local storage_live(array_ptr@1) storage_live(@2) storage_live(@3) @3 := @ArrayRepeat<'_, u32, 64 : usize>(const (0 : u32)) - @2 := &@3 - array_ptr@1 := &raw const *(@2) + storage_live(@21) + @21 := () + @2 := &(@3, move (@21)) + storage_live(@20) + @20 := () + array_ptr@1 := &raw const (*(@2), move (@20)) storage_dead(@2) storage_live(@4) storage_live(@5) @@ -239,8 +259,12 @@ fn ptr_casts() x@6 := const (0 : u8) storage_live(x@7) storage_live(@8) - @8 := &x@6 - x@7 := &raw const *(@8) + storage_live(@19) + @19 := () + @8 := &(x@6, move (@19)) + storage_live(@18) + @18 := () + x@7 := &raw const (*(@8), move (@18)) storage_dead(@8) storage_live(@9) storage_live(@10) @@ -322,9 +346,12 @@ fn {impl FnMut<(u8)> for closure}::call_mut<'_0>(@1: &'_0 mut (closure), @2: (u8 let state@1: &'_0 mut (closure); // arg #1 let args@2: (u8); // arg #2 let @3: &'_ (closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<(u8)> for closure}::call<'_>(move (@3), move (args@2)) @0 := () return @@ -337,9 +364,12 @@ fn {impl FnOnce<(u8)> for closure}::call_once(@1: closure, @2: (u8)) let @1: closure; // arg #1 let @2: (u8); // arg #2 let @3: &'_ mut (closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(u8)> for closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 @0 := () diff --git a/charon/tests/ui/simple-cmp.out b/charon/tests/ui/simple-cmp.out index 52c7dcb6e..32bc7b380 100644 --- a/charon/tests/ui/simple-cmp.out +++ b/charon/tests/ui/simple-cmp.out @@ -146,6 +146,9 @@ fn main() let @4: &'_ (i32); // anonymous local let @5: &'_ (i32); // anonymous local let @6: &'_ (i32); // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local + let @9: (); // anonymous local storage_live(x@1) x@1 := const (11 : i32) @@ -153,11 +156,17 @@ fn main() y@2 := const (22 : i32) storage_live(@3) storage_live(@4) - @4 := &x@1 + storage_live(@9) + @9 := () + @4 := &(x@1, move (@9)) storage_live(@5) storage_live(@6) - @6 := &y@2 - @5 := &*(@6) + storage_live(@8) + @8 := () + @6 := &(y@2, move (@8)) + storage_live(@7) + @7 := () + @5 := &(*(@6), move (@7)) @3 := {impl Ord for i32}::cmp<'_, '_>(move (@4), move (@5)) storage_dead(@5) storage_dead(@4) diff --git a/charon/tests/ui/simple/array_index.out b/charon/tests/ui/simple/array_index.out index d862a5a06..8652b4f6a 100644 --- a/charon/tests/ui/simple/array_index.out +++ b/charon/tests/ui/simple/array_index.out @@ -6,16 +6,19 @@ pub fn first(@1: Array) -> u32 let @0: u32; // return let s@1: Array; // arg #1 let @2: usize; // anonymous local - let @3: &'_ (Array); // anonymous local - let @4: &'_ (u32); // anonymous local + let @3: (); // anonymous local + let @4: &'_ (Array); // anonymous local + let @5: &'_ (u32); // anonymous local storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &s@1 + @3 := () storage_live(@4) - @4 := @ArrayIndexShared<'_, u32, 0 : usize>(move (@3), copy (@2)) - @0 := copy (*(@4)) + @4 := &(s@1, move (@3)) + storage_live(@5) + @5 := @ArrayIndexShared<'_, u32, 0 : usize>(move (@4), copy (@2)) + @0 := copy (*(@5)) storage_dead(@2) return } diff --git a/charon/tests/ui/simple/assoc-type-with-fn-bound.out b/charon/tests/ui/simple/assoc-type-with-fn-bound.out index ce386396f..8bc9a9110 100644 --- a/charon/tests/ui/simple/assoc-type-with-fn-bound.out +++ b/charon/tests/ui/simple/assoc-type-with-fn-bound.out @@ -94,9 +94,12 @@ where let self@1: &'_ (F); // arg #1 let @2: &'_ (F); // anonymous local let @3: (); // anonymous local + let @4: (); // anonymous local storage_live(@2) - @2 := &*(self@1) + storage_live(@4) + @4 := () + @2 := &(*(self@1), move (@4)) storage_live(@3) @3 := () @0 := @TraitClause0::call<'_>(move (@2), move (@3)) diff --git a/charon/tests/ui/simple/box-into-inner.out b/charon/tests/ui/simple/box-into-inner.out index f567774c1..8d364dc79 100644 --- a/charon/tests/ui/simple/box-into-inner.out +++ b/charon/tests/ui/simple/box-into-inner.out @@ -85,6 +85,7 @@ fn into_inner(@1: alloc::boxed::Box[MetaSized, Sized]) let @11: bool; // anonymous local let @12: bool; // anonymous local let @13: bool; // anonymous local + let @14: (); // anonymous local storage_live(@3) storage_live(@4) @@ -112,7 +113,9 @@ fn into_inner(@1: alloc::boxed::Box[MetaSized, Sized]) drop[{impl Drop for String}] _x@2 storage_dead(_x@2) @5 := transmute, *const String>(copy ((*(b@1)).0)) - @3 := &mut b@1 + storage_live(@14) + @14 := () + @3 := &mut (b@1, move (@14)) @4 := {impl Drop for alloc::boxed::Box[@TraitClause0, @TraitClause1]}::drop<'_, String, Global>[MetaSized, Sized](move (@3)) @0 := () return diff --git a/charon/tests/ui/simple/call-foreign-defaulted-method.out b/charon/tests/ui/simple/call-foreign-defaulted-method.out index 7ac6b49c5..adaee05fd 100644 --- a/charon/tests/ui/simple/call-foreign-defaulted-method.out +++ b/charon/tests/ui/simple/call-foreign-defaulted-method.out @@ -21,12 +21,15 @@ fn main() let @1: (); // anonymous local let @2: &'_ (()); // anonymous local let @3: (); // anonymous local + let @4: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) @3 := () - @2 := &@3 + storage_live(@4) + @4 := () + @2 := &(@3, move (@4)) @1 := test_crate::foo::{impl Trait for ()}::defaulted<'_>(move (@2)) storage_dead(@2) storage_dead(@3) diff --git a/charon/tests/ui/simple/call-method-via-supertrait-bound.out b/charon/tests/ui/simple/call-method-via-supertrait-bound.out index 9ffc5e78a..45711b32b 100644 --- a/charon/tests/ui/simple/call-method-via-supertrait-bound.out +++ b/charon/tests/ui/simple/call-method-via-supertrait-bound.out @@ -88,10 +88,13 @@ where let x@1: T; // arg #1 let @2: (); // anonymous local let @3: &'_ (T); // anonymous local + let @4: (); // anonymous local storage_live(@2) storage_live(@3) - @3 := &x@1 + storage_live(@4) + @4 := () + @3 := &(x@1, move (@4)) @2 := {impl HasMethod for T}::method<'_, T>[@TraitClause0, @TraitClause1::parent_clause1](move (@3)) storage_dead(@3) storage_dead(@2) diff --git a/charon/tests/ui/simple/closure-capture-ref-by-move.out b/charon/tests/ui/simple/closure-capture-ref-by-move.out index 771331da1..a1bea4f48 100644 --- a/charon/tests/ui/simple/closure-capture-ref-by-move.out +++ b/charon/tests/ui/simple/closure-capture-ref-by-move.out @@ -98,16 +98,22 @@ fn foo() let @4: (); // anonymous local let @5: &'_ mut (closure<'_>); // anonymous local let @6: (); // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local storage_live(x@1) x@1 := const (0 : i32) storage_live(rx@2) - rx@2 := &mut x@1 + storage_live(@8) + @8 := () + rx@2 := &mut (x@1, move (@8)) storage_live(closure@3) closure@3 := closure { 0: move (rx@2) } storage_live(@4) storage_live(@5) - @5 := &mut closure@3 + storage_live(@7) + @7 := () + @5 := &mut (closure@3, move (@7)) storage_live(@6) @6 := () @4 := {impl FnMut<()> for closure<'_0>}::call_mut<'_, '_>(move (@5), move (@6)) @@ -129,9 +135,12 @@ fn {impl FnOnce<()> for closure<'_0>}::call_once<'_0>(@1: closure<'_0>, @2: ()) let @1: closure<'_0>; // arg #1 let @2: (); // arg #2 let @3: &'_ mut (closure<'_0>); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<()> for closure<'_0>}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop>] @1 @0 := () diff --git a/charon/tests/ui/simple/closure-fn.out b/charon/tests/ui/simple/closure-fn.out index edd1cbb44..fcb67d20f 100644 --- a/charon/tests/ui/simple/closure-fn.out +++ b/charon/tests/ui/simple/closure-fn.out @@ -94,9 +94,12 @@ where let f@1: &'_ (impl Fn(u8, u8) -> u8); // arg #1 let @2: &'_ (impl Fn(u8, u8) -> u8); // anonymous local let @3: (u8, u8); // anonymous local + let @4: (); // anonymous local storage_live(@2) - @2 := &*(f@1) + storage_live(@4) + @4 := () + @2 := &(*(f@1), move (@4)) storage_live(@3) @3 := (const (10 : u8), const (20 : u8)) @0 := @TraitClause1::call<'_>(move (@2), move (@3)) @@ -116,9 +119,12 @@ where let f@1: &'_ mut (impl FnMut(u8, u8) -> u8); // arg #1 let @2: &'_ mut (impl FnMut(u8, u8) -> u8); // anonymous local let @3: (u8, u8); // anonymous local + let @4: (); // anonymous local storage_live(@2) - @2 := &mut *(f@1) + storage_live(@4) + @4 := () + @2 := &mut (*(f@1), move (@4)) storage_live(@3) @3 := (const (10 : u8), const (20 : u8)) @0 := @TraitClause1::call_mut<'_>(move (@2), move (@3)) @@ -213,9 +219,12 @@ fn {impl FnMut<(u8, u8)> for closure<'_0, '_1>}::call_mut<'_0, '_1, '_2>(@1: &'_ let state@1: &'_2 mut (closure<'_0, '_1>); // arg #1 let args@2: (u8, u8); // arg #2 let @3: &'_ (closure<'_0, '_1>); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<(u8, u8)> for closure<'_0, '_1>}::call<'_0, '_1, '_>(move (@3), move (args@2)) return } @@ -227,9 +236,12 @@ fn {impl FnOnce<(u8, u8)> for closure<'_0, '_1>}::call_once<'_0, '_1>(@1: closur let @1: closure<'_0, '_1>; // arg #1 let @2: (u8, u8); // arg #2 let @3: &'_ mut (closure<'_0, '_1>); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(u8, u8)> for closure<'_0, '_1>}::call_mut<'_0, '_1, '_>(move (@3), move (@2)) drop[Drop>] @1 return @@ -286,6 +298,13 @@ fn main() let @14: &'_ mut (closure<'_, '_>); // anonymous local let @15: u8; // anonymous local let @16: closure<'_, '_>; // anonymous local + let @17: (); // anonymous local + let @18: (); // anonymous local + let @19: (); // anonymous local + let @20: (); // anonymous local + let @21: (); // anonymous local + let @22: (); // anonymous local + let @23: (); // anonymous local storage_live(v@1) v@1 := const (5 : u8) @@ -293,15 +312,21 @@ fn main() z@2 := const (1 : u8) storage_live(f@3) storage_live(@4) - @4 := &v@1 + storage_live(@19) + @19 := () + @4 := &(v@1, move (@19)) storage_live(@5) - @5 := &z@2 + storage_live(@18) + @18 := () + @5 := &(z@2, move (@18)) f@3 := closure { 0: move (@4), 1: move (@5) } storage_dead(@5) storage_dead(@4) storage_live(@6) storage_live(@7) - @7 := &f@3 + storage_live(@17) + @17 := () + @7 := &(f@3, move (@17)) storage_live(@8) @8 := (const (10 : u8), const (20 : u8)) @6 := {impl Fn<(u8, u8)> for closure<'_0, '_1>}::call<'_, '_, '_>(move (@7), move (@8)) @@ -311,8 +336,12 @@ fn main() storage_live(@9) storage_live(@10) storage_live(@11) - @11 := &f@3 - @10 := &*(@11) + storage_live(@21) + @21 := () + @11 := &(f@3, move (@21)) + storage_live(@20) + @20 := () + @10 := &(*(@11), move (@20)) @9 := apply_to<'_, closure<'_, '_>>[Sized>, {impl Fn<(u8, u8)> for closure<'_0, '_1>}<'_, '_>](move (@10)) storage_dead(@10) storage_dead(@11) @@ -320,8 +349,12 @@ fn main() storage_live(@12) storage_live(@13) storage_live(@14) - @14 := &mut f@3 - @13 := &two-phase-mut *(@14) + storage_live(@23) + @23 := () + @14 := &mut (f@3, move (@23)) + storage_live(@22) + @22 := () + @13 := &two-phase-mut (*(@14), move (@22)) @12 := apply_to_mut<'_, closure<'_, '_>>[Sized>, {impl FnMut<(u8, u8)> for closure<'_0, '_1>}<'_, '_>](move (@13)) storage_dead(@13) storage_dead(@14) diff --git a/charon/tests/ui/simple/closure-fnmut.out b/charon/tests/ui/simple/closure-fnmut.out index e1bdded29..c0c890438 100644 --- a/charon/tests/ui/simple/closure-fnmut.out +++ b/charon/tests/ui/simple/closure-fnmut.out @@ -78,9 +78,12 @@ where let f@1: impl FnMut(u8) -> u8; // arg #1 let @2: &'_ mut (impl FnMut(u8) -> u8); // anonymous local let @3: (u8); // anonymous local + let @4: (); // anonymous local storage_live(@2) - @2 := &mut f@1 + storage_live(@4) + @4 := () + @2 := &mut (f@1, move (@4)) storage_live(@3) @3 := (const (0 : u8)) @0 := @TraitClause1::call_mut<'_>(move (@2), move (@3)) @@ -131,9 +134,12 @@ fn {impl FnOnce<(u8)> for closure<'_0>}::call_once<'_0>(@1: closure<'_0>, @2: (u let @1: closure<'_0>; // arg #1 let @2: (u8); // arg #2 let @3: &'_ mut (closure<'_0>); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(u8)> for closure<'_0>}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop>] @1 return @@ -168,13 +174,16 @@ fn main() let @2: u8; // anonymous local let @3: closure<'_>; // anonymous local let @4: &'_ mut (u8); // anonymous local + let @5: (); // anonymous local storage_live(z@1) z@1 := const (3 : u8) storage_live(@2) storage_live(@3) storage_live(@4) - @4 := &mut z@1 + storage_live(@5) + @5 := () + @4 := &mut (z@1, move (@5)) @3 := closure { 0: move (@4) } storage_dead(@4) @2 := apply_to_zero_mut>[Sized>, {impl FnMut<(u8)> for closure<'_0>}<'_>](move (@3)) diff --git a/charon/tests/ui/simple/closure-inside-impl.out b/charon/tests/ui/simple/closure-inside-impl.out index 657d18778..7391c2baf 100644 --- a/charon/tests/ui/simple/closure-inside-impl.out +++ b/charon/tests/ui/simple/closure-inside-impl.out @@ -143,9 +143,12 @@ where let state@1: &'_0 mut (closure[@TraitClause0, @TraitClause1]); // arg #1 let args@2: (()); // arg #2 let @3: &'_ (closure[@TraitClause0, @TraitClause1]); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<(())> for closure[@TraitClause0, @TraitClause1]}::call<'_, F, T>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) @0 := () return @@ -161,9 +164,12 @@ where let @1: closure[@TraitClause0, @TraitClause1]; // arg #1 let @2: (()); // arg #2 let @3: &'_ mut (closure[@TraitClause0, @TraitClause1]); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(())> for closure[@TraitClause0, @TraitClause1]}::call_mut<'_, F, T>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0, @TraitClause1]>] @1 @0 := () diff --git a/charon/tests/ui/simple/closure-uses-ambient-self-clause.out b/charon/tests/ui/simple/closure-uses-ambient-self-clause.out index 8656a284b..2cc3119e4 100644 --- a/charon/tests/ui/simple/closure-uses-ambient-self-clause.out +++ b/charon/tests/ui/simple/closure-uses-ambient-self-clause.out @@ -128,11 +128,14 @@ where let @3: closure[@TraitClause0]; // anonymous local let @4: (@TraitClause0::Item); // anonymous local let @5: @TraitClause0::Item; // anonymous local + let @6: (); // anonymous local storage_live(@2) storage_live(@3) @3 := closure { } - @2 := &@3 + storage_live(@6) + @6 := () + @2 := &(@3, move (@6)) storage_live(@4) storage_live(@5) @5 := move (i@1) @@ -157,9 +160,12 @@ where let state@1: &'_0 mut (closure[@TraitClause0]); // arg #1 let args@2: (@TraitClause0::Item); // arg #2 let @3: &'_ (closure[@TraitClause0]); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<(@TraitClause0::Item)> for closure[@TraitClause0]}::call<'_, Self>[@TraitClause0](move (@3), move (args@2)) @0 := () return @@ -174,9 +180,12 @@ where let @1: closure[@TraitClause0]; // arg #1 let @2: (@TraitClause0::Item); // arg #2 let @3: &'_ mut (closure[@TraitClause0]); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(@TraitClause0::Item)> for closure[@TraitClause0]}::call_mut<'_, Self>[@TraitClause0](move (@3), move (@2)) drop[Drop[@TraitClause0]>] @1 @0 := () diff --git a/charon/tests/ui/simple/closure-with-drops.out b/charon/tests/ui/simple/closure-with-drops.out index 4e0e13c03..ba4b391a0 100644 --- a/charon/tests/ui/simple/closure-with-drops.out +++ b/charon/tests/ui/simple/closure-with-drops.out @@ -196,9 +196,12 @@ fn {impl FnMut<()> for test_crate::bar::closure}::call_mut<'_0>(@1: &'_0 mut (te let state@1: &'_0 mut (test_crate::bar::closure); // arg #1 let args@2: (); // arg #2 let @3: &'_ (test_crate::bar::closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<()> for test_crate::bar::closure}::call<'_>(move (@3), move (args@2)) @0 := () return @@ -211,9 +214,12 @@ fn {impl FnOnce<()> for test_crate::bar::closure}::call_once(@1: test_crate::bar let @1: test_crate::bar::closure; // arg #1 let @2: (); // arg #2 let @3: &'_ mut (test_crate::bar::closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<()> for test_crate::bar::closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 @0 := () diff --git a/charon/tests/ui/simple/const-subslice.out b/charon/tests/ui/simple/const-subslice.out index 8dd174081..ad3641324 100644 --- a/charon/tests/ui/simple/const-subslice.out +++ b/charon/tests/ui/simple/const-subslice.out @@ -9,18 +9,24 @@ fn main() let @3: *const Slice; // anonymous local let @4: usize; // anonymous local let @5: *const u8; // anonymous local - let @6: Slice; // anonymous local - let @7: &'_ (Slice); // anonymous local + let @6: usize; // anonymous local + let @7: Slice; // anonymous local + let @8: (); // anonymous local + let @9: &'_ (Slice); // anonymous local - storage_live(@6) storage_live(@7) + storage_live(@8) + storage_live(@9) storage_live(y@1) - @6 := [const (0 : u8), const (1 : u8), const (2 : u8)] - @7 := &@6 - y@1 := move (@7) + @7 := [const (0 : u8), const (1 : u8), const (2 : u8)] + @8 := () + @9 := &(@7, move (@8)) + y@1 := move (@9) storage_live(z@2) storage_live(@3) - @3 := &raw const *(y@1) + storage_live(@6) + @6 := ptr_metadata(copy (y@1)) + @3 := &raw const (*(y@1), move (@6)) z@2 := cast<*const Slice, *const u8>(move (@3)) storage_dead(@3) storage_live(@4) diff --git a/charon/tests/ui/simple/drop-string.out b/charon/tests/ui/simple/drop-string.out index 9861eb79c..0201d0833 100644 --- a/charon/tests/ui/simple/drop-string.out +++ b/charon/tests/ui/simple/drop-string.out @@ -81,9 +81,12 @@ fn {impl Drop for String}::drop<'_0>(@1: &'_0 mut (String)) let @0: (); // return let @1: *mut String; // arg #1 let @2: &'_ mut (String); // anonymous local + let @3: (); // anonymous local storage_live(@2) - @2 := &mut *(@1) + storage_live(@3) + @3 := () + @2 := &mut (*(@1), move (@3)) drop[{impl Drop for Vec[@TraitClause0, @TraitClause1, @TraitClause3, @TraitClause4]}[Sized, Sized, Drop, {impl Drop for Global}]] (*(@2)).vec @0 := () return diff --git a/charon/tests/ui/simple/dyn-fn.out b/charon/tests/ui/simple/dyn-fn.out index 519aa3648..38fddcb4a 100644 --- a/charon/tests/ui/simple/dyn-fn.out +++ b/charon/tests/ui/simple/dyn-fn.out @@ -103,17 +103,26 @@ fn takes_fn<'_0>(@1: &'_0 ((dyn exists<_dyn> [@TraitClause0]: for<'a> Fn<_dyn, ( let @5: (&'_ mut (u32)); // anonymous local let @6: &'_ mut (u32); // anonymous local let @7: &'_ mut (u32); // anonymous local + let @8: (); // anonymous local + let @9: (); // anonymous local + let @10: &'static (core::ops::function::Fn::{vtable}<(&'_ mut (u32)), bool>); // anonymous local storage_live(counter@2) counter@2 := const (0 : u32) storage_live(@3) storage_live(@4) - @4 := &*(f@1) + storage_live(@10) + @10 := ptr_metadata(copy (f@1)) + @4 := &(*(f@1), move (@10)) storage_live(@5) storage_live(@6) storage_live(@7) - @7 := &mut counter@2 - @6 := &two-phase-mut *(@7) + storage_live(@9) + @9 := () + @7 := &mut (counter@2, move (@9)) + storage_live(@8) + @8 := () + @6 := &two-phase-mut (*(@7), move (@8)) @5 := (move (@6)) @3 := Fn<(dyn exists<_dyn> [@TraitClause0]: for<'a> Fn<_dyn, (&'a mut (u32))> + _dyn : '_ + for<'a> @TraitClause1_0::parent_clause1::parent_clause1::Output = bool), (&'_ mut (u32))>::call<'_>(move (@4), move (@5)) if move (@3) { @@ -164,9 +173,12 @@ fn {impl FnMut<(&'_ mut (u32))> for closure}::call_mut<'_0, '_1>(@1: &'_1 mut (c let state@1: &'_1 mut (closure); // arg #1 let args@2: (&'_0 mut (u32)); // arg #2 let @3: &'_ (closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<(&'_ mut (u32))> for closure}::call<'_0, '_>(move (@3), move (args@2)) return } @@ -178,9 +190,12 @@ fn {impl FnOnce<(&'_ mut (u32))> for closure}::call_once<'_0>(@1: closure, @2: ( let @1: closure; // arg #1 let @2: (&'_ mut (u32)); // arg #2 let @3: &'_ mut (closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(&'_ mut (u32))> for closure}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop] @1 return @@ -225,14 +240,20 @@ fn gives_fn() let @2: &'_ (closure); // anonymous local let @3: &'_ (closure); // anonymous local let @4: closure; // anonymous local + let @5: (); // anonymous local + let @6: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := closure { } - @3 := &@4 - @2 := &*(@3) + storage_live(@6) + @6 := () + @3 := &(@4, move (@6)) + storage_live(@5) + @5 := () + @2 := &(*(@3), move (@5)) @1 := unsize_cast<&'_ (closure), &'_ ((dyn exists<_dyn> [@TraitClause0]: for<'a> Fn<_dyn, (&'a mut (u32))> + _dyn : '_ + for<'a> @TraitClause1_0::parent_clause1::parent_clause1::Output = bool)), {impl Fn<(&'_ mut (u32))> for closure}<'_>>(move (@2)) storage_dead(@2) @0 := takes_fn<'_>(move (@1)) diff --git a/charon/tests/ui/simple/gat-complex-lifetimes.out b/charon/tests/ui/simple/gat-complex-lifetimes.out index 33875532f..62e4dee7f 100644 --- a/charon/tests/ui/simple/gat-complex-lifetimes.out +++ b/charon/tests/ui/simple/gat-complex-lifetimes.out @@ -62,12 +62,15 @@ where let x@1: @TraitClause1::Type; // arg #1 let @2: &'_ (&'_ (&'_ (()))); // anonymous local let @3: @TraitClause1::Type; // anonymous local + let @4: (); // anonymous local storage_live(@2) storage_live(@3) @3 := move (x@1) @2 := (@TraitClause1::Type::[@TraitClause1])::foo(move (@3)) - @0 := &*(@2) + storage_live(@4) + @4 := () + @0 := &(*(@2), move (@4)) storage_dead(@3) storage_dead(@2) drop[Drop<@TraitClause1::Type>] x@1 diff --git a/charon/tests/ui/simple/gat-implied-clause.out b/charon/tests/ui/simple/gat-implied-clause.out index 0996552c9..1940d784d 100644 --- a/charon/tests/ui/simple/gat-implied-clause.out +++ b/charon/tests/ui/simple/gat-implied-clause.out @@ -76,10 +76,13 @@ where let x@1: @TraitClause1::LifetimeGat; // arg #1 let @2: @TraitClause1::LifetimeGat; // anonymous local let @3: &'_ (@TraitClause1::LifetimeGat); // anonymous local + let @4: (); // anonymous local storage_live(@2) storage_live(@3) - @3 := &x@1 + storage_live(@4) + @4 := () + @3 := &(x@1, move (@4)) @2 := (@TraitClause1::LifetimeGat::[@TraitClause1])::clone<'_>(move (@3)) storage_dead(@3) drop[Drop<@TraitClause1::LifetimeGat>] @2 @@ -100,10 +103,13 @@ where let x@1: @TraitClause1::NonLifetimeGat; // arg #1 let @2: @TraitClause1::NonLifetimeGat; // anonymous local let @3: &'_ (@TraitClause1::NonLifetimeGat); // anonymous local + let @4: (); // anonymous local storage_live(@2) storage_live(@3) - @3 := &x@1 + storage_live(@4) + @4 := () + @3 := &(x@1, move (@4)) @2 := (@TraitClause1::NonLifetimeGat::[@TraitClause1])::clone<'_>(move (@3)) storage_dead(@3) drop[Drop<@TraitClause1::NonLifetimeGat>] @2 diff --git a/charon/tests/ui/simple/generic-cast-to-dyn.out b/charon/tests/ui/simple/generic-cast-to-dyn.out index 7fb60b85f..11ec3eb74 100644 --- a/charon/tests/ui/simple/generic-cast-to-dyn.out +++ b/charon/tests/ui/simple/generic-cast-to-dyn.out @@ -51,14 +51,20 @@ where let @2: &'_ ((dyn exists<_dyn> [@TraitClause0]: Any<_dyn> + _dyn : '_)); // anonymous local let @3: &'_ ((dyn exists<_dyn> [@TraitClause0]: Any<_dyn> + _dyn : '_)); // anonymous local let @4: &'_ (T); // anonymous local + let @5: &'static (core::any::Any::{vtable}); // anonymous local + let @6: (); // anonymous local storage_live(@2) storage_live(@3) storage_live(@4) - @4 := &*(x@1) + storage_live(@6) + @6 := () + @4 := &(*(x@1), move (@6)) @3 := unsize_cast<&'_ (T), &'_ ((dyn exists<_dyn> [@TraitClause0]: Any<_dyn> + _dyn : '_)), @TraitClause1>(move (@4)) storage_dead(@4) - @2 := &*(@3) + storage_live(@5) + @5 := ptr_metadata(copy (@3)) + @2 := &(*(@3), move (@5)) @0 := unsize_cast<&'_ ((dyn exists<_dyn> [@TraitClause0]: Any<_dyn> + _dyn : '_)), &'_ ((dyn exists<_dyn> [@TraitClause0]: Any<_dyn> + _dyn : '_)), Any<(dyn exists<_dyn> [@TraitClause0]: Any<_dyn> + _dyn : '_)>>(move (@2)) storage_dead(@3) storage_dead(@2) diff --git a/charon/tests/ui/simple/lending-iterator-gat.out b/charon/tests/ui/simple/lending-iterator-gat.out index 401799a18..72fef8cad 100644 --- a/charon/tests/ui/simple/lending-iterator-gat.out +++ b/charon/tests/ui/simple/lending-iterator-gat.out @@ -131,6 +131,9 @@ where let item@3: &'_ (T); // local let @4: Option<&'_ (T)>[Sized<&'_ (T)>]; // anonymous local let @5: &'_ (T); // anonymous local + let @6: (); // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local match *(self@1) { Option::Some => { @@ -141,15 +144,21 @@ where }, } storage_live(item@2) - item@2 := &mut (*(self@1) as variant Option::Some).0 + storage_live(@8) + @8 := () + item@2 := &mut ((*(self@1) as variant Option::Some).0, move (@8)) storage_live(item@3) - item@3 := &*(*(item@2)) + storage_live(@7) + @7 := () + item@3 := &(*(*(item@2)), move (@7)) storage_live(@4) @4 := Option::None { } *(self@1) := move (@4) storage_dead(@4) storage_live(@5) - @5 := &*(item@3) + storage_live(@6) + @6 := () + @5 := &(*(item@3), move (@6)) @0 := Option::Some { 0: move (@5) } storage_dead(@5) storage_dead(item@3) @@ -188,6 +197,8 @@ where let @8: (@TraitClause2::Item); // anonymous local let @9: @TraitClause2::Item; // anonymous local let @10: (); // anonymous local + let @11: (); // anonymous local + let @12: (); // anonymous local storage_live(@3) storage_live(@5) @@ -195,10 +206,14 @@ where storage_live(@7) storage_live(@8) storage_live(@9) + storage_live(@11) + storage_live(@12) loop { storage_live(@4) storage_live(@5) - @5 := &two-phase-mut iter@1 + storage_live(@11) + @11 := () + @5 := &two-phase-mut (iter@1, move (@11)) @4 := @TraitClause2::next<'_>(move (@5)) storage_dead(@5) match @4 { @@ -211,7 +226,9 @@ where storage_live(item@6) item@6 := move ((@4 as variant Option::Some).0) storage_live(@7) - @7 := &mut f@2 + storage_live(@12) + @12 := () + @7 := &mut (f@2, move (@12)) storage_live(@8) storage_live(@9) @9 := move (item@6) @@ -273,9 +290,12 @@ fn {impl FnOnce<(&'_ (i32))> for closure<'_0>}::call_once<'_0, '_1>(@1: closure< let @1: closure<'_0>; // arg #1 let @2: (&'_ (i32)); // arg #2 let @3: &'_ mut (closure<'_0>); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(&'_ (i32))> for closure<'_0>}::call_mut<'_0, '_1, '_>(move (@3), move (@2)) drop[Drop>] @1 @0 := () @@ -333,6 +353,14 @@ pub fn main() let @24: &'_ (i32); // anonymous local let @25: &'_ (i32); // anonymous local let @26: Option>[Sized>]; // anonymous local + let @27: (); // anonymous local + let @28: (); // anonymous local + let @29: (); // anonymous local + let @30: (); // anonymous local + let @31: (); // anonymous local + let @32: (); // anonymous local + let @33: (); // anonymous local + let @34: (); // anonymous local storage_live(kind@20) storage_live(@21) @@ -341,13 +369,19 @@ pub fn main() storage_live(@24) storage_live(@25) storage_live(@26) + storage_live(@31) + storage_live(@32) + storage_live(@33) + storage_live(@34) storage_live(x@1) x@1 := const (42 : i32) storage_live(iter@2) storage_live(@3) storage_live(@4) @4 := const (42 : i32) - @3 := &@4 + storage_live(@28) + @28 := () + @3 := &(@4, move (@28)) iter@2 := Option::Some { 0: move (@3) } storage_dead(@3) storage_live(sum@5) @@ -357,7 +391,9 @@ pub fn main() @7 := copy (iter@2) storage_live(@8) storage_live(@9) - @9 := &mut sum@5 + storage_live(@27) + @27 := () + @9 := &mut (sum@5, move (@27)) @8 := closure { 0: move (@9) } storage_dead(@9) @6 := for_each[Sized<&'_ (i32)>], closure<'_>>[Sized[Sized<&'_ (i32)>]>, Sized>, {impl LendingIterator for Option<&'a (T)>[Sized<&'_ (T)>]}<'_, i32>[Sized], {impl FnMut<(&'_ (i32))> for closure<'_0>}<'_, '_>](move (@7), move (@8)) @@ -367,11 +403,15 @@ pub fn main() storage_live(@10) storage_live(@11) storage_live(@12) - @12 := &sum@5 + storage_live(@30) + @30 := () + @12 := &(sum@5, move (@30)) storage_live(@13) storage_live(@14) @14 := const (42 : i32) - @13 := &@14 + storage_live(@29) + @29 := () + @13 := &(@14, move (@29)) @11 := (move (@12), move (@13)) storage_dead(@13) storage_dead(@12) @@ -396,12 +436,20 @@ pub fn main() @21 := move (kind@20) storage_live(@22) storage_live(@23) - @23 := &*(left_val@15) - @22 := &*(@23) + storage_live(@34) + @34 := () + @23 := &(*(left_val@15), move (@34)) + storage_live(@33) + @33 := () + @22 := &(*(@23), move (@33)) storage_live(@24) storage_live(@25) - @25 := &*(right_val@16) - @24 := &*(@25) + storage_live(@32) + @32 := () + @25 := &(*(right_val@16), move (@32)) + storage_live(@31) + @31 := () + @24 := &(*(@25), move (@31)) storage_live(@26) @26 := Option::None { } panic(core::panicking::assert_failed) diff --git a/charon/tests/ui/simple/mem-discriminant-from-derive.out b/charon/tests/ui/simple/mem-discriminant-from-derive.out index 64f25ab98..780e968ca 100644 --- a/charon/tests/ui/simple/mem-discriminant-from-derive.out +++ b/charon/tests/ui/simple/mem-discriminant-from-derive.out @@ -225,6 +225,12 @@ pub fn {impl PartialEq for Enum}::eq<'_0, '_1>(@1: &'_0 (Enum), @2: &'_1 ( let __arg1_0@14: &'_ (u8); // local let @15: &'_ (&'_ (u8)); // anonymous local let @16: &'_ (&'_ (u8)); // anonymous local + let @17: (); // anonymous local + let @18: (); // anonymous local + let @19: (); // anonymous local + let @20: (); // anonymous local + let @21: (); // anonymous local + let @22: (); // anonymous local storage_live(@10) storage_live(@11) @@ -233,14 +239,22 @@ pub fn {impl PartialEq for Enum}::eq<'_0, '_1>(@1: &'_0 (Enum), @2: &'_1 ( storage_live(__arg1_0@14) storage_live(@15) storage_live(@16) + storage_live(@19) + storage_live(@20) + storage_live(@21) + storage_live(@22) storage_live(__self_discr@3) storage_live(@4) - @4 := &*(self@1) + storage_live(@17) + @17 := () + @4 := &(*(self@1), move (@17)) __self_discr@3 := @discriminant(*(@4)) storage_dead(@4) storage_live(__arg1_discr@5) storage_live(@6) - @6 := &*(other@2) + storage_live(@18) + @18 := () + @6 := &(*(other@2), move (@18)) __arg1_discr@5 := @discriminant(*(@6)) storage_dead(@6) storage_live(@7) @@ -265,13 +279,21 @@ pub fn {impl PartialEq for Enum}::eq<'_0, '_1>(@1: &'_0 (Enum), @2: &'_1 ( match *((@10).1) { Enum::Some => { storage_live(__self_0@13) - __self_0@13 := &(*((@10).0) as variant Enum::Some).0 + storage_live(@22) + @22 := () + __self_0@13 := &((*((@10).0) as variant Enum::Some).0, move (@22)) storage_live(__arg1_0@14) - __arg1_0@14 := &(*((@10).1) as variant Enum::Some).0 + storage_live(@21) + @21 := () + __arg1_0@14 := &((*((@10).1) as variant Enum::Some).0, move (@21)) storage_live(@15) - @15 := &__self_0@13 + storage_live(@20) + @20 := () + @15 := &(__self_0@13, move (@20)) storage_live(@16) - @16 := &__arg1_0@14 + storage_live(@19) + @19 := () + @16 := &(__arg1_0@14, move (@19)) @0 := {impl PartialEq<&'_0 (B)> for &'_1 (A)}::eq<'_, '_, '_, '_, u8, u8>[{impl PartialEq for u8}](move (@15), move (@16)) storage_dead(@16) storage_dead(@15) diff --git a/charon/tests/ui/simple/multiple-promoteds.out b/charon/tests/ui/simple/multiple-promoteds.out index f2acf9271..cbe64140d 100644 --- a/charon/tests/ui/simple/multiple-promoteds.out +++ b/charon/tests/ui/simple/multiple-promoteds.out @@ -54,37 +54,49 @@ fn six() -> u32 let @6: &'_ (u32); // anonymous local let @7: &'_ (u32); // anonymous local let @8: &'_ (u32); // anonymous local - let @9: &'_ (u32); // anonymous local - let @10: u32; // anonymous local - let @11: u32; // anonymous local - let @12: &'_ (u32); // anonymous local + let @9: (); // anonymous local + let @10: (); // anonymous local + let @11: &'_ (u32); // anonymous local + let @12: u32; // anonymous local let @13: u32; // anonymous local - let @14: u32; // anonymous local + let @14: (); // anonymous local + let @15: &'_ (u32); // anonymous local + let @16: u32; // anonymous local + let @17: u32; // anonymous local + let @18: (); // anonymous local storage_live(@2) storage_live(@4) storage_live(@7) storage_live(@8) - storage_live(@9) - storage_live(@10) storage_live(@11) storage_live(@12) storage_live(@13) - storage_live(@14) + storage_live(@15) + storage_live(@16) + storage_live(@17) storage_live(x@1) @2 := const (0 : u32) panic.+ const (1 : u32) - @11 := const (0 : u32) wrap.+ const (1 : u32) - @10 := move (@11) - @9 := &@10 - @8 := move (@9) - x@1 := &*(@8) + @13 := const (0 : u32) wrap.+ const (1 : u32) + @12 := move (@13) + storage_live(@14) + @14 := () + @11 := &(@12, move (@14)) + @8 := move (@11) + storage_live(@9) + @9 := () + x@1 := &(*(@8), move (@9)) storage_live(y@3) @4 := const (2 : u32) panic.+ const (3 : u32) - @14 := const (2 : u32) wrap.+ const (3 : u32) - @13 := move (@14) - @12 := &@13 - @7 := move (@12) - y@3 := &*(@7) + @17 := const (2 : u32) wrap.+ const (3 : u32) + @16 := move (@17) + storage_live(@18) + @18 := () + @15 := &(@16, move (@18)) + @7 := move (@15) + storage_live(@10) + @10 := () + y@3 := &(*(@7), move (@10)) storage_live(@5) @5 := copy (x@1) storage_live(@6) diff --git a/charon/tests/ui/simple/nested-closure-trait-ref.out b/charon/tests/ui/simple/nested-closure-trait-ref.out index 2e16f573a..771d1b595 100644 --- a/charon/tests/ui/simple/nested-closure-trait-ref.out +++ b/charon/tests/ui/simple/nested-closure-trait-ref.out @@ -186,9 +186,12 @@ where let @1: &'_ (test_crate::foo::closure::closure[@TraitClause0, @TraitClause1]); // arg #1 let tupled_args@2: (); // arg #2 let @3: &'_ (T); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &(*(@1)).0 + storage_live(@4) + @4 := () + @3 := &((*(@1)).0, move (@4)) @0 := @TraitClause1::clone<'_>(move (@3)) storage_dead(@3) return @@ -204,9 +207,12 @@ where let state@1: &'_0 mut (test_crate::foo::closure::closure[@TraitClause0, @TraitClause1]); // arg #1 let args@2: (); // arg #2 let @3: &'_ (test_crate::foo::closure::closure[@TraitClause0, @TraitClause1]); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<()> for test_crate::foo::closure::closure[@TraitClause0, @TraitClause1]}::call<'_, T>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) return } @@ -221,9 +227,12 @@ where let @1: test_crate::foo::closure::closure[@TraitClause0, @TraitClause1]; // arg #1 let @2: (); // arg #2 let @3: &'_ mut (test_crate::foo::closure::closure[@TraitClause0, @TraitClause1]); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<()> for test_crate::foo::closure::closure[@TraitClause0, @TraitClause1]}::call_mut<'_, T>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0, @TraitClause1]>] @1 return diff --git a/charon/tests/ui/simple/nested-closure.out b/charon/tests/ui/simple/nested-closure.out index 91f00d841..3dab22bbe 100644 --- a/charon/tests/ui/simple/nested-closure.out +++ b/charon/tests/ui/simple/nested-closure.out @@ -149,9 +149,12 @@ where let @1: &'_ (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // arg #1 let tupled_args@2: (); // arg #2 let @3: &'_ (T); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*((*(@1)).0) + storage_live(@4) + @4 := () + @3 := &(*((*(@1)).0), move (@4)) @0 := test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure { 0: move (@3) } storage_dead(@3) return @@ -168,11 +171,14 @@ where let tupled_args@2: (&'_2 (u32)); // arg #2 let _y@3: &'_ (u32); // local let @4: &'_ (T); // anonymous local + let @5: (); // anonymous local storage_live(_y@3) _y@3 := move ((tupled_args@2).0) storage_live(@4) - @4 := &*((*(@1)).0) + storage_live(@5) + @5 := () + @4 := &(*((*(@1)).0), move (@5)) @0 := test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure::closure { 0: move (@4) } storage_dead(@4) return @@ -189,11 +195,14 @@ where let tupled_args@2: (&'_2 (u32)); // arg #2 let _z@3: &'_ (u32); // local let @4: &'_ (T); // anonymous local + let @5: (); // anonymous local storage_live(_z@3) _z@3 := move ((tupled_args@2).0) storage_live(@4) - @4 := &*((*(@1)).0) + storage_live(@5) + @5 := () + @4 := &(*((*(@1)).0), move (@5)) @0 := @TraitClause1::clone<'_>(move (@4)) storage_dead(@4) return @@ -223,10 +232,20 @@ where let @15: &'_ (u32); // anonymous local let @16: &'_ (u32); // anonymous local let @17: u32; // anonymous local + let @18: (); // anonymous local + let @19: (); // anonymous local + let @20: (); // anonymous local + let @21: (); // anonymous local + let @22: (); // anonymous local + let @23: (); // anonymous local + let @24: (); // anonymous local + let @25: (); // anonymous local storage_live(clo@2) storage_live(@3) - @3 := &*(*(x@1)) + storage_live(@19) + @19 := () + @3 := &(*(*(x@1)), move (@19)) clo@2 := test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure { 0: move (@3) } storage_dead(@3) storage_live(@4) @@ -234,11 +253,15 @@ where storage_live(@6) storage_live(@7) storage_live(@8) - @8 := &clo@2 + storage_live(@18) + @18 := () + @8 := &(clo@2, move (@18)) storage_live(@9) @9 := () @7 := {impl Fn<()> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call<'_, '_, '_, T>[@TraitClause0, @TraitClause1](move (@8), move (@9)) - @6 := &@7 + storage_live(@22) + @22 := () + @6 := &(@7, move (@22)) storage_dead(@9) storage_dead(@8) storage_live(@10) @@ -246,11 +269,17 @@ where storage_live(@12) storage_live(@13) @13 := const (0 : u32) - @12 := &@13 - @11 := &*(@12) + storage_live(@21) + @21 := () + @12 := &(@13, move (@21)) + storage_live(@20) + @20 := () + @11 := &(*(@12), move (@20)) @10 := (move (@11)) @5 := {impl Fn<(&'_ (u32))> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call<'_, '_, '_, '_, T>[@TraitClause0, @TraitClause1](move (@6), move (@10)) - @4 := &@5 + storage_live(@25) + @25 := () + @4 := &(@5, move (@25)) storage_dead(@11) storage_dead(@10) storage_dead(@6) @@ -259,8 +288,12 @@ where storage_live(@16) storage_live(@17) @17 := const (1 : u32) - @16 := &@17 - @15 := &*(@16) + storage_live(@24) + @24 := () + @16 := &(@17, move (@24)) + storage_live(@23) + @23 := () + @15 := &(*(@16), move (@23)) @14 := (move (@15)) @0 := {impl Fn<(&'_ (u32))> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call<'_, '_, '_, '_, T>[@TraitClause0, @TraitClause1](move (@4), move (@14)) storage_dead(@15) @@ -286,9 +319,12 @@ where let state@1: &'_2 mut (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // arg #1 let args@2: (); // arg #2 let @3: &'_ (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<()> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call<'_, '_1, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) return } @@ -303,9 +339,12 @@ where let @1: test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]; // arg #1 let @2: (); // arg #2 let @3: &'_ mut (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<()> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call_mut<'_, '_1, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]>] @1 return @@ -364,9 +403,12 @@ where let state@1: &'_3 mut (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // arg #1 let args@2: (&'_2 (u32)); // arg #2 let @3: &'_ (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<(&'_ (u32))> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call<'_, '_1, '_2, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) return } @@ -381,9 +423,12 @@ where let @1: test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]; // arg #1 let @2: (&'_ (u32)); // arg #2 let @3: &'_ mut (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(&'_ (u32))> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call_mut<'_, '_1, '_2, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0]}::test_nested_closures::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]>] @1 return @@ -442,9 +487,12 @@ where let state@1: &'_3 mut (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // arg #1 let args@2: (&'_2 (u32)); // arg #2 let @3: &'_ (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<(&'_ (u32))> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call<'_, '_1, '_2, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) return } @@ -459,9 +507,12 @@ where let @1: test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]; // arg #1 let @2: (&'_ (u32)); // arg #2 let @3: &'_ mut (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(&'_ (u32))> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call_mut<'_, '_1, '_2, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0]}::test_nested_closures::closure::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]>] @1 return diff --git a/charon/tests/ui/simple/pointee_metadata.out b/charon/tests/ui/simple/pointee_metadata.out index 878431dcb..e8431b228 100644 --- a/charon/tests/ui/simple/pointee_metadata.out +++ b/charon/tests/ui/simple/pointee_metadata.out @@ -220,14 +220,20 @@ fn empty_metadata() let @2: *const u32; // anonymous local let @3: &'_ (u32); // anonymous local let @4: u32; // anonymous local + let @5: (); // anonymous local + let @6: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := const (0 : u32) - @3 := &@4 - @2 := &raw const *(@3) + storage_live(@6) + @6 := () + @3 := &(@4, move (@6)) + storage_live(@5) + @5 := () + @2 := &raw const (*(@3), move (@5)) @1 := to_raw_parts(move (@2)) storage_dead(@2) storage_dead(@4) @@ -247,6 +253,8 @@ fn slice_metadata() let @3: *const Array; // anonymous local let @4: &'_ (Array); // anonymous local let @5: Array; // anonymous local + let @6: (); // anonymous local + let @7: (); // anonymous local storage_live(@1) storage_live(@2) @@ -254,8 +262,12 @@ fn slice_metadata() storage_live(@4) storage_live(@5) @5 := [const (0 : u32), const (1 : u32)] - @4 := &@5 - @3 := &raw const *(@4) + storage_live(@7) + @7 := () + @4 := &(@5, move (@7)) + storage_live(@6) + @6 := () + @3 := &raw const (*(@4), move (@6)) @2 := unsize_cast<*const Array, *const Slice, 2 : usize>(move (@3)) storage_dead(@3) @1 := to_raw_parts>(move (@2)) diff --git a/charon/tests/ui/simple/promoted-closure-no-warns.out b/charon/tests/ui/simple/promoted-closure-no-warns.out index c521d40b7..1c6f8e285 100644 --- a/charon/tests/ui/simple/promoted-closure-no-warns.out +++ b/charon/tests/ui/simple/promoted-closure-no-warns.out @@ -93,20 +93,32 @@ pub fn foo() -> &'static (closure) let @1: &'_ (closure); // anonymous local let @2: &'_ (closure); // anonymous local let @3: &'_ (closure); // anonymous local - let @4: &'_ (closure); // anonymous local - let @5: closure; // anonymous local + let @4: (); // anonymous local + let @5: (); // anonymous local + let @6: (); // anonymous local + let @7: &'_ (closure); // anonymous local + let @8: closure; // anonymous local + let @9: (); // anonymous local storage_live(@3) - storage_live(@4) - storage_live(@5) - @5 := closure { } - @4 := &@5 + storage_live(@7) + storage_live(@8) + @8 := closure { } + storage_live(@9) + @9 := () + @7 := &(@8, move (@9)) storage_live(@1) storage_live(@2) - @3 := move (@4) - @2 := &*(@3) - @1 := &*(@2) - @0 := &*(@1) + @3 := move (@7) + storage_live(@6) + @6 := () + @2 := &(*(@3), move (@6)) + storage_live(@5) + @5 := () + @1 := &(*(@2), move (@5)) + storage_live(@4) + @4 := () + @0 := &(*(@1), move (@4)) storage_dead(@2) storage_dead(@1) return @@ -133,9 +145,12 @@ fn {impl FnMut<(u32)> for closure}::call_mut<'_0>(@1: &'_0 mut (closure), @2: (u let state@1: &'_0 mut (closure); // arg #1 let args@2: (u32); // arg #2 let @3: &'_ (closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<(u32)> for closure}::call<'_>(move (@3), move (args@2)) return } @@ -147,9 +162,12 @@ fn {impl FnOnce<(u32)> for closure}::call_once(@1: closure, @2: (u32)) -> u32 let @1: closure; // arg #1 let @2: (u32); // arg #2 let @3: &'_ mut (closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(u32)> for closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return diff --git a/charon/tests/ui/simple/promoted-closure.out b/charon/tests/ui/simple/promoted-closure.out index c521d40b7..1c6f8e285 100644 --- a/charon/tests/ui/simple/promoted-closure.out +++ b/charon/tests/ui/simple/promoted-closure.out @@ -93,20 +93,32 @@ pub fn foo() -> &'static (closure) let @1: &'_ (closure); // anonymous local let @2: &'_ (closure); // anonymous local let @3: &'_ (closure); // anonymous local - let @4: &'_ (closure); // anonymous local - let @5: closure; // anonymous local + let @4: (); // anonymous local + let @5: (); // anonymous local + let @6: (); // anonymous local + let @7: &'_ (closure); // anonymous local + let @8: closure; // anonymous local + let @9: (); // anonymous local storage_live(@3) - storage_live(@4) - storage_live(@5) - @5 := closure { } - @4 := &@5 + storage_live(@7) + storage_live(@8) + @8 := closure { } + storage_live(@9) + @9 := () + @7 := &(@8, move (@9)) storage_live(@1) storage_live(@2) - @3 := move (@4) - @2 := &*(@3) - @1 := &*(@2) - @0 := &*(@1) + @3 := move (@7) + storage_live(@6) + @6 := () + @2 := &(*(@3), move (@6)) + storage_live(@5) + @5 := () + @1 := &(*(@2), move (@5)) + storage_live(@4) + @4 := () + @0 := &(*(@1), move (@4)) storage_dead(@2) storage_dead(@1) return @@ -133,9 +145,12 @@ fn {impl FnMut<(u32)> for closure}::call_mut<'_0>(@1: &'_0 mut (closure), @2: (u let state@1: &'_0 mut (closure); // arg #1 let args@2: (u32); // arg #2 let @3: &'_ (closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &*(state@1) + storage_live(@4) + @4 := () + @3 := &(*(state@1), move (@4)) @0 := {impl Fn<(u32)> for closure}::call<'_>(move (@3), move (args@2)) return } @@ -147,9 +162,12 @@ fn {impl FnOnce<(u32)> for closure}::call_once(@1: closure, @2: (u32)) -> u32 let @1: closure; // arg #1 let @2: (u32); // arg #2 let @3: &'_ mut (closure); // anonymous local + let @4: (); // anonymous local storage_live(@3) - @3 := &mut @1 + storage_live(@4) + @4 := () + @3 := &mut (@1, move (@4)) @0 := {impl FnMut<(u32)> for closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return diff --git a/charon/tests/ui/simple/promoted-in-generic-fn.out b/charon/tests/ui/simple/promoted-in-generic-fn.out index d10289d36..7bb000d14 100644 --- a/charon/tests/ui/simple/promoted-in-generic-fn.out +++ b/charon/tests/ui/simple/promoted-in-generic-fn.out @@ -26,18 +26,24 @@ where let @0: (); // return let @1: &'_ (usize); // anonymous local let @2: &'_ (usize); // anonymous local - let @3: &'_ (usize); // anonymous local - let @4: usize; // anonymous local + let @3: (); // anonymous local + let @4: &'_ (usize); // anonymous local + let @5: usize; // anonymous local + let @6: (); // anonymous local storage_live(@2) - storage_live(@3) storage_live(@4) + storage_live(@5) // This can't be evaluated generically. - @4 := size_of[@TraitClause0]() - @3 := &@4 + @5 := size_of[@TraitClause0]() + storage_live(@6) + @6 := () + @4 := &(@5, move (@6)) storage_live(@1) - @2 := move (@3) - @1 := &*(@2) + @2 := move (@4) + storage_live(@3) + @3 := () + @1 := &(*(@2), move (@3)) storage_dead(@1) @0 := () @0 := () diff --git a/charon/tests/ui/simple/promoted-inside-impl.out b/charon/tests/ui/simple/promoted-inside-impl.out index f1bfab04c..464377ab5 100644 --- a/charon/tests/ui/simple/promoted-inside-impl.out +++ b/charon/tests/ui/simple/promoted-inside-impl.out @@ -29,17 +29,23 @@ where let @0: (); // return let _promoted@1: &'_ (i32); // local let @2: &'_ (i32); // anonymous local - let @3: &'_ (i32); // anonymous local - let @4: i32; // anonymous local + let @3: (); // anonymous local + let @4: &'_ (i32); // anonymous local + let @5: i32; // anonymous local + let @6: (); // anonymous local storage_live(@2) - storage_live(@3) storage_live(@4) - @4 := const (0 : i32) - @3 := &@4 + storage_live(@5) + @5 := const (0 : i32) + storage_live(@6) + @6 := () + @4 := &(@5, move (@6)) storage_live(_promoted@1) - @2 := move (@3) - _promoted@1 := &*(@2) + @2 := move (@4) + storage_live(@3) + @3 := () + _promoted@1 := &(*(@2), move (@3)) @0 := () storage_dead(_promoted@1) @0 := () diff --git a/charon/tests/ui/simple/promoted-literal-addition-overflow.out b/charon/tests/ui/simple/promoted-literal-addition-overflow.out index f7313d489..da9c68774 100644 --- a/charon/tests/ui/simple/promoted-literal-addition-overflow.out +++ b/charon/tests/ui/simple/promoted-literal-addition-overflow.out @@ -13,23 +13,32 @@ fn overflow() -> &'static (u32) let @1: &'_ (u32); // anonymous local let @2: u32; // anonymous local let @3: &'_ (u32); // anonymous local - let @4: &'_ (u32); // anonymous local - let @5: u32; // anonymous local - let @6: u32; // anonymous local + let @4: (); // anonymous local + let @5: (); // anonymous local + let @6: &'_ (u32); // anonymous local + let @7: u32; // anonymous local + let @8: u32; // anonymous local + let @9: (); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@4) - storage_live(@5) storage_live(@6) + storage_live(@7) + storage_live(@8) storage_live(@1) @2 := copy (MAX) panic.+ const (1 : u32) - @6 := copy (MAX) wrap.+ const (1 : u32) - @5 := move (@6) - @4 := &@5 - @3 := move (@4) - @1 := &*(@3) - @0 := &*(@1) + @8 := copy (MAX) wrap.+ const (1 : u32) + @7 := move (@8) + storage_live(@9) + @9 := () + @6 := &(@7, move (@9)) + @3 := move (@6) + storage_live(@5) + @5 := () + @1 := &(*(@3), move (@5)) + storage_live(@4) + @4 := () + @0 := &(*(@1), move (@4)) storage_dead(@1) return } diff --git a/charon/tests/ui/simple/promoted-literal-addition.out b/charon/tests/ui/simple/promoted-literal-addition.out index 153576de5..3acb630a5 100644 --- a/charon/tests/ui/simple/promoted-literal-addition.out +++ b/charon/tests/ui/simple/promoted-literal-addition.out @@ -7,23 +7,32 @@ fn two() -> &'static (u32) let @1: &'_ (u32); // anonymous local let @2: u32; // anonymous local let @3: &'_ (u32); // anonymous local - let @4: &'_ (u32); // anonymous local - let @5: u32; // anonymous local - let @6: u32; // anonymous local + let @4: (); // anonymous local + let @5: (); // anonymous local + let @6: &'_ (u32); // anonymous local + let @7: u32; // anonymous local + let @8: u32; // anonymous local + let @9: (); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@4) - storage_live(@5) storage_live(@6) + storage_live(@7) + storage_live(@8) storage_live(@1) @2 := const (1 : u32) panic.+ const (1 : u32) - @6 := const (1 : u32) wrap.+ const (1 : u32) - @5 := move (@6) - @4 := &@5 - @3 := move (@4) - @1 := &*(@3) - @0 := &*(@1) + @8 := const (1 : u32) wrap.+ const (1 : u32) + @7 := move (@8) + storage_live(@9) + @9 := () + @6 := &(@7, move (@9)) + @3 := move (@6) + storage_live(@5) + @5 := () + @1 := &(*(@3), move (@5)) + storage_live(@4) + @4 := () + @0 := &(*(@1), move (@4)) storage_dead(@1) return } diff --git a/charon/tests/ui/simple/promoted-u32-slice.out b/charon/tests/ui/simple/promoted-u32-slice.out index c0e60166d..e2b967342 100644 --- a/charon/tests/ui/simple/promoted-u32-slice.out +++ b/charon/tests/ui/simple/promoted-u32-slice.out @@ -7,19 +7,28 @@ pub fn foo() -> &'static (Slice) let @1: &'_ (Array); // anonymous local let @2: &'_ (Array); // anonymous local let @3: &'_ (Array); // anonymous local - let @4: &'_ (Array); // anonymous local - let @5: Array; // anonymous local + let @4: (); // anonymous local + let @5: (); // anonymous local + let @6: &'_ (Array); // anonymous local + let @7: Array; // anonymous local + let @8: (); // anonymous local storage_live(@3) - storage_live(@4) - storage_live(@5) - @5 := [const (0 : u32), const (1 : u32), const (2 : u32), const (3 : u32)] - @4 := &@5 + storage_live(@6) + storage_live(@7) + @7 := [const (0 : u32), const (1 : u32), const (2 : u32), const (3 : u32)] + storage_live(@8) + @8 := () + @6 := &(@7, move (@8)) storage_live(@1) storage_live(@2) - @3 := move (@4) - @2 := &*(@3) - @1 := &*(@2) + @3 := move (@6) + storage_live(@5) + @5 := () + @2 := &(*(@3), move (@5)) + storage_live(@4) + @4 := () + @1 := &(*(@2), move (@4)) @0 := @ArrayToSliceShared<'_, u32, 4 : usize>(move (@1)) storage_dead(@1) storage_dead(@2) diff --git a/charon/tests/ui/simple/ptr-from-raw-parts.out b/charon/tests/ui/simple/ptr-from-raw-parts.out index a9a86403b..a1d9a9abc 100644 --- a/charon/tests/ui/simple/ptr-from-raw-parts.out +++ b/charon/tests/ui/simple/ptr-from-raw-parts.out @@ -265,12 +265,15 @@ fn main() let a@1: Array; // local let @2: *const Slice; // anonymous local let @3: *const Array; // anonymous local + let @4: (); // anonymous local storage_live(a@1) a@1 := @ArrayRepeat<'_, u32, 2 : usize>(const (1 : u32)) storage_live(@2) storage_live(@3) - @3 := &raw const a@1 + storage_live(@4) + @4 := () + @3 := &raw const (a@1, move (@4)) @2 := from_raw_parts, Array>[Sized>, {impl#0}>[Pointee> where Metadata = ()]](move (@3), const (2 : usize)) storage_dead(@3) storage_dead(@2) diff --git a/charon/tests/ui/simple/ptr_to_promoted.out b/charon/tests/ui/simple/ptr_to_promoted.out index fe84032d5..d251aaf72 100644 --- a/charon/tests/ui/simple/ptr_to_promoted.out +++ b/charon/tests/ui/simple/ptr_to_promoted.out @@ -9,19 +9,28 @@ fn main() let @3: usize; // anonymous local let @4: *const u8; // anonymous local let @5: &'_ (u8); // anonymous local - let @6: &'_ (u8); // anonymous local - let @7: u8; // anonymous local + let @6: (); // anonymous local + let @7: (); // anonymous local + let @8: &'_ (u8); // anonymous local + let @9: u8; // anonymous local + let @10: (); // anonymous local storage_live(@5) - storage_live(@6) - storage_live(@7) - @7 := const (0 : u8) - @6 := &@7 + storage_live(@8) + storage_live(@9) + @9 := const (0 : u8) + storage_live(@10) + @10 := () + @8 := &(@9, move (@10)) storage_live(x@1) storage_live(@2) - @5 := move (@6) - @2 := &*(@5) - x@1 := &raw const *(@2) + @5 := move (@8) + storage_live(@7) + @7 := () + @2 := &(*(@5), move (@7)) + storage_live(@6) + @6 := () + x@1 := &raw const (*(@2), move (@6)) storage_dead(@2) storage_live(@3) storage_live(@4) diff --git a/charon/tests/ui/simple/ref-in-const.out b/charon/tests/ui/simple/ref-in-const.out index 654e7c665..3c2475278 100644 --- a/charon/tests/ui/simple/ref-in-const.out +++ b/charon/tests/ui/simple/ref-in-const.out @@ -6,21 +6,33 @@ fn SOME_INT() -> &'static (&'static (i32)) let @0: &'_ (&'_ (i32)); // return let @1: &'_ (&'_ (i32)); // anonymous local let @2: &'_ (&'_ (i32)); // anonymous local - let @3: &'_ (&'_ (i32)); // anonymous local - let @4: &'_ (i32); // anonymous local - let @5: i32; // anonymous local + let @3: (); // anonymous local + let @4: (); // anonymous local + let @5: &'_ (&'_ (i32)); // anonymous local + let @6: &'_ (i32); // anonymous local + let @7: i32; // anonymous local + let @8: (); // anonymous local + let @9: (); // anonymous local storage_live(@2) - storage_live(@3) - storage_live(@4) storage_live(@5) - @5 := const (0 : i32) - @4 := &@5 - @3 := &@4 + storage_live(@6) + storage_live(@7) + @7 := const (0 : i32) + storage_live(@9) + @9 := () + @6 := &(@7, move (@9)) + storage_live(@8) + @8 := () + @5 := &(@6, move (@8)) storage_live(@1) - @2 := move (@3) - @1 := &*(@2) - @0 := &*(@1) + @2 := move (@5) + storage_live(@4) + @4 := () + @1 := &(*(@2), move (@4)) + storage_live(@3) + @3 := () + @0 := &(*(@1), move (@3)) storage_dead(@1) return } diff --git a/charon/tests/ui/simple/slice_increment.out b/charon/tests/ui/simple/slice_increment.out index 5fdc45ba7..4b168ef25 100644 --- a/charon/tests/ui/simple/slice_increment.out +++ b/charon/tests/ui/simple/slice_increment.out @@ -7,24 +7,33 @@ pub fn incr<'_0>(@1: &'_0 mut (Slice)) let s@1: &'_ mut (Slice); // arg #1 let @2: usize; // anonymous local let @3: u32; // anonymous local - let @4: &'_ mut (Slice); // anonymous local - let @5: &'_ mut (u32); // anonymous local - let @6: &'_ (Slice); // anonymous local - let @7: &'_ (u32); // anonymous local + let @4: usize; // anonymous local + let @5: usize; // anonymous local + let @6: &'_ mut (Slice); // anonymous local + let @7: &'_ mut (u32); // anonymous local + let @8: usize; // anonymous local + let @9: &'_ (Slice); // anonymous local + let @10: &'_ (u32); // anonymous local storage_live(@3) storage_live(@2) @2 := const (0 : usize) - storage_live(@6) - @6 := &*(s@1) - storage_live(@7) - @7 := @SliceIndexShared<'_, u32>(move (@6), copy (@2)) - @3 := copy (*(@7)) panic.+ const (1 : u32) storage_live(@4) - @4 := &mut *(s@1) + @4 := ptr_metadata(copy (s@1)) + storage_live(@8) + @8 := ptr_metadata(copy (s@1)) + storage_live(@9) + @9 := &(*(s@1), move (@8)) + storage_live(@10) + @10 := @SliceIndexShared<'_, u32>(move (@9), copy (@2)) + @3 := copy (*(@10)) panic.+ const (1 : u32) storage_live(@5) - @5 := @SliceIndexMut<'_, u32>(move (@4), copy (@2)) - *(@5) := move (@3) + @5 := ptr_metadata(copy (s@1)) + storage_live(@6) + @6 := &mut (*(s@1), move (@5)) + storage_live(@7) + @7 := @SliceIndexMut<'_, u32>(move (@6), copy (@2)) + *(@7) := move (@3) storage_dead(@2) @0 := () @0 := () diff --git a/charon/tests/ui/simple/slice_index.out b/charon/tests/ui/simple/slice_index.out index 0f5bfbb3c..b512f3807 100644 --- a/charon/tests/ui/simple/slice_index.out +++ b/charon/tests/ui/simple/slice_index.out @@ -6,16 +6,19 @@ pub fn first<'_0>(@1: &'_0 (Slice)) -> u32 let @0: u32; // return let s@1: &'_ (Slice); // arg #1 let @2: usize; // anonymous local - let @3: &'_ (Slice); // anonymous local - let @4: &'_ (u32); // anonymous local + let @3: usize; // anonymous local + let @4: &'_ (Slice); // anonymous local + let @5: &'_ (u32); // anonymous local storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &*(s@1) + @3 := ptr_metadata(copy (s@1)) storage_live(@4) - @4 := @SliceIndexShared<'_, u32>(move (@3), copy (@2)) - @0 := copy (*(@4)) + @4 := &(*(s@1), move (@3)) + storage_live(@5) + @5 := @SliceIndexShared<'_, u32>(move (@4), copy (@2)) + @0 := copy (*(@5)) storage_dead(@2) return } diff --git a/charon/tests/ui/simple/slice_index_range.out b/charon/tests/ui/simple/slice_index_range.out index 572a44534..2b4e8132d 100644 --- a/charon/tests/ui/simple/slice_index_range.out +++ b/charon/tests/ui/simple/slice_index_range.out @@ -95,19 +95,22 @@ pub fn new_const<'a, const N : usize>(@1: &'a (Array<&'static (Str), const N : u let @3: &'_ (Slice>); // anonymous local let @4: &'_ (Array, 0 : usize>); // anonymous local let @5: Array, 0 : usize>; // anonymous local - let @6: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @6: (); // anonymous local + let @7: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@4) storage_live(@5) - storage_live(@6) + storage_live(@7) @5 := [] - @4 := &@5 + storage_live(@6) + @6 := () + @4 := &(@5, move (@6)) storage_live(@2) @2 := @ArrayToSliceShared<'_, &'_ (Str), const N : usize>(copy (pieces@1)) storage_live(@3) @3 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@4)) - @6 := Option::None { } - @0 := Arguments { pieces: move (@2), fmt: move (@6), args: move (@3) } + @7 := Option::None { } + @0 := Arguments { pieces: move (@2), fmt: move (@7), args: move (@3) } storage_dead(@3) storage_dead(@2) return @@ -328,20 +331,29 @@ fn slice_end_index_overflow_fail() -> ! let @2: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @3: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @4: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local - let @5: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local - let @6: Array<&'_ (Str), 1 : usize>; // anonymous local + let @5: (); // anonymous local + let @6: (); // anonymous local + let @7: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local + let @8: Array<&'_ (Str), 1 : usize>; // anonymous local + let @9: (); // anonymous local storage_live(@4) - storage_live(@5) - storage_live(@6) - @6 := [const ("attempted to index slice up to maximum usize")] - @5 := &@6 + storage_live(@7) + storage_live(@8) + @8 := [const ("attempted to index slice up to maximum usize")] + storage_live(@9) + @9 := () + @7 := &(@8, move (@9)) storage_live(@1) storage_live(@2) storage_live(@3) - @4 := move (@5) - @3 := &*(@4) - @2 := &*(@3) + @4 := move (@7) + storage_live(@6) + @6 := () + @3 := &(*(@4), move (@6)) + storage_live(@5) + @5 := () + @2 := &(*(@3), move (@5)) @1 := new_const<'_, 1 : usize>(move (@2)) storage_dead(@2) panic(core::panicking::panic_fmt) @@ -400,7 +412,9 @@ where let @13: usize; // anonymous local let @14: *const T; // anonymous local let @15: *const T; // anonymous local - let @16: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @16: usize; // anonymous local + let @17: usize; // anonymous local + let @18: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(self@4) storage_live(rhs@5) @@ -413,6 +427,8 @@ where storage_live(@14) storage_live(@15) storage_live(@16) + storage_live(@17) + storage_live(@18) storage_live(@3) self@4 := copy ((self@1).end) rhs@5 := copy ((self@1).start) @@ -421,8 +437,8 @@ where if move (@12) { storage_dead(@12) storage_dead(@3) - @16 := Option::None { } - @0 := move (@16) + @18 := Option::None { } + @0 := move (@18) } else { storage_live(@13) @@ -439,7 +455,9 @@ where storage_dead(@8) storage_live(@10) storage_live(@11) - @11 := &raw const *(slice@2) + storage_live(@17) + @17 := ptr_metadata(copy (slice@2)) + @11 := &raw const (*(slice@2), move (@17)) storage_live(@14) storage_live(@15) @14 := cast<*const Slice, *const T>(copy (@11)) @@ -448,7 +466,9 @@ where storage_dead(@15) storage_dead(@14) storage_dead(@11) - @9 := &*(@10) + storage_live(@16) + @16 := ptr_metadata(copy (@10)) + @9 := &(*(@10), move (@16)) @0 := Option::Some { 0: copy (@9) } storage_dead(@10) storage_dead(@3) @@ -456,8 +476,8 @@ where else { storage_dead(@8) storage_dead(@3) - @16 := Option::None { } - @0 := move (@16) + @18 := Option::None { } + @0 := move (@18) } } storage_dead(@7) @@ -485,7 +505,9 @@ where let @13: usize; // anonymous local let @14: *mut T; // anonymous local let @15: *mut T; // anonymous local - let @16: Option<&'_ mut (Slice)>[Sized<&'_ mut (Slice)>]; // anonymous local + let @16: usize; // anonymous local + let @17: usize; // anonymous local + let @18: Option<&'_ mut (Slice)>[Sized<&'_ mut (Slice)>]; // anonymous local storage_live(self@4) storage_live(rhs@5) @@ -498,6 +520,8 @@ where storage_live(@14) storage_live(@15) storage_live(@16) + storage_live(@17) + storage_live(@18) storage_live(@3) self@4 := copy ((self@1).end) rhs@5 := copy ((self@1).start) @@ -506,8 +530,8 @@ where if move (@12) { storage_dead(@12) storage_dead(@3) - @16 := Option::None { } - @0 := move (@16) + @18 := Option::None { } + @0 := move (@18) } else { storage_live(@13) @@ -524,7 +548,9 @@ where storage_dead(@8) storage_live(@10) storage_live(ptr@11) - ptr@11 := &raw mut *(slice@2) + storage_live(@17) + @17 := ptr_metadata(copy (slice@2)) + ptr@11 := &raw mut (*(slice@2), move (@17)) storage_live(@14) storage_live(@15) @14 := cast<*mut Slice, *mut T>(copy (ptr@11)) @@ -533,7 +559,9 @@ where storage_dead(@15) storage_dead(@14) storage_dead(ptr@11) - @9 := &mut *(@10) + storage_live(@16) + @16 := ptr_metadata(copy (@10)) + @9 := &mut (*(@10), move (@16)) @0 := Option::Some { 0: copy (@9) } storage_dead(@10) storage_dead(@3) @@ -541,8 +569,8 @@ where else { storage_dead(@8) storage_dead(@3) - @16 := Option::None { } - @0 := move (@16) + @18 := Option::None { } + @0 := move (@18) } } storage_dead(@7) @@ -564,16 +592,18 @@ fn {impl SliceIndex> for Range[Sized]}::get_unchecked::pr let @9: Array<&'_ (Str), 1 : usize>; // anonymous local let @10: &'_ (Slice<&'_ (Str)>); // anonymous local let @11: &'_ (Slice>); // anonymous local - let @12: &'_ (Array, 0 : usize>); // anonymous local - let @13: Array, 0 : usize>; // anonymous local - let @14: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @12: (); // anonymous local + let @13: &'_ (Array, 0 : usize>); // anonymous local + let @14: Array, 0 : usize>; // anonymous local + let @15: (); // anonymous local + let @16: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@5) storage_live(@6) storage_live(pieces@8) - storage_live(@12) storage_live(@13) storage_live(@14) + storage_live(@16) storage_live(@4) @4 := copy (end@2) >= copy (start@1) if move (@4) { @@ -590,18 +620,22 @@ fn {impl SliceIndex> for Range[Sized]}::get_unchecked::pr } else { } - @13 := [] - @12 := &@13 + @14 := [] + storage_live(@15) + @15 := () + @13 := &(@14, move (@15)) storage_live(@7) storage_live(@9) @9 := [const ("unsafe precondition(s) violated: slice::get_unchecked requires that the range is within the slice\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@8 := &@9 + storage_live(@12) + @12 := () + pieces@8 := &(@9, move (@12)) storage_live(@10) @10 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@8)) storage_live(@11) - @11 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@12)) - @14 := Option::None { } - @7 := Arguments { pieces: move (@10), fmt: move (@14), args: move (@11) } + @11 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@13)) + @16 := Option::None { } + @7 := Arguments { pieces: move (@10), fmt: move (@16), args: move (@11) } storage_dead(@11) storage_dead(@10) @6 := panic_nounwind_fmt<'_>(move (@7), const (false)) @@ -679,16 +713,18 @@ fn {impl SliceIndex> for Range[Sized]}::get_unchecked_mut let @9: Array<&'_ (Str), 1 : usize>; // anonymous local let @10: &'_ (Slice<&'_ (Str)>); // anonymous local let @11: &'_ (Slice>); // anonymous local - let @12: &'_ (Array, 0 : usize>); // anonymous local - let @13: Array, 0 : usize>; // anonymous local - let @14: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @12: (); // anonymous local + let @13: &'_ (Array, 0 : usize>); // anonymous local + let @14: Array, 0 : usize>; // anonymous local + let @15: (); // anonymous local + let @16: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@5) storage_live(@6) storage_live(pieces@8) - storage_live(@12) storage_live(@13) storage_live(@14) + storage_live(@16) storage_live(@4) @4 := copy (end@2) >= copy (start@1) if move (@4) { @@ -705,18 +741,22 @@ fn {impl SliceIndex> for Range[Sized]}::get_unchecked_mut } else { } - @13 := [] - @12 := &@13 + @14 := [] + storage_live(@15) + @15 := () + @13 := &(@14, move (@15)) storage_live(@7) storage_live(@9) @9 := [const ("unsafe precondition(s) violated: slice::get_unchecked_mut requires that the range is within the slice\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@8 := &@9 + storage_live(@12) + @12 := () + pieces@8 := &(@9, move (@12)) storage_live(@10) @10 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@8)) storage_live(@11) - @11 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@12)) - @14 := Option::None { } - @7 := Arguments { pieces: move (@10), fmt: move (@14), args: move (@11) } + @11 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@13)) + @16 := Option::None { } + @7 := Arguments { pieces: move (@10), fmt: move (@16), args: move (@11) } storage_dead(@11) storage_dead(@10) @6 := panic_nounwind_fmt<'_>(move (@7), const (false)) @@ -801,6 +841,8 @@ where let @14: usize; // anonymous local let @15: *const T; // anonymous local let @16: *const T; // anonymous local + let @17: usize; // anonymous local + let @18: usize; // anonymous local storage_live(@3) storage_live(new_len@4) @@ -814,6 +856,8 @@ where storage_live(@14) storage_live(@15) storage_live(@16) + storage_live(@17) + storage_live(@18) storage_live(@5) self@6 := copy ((self@1).end) rhs@7 := copy ((self@1).start) @@ -838,7 +882,9 @@ where storage_dead(@8) storage_live(@11) storage_live(@12) - @12 := &raw const *(slice@2) + storage_live(@18) + @18 := ptr_metadata(copy (slice@2)) + @12 := &raw const (*(slice@2), move (@18)) storage_live(@15) storage_live(@16) @15 := cast<*const Slice, *const T>(copy (@12)) @@ -847,7 +893,9 @@ where storage_dead(@16) storage_dead(@15) storage_dead(@12) - @0 := &*(@11) + storage_live(@17) + @17 := ptr_metadata(copy (@11)) + @0 := &(*(@11), move (@17)) storage_dead(@11) return } @@ -880,6 +928,8 @@ where let @14: usize; // anonymous local let @15: *mut T; // anonymous local let @16: *mut T; // anonymous local + let @17: usize; // anonymous local + let @18: usize; // anonymous local storage_live(@3) storage_live(new_len@4) @@ -893,6 +943,8 @@ where storage_live(@14) storage_live(@15) storage_live(@16) + storage_live(@17) + storage_live(@18) storage_live(@5) self@6 := copy ((self@1).end) rhs@7 := copy ((self@1).start) @@ -917,7 +969,9 @@ where storage_dead(@8) storage_live(@11) storage_live(ptr@12) - ptr@12 := &raw mut *(slice@2) + storage_live(@18) + @18 := ptr_metadata(copy (slice@2)) + ptr@12 := &raw mut (*(slice@2), move (@18)) storage_live(@15) storage_live(@16) @15 := cast<*mut Slice, *mut T>(copy (ptr@12)) @@ -926,7 +980,9 @@ where storage_dead(@16) storage_dead(@15) storage_dead(ptr@12) - @0 := &mut *(@11) + storage_live(@17) + @17 := ptr_metadata(copy (@11)) + @0 := &mut (*(@11), move (@17)) storage_dead(@11) return } @@ -981,8 +1037,11 @@ where let @17: *const T; // anonymous local let self@18: usize; // local let self@19: bool; // local - let @20: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local - let @21: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @20: (); // anonymous local + let @21: usize; // anonymous local + let @22: usize; // anonymous local + let @23: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @24: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(self@4) storage_live(exclusive_end@6) @@ -999,17 +1058,21 @@ where storage_live(@17) storage_live(self@18) storage_live(self@19) - storage_live(@20) storage_live(@21) + storage_live(@22) + storage_live(@23) + storage_live(@24) storage_live(@3) storage_live(self@5) - self@5 := &self@1 + storage_live(@20) + @20 := () + self@5 := &(self@1, move (@20)) storage_dead(self@5) self@4 := copy ((self@1).end) @3 := copy (self@4) == copy (MAX) if move (@3) { - @20 := Option::None { } - @0 := move (@20) + @23 := Option::None { } + @0 := move (@23) } else { storage_live(self@18) @@ -1031,8 +1094,8 @@ where @14 := copy (exclusive_end@6) < copy (self@8) if move (@14) { storage_dead(@14) - @21 := Option::None { } - @0 := move (@21) + @24 := Option::None { } + @0 := move (@24) storage_dead(@9) storage_dead(@11) } @@ -1047,7 +1110,9 @@ where storage_dead(@10) storage_live(@12) storage_live(@13) - @13 := &raw const *(slice@2) + storage_live(@22) + @22 := ptr_metadata(copy (slice@2)) + @13 := &raw const (*(slice@2), move (@22)) storage_live(@16) storage_live(@17) @16 := cast<*const Slice, *const T>(copy (@13)) @@ -1056,14 +1121,16 @@ where storage_dead(@17) storage_dead(@16) storage_dead(@13) - @11 := &*(@12) + storage_live(@21) + @21 := ptr_metadata(copy (@12)) + @11 := &(*(@12), move (@21)) @0 := Option::Some { 0: copy (@11) } storage_dead(@12) } else { storage_dead(@10) - @21 := Option::None { } - @0 := move (@21) + @24 := Option::None { } + @0 := move (@24) } storage_dead(@9) storage_dead(@11) @@ -1098,8 +1165,11 @@ where let @17: *mut T; // anonymous local let self@18: usize; // local let self@19: bool; // local - let @20: Option<&'_ mut (Slice)>[Sized<&'_ mut (Slice)>]; // anonymous local - let @21: Option<&'_ mut (Slice)>[Sized<&'_ mut (Slice)>]; // anonymous local + let @20: (); // anonymous local + let @21: usize; // anonymous local + let @22: usize; // anonymous local + let @23: Option<&'_ mut (Slice)>[Sized<&'_ mut (Slice)>]; // anonymous local + let @24: Option<&'_ mut (Slice)>[Sized<&'_ mut (Slice)>]; // anonymous local storage_live(self@4) storage_live(exclusive_end@6) @@ -1116,17 +1186,21 @@ where storage_live(@17) storage_live(self@18) storage_live(self@19) - storage_live(@20) storage_live(@21) + storage_live(@22) + storage_live(@23) + storage_live(@24) storage_live(@3) storage_live(self@5) - self@5 := &self@1 + storage_live(@20) + @20 := () + self@5 := &(self@1, move (@20)) storage_dead(self@5) self@4 := copy ((self@1).end) @3 := copy (self@4) == copy (MAX) if move (@3) { - @20 := Option::None { } - @0 := move (@20) + @23 := Option::None { } + @0 := move (@23) } else { storage_live(self@18) @@ -1148,8 +1222,8 @@ where @14 := copy (exclusive_end@6) < copy (self@8) if move (@14) { storage_dead(@14) - @21 := Option::None { } - @0 := move (@21) + @24 := Option::None { } + @0 := move (@24) storage_dead(@9) storage_dead(@11) } @@ -1164,7 +1238,9 @@ where storage_dead(@10) storage_live(@12) storage_live(ptr@13) - ptr@13 := &raw mut *(slice@2) + storage_live(@22) + @22 := ptr_metadata(copy (slice@2)) + ptr@13 := &raw mut (*(slice@2), move (@22)) storage_live(@16) storage_live(@17) @16 := cast<*mut Slice, *mut T>(copy (ptr@13)) @@ -1173,14 +1249,16 @@ where storage_dead(@17) storage_dead(@16) storage_dead(ptr@13) - @11 := &mut *(@12) + storage_live(@21) + @21 := ptr_metadata(copy (@12)) + @11 := &mut (*(@12), move (@21)) @0 := Option::Some { 0: copy (@11) } storage_dead(@12) } else { storage_dead(@10) - @21 := Option::None { } - @0 := move (@21) + @24 := Option::None { } + @0 := move (@24) } storage_dead(@9) storage_dead(@11) @@ -1340,6 +1418,7 @@ where let @10: usize; // anonymous local let self@11: usize; // local let self@12: bool; // local + let @13: (); // anonymous local storage_live(self@4) storage_live(@6) @@ -1351,7 +1430,9 @@ where storage_live(self@12) storage_live(@3) storage_live(self@5) - self@5 := &self@1 + storage_live(@13) + @13 := () + self@5 := &(self@1, move (@13)) storage_dead(self@5) self@4 := copy ((self@1).end) @3 := copy (self@4) == copy (MAX) @@ -1404,6 +1485,7 @@ where let @10: usize; // anonymous local let self@11: usize; // local let self@12: bool; // local + let @13: (); // anonymous local storage_live(self@4) storage_live(@6) @@ -1415,7 +1497,9 @@ where storage_live(self@12) storage_live(@3) storage_live(self@5) - self@5 := &self@1 + storage_live(@13) + @13 := () + self@5 := &(self@1, move (@13)) storage_dead(self@5) self@4 := copy ((self@1).end) @3 := copy (self@4) == copy (MAX) @@ -1478,18 +1562,27 @@ pub fn slice_index_range<'_0>(@1: &'_0 (Slice)) -> &'_0 (Slice) let @3: &'_ (Slice); // anonymous local let @4: &'_ (Slice); // anonymous local let @5: RangeInclusive[Sized]; // anonymous local + let @6: usize; // anonymous local + let @7: usize; // anonymous local + let @8: usize; // anonymous local storage_live(@2) storage_live(@3) storage_live(@4) - @4 := &*(slice@1) + storage_live(@6) + @6 := ptr_metadata(copy (slice@1)) + @4 := &(*(slice@1), move (@6)) storage_live(@5) @5 := new[Sized](const (0 : usize), const (10 : usize)) @3 := {impl Index for Slice}::index<'_, u8, RangeInclusive[Sized]>[Sized, Sized[Sized]>, {impl SliceIndex> for RangeInclusive[Sized]}[Sized]](move (@4), move (@5)) storage_dead(@5) storage_dead(@4) - @2 := &*(@3) - @0 := &*(@2) + storage_live(@8) + @8 := ptr_metadata(copy (@3)) + @2 := &(*(@3), move (@8)) + storage_live(@7) + @7 := ptr_metadata(copy (@2)) + @0 := &(*(@2), move (@7)) storage_dead(@3) storage_dead(@2) return diff --git a/charon/tests/ui/simple/trait-alias.out b/charon/tests/ui/simple/trait-alias.out index 3df1ecc94..40c5cbd3b 100644 --- a/charon/tests/ui/simple/trait-alias.out +++ b/charon/tests/ui/simple/trait-alias.out @@ -133,10 +133,13 @@ where let x@1: T; // arg #1 let @2: T; // anonymous local let @3: &'_ (T); // anonymous local + let @4: (); // anonymous local storage_live(@2) storage_live(@3) - @3 := &x@1 + storage_live(@4) + @4 := () + @3 := &(x@1, move (@4)) @2 := @TraitClause1::parent_clause2::clone<'_>(move (@3)) storage_dead(@3) drop[Drop] @2 diff --git a/charon/tests/ui/simple/vec-push.out b/charon/tests/ui/simple/vec-push.out index aa992d92f..d5e51ece8 100644 --- a/charon/tests/ui/simple/vec-push.out +++ b/charon/tests/ui/simple/vec-push.out @@ -91,19 +91,27 @@ where let elem_size@13: usize; // local let self@14: UsizeNoHighBit; // local let @15: NonNull; // anonymous local + let @16: (); // anonymous local + let @17: (); // anonymous local + let @18: (); // anonymous local storage_live(len@3) storage_live(@7) storage_live(@8) storage_live(end@9) storage_live(self@14) + storage_live(@18) len@3 := copy ((*(self@1)).len) storage_live(@4) storage_live(@5) storage_live(self@6) - self@6 := &(*(self@1)).buf + storage_live(@17) + @17 := () + self@6 := &((*(self@1)).buf, move (@17)) storage_live(self@12) - self@12 := &((*(self@1)).buf).0 + storage_live(@16) + @16 := () + self@12 := &(((*(self@1)).buf).0, move (@16)) storage_live(elem_size@13) elem_size@13 := size_of switch move (elem_size@13) { @@ -124,7 +132,9 @@ where if move (@4) { storage_dead(@5) storage_live(@8) - @8 := &two-phase-mut (*(self@1)).buf + storage_live(@18) + @18 := () + @8 := &two-phase-mut ((*(self@1)).buf, move (@18)) @7 := grow_one<'_, T, A>[@TraitClause0, @TraitClause1](move (@8)) storage_dead(@8) } @@ -154,9 +164,12 @@ fn vec<'_0>(@1: &'_0 mut (Vec[Sized, Sized])) let @0: (); // return let x@1: &'_ mut (Vec[Sized, Sized]); // arg #1 let @2: &'_ mut (Vec[Sized, Sized]); // anonymous local + let @3: (); // anonymous local storage_live(@2) - @2 := &two-phase-mut *(x@1) + storage_live(@3) + @3 := () + @2 := &two-phase-mut (*(x@1), move (@3)) @0 := push<'_, u32, Global>[Sized, Sized](move (@2), const (42 : u32)) storage_dead(@2) @0 := () diff --git a/charon/tests/ui/skip-borrowck.out b/charon/tests/ui/skip-borrowck.out index 921ab9d3b..5584b2334 100644 --- a/charon/tests/ui/skip-borrowck.out +++ b/charon/tests/ui/skip-borrowck.out @@ -25,24 +25,42 @@ where let @5: &'_ mut (T); // anonymous local let @6: bool; // anonymous local let @7: &'_ mut (T); // anonymous local + let @8: (); // anonymous local + let @9: (); // anonymous local + let @10: (); // anonymous local + let @11: (); // anonymous local + let @12: (); // anonymous local storage_live(@7) + storage_live(@8) + storage_live(@9) + storage_live(@10) storage_live(@4) storage_live(@5) storage_live(@6) @6 := copy (b@1) if move (@6) { storage_live(@7) - @7 := &mut *(x@2) - @5 := &mut *(@7) + storage_live(@9) + @9 := () + @7 := &mut (*(x@2), move (@9)) + storage_live(@8) + @8 := () + @5 := &mut (*(@7), move (@8)) storage_dead(@7) } else { - @5 := &mut *(y@3) + storage_live(@10) + @10 := () + @5 := &mut (*(y@3), move (@10)) } - @4 := &mut *(@5) + storage_live(@12) + @12 := () + @4 := &mut (*(@5), move (@12)) storage_dead(@6) - @0 := &mut *(@4) + storage_live(@11) + @11 := () + @0 := &mut (*(@4), move (@11)) storage_dead(@5) storage_dead(@4) return @@ -72,6 +90,10 @@ pub fn choose_test() let @18: (); // anonymous local let @19: bool; // anonymous local let @20: i32; // anonymous local + let @21: (); // anonymous local + let @22: (); // anonymous local + let @23: (); // anonymous local + let @24: (); // anonymous local storage_live(@8) storage_live(x@1) @@ -81,12 +103,20 @@ pub fn choose_test() storage_live(z@3) storage_live(@4) storage_live(@5) - @5 := &mut x@1 - @4 := &two-phase-mut *(@5) + storage_live(@24) + @24 := () + @5 := &mut (x@1, move (@24)) + storage_live(@23) + @23 := () + @4 := &two-phase-mut (*(@5), move (@23)) storage_live(@6) storage_live(@7) - @7 := &mut y@2 - @6 := &two-phase-mut *(@7) + storage_live(@22) + @22 := () + @7 := &mut (y@2, move (@22)) + storage_live(@21) + @21 := () + @6 := &two-phase-mut (*(@7), move (@21)) z@3 := choose<'_, i32>[Sized](const (true), move (@4), move (@6)) storage_dead(@6) storage_dead(@4) diff --git a/charon/tests/ui/slice-index-range.out b/charon/tests/ui/slice-index-range.out index 1fecedb13..753aa3216 100644 --- a/charon/tests/ui/slice-index-range.out +++ b/charon/tests/ui/slice-index-range.out @@ -260,7 +260,9 @@ where let @13: usize; // anonymous local let @14: *const T; // anonymous local let @15: *const T; // anonymous local - let @16: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @16: usize; // anonymous local + let @17: usize; // anonymous local + let @18: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(self@4) storage_live(rhs@5) @@ -273,6 +275,8 @@ where storage_live(@14) storage_live(@15) storage_live(@16) + storage_live(@17) + storage_live(@18) storage_live(@3) self@4 := copy ((self@1).end) rhs@5 := copy ((self@1).start) @@ -281,8 +285,8 @@ where if move (@12) { storage_dead(@12) storage_dead(@3) - @16 := Option::None { } - @0 := move (@16) + @18 := Option::None { } + @0 := move (@18) } else { storage_live(@13) @@ -299,7 +303,9 @@ where storage_dead(@8) storage_live(@10) storage_live(@11) - @11 := &raw const *(slice@2) + storage_live(@17) + @17 := ptr_metadata(copy (slice@2)) + @11 := &raw const (*(slice@2), move (@17)) storage_live(@14) storage_live(@15) @14 := cast<*const Slice, *const T>(copy (@11)) @@ -308,7 +314,9 @@ where storage_dead(@15) storage_dead(@14) storage_dead(@11) - @9 := &*(@10) + storage_live(@16) + @16 := ptr_metadata(copy (@10)) + @9 := &(*(@10), move (@16)) @0 := Option::Some { 0: copy (@9) } storage_dead(@10) storage_dead(@3) @@ -316,8 +324,8 @@ where else { storage_dead(@8) storage_dead(@3) - @16 := Option::None { } - @0 := move (@16) + @18 := Option::None { } + @0 := move (@18) } } storage_dead(@7) @@ -345,7 +353,9 @@ where let @13: usize; // anonymous local let @14: *mut T; // anonymous local let @15: *mut T; // anonymous local - let @16: Option<&'_ mut (Slice)>[Sized<&'_ mut (Slice)>]; // anonymous local + let @16: usize; // anonymous local + let @17: usize; // anonymous local + let @18: Option<&'_ mut (Slice)>[Sized<&'_ mut (Slice)>]; // anonymous local storage_live(self@4) storage_live(rhs@5) @@ -358,6 +368,8 @@ where storage_live(@14) storage_live(@15) storage_live(@16) + storage_live(@17) + storage_live(@18) storage_live(@3) self@4 := copy ((self@1).end) rhs@5 := copy ((self@1).start) @@ -366,8 +378,8 @@ where if move (@12) { storage_dead(@12) storage_dead(@3) - @16 := Option::None { } - @0 := move (@16) + @18 := Option::None { } + @0 := move (@18) } else { storage_live(@13) @@ -384,7 +396,9 @@ where storage_dead(@8) storage_live(@10) storage_live(ptr@11) - ptr@11 := &raw mut *(slice@2) + storage_live(@17) + @17 := ptr_metadata(copy (slice@2)) + ptr@11 := &raw mut (*(slice@2), move (@17)) storage_live(@14) storage_live(@15) @14 := cast<*mut Slice, *mut T>(copy (ptr@11)) @@ -393,7 +407,9 @@ where storage_dead(@15) storage_dead(@14) storage_dead(ptr@11) - @9 := &mut *(@10) + storage_live(@16) + @16 := ptr_metadata(copy (@10)) + @9 := &mut (*(@10), move (@16)) @0 := Option::Some { 0: copy (@9) } storage_dead(@10) storage_dead(@3) @@ -401,8 +417,8 @@ where else { storage_dead(@8) storage_dead(@3) - @16 := Option::None { } - @0 := move (@16) + @18 := Option::None { } + @0 := move (@18) } } storage_dead(@7) @@ -424,12 +440,13 @@ fn {impl SliceIndex> for Range[Sized]}::get_unchecked::pr let @9: Array<&'_ (Str), 1 : usize>; // anonymous local let @10: &'_ (Slice<&'_ (Str)>); // anonymous local let @11: &'_ (Slice>); // anonymous local - let @12: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @12: (); // anonymous local + let @13: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@5) storage_live(@6) storage_live(pieces@8) - storage_live(@12) + storage_live(@13) storage_live(@4) @4 := copy (end@2) >= copy (start@1) if move (@4) { @@ -449,13 +466,15 @@ fn {impl SliceIndex> for Range[Sized]}::get_unchecked::pr storage_live(@7) storage_live(@9) @9 := [const ("unsafe precondition(s) violated: slice::get_unchecked requires that the range is within the slice\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@8 := &@9 + storage_live(@12) + @12 := () + pieces@8 := &(@9, move (@12)) storage_live(@10) @10 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@8)) storage_live(@11) @11 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(copy ({promoted_const}<'_, 1 : usize>)) - @12 := Option::None { } - @7 := Arguments { 0: move (@10), 1: move (@12), 2: move (@11) } + @13 := Option::None { } + @7 := Arguments { 0: move (@10), 1: move (@13), 2: move (@11) } storage_dead(@11) storage_dead(@10) @6 := panic_nounwind_fmt<'_>(move (@7), const (false)) @@ -533,12 +552,13 @@ fn {impl SliceIndex> for Range[Sized]}::get_unchecked_mut let @9: Array<&'_ (Str), 1 : usize>; // anonymous local let @10: &'_ (Slice<&'_ (Str)>); // anonymous local let @11: &'_ (Slice>); // anonymous local - let @12: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @12: (); // anonymous local + let @13: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@5) storage_live(@6) storage_live(pieces@8) - storage_live(@12) + storage_live(@13) storage_live(@4) @4 := copy (end@2) >= copy (start@1) if move (@4) { @@ -558,13 +578,15 @@ fn {impl SliceIndex> for Range[Sized]}::get_unchecked_mut storage_live(@7) storage_live(@9) @9 := [const ("unsafe precondition(s) violated: slice::get_unchecked_mut requires that the range is within the slice\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@8 := &@9 + storage_live(@12) + @12 := () + pieces@8 := &(@9, move (@12)) storage_live(@10) @10 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@8)) storage_live(@11) @11 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(copy ({promoted_const}<'_, 1 : usize>)) - @12 := Option::None { } - @7 := Arguments { 0: move (@10), 1: move (@12), 2: move (@11) } + @13 := Option::None { } + @7 := Arguments { 0: move (@10), 1: move (@13), 2: move (@11) } storage_dead(@11) storage_dead(@10) @6 := panic_nounwind_fmt<'_>(move (@7), const (false)) @@ -649,6 +671,8 @@ where let @14: usize; // anonymous local let @15: *const T; // anonymous local let @16: *const T; // anonymous local + let @17: usize; // anonymous local + let @18: usize; // anonymous local storage_live(@3) storage_live(new_len@4) @@ -662,6 +686,8 @@ where storage_live(@14) storage_live(@15) storage_live(@16) + storage_live(@17) + storage_live(@18) storage_live(@5) self@6 := copy ((self@1).end) rhs@7 := copy ((self@1).start) @@ -686,7 +712,9 @@ where storage_dead(@8) storage_live(@11) storage_live(@12) - @12 := &raw const *(slice@2) + storage_live(@18) + @18 := ptr_metadata(copy (slice@2)) + @12 := &raw const (*(slice@2), move (@18)) storage_live(@15) storage_live(@16) @15 := cast<*const Slice, *const T>(copy (@12)) @@ -695,7 +723,9 @@ where storage_dead(@16) storage_dead(@15) storage_dead(@12) - @0 := &*(@11) + storage_live(@17) + @17 := ptr_metadata(copy (@11)) + @0 := &(*(@11), move (@17)) storage_dead(@11) return } @@ -728,6 +758,8 @@ where let @14: usize; // anonymous local let @15: *mut T; // anonymous local let @16: *mut T; // anonymous local + let @17: usize; // anonymous local + let @18: usize; // anonymous local storage_live(@3) storage_live(new_len@4) @@ -741,6 +773,8 @@ where storage_live(@14) storage_live(@15) storage_live(@16) + storage_live(@17) + storage_live(@18) storage_live(@5) self@6 := copy ((self@1).end) rhs@7 := copy ((self@1).start) @@ -765,7 +799,9 @@ where storage_dead(@8) storage_live(@11) storage_live(ptr@12) - ptr@12 := &raw mut *(slice@2) + storage_live(@18) + @18 := ptr_metadata(copy (slice@2)) + ptr@12 := &raw mut (*(slice@2), move (@18)) storage_live(@15) storage_live(@16) @15 := cast<*mut Slice, *mut T>(copy (ptr@12)) @@ -774,7 +810,9 @@ where storage_dead(@16) storage_dead(@15) storage_dead(ptr@12) - @0 := &mut *(@11) + storage_live(@17) + @17 := ptr_metadata(copy (@11)) + @0 := &mut (*(@11), move (@17)) storage_dead(@11) return } @@ -817,31 +855,40 @@ fn main() let @7: bool; // anonymous local let @8: i32; // anonymous local let @9: usize; // anonymous local - let @10: &'_ (Slice); // anonymous local - let @11: &'_ (i32); // anonymous local + let @10: (); // anonymous local + let @11: usize; // anonymous local + let @12: usize; // anonymous local + let @13: &'_ (Slice); // anonymous local + let @14: &'_ (i32); // anonymous local storage_live(array@1) array@1 := [const (1 : i32), const (2 : i32), const (3 : i32), const (4 : i32), const (5 : i32), const (6 : i32)] storage_live(slice@2) storage_live(@3) storage_live(@4) - @4 := &array@1 + storage_live(@10) + @10 := () + @4 := &(array@1, move (@10)) storage_live(@5) @5 := Range { start: const (2 : usize), end: const (5 : usize) } @3 := {impl Index for Array}::index<'_, i32, Range[Sized], 6 : usize>[Sized, Sized[Sized]>, {impl Index for Slice}[Sized]>[Sized, Sized[Sized]>, {impl SliceIndex> for Range[Sized]}[Sized]]](move (@4), move (@5)) storage_dead(@5) storage_dead(@4) - slice@2 := &*(@3) + storage_live(@11) + @11 := ptr_metadata(copy (@3)) + slice@2 := &(*(@3), move (@11)) storage_live(@6) storage_live(@7) storage_live(@8) storage_live(@9) @9 := const (0 : usize) - storage_live(@10) - @10 := &*(slice@2) - storage_live(@11) - @11 := @SliceIndexShared<'_, i32>(move (@10), copy (@9)) - @8 := copy (*(@11)) + storage_live(@12) + @12 := ptr_metadata(copy (slice@2)) + storage_live(@13) + @13 := &(*(slice@2), move (@12)) + storage_live(@14) + @14 := @SliceIndexShared<'_, i32>(move (@13), copy (@9)) + @8 := copy (*(@14)) @7 := move (@8) == const (3 : i32) if move (@7) { } diff --git a/charon/tests/ui/statics.out b/charon/tests/ui/statics.out index 8ca5c3c59..58d8c9e1a 100644 --- a/charon/tests/ui/statics.out +++ b/charon/tests/ui/statics.out @@ -21,17 +21,23 @@ fn constant() let @3: usize; // anonymous local let _ref_mut@4: &'_ mut (usize); // local let @5: usize; // anonymous local + let @6: (); // anonymous local + let @7: (); // anonymous local storage_live(_val@1) _val@1 := copy (CONST) storage_live(_ref@2) storage_live(@3) @3 := copy (CONST) - _ref@2 := &@3 + storage_live(@7) + @7 := () + _ref@2 := &(@3, move (@7)) storage_live(_ref_mut@4) storage_live(@5) @5 := copy (CONST) - _ref_mut@4 := &mut @5 + storage_live(@6) + @6 := () + _ref_mut@4 := &mut (@5, move (@6)) @0 := () storage_dead(@5) storage_dead(_ref_mut@4) @@ -64,29 +70,44 @@ fn shared_static() let @4: &'_ (usize); // anonymous local let _ptr@5: *const usize; // local let @6: &'_ (usize); // anonymous local - let @7: &'_ (usize); // anonymous local - let @8: &'_ (usize); // anonymous local - let @9: &'_ (usize); // anonymous local + let @7: (); // anonymous local + let @8: (); // anonymous local + let @9: (); // anonymous local + let @10: &'_ (usize); // anonymous local + let @11: (); // anonymous local + let @12: &'_ (usize); // anonymous local + let @13: (); // anonymous local + let @14: &'_ (usize); // anonymous local - storage_live(@7) - storage_live(@8) storage_live(@9) + storage_live(@10) + storage_live(@11) + storage_live(@12) + storage_live(@13) + storage_live(@14) storage_live(_val@1) storage_live(@2) - @7 := &SHARED_STATIC - @2 := move (@7) + @9 := () + @10 := &(SHARED_STATIC, move (@9)) + @2 := move (@10) _val@1 := copy (*(@2)) storage_dead(@2) storage_live(_ref@3) storage_live(@4) - @8 := &SHARED_STATIC - @4 := move (@8) - _ref@3 := &*(@4) + @11 := () + @12 := &(SHARED_STATIC, move (@11)) + @4 := move (@12) + storage_live(@8) + @8 := () + _ref@3 := &(*(@4), move (@8)) storage_live(_ptr@5) storage_live(@6) - @9 := &SHARED_STATIC - @6 := move (@9) - _ptr@5 := &raw const *(@6) + @13 := () + @14 := &(SHARED_STATIC, move (@13)) + @6 := move (@14) + storage_live(@7) + @7 := () + _ptr@5 := &raw const (*(@6), move (@7)) @0 := () storage_dead(@6) storage_dead(_ptr@5) @@ -123,43 +144,70 @@ fn mut_static() let @8: *mut usize; // anonymous local let _ptr_mut@9: *mut usize; // local let @10: *mut usize; // anonymous local - let @11: *mut usize; // anonymous local - let @12: *mut usize; // anonymous local - let @13: *mut usize; // anonymous local - let @14: *mut usize; // anonymous local - let @15: *mut usize; // anonymous local + let @11: (); // anonymous local + let @12: (); // anonymous local + let @13: (); // anonymous local + let @14: (); // anonymous local + let @15: (); // anonymous local + let @16: *mut usize; // anonymous local + let @17: (); // anonymous local + let @18: *mut usize; // anonymous local + let @19: (); // anonymous local + let @20: *mut usize; // anonymous local + let @21: (); // anonymous local + let @22: *mut usize; // anonymous local + let @23: (); // anonymous local + let @24: *mut usize; // anonymous local - storage_live(@11) - storage_live(@12) - storage_live(@13) - storage_live(@14) storage_live(@15) + storage_live(@16) + storage_live(@17) + storage_live(@18) + storage_live(@19) + storage_live(@20) + storage_live(@21) + storage_live(@22) + storage_live(@23) + storage_live(@24) storage_live(_val@1) storage_live(@2) - @11 := &raw mut MUT_STATIC - @2 := move (@11) + @15 := () + @16 := &raw mut (MUT_STATIC, move (@15)) + @2 := move (@16) _val@1 := copy (*(@2)) storage_dead(@2) storage_live(_ref@3) storage_live(@4) - @12 := &raw mut MUT_STATIC - @4 := move (@12) - _ref@3 := &*(@4) + @17 := () + @18 := &raw mut (MUT_STATIC, move (@17)) + @4 := move (@18) + storage_live(@14) + @14 := () + _ref@3 := &(*(@4), move (@14)) storage_live(_ref_mut@5) storage_live(@6) - @13 := &raw mut MUT_STATIC - @6 := move (@13) - _ref_mut@5 := &mut *(@6) + @19 := () + @20 := &raw mut (MUT_STATIC, move (@19)) + @6 := move (@20) + storage_live(@13) + @13 := () + _ref_mut@5 := &mut (*(@6), move (@13)) storage_live(_ptr@7) storage_live(@8) - @14 := &raw mut MUT_STATIC - @8 := move (@14) - _ptr@7 := &raw const *(@8) + @21 := () + @22 := &raw mut (MUT_STATIC, move (@21)) + @8 := move (@22) + storage_live(@12) + @12 := () + _ptr@7 := &raw const (*(@8), move (@12)) storage_live(_ptr_mut@9) storage_live(@10) - @15 := &raw mut MUT_STATIC - @10 := move (@15) - _ptr_mut@9 := &raw mut *(@10) + @23 := () + @24 := &raw mut (MUT_STATIC, move (@23)) + @10 := move (@24) + storage_live(@11) + @11 := () + _ptr_mut@9 := &raw mut (*(@10), move (@11)) @0 := () storage_dead(@10) storage_dead(_ptr_mut@9) @@ -206,14 +254,20 @@ fn non_copy_static() let @0: (); // return let @1: &'_ (Foo); // anonymous local let @2: &'_ (Foo); // anonymous local - let @3: &'_ (Foo); // anonymous local + let @3: (); // anonymous local + let @4: (); // anonymous local + let @5: &'_ (Foo); // anonymous local - storage_live(@3) + storage_live(@4) + storage_live(@5) storage_live(@1) storage_live(@2) - @3 := &FOO - @2 := move (@3) - @1 := &*(@2) + @4 := () + @5 := &(FOO, move (@4)) + @2 := move (@5) + storage_live(@3) + @3 := () + @1 := &(*(@2), move (@3)) @0 := method<'_>(move (@1)) storage_dead(@1) storage_dead(@2) diff --git a/charon/tests/ui/string-literal.out b/charon/tests/ui/string-literal.out index 3f8e52008..59f0d5c56 100644 --- a/charon/tests/ui/string-literal.out +++ b/charon/tests/ui/string-literal.out @@ -123,17 +123,23 @@ fn BAR() -> &'static (Slice) let @0: &'_ (Slice); // return let @1: &'_ (Array); // anonymous local let @2: &'_ (Array); // anonymous local - let @3: Array; // anonymous local - let @4: &'_ (Array); // anonymous local + let @3: (); // anonymous local + let @4: Array; // anonymous local + let @5: (); // anonymous local + let @6: &'_ (Array); // anonymous local - storage_live(@3) storage_live(@4) + storage_live(@5) + storage_live(@6) storage_live(@1) storage_live(@2) - @3 := [const (104 : u8), const (101 : u8), const (108 : u8), const (108 : u8), const (111 : u8)] - @4 := &@3 - @2 := move (@4) - @1 := &*(@2) + @4 := [const (104 : u8), const (101 : u8), const (108 : u8), const (108 : u8), const (111 : u8)] + @5 := () + @6 := &(@4, move (@5)) + @2 := move (@6) + storage_live(@3) + @3 := () + @1 := &(*(@2), move (@3)) @0 := @ArrayToSliceShared<'_, u8, 5 : usize>(move (@1)) storage_dead(@2) storage_dead(@1) @@ -150,12 +156,15 @@ fn main() let _s@1: String; // local let @2: &'_ (Str); // anonymous local let @3: &'_ (Str); // anonymous local + let @4: usize; // anonymous local storage_live(_s@1) storage_live(@2) storage_live(@3) @3 := const ("Hello") - @2 := &*(@3) + storage_live(@4) + @4 := ptr_metadata(copy (@3)) + @2 := &(*(@3), move (@4)) _s@1 := {impl ToString for T}::to_string<'_, Str>[MetaSized, {impl Display for Str}](move (@2)) storage_dead(@2) storage_dead(@3) diff --git a/charon/tests/ui/traits.out b/charon/tests/ui/traits.out index 9c657da2a..eec32d8f8 100644 --- a/charon/tests/ui/traits.out +++ b/charon/tests/ui/traits.out @@ -182,16 +182,23 @@ pub fn test_bool_trait_bool(@1: bool) -> bool let @2: bool; // anonymous local let @3: &'_ (bool); // anonymous local let @4: &'_ (bool); // anonymous local + let @5: (); // anonymous local + let @6: (); // anonymous local storage_live(@4) + storage_live(@6) storage_live(@2) storage_live(@3) - @3 := &x@1 + storage_live(@5) + @5 := () + @3 := &(x@1, move (@5)) @2 := {impl BoolTrait for bool}::get_bool<'_>(move (@3)) if move (@2) { storage_dead(@3) storage_live(@4) - @4 := &x@1 + storage_live(@6) + @6 := () + @4 := &(x@1, move (@6)) @0 := test_crate::{impl BoolTrait for bool}::ret_true<'_>(move (@4)) storage_dead(@4) } @@ -255,16 +262,23 @@ where let @2: bool; // anonymous local let @3: &'_ (Option[@TraitClause0]); // anonymous local let @4: &'_ (Option[@TraitClause0]); // anonymous local + let @5: (); // anonymous local + let @6: (); // anonymous local storage_live(@4) + storage_live(@6) storage_live(@2) storage_live(@3) - @3 := &x@1 + storage_live(@5) + @5 := () + @3 := &(x@1, move (@5)) @2 := {impl BoolTrait for Option[@TraitClause0]}::get_bool<'_, T>[@TraitClause0](move (@3)) if move (@2) { storage_dead(@3) storage_live(@4) - @4 := &x@1 + storage_live(@6) + @6 := () + @4 := &(x@1, move (@6)) @0 := test_crate::{impl BoolTrait for Option[@TraitClause0]}::ret_true<'_, T>[@TraitClause0](move (@4)) storage_dead(@4) } @@ -286,9 +300,12 @@ where let @0: bool; // return let x@1: T; // arg #1 let @2: &'_ (T); // anonymous local + let @3: (); // anonymous local storage_live(@2) - @2 := &x@1 + storage_live(@3) + @3 := () + @2 := &(x@1, move (@3)) @0 := @TraitClause1::get_bool<'_>(move (@2)) storage_dead(@2) drop[Drop] x@1 @@ -648,8 +665,10 @@ where let @6: bool; // anonymous local let @7: u64; // anonymous local let @8: &'_ (TestType1); // anonymous local + let @9: (); // anonymous local storage_live(@8) + storage_live(@9) storage_live(x@3) storage_live(@4) // Remark: we can't write: impl TestTrait for TestType, @@ -669,7 +688,9 @@ where if move (@6) { storage_dead(@7) storage_live(@8) - @8 := &y@5 + storage_live(@9) + @9 := () + @8 := &(y@5, move (@9)) @0 := {impl TestTrait for TestType1}::test<'_>(move (@8)) storage_dead(@8) } @@ -930,9 +951,12 @@ where let @0: String; // return let x@1: &'_ (T); // arg #1 let @2: &'_ (T); // anonymous local + let @3: (); // anonymous local storage_live(@2) - @2 := &*(x@1) + storage_live(@3) + @3 := () + @2 := &(*(x@1), move (@3)) @0 := @TraitClause1::parent_clause1::get_name<'_>(move (@2)) storage_dead(@2) return @@ -947,9 +971,12 @@ where let @0: @TraitClause1::parent_clause1::W; // return let x@1: &'_ (T); // arg #1 let @2: &'_ (T); // anonymous local + let @3: (); // anonymous local storage_live(@2) - @2 := &*(x@1) + storage_live(@3) + @3 := () + @2 := &(*(x@1), move (@3)) @0 := @TraitClause1::parent_clause1::get_w<'_>(move (@2)) storage_dead(@2) return @@ -1172,9 +1199,12 @@ where let @0: @TraitClause1::W; // return let x@1: &'_ (T); // arg #1 let @2: &'_ (T); // anonymous local + let @3: (); // anonymous local storage_live(@2) - @2 := &*(x@1) + storage_live(@3) + @3 := () + @2 := &(*(x@1), move (@3)) @0 := @TraitClause1::get_w<'_>(move (@2)) storage_dead(@2) return diff --git a/charon/tests/ui/type_inference_is_order_dependent.out b/charon/tests/ui/type_inference_is_order_dependent.out index f680744f0..5861ee7bf 100644 --- a/charon/tests/ui/type_inference_is_order_dependent.out +++ b/charon/tests/ui/type_inference_is_order_dependent.out @@ -159,6 +159,12 @@ where let @10: Array<&'_ (Str), 2 : usize>; // anonymous local let @11: &'_ (Array, 1 : usize>); // anonymous local let @12: &'_ (Array, 1 : usize>); // anonymous local + let @13: (); // anonymous local + let @14: (); // anonymous local + let @15: (); // anonymous local + let @16: (); // anonymous local + let @17: (); // anonymous local + let @18: (); // anonymous local storage_live(@1) storage_live(@2) @@ -168,8 +174,12 @@ where storage_live(@6) storage_live(@7) @7 := @TraitClause4::default() - @6 := &@7 - @5 := &*(@6) + storage_live(@14) + @14 := () + @6 := &(@7, move (@14)) + storage_live(@13) + @13 := () + @5 := &(*(@6), move (@13)) @4 := new_debug<'_, '_, U>[@TraitClause1, @TraitClause5](move (@5)) storage_dead(@5) args@3 := [move (@4)] @@ -178,12 +188,20 @@ where storage_live(@9) storage_live(@10) @10 := [const (""), const ("\n")] - @9 := &@10 - @8 := &*(@9) + storage_live(@18) + @18 := () + @9 := &(@10, move (@18)) + storage_live(@17) + @17 := () + @8 := &(*(@9), move (@17)) storage_live(@11) storage_live(@12) - @12 := &args@3 - @11 := &*(@12) + storage_live(@16) + @16 := () + @12 := &(args@3, move (@16)) + storage_live(@15) + @15 := () + @11 := &(*(@12), move (@15)) @2 := new_v1<'_, 2 : usize, 1 : usize>(move (@8), move (@11)) storage_dead(@12) storage_dead(@11) diff --git a/charon/tests/ui/ullbc-control-flow.out b/charon/tests/ui/ullbc-control-flow.out index 85ebb175f..b92a5ca5b 100644 --- a/charon/tests/ui/ullbc-control-flow.out +++ b/charon/tests/ui/ullbc-control-flow.out @@ -587,6 +587,12 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize let @34: (); // anonymous local let @35: bool; // anonymous local let @36: usize; // anonymous local + let @37: (); // anonymous local + let @38: (); // anonymous local + let @39: (); // anonymous local + let @40: (); // anonymous local + let @41: (); // anonymous local + let @42: (); // anonymous local bb0: { storage_live(@12); @@ -619,8 +625,12 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize storage_live(@9); storage_live(@10); storage_live(@11); - @11 := &mut iter@7; - @10 := &two-phase-mut *(@11); + storage_live(@38); + @38 := (); + @11 := &mut (iter@7, move (@38)); + storage_live(@37); + @37 := (); + @10 := &two-phase-mut (*(@11), move (@37)); @9 := {impl Iterator for Range[@TraitClause0]}::next<'_, i32>[Sized, {impl Step for i32}](move (@10)) -> bb4 (unwind: bb2); } @@ -672,8 +682,12 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize storage_live(@20); storage_live(@21); storage_live(@22); - @22 := &mut iter@18; - @21 := &two-phase-mut *(@22); + storage_live(@40); + @40 := (); + @22 := &mut (iter@18, move (@40)); + storage_live(@39); + @39 := (); + @21 := &two-phase-mut (*(@22), move (@39)); @20 := {impl Iterator for Range[@TraitClause0]}::next<'_, usize>[Sized, {impl Step for usize}](move (@21)) -> bb10 (unwind: bb2); } @@ -722,8 +736,12 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize storage_live(@29); storage_live(@30); storage_live(@31); - @31 := &mut iter@27; - @30 := &two-phase-mut *(@31); + storage_live(@42); + @42 := (); + @31 := &mut (iter@27, move (@42)); + storage_live(@41); + @41 := (); + @30 := &two-phase-mut (*(@31), move (@41)); @29 := {impl Iterator for Range[@TraitClause0]}::next<'_, usize>[Sized, {impl Step for usize}](move (@30)) -> bb16 (unwind: bb2); } diff --git a/charon/tests/ui/unsafe.out b/charon/tests/ui/unsafe.out index 6f4a50c1c..754a27ff5 100644 --- a/charon/tests/ui/unsafe.out +++ b/charon/tests/ui/unsafe.out @@ -345,13 +345,16 @@ fn access_mutable_static() let @0: (); // return let @1: *mut usize; // anonymous local let @2: usize; // anonymous local - let @3: *mut usize; // anonymous local + let @3: (); // anonymous local + let @4: *mut usize; // anonymous local storage_live(@2) storage_live(@3) + storage_live(@4) storage_live(@1) - @3 := &raw mut COUNTER - @1 := move (@3) + @3 := () + @4 := &raw mut (COUNTER, move (@3)) + @1 := move (@4) @2 := copy (*(@1)) panic.+ const (1 : usize) *(@1) := move (@2) storage_dead(@1) diff --git a/charon/tests/ui/unsize.out b/charon/tests/ui/unsize.out index f033ba1ba..a25adf583 100644 --- a/charon/tests/ui/unsize.out +++ b/charon/tests/ui/unsize.out @@ -203,14 +203,24 @@ fn foo() let @20: Rc[MetaSized, Sized]; // anonymous local let @21: String; // anonymous local let @22: &'_ (String); // anonymous local + let @23: (); // anonymous local + let @24: (); // anonymous local + let @25: (); // anonymous local + let @26: (); // anonymous local + let @27: (); // anonymous local + let @28: (); // anonymous local storage_live(array@1) array@1 := @ArrayRepeat<'_, i32, 2 : usize>(const (0 : i32)) storage_live(@2) storage_live(@3) storage_live(@4) - @4 := &array@1 - @3 := &*(@4) + storage_live(@24) + @24 := () + @4 := &(array@1, move (@24)) + storage_live(@23) + @23 := () + @3 := &(*(@4), move (@23)) @2 := @ArrayToSliceShared<'_, i32, 2 : usize>(move (@3)) storage_dead(@3) storage_dead(@4) @@ -242,8 +252,12 @@ fn foo() storage_live(@12) storage_live(@13) storage_live(@14) - @14 := &string@11 - @13 := &*(@14) + storage_live(@27) + @27 := () + @14 := &(string@11, move (@27)) + storage_live(@26) + @26 := () + @13 := &(*(@14), move (@26)) @12 := unsize_cast<&'_ (String), &'_ ((dyn exists<_dyn> [@TraitClause0]: Display<_dyn> + _dyn : '_)), {impl Display for String}>(move (@13)) storage_dead(@13) storage_dead(@14) @@ -252,7 +266,9 @@ fn foo() storage_live(@16) storage_live(@17) storage_live(@18) - @18 := &string@11 + storage_live(@25) + @25 := () + @18 := &(string@11, move (@25)) @17 := {impl Clone for String}::clone<'_>(move (@18)) storage_dead(@18) @16 := @BoxNew[Sized](move (@17)) @@ -266,7 +282,9 @@ fn foo() storage_live(@20) storage_live(@21) storage_live(@22) - @22 := &string@11 + storage_live(@28) + @28 := () + @22 := &(string@11, move (@28)) @21 := {impl Clone for String}::clone<'_>(move (@22)) storage_dead(@22) @20 := alloc::rc::{Rc[@TraitClause0::parent_clause0, Sized]}::new[Sized](move (@21)) diff --git a/charon/tests/ui/unsupported/issue-79-bound-regions.out b/charon/tests/ui/unsupported/issue-79-bound-regions.out index 53634e3fd..222dadb4e 100644 --- a/charon/tests/ui/unsupported/issue-79-bound-regions.out +++ b/charon/tests/ui/unsupported/issue-79-bound-regions.out @@ -418,14 +418,22 @@ fn main() let @6: &'_ mut (Iter<'_, i32>[Sized]); // anonymous local let @7: Iter<'_, i32>[Sized]; // anonymous local let @8: &'_ (Slice); // anonymous local + let @9: usize; // anonymous local + let @10: (); // anonymous local + let @11: (); // anonymous local + let @12: (); // anonymous local storage_live(slice@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := [const (0 : i32)] - @3 := &@4 - @2 := &*(@3) + storage_live(@11) + @11 := () + @3 := &(@4, move (@11)) + storage_live(@10) + @10 := () + @2 := &(*(@3), move (@10)) slice@1 := @ArrayToSliceShared<'_, i32, 1 : usize>(move (@2)) storage_dead(@2) storage_dead(@3) @@ -433,9 +441,13 @@ fn main() storage_live(@6) storage_live(@7) storage_live(@8) - @8 := &*(slice@1) + storage_live(@9) + @9 := ptr_metadata(copy (slice@1)) + @8 := &(*(slice@1), move (@9)) @7 := iter<'_, i32>[Sized](move (@8)) - @6 := &two-phase-mut @7 + storage_live(@12) + @12 := () + @6 := &two-phase-mut (@7, move (@12)) storage_dead(@8) @5 := {impl Iterator for Iter<'a, T>[@TraitClause0]}::next<'_, '_, i32>[Sized](move (@6)) storage_dead(@6) diff --git a/charon/tests/ui/vtables.out b/charon/tests/ui/vtables.out index 1624b22b9..4e2c863ab 100644 --- a/charon/tests/ui/vtables.out +++ b/charon/tests/ui/vtables.out @@ -246,10 +246,13 @@ fn {impl Checkable for i32}::check<'_0>(@1: &'_0 (i32)) -> bool let self@1: &'_ (i32); // arg #1 let @2: i32; // anonymous local let @3: &'_ (i32); // anonymous local + let @4: (); // anonymous local storage_live(@2) storage_live(@3) - @3 := &*(self@1) + storage_live(@4) + @4 := () + @3 := &(*(self@1), move (@4)) @2 := {impl Super for i32}::super_method<'_>(move (@3), const (10 : i32)) storage_dead(@3) @0 := move (@2) > const (0 : i32) @@ -261,11 +264,14 @@ fn {impl Checkable for i32}::check<'_0>(@1: &'_0 (i32)) -> bool fn {impl Checkable for i32}::{vtable}() -> test_crate::Checkable::{vtable} { let ret@0: test_crate::Checkable::{vtable}; // return - let @1: &'static (test_crate::Super::{vtable}); // anonymous local + let @1: (); // anonymous local + let @2: &'static (test_crate::Super::{vtable}); // anonymous local storage_live(@1) - @1 := &{impl Super for i32}::{vtable} - ret@0 := test_crate::Checkable::{vtable} { size: const (Opaque(unknown size)), align: const (Opaque(unknown align)), drop: const (Opaque(unknown drop)), method_check: const ({impl Checkable for i32}::check), super_trait_0: const (Opaque(missing supertrait vtable)), super_trait_1: move (@1) } + storage_live(@2) + @1 := () + @2 := &({impl Super for i32}::{vtable}, move (@1)) + ret@0 := test_crate::Checkable::{vtable} { size: const (Opaque(unknown size)), align: const (Opaque(unknown align)), drop: const (Opaque(unknown drop)), method_check: const ({impl Checkable for i32}::check), super_trait_0: const (Opaque(missing supertrait vtable)), super_trait_1: move (@2) } return } @@ -347,14 +353,20 @@ where let @2: &'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)); // anonymous local let @3: &'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)); // anonymous local let @4: &'_ (T); // anonymous local + let @5: &'static (test_crate::NoParam::{vtable}); // anonymous local + let @6: (); // anonymous local storage_live(@2) storage_live(@3) storage_live(@4) - @4 := &*(arg@1) + storage_live(@6) + @6 := () + @4 := &(*(arg@1), move (@6)) @3 := unsize_cast<&'_ (T), &'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)), @TraitClause1>(move (@4)) storage_dead(@4) - @2 := &*(@3) + storage_live(@5) + @5 := ptr_metadata(copy (@3)) + @2 := &(*(@3), move (@5)) @0 := unsize_cast<&'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)), &'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)), NoParam<(dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)>>(move (@2)) storage_dead(@3) storage_dead(@2) @@ -393,12 +405,15 @@ where let arg@2: &'_ (T); // arg #2 let @3: i32; // anonymous local let @4: &'_ (T); // anonymous local + let @5: (); // anonymous local storage_live(@3) @3 := copy (*(self@1)) panic.+ const (1 : i32) *(self@1) := move (@3) storage_live(@4) - @4 := &*(arg@2) + storage_live(@5) + @5 := () + @4 := &(*(arg@2), move (@5)) @0 := @TraitClause1::clone<'_>(move (@4)) storage_dead(@4) return @@ -449,21 +464,33 @@ where let @5: i32; // anonymous local let @6: &'_ mut ((dyn exists<_dyn> [@TraitClause0]: Modifiable<_dyn, T> + _dyn : '_)); // anonymous local let @7: &'_ (T); // anonymous local + let @8: (); // anonymous local + let @9: &'static (test_crate::Modifiable::{vtable}); // anonymous local + let @10: (); // anonymous local + let @11: (); // anonymous local storage_live(x@2) storage_live(@3) storage_live(@4) storage_live(@5) @5 := const (199 : i32) - @4 := &mut @5 - @3 := &mut *(@4) + storage_live(@11) + @11 := () + @4 := &mut (@5, move (@11)) + storage_live(@10) + @10 := () + @3 := &mut (*(@4), move (@10)) x@2 := unsize_cast<&'_ mut (i32), &'_ mut ((dyn exists<_dyn> [@TraitClause0]: Modifiable<_dyn, T> + _dyn : '_)), {impl Modifiable for i32}[@TraitClause0, @TraitClause1]>(move (@3)) storage_dead(@3) storage_dead(@4) storage_live(@6) - @6 := &two-phase-mut *(x@2) + storage_live(@9) + @9 := ptr_metadata(copy (x@2)) + @6 := &two-phase-mut (*(x@2), move (@9)) storage_live(@7) - @7 := &*(arg@1) + storage_live(@8) + @8 := () + @7 := &(*(arg@1), move (@8)) @0 := Modifiable<(dyn exists<_dyn> [@TraitClause0]: Modifiable<_dyn, T> + _dyn : '_), T>::modify<'_, '_>(move (@6), move (@7)) storage_dead(@7) storage_dead(@6) @@ -520,21 +547,33 @@ where let @7: (); // anonymous local let @8: &'_ (Self); // anonymous local let @9: &'_ (i64); // anonymous local + let @10: (); // anonymous local + let @11: PtrMetadata; // anonymous local + let @12: (); // anonymous local + let @13: PtrMetadata; // anonymous local storage_live(@4) storage_live(@5) - @5 := &*(self@1) + storage_live(@11) + @11 := ptr_metadata(copy (self@1)) + @5 := &(*(self@1), move (@11)) storage_live(@6) - @6 := &*(t32@2) + storage_live(@10) + @10 := () + @6 := &(*(t32@2), move (@10)) @4 := @TraitClause0::parent_clause1::operate_on<'_, '_>(move (@5), move (@6)) storage_dead(@6) storage_dead(@5) storage_dead(@4) storage_live(@7) storage_live(@8) - @8 := &*(self@1) + storage_live(@13) + @13 := ptr_metadata(copy (self@1)) + @8 := &(*(self@1), move (@13)) storage_live(@9) - @9 := &*(t64@3) + storage_live(@12) + @12 := () + @9 := &(*(t64@3), move (@12)) @7 := @TraitClause0::parent_clause2::operate_on<'_, '_>(move (@8), move (@9)) storage_dead(@9) storage_dead(@8) @@ -644,21 +683,33 @@ fn test_crate::{impl Both32And64 for i32}::both_operate<'_0, '_1, '_2>(@1: &'_0 let @7: (); // anonymous local let @8: &'_ (i32); // anonymous local let @9: &'_ (i64); // anonymous local + let @10: (); // anonymous local + let @11: (); // anonymous local + let @12: (); // anonymous local + let @13: (); // anonymous local storage_live(@4) storage_live(@5) - @5 := &*(self@1) + storage_live(@11) + @11 := () + @5 := &(*(self@1), move (@11)) storage_live(@6) - @6 := &*(t32@2) + storage_live(@10) + @10 := () + @6 := &(*(t32@2), move (@10)) @4 := {impl Both32And64 for i32}::parent_clause1::operate_on<'_, '_>(move (@5), move (@6)) storage_dead(@6) storage_dead(@5) storage_dead(@4) storage_live(@7) storage_live(@8) - @8 := &*(self@1) + storage_live(@13) + @13 := () + @8 := &(*(self@1), move (@13)) storage_live(@9) - @9 := &*(t64@3) + storage_live(@12) + @12 := () + @9 := &(*(t64@3), move (@12)) @7 := {impl Both32And64 for i32}::parent_clause2::operate_on<'_, '_>(move (@8), move (@9)) storage_dead(@9) storage_dead(@8) @@ -672,14 +723,20 @@ fn test_crate::{impl Both32And64 for i32}::both_operate<'_0, '_1, '_2>(@1: &'_0 fn {impl Both32And64 for i32}::{vtable}() -> test_crate::Both32And64::{vtable} { let ret@0: test_crate::Both32And64::{vtable}; // return - let @1: &'static (test_crate::BaseOn::{vtable}); // anonymous local - let @2: &'static (test_crate::BaseOn::{vtable}); // anonymous local + let @1: (); // anonymous local + let @2: &'static (test_crate::BaseOn::{vtable}); // anonymous local + let @3: (); // anonymous local + let @4: &'static (test_crate::BaseOn::{vtable}); // anonymous local storage_live(@1) storage_live(@2) - @1 := &{impl BaseOn for i32}::{vtable} - @2 := &{impl BaseOn for i32}::{vtable} - ret@0 := test_crate::Both32And64::{vtable} { size: const (Opaque(unknown size)), align: const (Opaque(unknown align)), drop: const (Opaque(unknown drop)), method_both_operate: const (Opaque(shim for provided methods aren't yet supported)), super_trait_0: const (Opaque(missing supertrait vtable)), super_trait_1: move (@1), super_trait_2: move (@2) } + storage_live(@3) + storage_live(@4) + @1 := () + @2 := &({impl BaseOn for i32}::{vtable}, move (@1)) + @3 := () + @4 := &({impl BaseOn for i32}::{vtable}, move (@3)) + ret@0 := test_crate::Both32And64::{vtable} { size: const (Opaque(unknown size)), align: const (Opaque(unknown align)), drop: const (Opaque(unknown drop)), method_both_operate: const (Opaque(shim for provided methods aren't yet supported)), super_trait_0: const (Opaque(missing supertrait vtable)), super_trait_1: move (@2), super_trait_2: move (@4) } return } @@ -716,22 +773,37 @@ fn use_alias<'_0>(@1: &'_0 ((dyn exists<_dyn> [@TraitClause0]: Both32And64<_dyn> let @7: &'_ (i64); // anonymous local let @8: &'_ (i64); // anonymous local let @9: i64; // anonymous local + let @10: (); // anonymous local + let @11: (); // anonymous local + let @12: (); // anonymous local + let @13: (); // anonymous local + let @14: &'static (test_crate::Both32And64::{vtable}); // anonymous local storage_live(@2) storage_live(@3) - @3 := &*(x@1) + storage_live(@14) + @14 := ptr_metadata(copy (x@1)) + @3 := &(*(x@1), move (@14)) storage_live(@4) storage_live(@5) storage_live(@6) @6 := const (100 : i32) - @5 := &@6 - @4 := &*(@5) + storage_live(@13) + @13 := () + @5 := &(@6, move (@13)) + storage_live(@12) + @12 := () + @4 := &(*(@5), move (@12)) storage_live(@7) storage_live(@8) storage_live(@9) @9 := const (200 : i64) - @8 := &@9 - @7 := &*(@8) + storage_live(@11) + @11 := () + @8 := &(@9, move (@11)) + storage_live(@10) + @10 := () + @7 := &(*(@8), move (@10)) @2 := Both32And64<(dyn exists<_dyn> [@TraitClause0]: Both32And64<_dyn> + _dyn : '_)>::both_operate<'_, '_, '_>(move (@3), move (@4), move (@7)) storage_dead(@7) storage_dead(@4) @@ -812,6 +884,35 @@ fn main() let @60: &'_ (i64); // anonymous local let @61: &'_ (i64); // anonymous local let @62: i64; // anonymous local + let @63: &'static (test_crate::Checkable::{vtable}); // anonymous local + let @64: (); // anonymous local + let @65: (); // anonymous local + let @66: usize; // anonymous local + let @67: (); // anonymous local + let @68: (); // anonymous local + let @69: (); // anonymous local + let @70: (); // anonymous local + let @71: (); // anonymous local + let @72: (); // anonymous local + let @73: (); // anonymous local + let @74: &'static (test_crate::Modifiable::{vtable}); // anonymous local + let @75: (); // anonymous local + let @76: (); // anonymous local + let @77: (); // anonymous local + let @78: (); // anonymous local + let @79: (); // anonymous local + let @80: (); // anonymous local + let @81: (); // anonymous local + let @82: (); // anonymous local + let @83: &'static (test_crate::NoParam::{vtable}); // anonymous local + let @84: &'static (test_crate::NoParam::{vtable}); // anonymous local + let @85: (); // anonymous local + let @86: (); // anonymous local + let @87: (); // anonymous local + let @88: (); // anonymous local + let @89: &'static (test_crate::Both32And64::{vtable}); // anonymous local + let @90: (); // anonymous local + let @91: (); // anonymous local storage_live(@21) storage_live(@22) @@ -855,20 +956,46 @@ fn main() storage_live(@60) storage_live(@61) storage_live(@62) + storage_live(@72) + storage_live(@73) + storage_live(@74) + storage_live(@75) + storage_live(@76) + storage_live(@77) + storage_live(@78) + storage_live(@79) + storage_live(@80) + storage_live(@81) + storage_live(@82) + storage_live(@83) + storage_live(@84) + storage_live(@85) + storage_live(@86) + storage_live(@87) + storage_live(@88) + storage_live(@89) + storage_live(@90) + storage_live(@91) storage_live(x@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := const (42 : i32) - @3 := &@4 - @2 := &*(@3) + storage_live(@65) + @65 := () + @3 := &(@4, move (@65)) + storage_live(@64) + @64 := () + @2 := &(*(@3), move (@64)) x@1 := unsize_cast<&'_ (i32), &'_ ((dyn exists<_dyn> [@TraitClause0]: Checkable<_dyn, i32> + _dyn : '_)), {impl Checkable for i32}>(move (@2)) storage_dead(@2) storage_dead(@3) storage_live(@5) storage_live(@6) storage_live(@7) - @7 := &*(x@1) + storage_live(@63) + @63 := ptr_metadata(copy (x@1)) + @7 := &(*(x@1), move (@63)) @6 := Checkable<(dyn exists<_dyn> [@TraitClause0]: Checkable<_dyn, i32> + _dyn : '_), i32>::check<'_>(move (@7)) if move (@6) { } @@ -884,8 +1011,12 @@ fn main() storage_live(@10) storage_live(@11) @11 := const (99 : i32) - @10 := &mut @11 - @9 := &mut *(@10) + storage_live(@68) + @68 := () + @10 := &mut (@11, move (@68)) + storage_live(@67) + @67 := () + @9 := &mut (*(@10), move (@67)) y@8 := unsize_cast<&'_ mut (i32), &'_ mut ((dyn exists<_dyn> [@TraitClause0]: Modifiable<_dyn, i32> + _dyn : '_)), {impl Modifiable for i32}[Sized, {impl Clone for i32}]>(move (@9)) storage_dead(@9) storage_dead(@10) @@ -899,13 +1030,21 @@ fn main() storage_live(@19) storage_live(@20) @20 := const ("Hello") - @19 := &*(@20) + storage_live(@66) + @66 := ptr_metadata(copy (@20)) + @19 := &(*(@20), move (@66)) @18 := {impl ToString for T}::to_string<'_, Str>[MetaSized, {impl Display for Str}](move (@19)) storage_dead(@19) - @17 := &@18 - @16 := &*(@17) + storage_live(@70) + @70 := () + @17 := &(@18, move (@70)) + storage_live(@69) + @69 := () + @16 := &(*(@17), move (@69)) @15 := modify_trait_object<'_, String>[Sized, {impl Clone for String}](move (@16)) - @14 := &@15 + storage_live(@71) + @71 := () + @14 := &(@15, move (@71)) storage_dead(@16) @13 := is_empty<'_>(move (@14)) if move (@13) { @@ -925,21 +1064,31 @@ fn main() storage_live(@23) storage_live(@24) storage_live(@25) - @25 := &two-phase-mut *(y@8) + storage_live(@74) + @74 := ptr_metadata(copy (y@8)) + @25 := &two-phase-mut (*(y@8), move (@74)) storage_live(@26) storage_live(@27) storage_live(@28) @28 := const (100 : i32) - @27 := &mut @28 - @26 := &*(@27) + storage_live(@73) + @73 := () + @27 := &mut (@28, move (@73)) + storage_live(@72) + @72 := () + @26 := &(*(@27), move (@72)) @24 := Modifiable<(dyn exists<_dyn> [@TraitClause0]: Modifiable<_dyn, i32> + _dyn : '_), i32>::modify<'_, '_>(move (@25), move (@26)) storage_dead(@26) storage_dead(@25) - @23 := &@24 + storage_live(@76) + @76 := () + @23 := &(@24, move (@76)) storage_live(@29) storage_live(@30) @30 := const (100 : i32) - @29 := &@30 + storage_live(@75) + @75 := () + @29 := &(@30, move (@75)) @22 := (move (@23), move (@29)) storage_dead(@29) storage_dead(@23) @@ -964,12 +1113,20 @@ fn main() @37 := move (kind@36) storage_live(@38) storage_live(@39) - @39 := &*(left_val@31) - @38 := &*(@39) + storage_live(@82) + @82 := () + @39 := &(*(left_val@31), move (@82)) + storage_live(@81) + @81 := () + @38 := &(*(@39), move (@81)) storage_live(@40) storage_live(@41) - @41 := &*(right_val@32) - @40 := &*(@41) + storage_live(@80) + @80 := () + @41 := &(*(right_val@32), move (@80)) + storage_live(@79) + @79 := () + @40 := &(*(@41), move (@79)) storage_live(@42) @42 := Option::None { } panic(core::panicking::assert_failed) @@ -992,10 +1149,16 @@ fn main() storage_live(@47) storage_live(@48) @48 := const (42 : i32) - @47 := &@48 - @46 := &*(@47) + storage_live(@78) + @78 := () + @47 := &(@48, move (@78)) + storage_live(@77) + @77 := () + @46 := &(*(@47), move (@77)) @45 := to_dyn_obj<'_, i32>[Sized, {impl NoParam for i32}](move (@46)) - @44 := &*(@45) + storage_live(@84) + @84 := ptr_metadata(copy (@45)) + @44 := &(*(@45), move (@84)) z@43 := unsize_cast<&'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)), &'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)), NoParam<(dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)>>(move (@44)) storage_dead(@46) storage_dead(@44) @@ -1004,7 +1167,9 @@ fn main() storage_dead(@45) storage_live(@49) storage_live(@50) - @50 := &*(z@43) + storage_live(@83) + @83 := ptr_metadata(copy (z@43)) + @50 := &(*(z@43), move (@83)) @49 := NoParam<(dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)>::dummy<'_>(move (@50)) storage_dead(@50) storage_dead(@49) @@ -1013,26 +1178,40 @@ fn main() storage_live(@53) storage_live(@54) @54 := const (42 : i32) - @53 := &@54 - @52 := &*(@53) + storage_live(@91) + @91 := () + @53 := &(@54, move (@91)) + storage_live(@90) + @90 := () + @52 := &(*(@53), move (@90)) a@51 := unsize_cast<&'_ (i32), &'_ ((dyn exists<_dyn> [@TraitClause0]: Both32And64<_dyn> + _dyn : '_)), {impl Both32And64 for i32}>(move (@52)) storage_dead(@52) storage_dead(@53) storage_live(@55) storage_live(@56) - @56 := &*(a@51) + storage_live(@89) + @89 := ptr_metadata(copy (a@51)) + @56 := &(*(a@51), move (@89)) storage_live(@57) storage_live(@58) storage_live(@59) @59 := const (100 : i32) - @58 := &@59 - @57 := &*(@58) + storage_live(@88) + @88 := () + @58 := &(@59, move (@88)) + storage_live(@87) + @87 := () + @57 := &(*(@58), move (@87)) storage_live(@60) storage_live(@61) storage_live(@62) @62 := const (200 : i64) - @61 := &@62 - @60 := &*(@61) + storage_live(@86) + @86 := () + @61 := &(@62, move (@86)) + storage_live(@85) + @85 := () + @60 := &(*(@61), move (@85)) @55 := Both32And64<(dyn exists<_dyn> [@TraitClause0]: Both32And64<_dyn> + _dyn : '_)>::both_operate<'_, '_, '_>(move (@56), move (@57), move (@60)) storage_dead(@60) storage_dead(@57) From 3a762d8d4e9d7abbdc22abe3eb944bb2fdc04bb7 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Wed, 17 Sep 2025 16:04:59 +0200 Subject: [PATCH 02/10] Use a global instead of a local for unit metadata --- charon-ml/src/GAst.ml | 1 + charon-ml/src/GAstOfJson.ml | 3 + charon-ml/src/LlbcAstUtils.ml | 9 +- charon/src/ast/gast_utils.rs | 7 + charon/src/ast/krate.rs | 3 + charon/src/ast/names_utils.rs | 2 +- .../translate/translate_closures.rs | 10 +- .../translate/translate_crate.rs | 2 + .../translate/translate_functions.rs | 6 +- .../translate/translate_items.rs | 61 + .../translate/translate_trait_objects.rs | 5 +- charon/src/transform/insert_ptr_metadata.rs | 5 +- charon/tests/cargo/toml.out | 10 + charon/tests/cli.rs | 31 - charon/tests/crate_data.rs | 31 +- charon/tests/ui/arrays.out | 741 +++++------- charon/tests/ui/arrays_const_generics.out | 23 +- charon/tests/ui/assoc-const-with-generics.out | 10 + charon/tests/ui/associated-types.out | 15 +- charon/tests/ui/bitwise.out | 10 + .../tests/ui/call-to-known-trait-method.out | 10 + charon/tests/ui/closure-as-fn.out | 20 +- charon/tests/ui/closures.out | 263 +---- charon/tests/ui/closures_with_where.out | 15 +- charon/tests/ui/comments.out | 57 +- charon/tests/ui/constants.out | 10 + charon/tests/ui/copy_nonoverlapping.out | 20 +- charon/tests/ui/cross_compile_32_bit.out | 15 +- charon/tests/ui/cross_compile_big_endian.out | 10 + charon/tests/ui/demo.out | 207 +--- .../ui/dictionary_passing_style_woes.out | 20 +- charon/tests/ui/disambiguator.out | 10 + charon/tests/ui/diverging.out | 10 + charon/tests/ui/dyn-trait.out | 10 + .../tests/ui/dyn-with-diamond-supertraits.out | 40 +- charon/tests/ui/explicit-drop-bounds.out | 10 + charon/tests/ui/external.out | 35 +- charon/tests/ui/find-sized-clause.out | 10 + charon/tests/ui/float.out | 10 + charon/tests/ui/foreign-constant.out | 10 + .../ui/gat-causes-unhandled-ty-clause.out | 10 + charon/tests/ui/gosim-demo.out | 68 +- charon/tests/ui/hide-marker-traits.out | 10 + charon/tests/ui/impl-trait.out | 58 +- charon/tests/ui/issue-114-opaque-bodies.out | 10 + charon/tests/ui/issue-118-generic-copy.out | 10 + .../ui/issue-120-bare-discriminant-read.out | 25 +- ...59-heterogeneous-recursive-definitions.out | 10 + charon/tests/ui/issue-165-vec-macro.out | 10 + .../tests/ui/issue-166-self-constructors.out | 10 + charon/tests/ui/issue-297-cfg.out | 118 +- charon/tests/ui/issue-320-slice-pattern.out | 227 ++-- .../ui/issue-322-macro-disambiguator.out | 10 + charon/tests/ui/issue-323-closure-borrow.out | 25 +- .../ui/issue-369-mismatched-genericparams.out | 10 + .../ui/issue-372-type-param-out-of-range.out | 10 + charon/tests/ui/issue-378-ctor-as-fn.out | 25 +- .../tests/ui/issue-394-rpit-with-lifetime.out | 15 +- .../ui/issue-395-failed-to-normalize.out | 10 + .../tests/ui/issue-4-slice-try-into-array.out | 10 + charon/tests/ui/issue-4-traits.out | 10 + charon/tests/ui/issue-45-misc.out | 81 +- charon/tests/ui/issue-507-cfg.out | 10 + .../issue-70-override-provided-method.2.out | 55 +- .../issue-70-override-provided-method.3.out | 40 +- .../ui/issue-70-override-provided-method.out | 40 +- .../tests/ui/issue-72-hash-missing-impl.out | 25 +- charon/tests/ui/issue-73-extern.out | 10 + .../ui/issue-91-enum-to-discriminant-cast.out | 10 + .../issue-92-nonpositive-variant-indices.out | 10 + ...e-93-recursive-traits-with-assoc-types.out | 10 + .../ui/issue-94-recursive-trait-defns.out | 10 + .../issue-97-missing-parent-item-clause.out | 15 +- charon/tests/ui/iterator.out | 113 +- charon/tests/ui/loops.out | 132 +-- charon/tests/ui/matches.out | 10 + charon/tests/ui/max_char.out | 10 + .../tests/ui/method-impl-generalization.out | 55 +- charon/tests/ui/method-ref.out | 10 + charon/tests/ui/ml-name-matcher-tests.out | 39 +- charon/tests/ui/monomorphization/adt_proj.out | 10 + .../ui/monomorphization/bound_lifetime.out | 25 +- .../tests/ui/monomorphization/closure-fn.out | 65 +- .../ui/monomorphization/closure-fnonce.out | 10 + charon/tests/ui/monomorphization/closures.out | 45 +- .../ui/monomorphization/fn_ptr_generics.out | 23 +- .../ui/monomorphization/fndefs-casts.out | 75 +- .../monomorphization/global_with_generics.out | 10 + charon/tests/ui/monomorphization/rec-adt.out | 10 + .../tests/ui/monomorphization/trait_impls.out | 15 +- .../ui/monomorphization/trait_impls_ullbc.out | 22 +- charon/tests/ui/no_nested_borrows.out | 20 +- charon/tests/ui/opacity.out | 25 +- charon/tests/ui/opaque-trait.out | 10 + charon/tests/ui/opaque_attribute.out | 22 +- charon/tests/ui/panics.out | 72 +- charon/tests/ui/params.out | 10 + charon/tests/ui/plain-panic-str.out | 20 +- .../tests/ui/pointers-in-consts-no-warns.out | 10 + charon/tests/ui/polonius_map.out | 67 +- .../ui/predicates-on-late-bound-vars.out | 25 +- charon/tests/ui/projection-index-from-end.out | 35 +- charon/tests/ui/ptr-offset.out | 28 +- charon/tests/ui/ptr_no_provenance.out | 10 + charon/tests/ui/quantified-clause.out | 10 + charon/tests/ui/raw-boxes.out | 1010 ++++++----------- charon/tests/ui/reconstruct_early_return.out | 10 + charon/tests/ui/region-inference-vars.out | 10 + ...e-inside-impl-with-bound-with-assoc-ty.out | 20 +- charon/tests/ui/remove-dynamic-checks.out | 10 + charon/tests/ui/rename_attribute.out | 21 +- charon/tests/ui/result-unwrap.out | 16 +- charon/tests/ui/rust-name-matcher-tests.out | 10 + charon/tests/ui/rvalues.out | 60 +- charon/tests/ui/scopes.out | 10 + charon/tests/ui/send_bound.out | 10 + charon/tests/ui/simple-cmp.out | 25 +- charon/tests/ui/simple/addition.out | 10 + charon/tests/ui/simple/additions.out | 10 + charon/tests/ui/simple/array_index.out | 23 +- .../assoc-constraint-on-assoc-ty-nested.out | 10 + .../simple/assoc-constraint-on-assoc-ty.2.out | 10 + .../simple/assoc-constraint-on-assoc-ty.out | 10 + .../assoc-ty-via-supertrait-and-bounds.out | 10 + .../ui/simple/assoc-type-with-fn-bound.out | 15 +- charon/tests/ui/simple/basic-mono.out | 10 + charon/tests/ui/simple/box-into-inner.out | 15 +- charon/tests/ui/simple/box-new.out | 10 + .../simple/call-foreign-defaulted-method.out | 15 +- .../call-inherent-method-with-trait-bound.out | 10 + .../call-method-via-supertrait-bound.out | 15 +- .../ui/simple/closure-capture-ref-by-move.out | 25 +- charon/tests/ui/simple/closure-fn.out | 65 +- charon/tests/ui/simple/closure-fnmut.out | 25 +- charon/tests/ui/simple/closure-fnonce.out | 10 + .../tests/ui/simple/closure-inside-impl.out | 20 +- .../closure-uses-ambient-self-clause.out | 25 +- charon/tests/ui/simple/closure-with-drops.out | 20 +- charon/tests/ui/simple/conditional-drop.out | 10 + charon/tests/ui/simple/const-subslice.out | 10 + ...lt-method-with-clause-and-marker-trait.out | 10 + charon/tests/ui/simple/drop-string.out | 15 +- charon/tests/ui/simple/dyn-fn.out | 48 +- .../ui/simple/gat-check-binder-levels.out | 10 + .../tests/ui/simple/gat-complex-lifetimes.out | 15 +- charon/tests/ui/simple/gat-implied-clause.out | 20 +- .../tests/ui/simple/generic-cast-to-dyn.out | 15 +- ...ulted-method-with-clause-with-assoc-ty.out | 10 + .../generic-impl-with-defaulted-method.out | 10 + .../ui/simple/generic-impl-with-method.out | 10 + charon/tests/ui/simple/hide-drops.out | 10 + .../tests/ui/simple/lending-iterator-gat.out | 86 +- charon/tests/ui/simple/match-on-char.out | 10 + charon/tests/ui/simple/match-on-float.out | 10 + .../simple/mem-discriminant-from-derive.out | 44 +- .../method-with-assoc-type-constraint.out | 10 + charon/tests/ui/simple/multiple-promoteds.out | 58 +- .../ui/simple/nested-closure-trait-ref.out | 25 +- charon/tests/ui/simple/nested-closure.out | 95 +- .../tests/ui/simple/nested-inline-const.out | 10 + charon/tests/ui/simple/non-lifetime-gats.out | 10 + .../opaque-trait-with-clause-in-method.out | 10 + .../pass-higher-kinded-fn-item-as-closure.out | 10 + charon/tests/ui/simple/pointee_metadata.out | 30 +- .../ui/simple/promoted-closure-no-warns.out | 52 +- charon/tests/ui/simple/promoted-closure.out | 52 +- .../ui/simple/promoted-in-generic-fn.out | 30 +- .../tests/ui/simple/promoted-inside-impl.out | 30 +- .../promoted-literal-addition-overflow.out | 41 +- .../ui/simple/promoted-literal-addition.out | 41 +- charon/tests/ui/simple/promoted-u32-slice.out | 37 +- charon/tests/ui/simple/ptr-from-raw-parts.out | 15 +- charon/tests/ui/simple/ptr_metadata.out | 10 + charon/tests/ui/simple/ptr_to_promoted.out | 37 +- .../quantified-trait-type-constraint.out | 10 + charon/tests/ui/simple/ref-in-const.out | 44 +- charon/tests/ui/simple/slice_increment.out | 10 + charon/tests/ui/simple/slice_index.out | 10 + charon/tests/ui/simple/slice_index_range.out | 182 ++- ...rtrait-impl-with-assoc-type-constraint.out | 10 + charon/tests/ui/simple/trait-alias.out | 15 +- .../trait-default-const-cross-crate.out | 10 + .../tests/ui/simple/trait-default-const.out | 10 + charon/tests/ui/simple/uncheck-ops.out | 10 + charon/tests/ui/simple/vec-push.out | 31 +- charon/tests/ui/simple/vec-with-capacity.out | 10 + charon/tests/ui/simple/wrapping-ops.out | 10 + charon/tests/ui/skip-borrowck.out | 58 +- charon/tests/ui/slice-index-range.out | 63 +- charon/tests/ui/start_from.out | 10 + charon/tests/ui/statics.out | 129 +-- charon/tests/ui/stealing.out | 10 + charon/tests/ui/string-literal.out | 31 +- charon/tests/ui/traits.out | 58 +- charon/tests/ui/traits_special.out | 10 + charon/tests/ui/type_alias.out | 10 + .../ui/type_inference_is_order_dependent.out | 40 +- charon/tests/ui/typenum.out | 10 + charon/tests/ui/ullbc-control-flow.out | 42 +- charon/tests/ui/unions.out | 10 + charon/tests/ui/unsafe-impl-send.out | 10 + charon/tests/ui/unsafe.out | 10 + charon/tests/ui/unsize.out | 40 +- .../ui/unsupported/issue-79-bound-regions.out | 25 +- charon/tests/ui/vtables.out | 299 ++--- 205 files changed, 3583 insertions(+), 3992 deletions(-) diff --git a/charon-ml/src/GAst.ml b/charon-ml/src/GAst.ml index b49ad683a..2150abc37 100644 --- a/charon-ml/src/GAst.ml +++ b/charon-ml/src/GAst.ml @@ -53,5 +53,6 @@ type 'fun_body gcrate = { global_decls : global_decl GlobalDeclId.Map.t; trait_decls : trait_decl TraitDeclId.Map.t; trait_impls : trait_impl TraitImplId.Map.t; + unit_metadata : global_decl_ref; } [@@deriving show] diff --git a/charon-ml/src/GAstOfJson.ml b/charon-ml/src/GAstOfJson.ml index 9001bcbeb..701181dd4 100644 --- a/charon-ml/src/GAstOfJson.ml +++ b/charon-ml/src/GAstOfJson.ml @@ -96,6 +96,7 @@ and gtranslated_crate_of_json ("global_decls", globals); ("trait_decls", trait_decls); ("trait_impls", trait_impls); + ("unit_metadata", unit_metadata); ("ordered_decls", declarations); ] -> let* ctx = id_to_file_of_json files in @@ -126,6 +127,7 @@ and gtranslated_crate_of_json vector_of_json trait_impl_id_of_json trait_impl_of_json ctx trait_impls in + let* unit_metadata = global_decl_ref_of_json ctx unit_metadata in let type_decls = TypeDeclId.Map.of_list @@ -159,6 +161,7 @@ and gtranslated_crate_of_json global_decls; trait_decls; trait_impls; + unit_metadata; } | _ -> Error "") diff --git a/charon-ml/src/LlbcAstUtils.ml b/charon-ml/src/LlbcAstUtils.ml index 09142f41c..e8b08d7dd 100644 --- a/charon-ml/src/LlbcAstUtils.ml +++ b/charon-ml/src/LlbcAstUtils.ml @@ -207,6 +207,7 @@ class ['self] map_crate_with_span = global_decls; trait_decls; trait_impls; + unit_metadata; } = crate in @@ -235,6 +236,9 @@ class ['self] map_crate_with_span = let trait_impls = TraitImplId.Map.map (self#visit_trait_impl decl_span_info) trait_impls in + let unit_metadata = + self#visit_global_decl_ref decl_span_info unit_metadata + in { name; options; @@ -245,6 +249,7 @@ class ['self] map_crate_with_span = global_decls; trait_decls; trait_impls; + unit_metadata; } end @@ -386,6 +391,7 @@ class ['self] iter_crate_with_span = global_decls; trait_decls; trait_impls; + unit_metadata; } = crate in @@ -404,7 +410,8 @@ class ['self] iter_crate_with_span = trait_decls; TraitImplId.Map.iter (fun _ -> self#visit_trait_impl decl_span_info) - trait_impls + trait_impls; + self#visit_global_decl_ref decl_span_info unit_metadata end (** For error reporting: compute which local definitions (transitively) depend diff --git a/charon/src/ast/gast_utils.rs b/charon/src/ast/gast_utils.rs index 5adc463df..3b95588b9 100644 --- a/charon/src/ast/gast_utils.rs +++ b/charon/src/ast/gast_utils.rs @@ -43,6 +43,13 @@ impl Body { } impl Locals { + pub fn new(arg_count: usize) -> Self { + Self { + arg_count, + locals: Default::default(), + } + } + /// Creates a new variable and returns a place pointing to it. pub fn new_var(&mut self, name: Option, ty: Ty) -> Place { let local_id = self.locals.push_with(|index| Local { diff --git a/charon/src/ast/krate.rs b/charon/src/ast/krate.rs index 9f7bca252..43e5c8d5f 100644 --- a/charon/src/ast/krate.rs +++ b/charon/src/ast/krate.rs @@ -156,6 +156,9 @@ pub struct TranslatedCrate { pub trait_decls: Vector, /// The translated trait declarations pub trait_impls: Vector, + /// A `const UNIT: () = ();` used whenever we make a thin pointer/reference to avoid creating a + /// local `let unit = ();` variable. It is always `Some`. + pub unit_metadata: Option, /// The re-ordered groups of declarations, initialized as empty. #[drive(skip)] pub ordered_decls: Option, diff --git a/charon/src/ast/names_utils.rs b/charon/src/ast/names_utils.rs index c29828c91..09326df1e 100644 --- a/charon/src/ast/names_utils.rs +++ b/charon/src/ast/names_utils.rs @@ -16,7 +16,7 @@ impl PathElem { impl Name { /// Convert a path like `["std", "alloc", "Box"]` to a name. Needed on occasion when crafting /// names that were not present in the original code. - pub(crate) fn from_path(path: &[&str]) -> Name { + pub fn from_path(path: &[&str]) -> Name { Name { name: path .iter() diff --git a/charon/src/bin/charon-driver/translate/translate_closures.rs b/charon/src/bin/charon-driver/translate/translate_closures.rs index 309a1ac5c..1333b641c 100644 --- a/charon/src/bin/charon-driver/translate/translate_closures.rs +++ b/charon/src/bin/charon-driver/translate/translate_closures.rs @@ -467,10 +467,7 @@ impl ItemTransCtx<'_, '_> { })), }); - let mut locals = Locals { - arg_count: 2, - locals: Vector::new(), - }; + let mut locals = Locals::new(2); let mut statements = vec![]; let mut blocks = Vector::default(); @@ -721,10 +718,7 @@ impl ItemTransCtx<'_, '_> { generics: impl_ref.generics.clone(), }); - let mut locals = Locals { - arg_count: signature.inputs.len(), - locals: Vector::new(), - }; + let mut locals = Locals::new(signature.inputs.len()); let mut statements = vec![]; let mut blocks = Vector::default(); diff --git a/charon/src/bin/charon-driver/translate/translate_crate.rs b/charon/src/bin/charon-driver/translate/translate_crate.rs index fe984d5c6..562368d2e 100644 --- a/charon/src/bin/charon-driver/translate/translate_crate.rs +++ b/charon/src/bin/charon-driver/translate/translate_crate.rs @@ -660,6 +660,8 @@ pub fn translate<'tcx, 'ctx>( &ctx.items_to_translate ); + ctx.translate_unit_metadata_const(); + // Translate. // // For as long as the queue of items to translate is not empty, we pop the top item and diff --git a/charon/src/bin/charon-driver/translate/translate_functions.rs b/charon/src/bin/charon-driver/translate/translate_functions.rs index 2e9710796..28baee089 100644 --- a/charon/src/bin/charon-driver/translate/translate_functions.rs +++ b/charon/src/bin/charon-driver/translate/translate_functions.rs @@ -9,7 +9,6 @@ use super::translate_ctx::*; use charon_lib::ast::*; use charon_lib::common::*; use charon_lib::formatter::IntoFormatter; -use charon_lib::ids::Vector; use charon_lib::pretty::FmtWithCtx; use charon_lib::ullbc_ast::*; use itertools::Itertools; @@ -107,10 +106,7 @@ impl ItemTransCtx<'_, '_> { let tref = self .translate_type_decl_ref(span, &def.this().with_def_id(self.hax_state(), adt_def_id))?; let output_ty = self.translate_ty(span, output_ty)?; - let mut locals = Locals { - arg_count: fields.len(), - locals: Vector::new(), - }; + let mut locals = Locals::new(fields.len()); locals.new_var(None, output_ty); let args: Vec<_> = fields .iter() diff --git a/charon/src/bin/charon-driver/translate/translate_items.rs b/charon/src/bin/charon-driver/translate/translate_items.rs index 106c81349..efdcb919f 100644 --- a/charon/src/bin/charon-driver/translate/translate_items.rs +++ b/charon/src/bin/charon-driver/translate/translate_items.rs @@ -191,6 +191,67 @@ impl<'tcx, 'ctx> TranslateCtx<'tcx> { let item = self.translated.get_item(id); Ok(item.unwrap()) } + + /// Add a `const UNIT: () = ();` const, used as metadata for thin pointers/references. + pub fn translate_unit_metadata_const(&mut self) { + use charon_lib::ullbc_ast::*; + let name = Name::from_path(&["UNIT_METADATA"]); + let item_meta = ItemMeta { + name, + span: Span::dummy(), + source_text: None, + attr_info: AttrInfo::default(), + is_local: false, + opacity: ItemOpacity::Foreign, + lang_item: None, + }; + + let body = { + let mut body = GExprBody { + span: Span::dummy(), + locals: Locals::new(0), + comments: Default::default(), + body: Vector::default(), + }; + let _ = body.locals.new_var(None, Ty::mk_unit()); + body.body.push(BlockData { + statements: Default::default(), + terminator: Terminator::new(Span::dummy(), TerminatorKind::Return), + }); + body + }; + + let global_id = self.translated.global_decls.reserve_slot(); + let initializer = self.translated.fun_decls.push_with(|def_id| FunDecl { + def_id, + item_meta: item_meta.clone(), + kind: ItemKind::TopLevel, + is_global_initializer: Some(global_id), + signature: FunSig { + is_unsafe: false, + generics: Default::default(), + inputs: vec![], + output: Ty::mk_unit(), + }, + body: Ok(Body::Unstructured(body)), + }); + self.translated.global_decls.set_slot( + global_id, + GlobalDecl { + def_id: global_id, + item_meta, + generics: Default::default(), + ty: Ty::mk_unit(), + kind: ItemKind::TopLevel, + global_kind: GlobalKind::NamedConst, + init: initializer, + }, + ); + self.translated.unit_metadata = Some(GlobalDeclRef { + id: global_id, + generics: Box::new(GenericArgs::empty()), + }); + } } impl ItemTransCtx<'_, '_> { diff --git a/charon/src/bin/charon-driver/translate/translate_trait_objects.rs b/charon/src/bin/charon-driver/translate/translate_trait_objects.rs index c65183aef..b9ca84f9a 100644 --- a/charon/src/bin/charon-driver/translate/translate_trait_objects.rs +++ b/charon/src/bin/charon-driver/translate/translate_trait_objects.rs @@ -636,10 +636,7 @@ impl ItemTransCtx<'_, '_> { impl_def: &hax::FullDef, vtable_struct_ref: TypeDeclRef, ) -> Result { - let mut locals = Locals { - arg_count: 0, - locals: Vector::new(), - }; + let mut locals = Locals::new(0); let ret_ty = Ty::new(TyKind::Adt(vtable_struct_ref.clone())); let ret_place = locals.new_var(Some("ret".into()), ret_ty.clone()); diff --git a/charon/src/transform/insert_ptr_metadata.rs b/charon/src/transform/insert_ptr_metadata.rs index ab96b80e7..7a33ee5fb 100644 --- a/charon/src/transform/insert_ptr_metadata.rs +++ b/charon/src/transform/insert_ptr_metadata.rs @@ -154,9 +154,8 @@ fn get_ptr_metadata_aux( /// No metadata, use unit, but as const ADT (for `()`) is not allowed /// Introduce a new local to hold this fn no_metadata(ctx: &mut T) -> Operand { - let new_place = ctx.fresh_var(None, Ty::mk_unit()); - ctx.insert_assn_stmt(new_place.clone(), Rvalue::unit_value()); - Operand::Move(new_place) + let unit_meta = ctx.get_ctx().translated.unit_metadata.clone().unwrap(); + Operand::Copy(Place::new_global(unit_meta, Ty::mk_unit())) } /// When a place is to be referred to as a reference or a raw pointer, we compute the metadata required diff --git a/charon/tests/cargo/toml.out b/charon/tests/cargo/toml.out index 48334ad10..d232a3ad7 100644 --- a/charon/tests/cargo/toml.out +++ b/charon/tests/cargo/toml.out @@ -37,6 +37,16 @@ where return } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun2() + // Full name: test_cargo_toml::main fn main() { diff --git a/charon/tests/cli.rs b/charon/tests/cli.rs index 1abe9179a..5d1726f17 100644 --- a/charon/tests/cli.rs +++ b/charon/tests/cli.rs @@ -104,12 +104,6 @@ fn charon_cargo_features() -> Result<()> { "Output of `{cmd}` is:\n{stdout:?}\nIt doesn't contain {main:?}." ); - let count_fn = stdout.matches("fn").count(); - ensure!( - count_fn == 1, - "Output of `{cmd}` is:\n{stdout:?}\nThe count of `fn` should only be one." - ); - ensure!( !stdout.contains(take_mut), "Output of `{cmd}` is:\n{stdout:?}\nIt shouldn't contain {take_mut:?}." @@ -123,7 +117,6 @@ fn charon_cargo_target() -> Result<()> { let target = "riscv64gc-unknown-none-elf"; let dir = "tests/cargo/multi-targets"; - let fn_ = "pub fn"; #[cfg(target_family = "unix")] charon(&["cargo", "--print-llbc"], dir, |stdout, cmd| { @@ -132,12 +125,6 @@ fn charon_cargo_target() -> Result<()> { stdout.contains(main), "Output of `{cmd}` is:\n{stdout:?}\nIt doesn't contain {main:?}." ); - - let count_fn = stdout.matches(fn_).count(); - ensure!( - count_fn == 1, - "Output of `{cmd}` is:\n{stdout:?}\nThe count of {fn_:?} should only be one." - ); Ok(()) })?; @@ -148,12 +135,6 @@ fn charon_cargo_target() -> Result<()> { stdout.contains(main), "Output of `{cmd}` is:\n{stdout:?}\nIt doesn't contain {main:?}." ); - - let count_fn = stdout.matches(fn_).count(); - ensure!( - count_fn == 1, - "Output of `{cmd}` is:\n{stdout:?}\nThe count of {fn_:?} should only be one." - ); Ok(()) })?; @@ -164,12 +145,6 @@ fn charon_cargo_target() -> Result<()> { stdout.contains(main), "Output of `{cmd}` is:\n{stdout:?}\nIt doesn't contain {main:?}." ); - - let count_fn = stdout.matches(fn_).count(); - ensure!( - count_fn == 1, - "Output of `{cmd}` is:\n{stdout:?}\nThe count of {fn_:?} should only be one." - ); Ok(()) }) } @@ -187,12 +162,6 @@ fn charon_rustc() -> Result<()> { stdout.contains(fn_), "Output of `{cmd}` is:\n{stdout:?}\nIt doesn't contain {fn_:?}." ); - - let count_fn = stdout.matches("fn").count(); - ensure!( - count_fn == 1, - "Output of `{cmd}` is:\n{stdout:?}\nThe count of `fn` should only be one." - ); Ok(()) }) } diff --git a/charon/tests/crate_data.rs b/charon/tests/crate_data.rs index f538b9c28..7cadbf8b9 100644 --- a/charon/tests/crate_data.rs +++ b/charon/tests/crate_data.rs @@ -93,7 +93,7 @@ fn spans() -> anyhow::Result<()> { } ", )?; - let function = &crate_data.fun_decls[0]; + let function = &crate_data.fun_decls[1]; // Span of the whole function. assert_eq!(repr_span(function.item_meta.span), "2:8-10:9"); @@ -292,20 +292,20 @@ fn attributes() -> anyhow::Result<()> { vec!["clippy::foo"] ); assert_eq!( - unknown_attrs(&crate_data.global_decls[0].item_meta), + unknown_attrs(&crate_data.global_decls[1].item_meta), vec!["clippy::foo"] ); assert_eq!( - unknown_attrs(&crate_data.global_decls[1].item_meta), + unknown_attrs(&crate_data.global_decls[2].item_meta), vec!["clippy::foo"] ); - assert!(unknown_attrs(&crate_data.fun_decls[0].item_meta).is_empty()); + assert!(unknown_attrs(&crate_data.fun_decls[1].item_meta).is_empty()); assert_eq!( - crate_data.fun_decls[0].item_meta.attr_info.inline, + crate_data.fun_decls[1].item_meta.attr_info.inline, Some(InlineAttr::Never) ); assert_eq!( - crate_data.fun_decls[0] + crate_data.fun_decls[1] .item_meta .attr_info .attributes @@ -458,7 +458,7 @@ fn rename_attribute() -> anyhow::Result<()> { ); assert_eq!( - crate_data.fun_decls[0] + crate_data.fun_decls[1] .item_meta .attr_info .rename @@ -467,7 +467,7 @@ fn rename_attribute() -> anyhow::Result<()> { ); assert_eq!( - crate_data.fun_decls[1] + crate_data.fun_decls[2] .item_meta .attr_info .rename @@ -476,7 +476,7 @@ fn rename_attribute() -> anyhow::Result<()> { ); assert_eq!( - crate_data.fun_decls[2] + crate_data.fun_decls[3] .item_meta .attr_info .rename @@ -485,7 +485,7 @@ fn rename_attribute() -> anyhow::Result<()> { ); assert_eq!( - crate_data.fun_decls[4] + crate_data.fun_decls[5] .item_meta .attr_info .rename @@ -539,7 +539,7 @@ fn rename_attribute() -> anyhow::Result<()> { ); assert_eq!( - crate_data.global_decls[0] + crate_data.global_decls[1] .item_meta .attr_info .rename @@ -580,10 +580,11 @@ fn declaration_groups() -> anyhow::Result<()> { "#, )?; - // There are two function items: one for `foo`, one for the initializer of `Trait::FOO`. - assert_eq!(crate_data.fun_decls.iter().count(), 2); + // There are 3 function items: one for `foo`, one for the initializer of `Trait::FOO`, and + // one for the initializer of UNIT_METADATA (always included). + assert_eq!(crate_data.fun_decls.iter().count(), 3); let decl_groups = crate_data.ordered_decls.unwrap(); - assert_eq!(decl_groups.len(), 6); + assert_eq!(decl_groups.len(), 8); Ok(()) } @@ -638,7 +639,7 @@ fn known_trait_method_call() -> Result<(), Box> { } "#, )?; - let function = &crate_data.fun_decls[0]; + let function = &crate_data.fun_decls[1]; assert_eq!( repr_name(&crate_data, &function.item_meta.name), "test_crate::use_default" diff --git a/charon/tests/ui/arrays.out b/charon/tests/ui/arrays.out index c3b913070..50d1be68d 100644 --- a/charon/tests/ui/arrays.out +++ b/charon/tests/ui/arrays.out @@ -268,6 +268,16 @@ pub fn len<'_0, T>(@1: &'_0 (Slice)) -> usize where [@TraitClause0]: Sized, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::AB pub enum AB { A, @@ -297,12 +307,9 @@ where let @0: &'_ (Slice); // return let s@1: &'_ (Array); // arg #1 let @2: &'_ (Array); // anonymous local - let @3: (); // anonymous local storage_live(@2) - storage_live(@3) - @3 := () - @2 := &(*(s@1), move (@3)) + @2 := &(*(s@1), copy (@Global0)) @0 := @ArrayToSliceShared<'_, T, 32 : usize>(move (@2)) storage_dead(@2) return @@ -318,13 +325,10 @@ where let @2: &'_ mut (Slice); // anonymous local let @3: &'_ mut (Array); // anonymous local let @4: usize; // anonymous local - let @5: (); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@5) - @5 := () - @3 := &mut (*(s@1), move (@5)) + @3 := &mut (*(s@1), copy (@Global0)) @2 := @ArrayToSliceMut<'_, T, 32 : usize>(move (@3)) storage_dead(@3) storage_live(@4) @@ -343,13 +347,10 @@ where let s@1: Array; // arg #1 let @2: &'_ (Slice); // anonymous local let @3: &'_ (Array); // anonymous local - let @4: (); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(s@1, move (@4)) + @3 := &(s@1, copy (@Global0)) @2 := @ArrayToSliceShared<'_, T, 32 : usize>(move (@3)) storage_dead(@3) @0 := len<'_, T>[@TraitClause0](move (@2)) @@ -367,13 +368,10 @@ where let s@1: &'_ (Array); // arg #1 let @2: &'_ (Slice); // anonymous local let @3: &'_ (Array); // anonymous local - let @4: (); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(s@1), move (@4)) + @3 := &(*(s@1), copy (@Global0)) @2 := @ArrayToSliceShared<'_, T, 32 : usize>(move (@3)) storage_dead(@3) @0 := len<'_, T>[@TraitClause0](move (@2)) @@ -410,27 +408,18 @@ where let i@2: usize; // arg #2 let @3: &'_ (T); // anonymous local let @4: usize; // anonymous local - let @5: (); // anonymous local - let @6: (); // anonymous local - let @7: (); // anonymous local - let @8: &'_ (Array); // anonymous local - let @9: &'_ (T); // anonymous local + let @5: &'_ (Array); // anonymous local + let @6: &'_ (T); // anonymous local storage_live(@3) storage_live(@4) @4 := copy (i@2) - storage_live(@6) - @6 := () - storage_live(@7) - @7 := () - storage_live(@8) - @8 := &(*(s@1), move (@7)) - storage_live(@9) - @9 := @ArrayIndexShared<'_, T, 32 : usize>(move (@8), copy (@4)) - @3 := &(*(@9), move (@6)) storage_live(@5) - @5 := () - @0 := &(*(@3), move (@5)) + @5 := &(*(s@1), const (@Global0)) + storage_live(@6) + @6 := @ArrayIndexShared<'_, T, 32 : usize>(move (@5), copy (@4)) + @3 := &(*(@6), copy (@Global0)) + @0 := &(*(@3), copy (@Global0)) storage_dead(@4) storage_dead(@3) return @@ -443,19 +432,16 @@ pub fn index_array_u32(@1: Array, @2: usize) -> u32 let s@1: Array; // arg #1 let i@2: usize; // arg #2 let @3: usize; // anonymous local - let @4: (); // anonymous local - let @5: &'_ (Array); // anonymous local - let @6: &'_ (u32); // anonymous local + let @4: &'_ (Array); // anonymous local + let @5: &'_ (u32); // anonymous local storage_live(@3) @3 := copy (i@2) storage_live(@4) - @4 := () + @4 := &(s@1, const (@Global0)) storage_live(@5) - @5 := &(s@1, move (@4)) - storage_live(@6) - @6 := @ArrayIndexShared<'_, u32, 32 : usize>(move (@5), copy (@3)) - @0 := copy (*(@6)) + @5 := @ArrayIndexShared<'_, u32, 32 : usize>(move (@4), copy (@3)) + @0 := copy (*(@5)) storage_dead(@3) return } @@ -466,19 +452,16 @@ pub fn index_array_copy<'_0>(@1: &'_0 (Array)) -> u32 let @0: u32; // return let x@1: &'_ (Array); // arg #1 let @2: usize; // anonymous local - let @3: (); // anonymous local - let @4: &'_ (Array); // anonymous local - let @5: &'_ (u32); // anonymous local + let @3: &'_ (Array); // anonymous local + let @4: &'_ (u32); // anonymous local storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := () + @3 := &(*(x@1), const (@Global0)) storage_live(@4) - @4 := &(*(x@1), move (@3)) - storage_live(@5) - @5 := @ArrayIndexShared<'_, u32, 32 : usize>(move (@4), copy (@2)) - @0 := copy (*(@5)) + @4 := @ArrayIndexShared<'_, u32, 32 : usize>(move (@3), copy (@2)) + @0 := copy (*(@4)) storage_dead(@2) return } @@ -494,32 +477,20 @@ where let @3: &'_ mut (T); // anonymous local let @4: &'_ mut (T); // anonymous local let @5: usize; // anonymous local - let @6: (); // anonymous local - let @7: (); // anonymous local - let @8: (); // anonymous local - let @9: (); // anonymous local - let @10: &'_ mut (Array); // anonymous local - let @11: &'_ mut (T); // anonymous local + let @6: &'_ mut (Array); // anonymous local + let @7: &'_ mut (T); // anonymous local storage_live(@3) storage_live(@4) storage_live(@5) @5 := copy (i@2) - storage_live(@8) - @8 := () - storage_live(@9) - @9 := () - storage_live(@10) - @10 := &mut (*(s@1), move (@9)) - storage_live(@11) - @11 := @ArrayIndexMut<'_, T, 32 : usize>(move (@10), copy (@5)) - @4 := &mut (*(@11), move (@8)) - storage_live(@7) - @7 := () - @3 := &mut (*(@4), move (@7)) storage_live(@6) - @6 := () - @0 := &mut (*(@3), move (@6)) + @6 := &mut (*(s@1), const (@Global0)) + storage_live(@7) + @7 := @ArrayIndexMut<'_, T, 32 : usize>(move (@6), copy (@5)) + @4 := &mut (*(@7), copy (@Global0)) + @3 := &mut (*(@4), copy (@Global0)) + @0 := &mut (*(@3), copy (@Global0)) storage_dead(@5) storage_dead(@4) storage_dead(@3) @@ -536,27 +507,21 @@ where let i@2: usize; // arg #2 let @3: &'_ (T); // anonymous local let @4: usize; // anonymous local - let @5: (); // anonymous local - let @6: (); // anonymous local - let @7: usize; // anonymous local - let @8: &'_ (Slice); // anonymous local - let @9: &'_ (T); // anonymous local + let @5: usize; // anonymous local + let @6: &'_ (Slice); // anonymous local + let @7: &'_ (T); // anonymous local storage_live(@3) storage_live(@4) @4 := copy (i@2) + storage_live(@5) + @5 := ptr_metadata(copy (s@1)) storage_live(@6) - @6 := () + @6 := &(*(s@1), move (@5)) storage_live(@7) - @7 := ptr_metadata(copy (s@1)) - storage_live(@8) - @8 := &(*(s@1), move (@7)) - storage_live(@9) - @9 := @SliceIndexShared<'_, T>(move (@8), copy (@4)) - @3 := &(*(@9), move (@6)) - storage_live(@5) - @5 := () - @0 := &(*(@3), move (@5)) + @7 := @SliceIndexShared<'_, T>(move (@6), copy (@4)) + @3 := &(*(@7), copy (@Global0)) + @0 := &(*(@3), copy (@Global0)) storage_dead(@4) storage_dead(@3) return @@ -574,12 +539,9 @@ where let @4: &'_ mut (T); // anonymous local let @5: usize; // anonymous local let @6: usize; // anonymous local - let @7: (); // anonymous local - let @8: (); // anonymous local - let @9: (); // anonymous local - let @10: usize; // anonymous local - let @11: &'_ mut (Slice); // anonymous local - let @12: &'_ mut (T); // anonymous local + let @7: usize; // anonymous local + let @8: &'_ mut (Slice); // anonymous local + let @9: &'_ mut (T); // anonymous local storage_live(@3) storage_live(@4) @@ -587,21 +549,15 @@ where @5 := copy (i@2) storage_live(@6) @6 := ptr_metadata(copy (s@1)) - storage_live(@9) - @9 := () - storage_live(@10) - @10 := ptr_metadata(copy (s@1)) - storage_live(@11) - @11 := &mut (*(s@1), move (@10)) - storage_live(@12) - @12 := @SliceIndexMut<'_, T>(move (@11), copy (@5)) - @4 := &mut (*(@12), move (@9)) - storage_live(@8) - @8 := () - @3 := &mut (*(@4), move (@8)) storage_live(@7) - @7 := () - @0 := &mut (*(@3), move (@7)) + @7 := ptr_metadata(copy (s@1)) + storage_live(@8) + @8 := &mut (*(s@1), move (@7)) + storage_live(@9) + @9 := @SliceIndexMut<'_, T>(move (@8), copy (@5)) + @4 := &mut (*(@9), copy (@Global0)) + @3 := &mut (*(@4), copy (@Global0)) + @0 := &mut (*(@3), copy (@Global0)) storage_dead(@5) storage_dead(@4) storage_dead(@3) @@ -711,12 +667,9 @@ pub fn array_to_slice_shared_<'_0>(@1: &'_0 (Array)) -> &'_0 (S let @0: &'_ (Slice); // return let x@1: &'_ (Array); // arg #1 let @2: &'_ (Array); // anonymous local - let @3: (); // anonymous local storage_live(@2) - storage_live(@3) - @3 := () - @2 := &(*(x@1), move (@3)) + @2 := &(*(x@1), copy (@Global0)) @0 := @ArrayToSliceShared<'_, u32, 32 : usize>(move (@2)) storage_dead(@2) return @@ -730,13 +683,10 @@ pub fn array_to_slice_mut_<'_0>(@1: &'_0 mut (Array)) -> &'_0 m let @2: &'_ mut (Slice); // anonymous local let @3: &'_ mut (Array); // anonymous local let @4: usize; // anonymous local - let @5: (); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@5) - @5 := () - @3 := &mut (*(x@1), move (@5)) + @3 := &mut (*(x@1), copy (@Global0)) @2 := @ArrayToSliceMut<'_, u32, 32 : usize>(move (@3)) storage_dead(@3) storage_live(@4) @@ -759,16 +709,13 @@ pub fn array_subslice_shared_<'_0>(@1: &'_0 (Array), @2: usize, let @7: Range[Sized]; // anonymous local let @8: usize; // anonymous local let @9: usize; // anonymous local - let @10: (); // anonymous local + let @10: usize; // anonymous local let @11: usize; // anonymous local - let @12: usize; // anonymous local storage_live(@4) storage_live(@5) storage_live(@6) - storage_live(@10) - @10 := () - @6 := &(*(x@1), move (@10)) + @6 := &(*(x@1), copy (@Global0)) storage_live(@7) storage_live(@8) @8 := copy (y@2) @@ -780,12 +727,12 @@ pub fn array_subslice_shared_<'_0>(@1: &'_0 (Array), @2: usize, @5 := {impl Index for Array}::index<'_, u32, Range[Sized], Slice, 32 : usize>[Sized, Sized[Sized]>, {impl Index for Slice}[Sized], Slice>[Sized, Sized[Sized]>, {impl SliceIndex, Slice> for Range[Sized]}[Sized]]](move (@6), move (@7)) storage_dead(@7) storage_dead(@6) - storage_live(@12) - @12 := ptr_metadata(copy (@5)) - @4 := &(*(@5), move (@12)) storage_live(@11) - @11 := ptr_metadata(copy (@4)) - @0 := &(*(@4), move (@11)) + @11 := ptr_metadata(copy (@5)) + @4 := &(*(@5), move (@11)) + storage_live(@10) + @10 := ptr_metadata(copy (@4)) + @0 := &(*(@4), move (@10)) storage_dead(@5) storage_dead(@4) return @@ -805,18 +752,15 @@ pub fn array_subslice_mut_<'_0>(@1: &'_0 mut (Array), @2: usize let @8: Range[Sized]; // anonymous local let @9: usize; // anonymous local let @10: usize; // anonymous local - let @11: (); // anonymous local + let @11: usize; // anonymous local let @12: usize; // anonymous local let @13: usize; // anonymous local - let @14: usize; // anonymous local storage_live(@4) storage_live(@5) storage_live(@6) storage_live(@7) - storage_live(@11) - @11 := () - @7 := &mut (*(x@1), move (@11)) + @7 := &mut (*(x@1), copy (@Global0)) storage_live(@8) storage_live(@9) @9 := copy (y@2) @@ -828,15 +772,15 @@ pub fn array_subslice_mut_<'_0>(@1: &'_0 mut (Array), @2: usize @6 := {impl IndexMut for Array}::index_mut<'_, u32, Range[Sized], Slice, 32 : usize>[Sized, Sized[Sized]>, {impl IndexMut for Slice}[Sized], Slice>[Sized, Sized[Sized]>, {impl SliceIndex, Slice> for Range[Sized]}[Sized]]](move (@7), move (@8)) storage_dead(@8) storage_dead(@7) - storage_live(@14) - @14 := ptr_metadata(copy (@6)) - @5 := &mut (*(@6), move (@14)) storage_live(@13) - @13 := ptr_metadata(copy (@5)) - @4 := &mut (*(@5), move (@13)) + @13 := ptr_metadata(copy (@6)) + @5 := &mut (*(@6), move (@13)) storage_live(@12) - @12 := ptr_metadata(copy (@4)) - @0 := &mut (*(@4), move (@12)) + @12 := ptr_metadata(copy (@5)) + @4 := &mut (*(@5), move (@12)) + storage_live(@11) + @11 := ptr_metadata(copy (@4)) + @0 := &mut (*(@4), move (@11)) storage_dead(@6) storage_dead(@5) storage_dead(@4) @@ -852,27 +796,21 @@ where let s@1: &'_ (Slice); // arg #1 let @2: &'_ (T); // anonymous local let @3: usize; // anonymous local - let @4: (); // anonymous local - let @5: (); // anonymous local - let @6: usize; // anonymous local - let @7: &'_ (Slice); // anonymous local - let @8: &'_ (T); // anonymous local + let @4: usize; // anonymous local + let @5: &'_ (Slice); // anonymous local + let @6: &'_ (T); // anonymous local storage_live(@2) storage_live(@3) @3 := const (0 : usize) + storage_live(@4) + @4 := ptr_metadata(copy (s@1)) storage_live(@5) - @5 := () + @5 := &(*(s@1), move (@4)) storage_live(@6) - @6 := ptr_metadata(copy (s@1)) - storage_live(@7) - @7 := &(*(s@1), move (@6)) - storage_live(@8) - @8 := @SliceIndexShared<'_, T>(move (@7), copy (@3)) - @2 := &(*(@8), move (@5)) - storage_live(@4) - @4 := () - @0 := &(*(@2), move (@4)) + @6 := @SliceIndexShared<'_, T>(move (@5), copy (@3)) + @2 := &(*(@6), copy (@Global0)) + @0 := &(*(@2), copy (@Global0)) storage_dead(@3) storage_dead(@2) return @@ -887,27 +825,18 @@ where let s@1: &'_ (Array); // arg #1 let @2: &'_ (T); // anonymous local let @3: usize; // anonymous local - let @4: (); // anonymous local - let @5: (); // anonymous local - let @6: (); // anonymous local - let @7: &'_ (Array); // anonymous local - let @8: &'_ (T); // anonymous local + let @4: &'_ (Array); // anonymous local + let @5: &'_ (T); // anonymous local storage_live(@2) storage_live(@3) @3 := const (0 : usize) - storage_live(@5) - @5 := () - storage_live(@6) - @6 := () - storage_live(@7) - @7 := &(*(s@1), move (@6)) - storage_live(@8) - @8 := @ArrayIndexShared<'_, T, 32 : usize>(move (@7), copy (@3)) - @2 := &(*(@8), move (@5)) storage_live(@4) - @4 := () - @0 := &(*(@2), move (@4)) + @4 := &(*(s@1), const (@Global0)) + storage_live(@5) + @5 := @ArrayIndexShared<'_, T, 32 : usize>(move (@4), copy (@3)) + @2 := &(*(@5), copy (@Global0)) + @0 := &(*(@2), copy (@Global0)) storage_dead(@3) storage_dead(@2) return @@ -922,30 +851,24 @@ pub fn index_index_array(@1: Array, 32 : usize>, @2: usiz let j@3: usize; // arg #3 let @4: usize; // anonymous local let @5: usize; // anonymous local - let @6: (); // anonymous local - let @7: &'_ (Array, 32 : usize>); // anonymous local + let @6: &'_ (Array, 32 : usize>); // anonymous local + let @7: &'_ (Array); // anonymous local let @8: &'_ (Array); // anonymous local - let @9: (); // anonymous local - let @10: &'_ (Array); // anonymous local - let @11: &'_ (u32); // anonymous local + let @9: &'_ (u32); // anonymous local storage_live(@4) @4 := copy (i@2) storage_live(@5) @5 := copy (j@3) storage_live(@6) - @6 := () + @6 := &(s@1, const (@Global0)) storage_live(@7) - @7 := &(s@1, move (@6)) + @7 := @ArrayIndexShared<'_, Array, 32 : usize>(move (@6), copy (@4)) storage_live(@8) - @8 := @ArrayIndexShared<'_, Array, 32 : usize>(move (@7), copy (@4)) + @8 := &(*(@7), const (@Global0)) storage_live(@9) - @9 := () - storage_live(@10) - @10 := &(*(@8), move (@9)) - storage_live(@11) - @11 := @ArrayIndexShared<'_, u32, 32 : usize>(move (@10), copy (@5)) - @0 := copy (*(@11)) + @9 := @ArrayIndexShared<'_, u32, 32 : usize>(move (@8), copy (@5)) + @0 := copy (*(@9)) storage_dead(@5) storage_dead(@4) return @@ -960,30 +883,24 @@ pub fn update_update_array(@1: Array, 32 : usize>, @2: us let j@3: usize; // arg #3 let @4: usize; // anonymous local let @5: usize; // anonymous local - let @6: (); // anonymous local - let @7: &'_ mut (Array, 32 : usize>); // anonymous local + let @6: &'_ mut (Array, 32 : usize>); // anonymous local + let @7: &'_ mut (Array); // anonymous local let @8: &'_ mut (Array); // anonymous local - let @9: (); // anonymous local - let @10: &'_ mut (Array); // anonymous local - let @11: &'_ mut (u32); // anonymous local + let @9: &'_ mut (u32); // anonymous local storage_live(@4) @4 := copy (i@2) storage_live(@5) @5 := copy (j@3) storage_live(@6) - @6 := () + @6 := &mut (s@1, const (@Global0)) storage_live(@7) - @7 := &mut (s@1, move (@6)) + @7 := @ArrayIndexMut<'_, Array, 32 : usize>(move (@6), copy (@4)) storage_live(@8) - @8 := @ArrayIndexMut<'_, Array, 32 : usize>(move (@7), copy (@4)) + @8 := &mut (*(@7), const (@Global0)) storage_live(@9) - @9 := () - storage_live(@10) - @10 := &mut (*(@8), move (@9)) - storage_live(@11) - @11 := @ArrayIndexMut<'_, u32, 32 : usize>(move (@10), copy (@5)) - *(@11) := const (0 : u32) + @9 := @ArrayIndexMut<'_, u32, 32 : usize>(move (@8), copy (@5)) + *(@9) := const (0 : u32) storage_dead(@5) storage_dead(@4) @0 := () @@ -998,30 +915,24 @@ pub fn incr_array_self<'_0>(@1: &'_0 mut (Array)) let s@1: &'_ mut (Array); // arg #1 let @2: usize; // anonymous local let @3: u32; // anonymous local - let @4: (); // anonymous local - let @5: &'_ mut (Array); // anonymous local - let @6: &'_ mut (u32); // anonymous local - let @7: (); // anonymous local - let @8: &'_ (Array); // anonymous local - let @9: &'_ (u32); // anonymous local + let @4: &'_ mut (Array); // anonymous local + let @5: &'_ mut (u32); // anonymous local + let @6: &'_ (Array); // anonymous local + let @7: &'_ (u32); // anonymous local storage_live(@3) storage_live(@2) @2 := const (0 : usize) + storage_live(@6) + @6 := &(*(s@1), const (@Global0)) storage_live(@7) - @7 := () - storage_live(@8) - @8 := &(*(s@1), move (@7)) - storage_live(@9) - @9 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@8), copy (@2)) - @3 := copy (*(@9)) panic.+ const (1 : u32) + @7 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@6), copy (@2)) + @3 := copy (*(@7)) panic.+ const (1 : u32) storage_live(@4) - @4 := () + @4 := &mut (*(s@1), const (@Global0)) storage_live(@5) - @5 := &mut (*(s@1), move (@4)) - storage_live(@6) - @6 := @ArrayIndexMut<'_, u32, 2 : usize>(move (@5), copy (@2)) - *(@6) := move (@3) + @5 := @ArrayIndexMut<'_, u32, 2 : usize>(move (@4), copy (@2)) + *(@5) := move (@3) storage_dead(@2) @0 := () @0 := () @@ -1144,20 +1055,14 @@ pub fn const_slice() let @2: &'_ (Array); // anonymous local let @3: &'_ (Array); // anonymous local let @4: Array; // anonymous local - let @5: (); // anonymous local - let @6: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := @ArrayRepeat<'_, u32, 2 : usize>(const (0 : u32)) - storage_live(@6) - @6 := () - @3 := &(@4, move (@6)) - storage_live(@5) - @5 := () - @2 := &(*(@3), move (@5)) + @3 := &(@4, copy (@Global0)) + @2 := &(*(@3), copy (@Global0)) @1 := @ArrayToSliceShared<'_, u32, 2 : usize>(move (@2)) storage_dead(@2) storage_dead(@3) @@ -1188,12 +1093,6 @@ pub fn take_all() let @14: &'_ mut (Slice); // anonymous local let @15: &'_ mut (Array); // anonymous local let @16: &'_ mut (Array); // anonymous local - let @17: (); // anonymous local - let @18: (); // anonymous local - let @19: (); // anonymous local - let @20: (); // anonymous local - let @21: (); // anonymous local - let @22: (); // anonymous local storage_live(x@1) x@1 := @ArrayRepeat<'_, u32, 2 : usize>(const (0 : u32)) @@ -1213,13 +1112,9 @@ pub fn take_all() storage_live(@6) storage_live(@7) storage_live(@8) - storage_live(@18) // x passed by address, there is a reborrow here - @18 := () - @8 := &(x@1, move (@18)) - storage_live(@17) - @17 := () - @7 := &(*(@8), move (@17)) + @8 := &(x@1, copy (@Global0)) + @7 := &(*(@8), copy (@Global0)) @6 := take_array_borrow<'_>(move (@7)) storage_dead(@7) storage_dead(@8) @@ -1228,13 +1123,9 @@ pub fn take_all() storage_live(@10) storage_live(@11) storage_live(@12) - storage_live(@20) // automatic cast from array to slice (spanning entire array) - @20 := () - @12 := &(x@1, move (@20)) - storage_live(@19) - @19 := () - @11 := &(*(@12), move (@19)) + @12 := &(x@1, copy (@Global0)) + @11 := &(*(@12), copy (@Global0)) @10 := @ArrayToSliceShared<'_, u32, 2 : usize>(move (@11)) storage_dead(@11) @9 := take_slice<'_>(move (@10)) @@ -1245,14 +1136,10 @@ pub fn take_all() storage_live(@14) storage_live(@15) storage_live(@16) - storage_live(@22) // note that both appear as SliceNew expressions, meaning the SliceNew UnOp is overloaded for // mut and non-mut cases - @22 := () - @16 := &mut (x@1, move (@22)) - storage_live(@21) - @21 := () - @15 := &mut (*(@16), move (@21)) + @16 := &mut (x@1, copy (@Global0)) + @15 := &mut (*(@16), copy (@Global0)) @14 := @ArrayToSliceMut<'_, u32, 2 : usize>(move (@15)) storage_dead(@15) @13 := take_mut_slice<'_>(move (@14)) @@ -1271,19 +1158,16 @@ pub fn index_array(@1: Array) -> u32 let @0: u32; // return let x@1: Array; // arg #1 let @2: usize; // anonymous local - let @3: (); // anonymous local - let @4: &'_ (Array); // anonymous local - let @5: &'_ (u32); // anonymous local + let @3: &'_ (Array); // anonymous local + let @4: &'_ (u32); // anonymous local storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := () + @3 := &(x@1, const (@Global0)) storage_live(@4) - @4 := &(x@1, move (@3)) - storage_live(@5) - @5 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@4), copy (@2)) - @0 := copy (*(@5)) + @4 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@3), copy (@2)) + @0 := copy (*(@4)) storage_dead(@2) return } @@ -1294,19 +1178,16 @@ pub fn index_array_borrow<'_0>(@1: &'_0 (Array)) -> u32 let @0: u32; // return let x@1: &'_ (Array); // arg #1 let @2: usize; // anonymous local - let @3: (); // anonymous local - let @4: &'_ (Array); // anonymous local - let @5: &'_ (u32); // anonymous local + let @3: &'_ (Array); // anonymous local + let @4: &'_ (u32); // anonymous local storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := () + @3 := &(*(x@1), const (@Global0)) storage_live(@4) - @4 := &(*(x@1), move (@3)) - storage_live(@5) - @5 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@4), copy (@2)) - @0 := copy (*(@5)) + @4 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@3), copy (@2)) + @0 := copy (*(@4)) storage_dead(@2) return } @@ -1391,12 +1272,6 @@ pub fn index_all() -> u32 let @25: &'_ mut (Array); // anonymous local let @26: &'_ mut (Array); // anonymous local let @27: u32; // anonymous local - let @28: (); // anonymous local - let @29: (); // anonymous local - let @30: (); // anonymous local - let @31: (); // anonymous local - let @32: (); // anonymous local - let @33: (); // anonymous local storage_live(_y@4) storage_live(_z@5) @@ -1441,12 +1316,8 @@ pub fn index_all() -> u32 storage_live(@14) storage_live(@15) storage_live(@16) - storage_live(@29) - @29 := () - @16 := &(x@1, move (@29)) - storage_live(@28) - @28 := () - @15 := &(*(@16), move (@28)) + @16 := &(x@1, copy (@Global0)) + @15 := &(*(@16), copy (@Global0)) @14 := index_array_borrow<'_>(move (@15)) storage_dead(@15) @17 := copy (@8) panic.+ copy (@14) @@ -1457,12 +1328,8 @@ pub fn index_all() -> u32 storage_live(@19) storage_live(@20) storage_live(@21) - storage_live(@31) - @31 := () - @21 := &(x@1, move (@31)) - storage_live(@30) - @30 := () - @20 := &(*(@21), move (@30)) + @21 := &(x@1, copy (@Global0)) + @20 := &(*(@21), copy (@Global0)) @19 := @ArrayToSliceShared<'_, u32, 2 : usize>(move (@20)) storage_dead(@20) @18 := index_slice_u32_0<'_>(move (@19)) @@ -1475,12 +1342,8 @@ pub fn index_all() -> u32 storage_live(@24) storage_live(@25) storage_live(@26) - storage_live(@33) - @33 := () - @26 := &mut (x@1, move (@33)) - storage_live(@32) - @32 := () - @25 := &mut (*(@26), move (@32)) + @26 := &mut (x@1, copy (@Global0)) + @25 := &mut (*(@26), copy (@Global0)) @24 := @ArrayToSliceMut<'_, u32, 2 : usize>(move (@25)) storage_dead(@25) @23 := index_mut_slice_u32_0<'_>(move (@24)) @@ -1502,19 +1365,16 @@ pub fn update_array(@1: Array) let @0: (); // return let x@1: Array; // arg #1 let @2: usize; // anonymous local - let @3: (); // anonymous local - let @4: &'_ mut (Array); // anonymous local - let @5: &'_ mut (u32); // anonymous local + let @3: &'_ mut (Array); // anonymous local + let @4: &'_ mut (u32); // anonymous local storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := () + @3 := &mut (x@1, const (@Global0)) storage_live(@4) - @4 := &mut (x@1, move (@3)) - storage_live(@5) - @5 := @ArrayIndexMut<'_, u32, 2 : usize>(move (@4), copy (@2)) - *(@5) := const (1 : u32) + @4 := @ArrayIndexMut<'_, u32, 2 : usize>(move (@3), copy (@2)) + *(@4) := const (1 : u32) @0 := () storage_dead(@2) @0 := () @@ -1527,19 +1387,16 @@ pub fn update_array_mut_borrow<'_0>(@1: &'_0 mut (Array)) let @0: (); // return let x@1: &'_ mut (Array); // arg #1 let @2: usize; // anonymous local - let @3: (); // anonymous local - let @4: &'_ mut (Array); // anonymous local - let @5: &'_ mut (u32); // anonymous local + let @3: &'_ mut (Array); // anonymous local + let @4: &'_ mut (u32); // anonymous local storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := () + @3 := &mut (*(x@1), const (@Global0)) storage_live(@4) - @4 := &mut (*(x@1), move (@3)) - storage_live(@5) - @5 := @ArrayIndexMut<'_, u32, 2 : usize>(move (@4), copy (@2)) - *(@5) := const (1 : u32) + @4 := @ArrayIndexMut<'_, u32, 2 : usize>(move (@3), copy (@2)) + *(@4) := const (1 : u32) @0 := () storage_dead(@2) @0 := () @@ -1590,10 +1447,6 @@ pub fn update_all() let @10: &'_ mut (Slice); // anonymous local let @11: &'_ mut (Array); // anonymous local let @12: &'_ mut (Array); // anonymous local - let @13: (); // anonymous local - let @14: (); // anonymous local - let @15: (); // anonymous local - let @16: (); // anonymous local storage_live(x@1) x@1 := @ArrayRepeat<'_, u32, 2 : usize>(const (0 : u32)) @@ -1612,12 +1465,8 @@ pub fn update_all() storage_live(@6) storage_live(@7) storage_live(@8) - storage_live(@14) - @14 := () - @8 := &mut (x@1, move (@14)) - storage_live(@13) - @13 := () - @7 := &two-phase-mut (*(@8), move (@13)) + @8 := &mut (x@1, copy (@Global0)) + @7 := &two-phase-mut (*(@8), copy (@Global0)) @6 := update_array_mut_borrow<'_>(move (@7)) storage_dead(@7) storage_dead(@8) @@ -1626,12 +1475,8 @@ pub fn update_all() storage_live(@10) storage_live(@11) storage_live(@12) - storage_live(@16) - @16 := () - @12 := &mut (x@1, move (@16)) - storage_live(@15) - @15 := () - @11 := &mut (*(@12), move (@15)) + @12 := &mut (x@1, copy (@Global0)) + @11 := &mut (*(@12), copy (@Global0)) @10 := @ArrayToSliceMut<'_, u32, 2 : usize>(move (@11)) storage_dead(@11) @9 := update_mut_slice<'_>(move (@10)) @@ -1655,9 +1500,8 @@ pub fn range_all() let @5: &'_ mut (Slice); // anonymous local let @6: &'_ mut (Array); // anonymous local let @7: Range[Sized]; // anonymous local - let @8: (); // anonymous local + let @8: usize; // anonymous local let @9: usize; // anonymous local - let @10: usize; // anonymous local storage_live(x@1) x@1 := @ArrayRepeat<'_, u32, 4 : usize>(const (0 : u32)) @@ -1666,21 +1510,19 @@ pub fn range_all() storage_live(@4) storage_live(@5) storage_live(@6) - storage_live(@8) // CONFIRM: there is no way to shrink [T;N] into [T;M] with M for Array}::index_mut<'_, u32, Range[Sized], Slice, 4 : usize>[Sized, Sized[Sized]>, {impl IndexMut for Slice}[Sized], Slice>[Sized, Sized[Sized]>, {impl SliceIndex, Slice> for Range[Sized]}[Sized]]](move (@6), move (@7)) storage_dead(@7) storage_dead(@6) - storage_live(@10) - @10 := ptr_metadata(copy (@5)) - @4 := &mut (*(@5), move (@10)) storage_live(@9) - @9 := ptr_metadata(copy (@4)) - @3 := &two-phase-mut (*(@4), move (@9)) + @9 := ptr_metadata(copy (@5)) + @4 := &mut (*(@5), move (@9)) + storage_live(@8) + @8 := ptr_metadata(copy (@4)) + @3 := &two-phase-mut (*(@4), move (@8)) @2 := update_mut_slice<'_>(move (@3)) storage_dead(@3) storage_dead(@5) @@ -1699,21 +1541,18 @@ pub fn deref_array_borrow<'_0>(@1: &'_0 (Array)) -> u32 let x@1: &'_ (Array); // arg #1 let x@2: Array; // local let @3: usize; // anonymous local - let @4: (); // anonymous local - let @5: &'_ (Array); // anonymous local - let @6: &'_ (u32); // anonymous local + let @4: &'_ (Array); // anonymous local + let @5: &'_ (u32); // anonymous local storage_live(x@2) x@2 := copy (*(x@1)) storage_live(@3) @3 := const (0 : usize) storage_live(@4) - @4 := () + @4 := &(x@2, const (@Global0)) storage_live(@5) - @5 := &(x@2, move (@4)) - storage_live(@6) - @6 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@5), copy (@3)) - @0 := copy (*(@6)) + @5 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@4), copy (@3)) + @0 := copy (*(@5)) storage_dead(x@2) storage_dead(@3) return @@ -1726,21 +1565,18 @@ pub fn deref_array_mut_borrow<'_0>(@1: &'_0 mut (Array)) -> u32 let x@1: &'_ mut (Array); // arg #1 let x@2: Array; // local let @3: usize; // anonymous local - let @4: (); // anonymous local - let @5: &'_ (Array); // anonymous local - let @6: &'_ (u32); // anonymous local + let @4: &'_ (Array); // anonymous local + let @5: &'_ (u32); // anonymous local storage_live(x@2) x@2 := copy (*(x@1)) storage_live(@3) @3 := const (0 : usize) storage_live(@4) - @4 := () + @4 := &(x@2, const (@Global0)) storage_live(@5) - @5 := &(x@2, move (@4)) - storage_live(@6) - @6 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@5), copy (@3)) - @0 := copy (*(@6)) + @5 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@4), copy (@3)) + @0 := copy (*(@5)) storage_dead(x@2) storage_dead(@3) return @@ -2040,23 +1876,17 @@ pub fn f0() let @4: Array; // anonymous local let @5: usize; // anonymous local let @6: usize; // anonymous local - let @7: (); // anonymous local - let @8: (); // anonymous local - let @9: usize; // anonymous local - let @10: &'_ mut (Slice); // anonymous local - let @11: &'_ mut (u32); // anonymous local + let @7: usize; // anonymous local + let @8: &'_ mut (Slice); // anonymous local + let @9: &'_ mut (u32); // anonymous local storage_live(s@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := [const (1 : u32), const (2 : u32)] - storage_live(@8) - @8 := () - @3 := &mut (@4, move (@8)) - storage_live(@7) - @7 := () - @2 := &mut (*(@3), move (@7)) + @3 := &mut (@4, copy (@Global0)) + @2 := &mut (*(@3), copy (@Global0)) s@1 := @ArrayToSliceMut<'_, u32, 2 : usize>(move (@2)) storage_dead(@2) storage_dead(@3) @@ -2064,13 +1894,13 @@ pub fn f0() @5 := const (0 : usize) storage_live(@6) @6 := ptr_metadata(copy (s@1)) + storage_live(@7) + @7 := ptr_metadata(copy (s@1)) + storage_live(@8) + @8 := &mut (*(s@1), move (@7)) storage_live(@9) - @9 := ptr_metadata(copy (s@1)) - storage_live(@10) - @10 := &mut (*(s@1), move (@9)) - storage_live(@11) - @11 := @SliceIndexMut<'_, u32>(move (@10), copy (@5)) - *(@11) := const (1 : u32) + @9 := @SliceIndexMut<'_, u32>(move (@8), copy (@5)) + *(@9) := const (1 : u32) storage_dead(@5) @0 := () storage_dead(@4) @@ -2085,21 +1915,18 @@ pub fn f1() let @0: (); // return let s@1: Array; // local let @2: usize; // anonymous local - let @3: (); // anonymous local - let @4: &'_ mut (Array); // anonymous local - let @5: &'_ mut (u32); // anonymous local + let @3: &'_ mut (Array); // anonymous local + let @4: &'_ mut (u32); // anonymous local storage_live(s@1) s@1 := [const (1 : u32), const (2 : u32)] storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := () + @3 := &mut (s@1, const (@Global0)) storage_live(@4) - @4 := &mut (s@1, move (@3)) - storage_live(@5) - @5 := @ArrayIndexMut<'_, u32, 2 : usize>(move (@4), copy (@2)) - *(@5) := const (1 : u32) + @4 := @ArrayIndexMut<'_, u32, 2 : usize>(move (@3), copy (@2)) + *(@4) := const (1 : u32) storage_dead(@2) @0 := () storage_dead(s@1) @@ -2131,16 +1958,13 @@ pub fn f4<'_0>(@1: &'_0 (Array), @2: usize, @3: usize) -> &'_0 let @7: Range[Sized]; // anonymous local let @8: usize; // anonymous local let @9: usize; // anonymous local - let @10: (); // anonymous local + let @10: usize; // anonymous local let @11: usize; // anonymous local - let @12: usize; // anonymous local storage_live(@4) storage_live(@5) storage_live(@6) - storage_live(@10) - @10 := () - @6 := &(*(x@1), move (@10)) + @6 := &(*(x@1), copy (@Global0)) storage_live(@7) storage_live(@8) @8 := copy (y@2) @@ -2152,12 +1976,12 @@ pub fn f4<'_0>(@1: &'_0 (Array), @2: usize, @3: usize) -> &'_0 @5 := {impl Index for Array}::index<'_, u32, Range[Sized], Slice, 32 : usize>[Sized, Sized[Sized]>, {impl Index for Slice}[Sized], Slice>[Sized, Sized[Sized]>, {impl SliceIndex, Slice> for Range[Sized]}[Sized]]](move (@6), move (@7)) storage_dead(@7) storage_dead(@6) - storage_live(@12) - @12 := ptr_metadata(copy (@5)) - @4 := &(*(@5), move (@12)) storage_live(@11) - @11 := ptr_metadata(copy (@4)) - @0 := &(*(@4), move (@11)) + @11 := ptr_metadata(copy (@5)) + @4 := &(*(@5), move (@11)) + storage_live(@10) + @10 := ptr_metadata(copy (@4)) + @0 := &(*(@4), move (@10)) storage_dead(@5) storage_dead(@4) return @@ -2179,14 +2003,9 @@ pub fn f3() -> u32 let @10: &'_ (Slice); // anonymous local let @11: &'_ (Array); // anonymous local let @12: &'_ (Array); // anonymous local - let @13: (); // anonymous local - let @14: (); // anonymous local - let @15: (); // anonymous local - let @16: (); // anonymous local - let @17: usize; // anonymous local - let @18: (); // anonymous local - let @19: &'_ (Array); // anonymous local - let @20: &'_ (u32); // anonymous local + let @13: usize; // anonymous local + let @14: &'_ (Array); // anonymous local + let @15: &'_ (u32); // anonymous local storage_live(a@1) a@1 := [const (1 : u32), const (2 : u32)] @@ -2194,13 +2013,11 @@ pub fn f3() -> u32 storage_live(@3) storage_live(@4) @4 := const (0 : usize) - storage_live(@18) - @18 := () - storage_live(@19) - @19 := &(a@1, move (@18)) - storage_live(@20) - @20 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@19), copy (@4)) - @3 := copy (*(@20)) + storage_live(@14) + @14 := &(a@1, const (@Global0)) + storage_live(@15) + @15 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@14), copy (@4)) + @3 := copy (*(@15)) @2 := f2(move (@3)) storage_dead(@3) storage_dead(@4) @@ -2210,28 +2027,20 @@ pub fn f3() -> u32 storage_live(@6) storage_live(@7) storage_live(@8) - storage_live(@16) - @16 := () - @8 := &(a@1, move (@16)) - storage_live(@15) - @15 := () - @7 := &(*(@8), move (@15)) + @8 := &(a@1, copy (@Global0)) + @7 := &(*(@8), copy (@Global0)) @6 := @ArrayToSliceShared<'_, u32, 2 : usize>(move (@7)) storage_dead(@7) storage_live(@9) storage_live(@10) storage_live(@11) storage_live(@12) - storage_live(@14) - @14 := () - @12 := &(b@5, move (@14)) - storage_live(@13) - @13 := () - @11 := &(*(@12), move (@13)) + @12 := &(b@5, copy (@Global0)) + @11 := &(*(@12), copy (@Global0)) @10 := f4<'_>(move (@11), const (16 : usize), const (18 : usize)) - storage_live(@17) - @17 := ptr_metadata(copy (@10)) - @9 := &(*(@10), move (@17)) + storage_live(@13) + @13 := ptr_metadata(copy (@10)) + @9 := &(*(@10), move (@13)) storage_dead(@11) @0 := sum2<'_, '_>(move (@6), move (@9)) storage_dead(@9) @@ -2262,19 +2071,16 @@ pub fn f5<'_0>(@1: &'_0 (Array)) -> u32 let @0: u32; // return let x@1: &'_ (Array); // arg #1 let @2: usize; // anonymous local - let @3: (); // anonymous local - let @4: &'_ (Array); // anonymous local - let @5: &'_ (u32); // anonymous local + let @3: &'_ (Array); // anonymous local + let @4: &'_ (u32); // anonymous local storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := () + @3 := &(*(x@1), const (@Global0)) storage_live(@4) - @4 := &(*(x@1), move (@3)) - storage_live(@5) - @5 := @ArrayIndexShared<'_, u32, 32 : usize>(move (@4), copy (@2)) - @0 := copy (*(@5)) + @4 := @ArrayIndexShared<'_, u32, 32 : usize>(move (@3), copy (@2)) + @0 := copy (*(@4)) storage_dead(@2) return } @@ -2294,10 +2100,6 @@ pub fn ite() let @9: &'_ mut (Slice); // anonymous local let @10: &'_ mut (Array); // anonymous local let @11: &'_ mut (Array); // anonymous local - let @12: (); // anonymous local - let @13: (); // anonymous local - let @14: (); // anonymous local - let @15: (); // anonymous local storage_live(y@3) storage_live(@4) @@ -2308,10 +2110,6 @@ pub fn ite() storage_live(@9) storage_live(@10) storage_live(@11) - storage_live(@12) - storage_live(@13) - storage_live(@14) - storage_live(@15) storage_live(x@1) x@1 := @ArrayRepeat<'_, u32, 2 : usize>(const (0 : u32)) storage_live(@2) @@ -2323,12 +2121,8 @@ pub fn ite() storage_live(@5) storage_live(@6) storage_live(@7) - storage_live(@13) - @13 := () - @7 := &mut (x@1, move (@13)) - storage_live(@12) - @12 := () - @6 := &mut (*(@7), move (@12)) + @7 := &mut (x@1, copy (@Global0)) + @6 := &mut (*(@7), copy (@Global0)) @5 := @ArrayToSliceMut<'_, u32, 2 : usize>(move (@6)) storage_dead(@6) @4 := index_mut_slice_u32_0<'_>(move (@5)) @@ -2339,12 +2133,8 @@ pub fn ite() storage_live(@9) storage_live(@10) storage_live(@11) - storage_live(@15) - @15 := () - @11 := &mut (y@3, move (@15)) - storage_live(@14) - @14 := () - @10 := &mut (*(@11), move (@14)) + @11 := &mut (y@3, copy (@Global0)) + @10 := &mut (*(@11), copy (@Global0)) @9 := @ArrayToSliceMut<'_, u32, 2 : usize>(move (@10)) storage_dead(@10) @8 := index_mut_slice_u32_0<'_>(move (@9)) @@ -2593,18 +2383,15 @@ fn slice_pattern_1(@1: Array<(), 1 : usize>) let @0: (); // return let x@1: Array<(), 1 : usize>; // arg #1 let _named@2: (); // local - let @3: (); // anonymous local - let @4: &'_ (Array<(), 1 : usize>); // anonymous local - let @5: &'_ (()); // anonymous local + let @3: &'_ (Array<(), 1 : usize>); // anonymous local + let @4: &'_ (()); // anonymous local storage_live(_named@2) storage_live(@3) - @3 := () + @3 := &(x@1, const (@Global0)) storage_live(@4) - @4 := &(x@1, move (@3)) - storage_live(@5) - @5 := @ArrayIndexShared<'_, (), 1 : usize>(move (@4), const (0 : usize)) - _named@2 := copy (*(@5)) + @4 := @ArrayIndexShared<'_, (), 1 : usize>(move (@3), const (0 : usize)) + _named@2 := copy (*(@4)) @0 := () storage_dead(_named@2) @0 := () @@ -2621,40 +2408,31 @@ where let _a@2: &'_ mut (T); // local let _b@3: &'_ mut (T); // local let _c@4: &'_ mut (T); // local - let @5: (); // anonymous local - let @6: &'_ mut (Array<&'_ mut (T), 3 : usize>); // anonymous local - let @7: &'_ mut (&'_ mut (T)); // anonymous local - let @8: (); // anonymous local + let @5: &'_ mut (Array<&'_ mut (T), 3 : usize>); // anonymous local + let @6: &'_ mut (&'_ mut (T)); // anonymous local + let @7: &'_ mut (Array<&'_ mut (T), 3 : usize>); // anonymous local + let @8: &'_ mut (&'_ mut (T)); // anonymous local let @9: &'_ mut (Array<&'_ mut (T), 3 : usize>); // anonymous local let @10: &'_ mut (&'_ mut (T)); // anonymous local - let @11: (); // anonymous local - let @12: &'_ mut (Array<&'_ mut (T), 3 : usize>); // anonymous local - let @13: &'_ mut (&'_ mut (T)); // anonymous local storage_live(_a@2) - storage_live(@11) - @11 := () - storage_live(@12) - @12 := &mut (x@1, move (@11)) - storage_live(@13) - @13 := @ArrayIndexMut<'_, &'_ mut (T), 3 : usize>(move (@12), const (0 : usize)) - _a@2 := move (*(@13)) - storage_live(_b@3) - storage_live(@8) - @8 := () storage_live(@9) - @9 := &mut (x@1, move (@8)) + @9 := &mut (x@1, const (@Global0)) storage_live(@10) - @10 := @ArrayIndexMut<'_, &'_ mut (T), 3 : usize>(move (@9), const (1 : usize)) - _b@3 := move (*(@10)) + @10 := @ArrayIndexMut<'_, &'_ mut (T), 3 : usize>(move (@9), const (0 : usize)) + _a@2 := move (*(@10)) + storage_live(_b@3) + storage_live(@7) + @7 := &mut (x@1, const (@Global0)) + storage_live(@8) + @8 := @ArrayIndexMut<'_, &'_ mut (T), 3 : usize>(move (@7), const (1 : usize)) + _b@3 := move (*(@8)) storage_live(_c@4) storage_live(@5) - @5 := () + @5 := &mut (x@1, const (@Global0)) storage_live(@6) - @6 := &mut (x@1, move (@5)) - storage_live(@7) - @7 := @ArrayIndexMut<'_, &'_ mut (T), 3 : usize>(move (@6), const (2 : usize)) - _c@4 := move (*(@7)) + @6 := @ArrayIndexMut<'_, &'_ mut (T), 3 : usize>(move (@5), const (2 : usize)) + _c@4 := move (*(@6)) @0 := () storage_dead(_c@4) storage_dead(_b@3) @@ -2669,21 +2447,15 @@ fn slice_pattern_3<'_0>(@1: &'_0 (Array<(), 1 : usize>)) let @0: (); // return let x@1: &'_ (Array<(), 1 : usize>); // arg #1 let _named@2: &'_ (()); // local - let @3: (); // anonymous local - let @4: (); // anonymous local - let @5: &'_ (Array<(), 1 : usize>); // anonymous local - let @6: &'_ (()); // anonymous local + let @3: &'_ (Array<(), 1 : usize>); // anonymous local + let @4: &'_ (()); // anonymous local storage_live(_named@2) storage_live(@3) - @3 := () + @3 := &(*(x@1), const (@Global0)) storage_live(@4) - @4 := () - storage_live(@5) - @5 := &(*(x@1), move (@4)) - storage_live(@6) - @6 := @ArrayIndexShared<'_, (), 1 : usize>(move (@5), const (0 : usize)) - _named@2 := &(*(@6), move (@3)) + @4 := @ArrayIndexShared<'_, (), 1 : usize>(move (@3), const (0 : usize)) + _named@2 := &(*(@4), copy (@Global0)) @0 := () storage_dead(_named@2) @0 := () @@ -2699,10 +2471,9 @@ fn slice_pattern_4<'_0>(@1: &'_0 (Slice<()>)) let @3: usize; // anonymous local let @4: bool; // anonymous local let _named@5: &'_ (()); // local - let @6: (); // anonymous local - let @7: usize; // anonymous local - let @8: &'_ (Slice<()>); // anonymous local - let @9: &'_ (()); // anonymous local + let @6: usize; // anonymous local + let @7: &'_ (Slice<()>); // anonymous local + let @8: &'_ (()); // anonymous local storage_live(@2) storage_live(@3) @@ -2719,14 +2490,12 @@ fn slice_pattern_4<'_0>(@1: &'_0 (Slice<()>)) } storage_live(_named@5) storage_live(@6) - @6 := () + @6 := ptr_metadata(copy (x@1)) storage_live(@7) - @7 := ptr_metadata(copy (x@1)) + @7 := &(*(x@1), move (@6)) storage_live(@8) - @8 := &(*(x@1), move (@7)) - storage_live(@9) - @9 := @SliceIndexShared<'_, ()>(move (@8), const (0 : usize)) - _named@5 := &(*(@9), move (@6)) + @8 := @SliceIndexShared<'_, ()>(move (@7), const (0 : usize)) + _named@5 := &(*(@8), copy (@Global0)) @0 := () storage_dead(_named@5) @0 := () diff --git a/charon/tests/ui/arrays_const_generics.out b/charon/tests/ui/arrays_const_generics.out index 78af2aaa8..b216fd091 100644 --- a/charon/tests/ui/arrays_const_generics.out +++ b/charon/tests/ui/arrays_const_generics.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::index_array_generic pub fn index_array_generic(@1: Array, @2: usize) -> u32 { @@ -7,19 +17,16 @@ pub fn index_array_generic(@1: Array, @2: let s@1: Array; // arg #1 let i@2: usize; // arg #2 let @3: usize; // anonymous local - let @4: (); // anonymous local - let @5: &'_ (Array); // anonymous local - let @6: &'_ (u32); // anonymous local + let @4: &'_ (Array); // anonymous local + let @5: &'_ (u32); // anonymous local storage_live(@3) @3 := copy (i@2) storage_live(@4) - @4 := () + @4 := &(s@1, const (@Global0)) storage_live(@5) - @5 := &(s@1, move (@4)) - storage_live(@6) - @6 := @ArrayIndexShared<'_, u32, const N : usize>(move (@5), copy (@3)) - @0 := copy (*(@6)) + @5 := @ArrayIndexShared<'_, u32, const N : usize>(move (@4), copy (@3)) + @0 := copy (*(@5)) storage_dead(@3) return } diff --git a/charon/tests/ui/assoc-const-with-generics.out b/charon/tests/ui/assoc-const-with-generics.out index a00cd650e..ca8756a25 100644 --- a/charon/tests/ui/assoc-const-with-generics.out +++ b/charon/tests/ui/assoc-const-with-generics.out @@ -12,6 +12,16 @@ pub trait Sized non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::V struct V where diff --git a/charon/tests/ui/associated-types.out b/charon/tests/ui/associated-types.out index 1fac15b55..3b0a2018a 100644 --- a/charon/tests/ui/associated-types.out +++ b/charon/tests/ui/associated-types.out @@ -145,6 +145,16 @@ pub fn to_owned<'_0, Self, Clause0_Owned>(@1: &'_0 (Self)) -> Clause0_Owned where [@TraitClause0]: ToOwned, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + trait test_crate::Foo<'a, Self, Self_Item> where Self_Item : 'a, @@ -269,16 +279,13 @@ where let @2: &'_ (Clause1_Item); // anonymous local let @3: Clause1_Item; // anonymous local let @4: Clause1_Item; // anonymous local - let @5: (); // anonymous local storage_live(@2) storage_live(@3) storage_live(@4) @4 := copy (x@1) @3 := @TraitClause1::use_item_provided[@TraitClause2](move (@4)) - storage_live(@5) - @5 := () - @2 := &(@3, move (@5)) + @2 := &(@3, copy (@Global0)) storage_dead(@4) @0 := @TraitClause2::parent_clause1::parent_clause1::clone<'_>(move (@2)) storage_dead(@2) diff --git a/charon/tests/ui/bitwise.out b/charon/tests/ui/bitwise.out index 55481eb19..6a6bc996f 100644 --- a/charon/tests/ui/bitwise.out +++ b/charon/tests/ui/bitwise.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::shift_u32 pub fn shift_u32(@1: u32) -> u32 { diff --git a/charon/tests/ui/call-to-known-trait-method.out b/charon/tests/ui/call-to-known-trait-method.out index 7b5d785bf..582d25c37 100644 --- a/charon/tests/ui/call-to-known-trait-method.out +++ b/charon/tests/ui/call-to-known-trait-method.out @@ -108,6 +108,16 @@ where #[lang_item("String")] pub opaque type String +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Struct struct Struct where diff --git a/charon/tests/ui/closure-as-fn.out b/charon/tests/ui/closure-as-fn.out index 850b16263..5b5181623 100644 --- a/charon/tests/ui/closure-as-fn.out +++ b/charon/tests/ui/closure-as-fn.out @@ -83,6 +83,16 @@ pub fn core::ops::function::FnOnce::call_once(@1: Self, @2: Args) -> where [@TraitClause0]: FnOnce, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::main::closure struct closure {} @@ -109,12 +119,9 @@ fn {impl FnMut<()> for closure}::call_mut<'_0>(@1: &'_0 mut (closure), @2: ()) let state@1: &'_0 mut (closure); // arg #1 let args@2: (); // arg #2 let @3: &'_ (closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<()> for closure}::call<'_>(move (@3), move (args@2)) @0 := () return @@ -127,12 +134,9 @@ fn {impl FnOnce<()> for closure}::call_once(@1: closure, @2: ()) let @1: closure; // arg #1 let @2: (); // arg #2 let @3: &'_ mut (closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<()> for closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 @0 := () diff --git a/charon/tests/ui/closures.out b/charon/tests/ui/closures.out index 3f9da7cad..369302e0f 100644 --- a/charon/tests/ui/closures.out +++ b/charon/tests/ui/closures.out @@ -146,6 +146,16 @@ where non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::incr_u32 pub fn incr_u32(@1: u32) -> u32 { @@ -178,14 +188,12 @@ where let @5: &'_ (F); // anonymous local let @6: (T); // anonymous local let @7: T; // anonymous local - let @8: (); // anonymous local storage_live(x@3) storage_live(@4) storage_live(@5) storage_live(@6) storage_live(@7) - storage_live(@8) match x@1 { Option::None => { @0 := Option::None { } @@ -195,9 +203,7 @@ where x@3 := move ((x@1 as variant Option::Some).0) storage_live(@4) storage_live(@5) - storage_live(@8) - @8 := () - @5 := &(f@2, move (@8)) + @5 := &(f@2, copy (@Global0)) storage_live(@6) storage_live(@7) @7 := move (x@3) @@ -232,30 +238,22 @@ where let @4: T; // anonymous local let @5: fn<'_0>(&'_0_0 (T)) -> T; // anonymous local let @6: &'_ (T); // anonymous local - let @7: (); // anonymous local - let @8: (); // anonymous local storage_live(x@3) storage_live(@4) storage_live(@5) storage_live(@6) - storage_live(@7) - storage_live(@8) match *(x@1) { Option::None => { }, Option::Some => { storage_live(x@3) - storage_live(@8) - @8 := () - x@3 := &((*(x@1) as variant Option::Some).0, move (@8)) + x@3 := &((*(x@1) as variant Option::Some).0, copy (@Global0)) storage_live(@4) storage_live(@5) @5 := copy (f@2) storage_live(@6) - storage_live(@7) - @7 := () - @6 := &(*(x@3), move (@7)) + @6 := &(*(x@3), copy (@Global0)) @4 := (move @5)(move (@6)) storage_dead(@6) storage_dead(@5) @@ -307,12 +305,9 @@ fn {impl FnMut<(u32), u32> for test_crate::test_closure_u32::closure}::call_mut< let state@1: &'_0 mut (test_crate::test_closure_u32::closure); // arg #1 let args@2: (u32); // arg #2 let @3: &'_ (test_crate::test_closure_u32::closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<(u32), u32> for test_crate::test_closure_u32::closure}::call<'_>(move (@3), move (args@2)) return } @@ -324,12 +319,9 @@ fn {impl FnOnce<(u32), u32> for test_crate::test_closure_u32::closure}::call_onc let @1: test_crate::test_closure_u32::closure; // arg #1 let @2: (u32); // arg #2 let @3: &'_ mut (test_crate::test_closure_u32::closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(u32), u32> for test_crate::test_closure_u32::closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return @@ -443,12 +435,9 @@ fn {impl FnMut<(u32, u32), u32> for test_crate::test_closure_u32s::closure}::cal let state@1: &'_0 mut (test_crate::test_closure_u32s::closure); // arg #1 let args@2: (u32, u32); // arg #2 let @3: &'_ (test_crate::test_closure_u32s::closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<(u32, u32), u32> for test_crate::test_closure_u32s::closure}::call<'_>(move (@3), move (args@2)) return } @@ -460,12 +449,9 @@ fn {impl FnOnce<(u32, u32), u32> for test_crate::test_closure_u32s::closure}::ca let @1: test_crate::test_closure_u32s::closure; // arg #1 let @2: (u32, u32); // arg #2 let @3: &'_ mut (test_crate::test_closure_u32s::closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(u32, u32), u32> for test_crate::test_closure_u32s::closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return @@ -570,12 +556,9 @@ fn {impl FnMut<(&'_ (u32)), &'_ (u32)> for test_crate::test_closure_ref_u32::clo let state@1: &'_1 mut (test_crate::test_closure_ref_u32::closure); // arg #1 let args@2: (&'_0 (u32)); // arg #2 let @3: &'_ (test_crate::test_closure_ref_u32::closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<(&'_ (u32)), &'_ (u32)> for test_crate::test_closure_ref_u32::closure}::call<'_0, '_>(move (@3), move (args@2)) return } @@ -587,12 +570,9 @@ fn {impl FnOnce<(&'_ (u32)), &'_ (u32)> for test_crate::test_closure_ref_u32::cl let @1: test_crate::test_closure_ref_u32::closure; // arg #1 let @2: (&'_ (u32)); // arg #2 let @3: &'_ mut (test_crate::test_closure_ref_u32::closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(&'_ (u32)), &'_ (u32)> for test_crate::test_closure_ref_u32::closure}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop] @1 return @@ -623,8 +603,6 @@ pub fn test_closure_ref_u32<'a>(@1: &'a (u32)) -> &'a (u32) let @4: &'_ (u32); // anonymous local let @5: fn<'_0>(&'_0_0 (u32)) -> &'_0_0 (u32); // anonymous local let @6: &'_ (u32); // anonymous local - let @7: (); // anonymous local - let @8: (); // anonymous local storage_live(f@2) storage_live(@3) @@ -635,13 +613,9 @@ pub fn test_closure_ref_u32<'a>(@1: &'a (u32)) -> &'a (u32) storage_live(@5) @5 := copy (f@2) storage_live(@6) - storage_live(@7) - @7 := () - @6 := &(*(x@1), move (@7)) + @6 := &(*(x@1), copy (@Global0)) @4 := (move @5)(move (@6)) - storage_live(@8) - @8 := () - @0 := &(*(@4), move (@8)) + @0 := &(*(@4), copy (@Global0)) storage_dead(@6) storage_dead(@5) storage_dead(f@2) @@ -709,12 +683,9 @@ where let state@1: &'_1 mut (test_crate::test_closure_ref_param::closure[@TraitClause0]); // arg #1 let args@2: (&'_0 (T)); // arg #2 let @3: &'_ (test_crate::test_closure_ref_param::closure[@TraitClause0]); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<(&'_ (T)), &'_ (T)> for test_crate::test_closure_ref_param::closure[@TraitClause0]}::call<'_0, '_, T>[@TraitClause0](move (@3), move (args@2)) return } @@ -728,12 +699,9 @@ where let @1: test_crate::test_closure_ref_param::closure[@TraitClause0]; // arg #1 let @2: (&'_ (T)); // arg #2 let @3: &'_ mut (test_crate::test_closure_ref_param::closure[@TraitClause0]); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(&'_ (T)), &'_ (T)> for test_crate::test_closure_ref_param::closure[@TraitClause0]}::call_mut<'_0, '_, T>[@TraitClause0](move (@3), move (@2)) drop[Drop[@TraitClause0]>] @1 return @@ -768,8 +736,6 @@ where let @4: &'_ (T); // anonymous local let @5: fn<'_0>(&'_0_0 (T)) -> &'_0_0 (T); // anonymous local let @6: &'_ (T); // anonymous local - let @7: (); // anonymous local - let @8: (); // anonymous local storage_live(f@2) storage_live(@3) @@ -780,13 +746,9 @@ where storage_live(@5) @5 := copy (f@2) storage_live(@6) - storage_live(@7) - @7 := () - @6 := &(*(x@1), move (@7)) + @6 := &(*(x@1), copy (@Global0)) @4 := (move @5)(move (@6)) - storage_live(@8) - @8 := () - @0 := &(*(@4), move (@8)) + @0 := &(*(@4), copy (@Global0)) storage_dead(@6) storage_dead(@5) storage_dead(f@2) @@ -873,12 +835,9 @@ where let state@1: &'_2 mut (test_crate::test_closure_ref_early_bound::closure<'_, T>[@TraitClause0, @TraitClause1]); // arg #1 let args@2: (&'_1 (T)); // arg #2 let @3: &'_ (test_crate::test_closure_ref_early_bound::closure<'_, T>[@TraitClause0, @TraitClause1]); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<(&'_ (T)), &'_ (T)> for test_crate::test_closure_ref_early_bound::closure<'_, T>[@TraitClause0, @TraitClause1]}::call<'_, '_1, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) return } @@ -893,12 +852,9 @@ where let @1: test_crate::test_closure_ref_early_bound::closure<'_, T>[@TraitClause0, @TraitClause1]; // arg #1 let @2: (&'_ (T)); // arg #2 let @3: &'_ mut (test_crate::test_closure_ref_early_bound::closure<'_, T>[@TraitClause0, @TraitClause1]); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(&'_ (T)), &'_ (T)> for test_crate::test_closure_ref_early_bound::closure<'_, T>[@TraitClause0, @TraitClause1]}::call_mut<'_, '_1, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0, @TraitClause1]>] @1 return @@ -935,8 +891,6 @@ where let @4: &'_ (T); // anonymous local let @5: fn<'_0>(&'_0_0 (T)) -> &'_0_0 (T); // anonymous local let @6: &'_ (T); // anonymous local - let @7: (); // anonymous local - let @8: (); // anonymous local storage_live(f@2) storage_live(@3) @@ -947,13 +901,9 @@ where storage_live(@5) @5 := copy (f@2) storage_live(@6) - storage_live(@7) - @7 := () - @6 := &(*(x@1), move (@7)) + @6 := &(*(x@1), copy (@Global0)) @4 := (move @5)(move (@6)) - storage_live(@8) - @8 := () - @0 := &(*(@4), move (@8)) + @0 := &(*(@4), copy (@Global0)) storage_dead(@6) storage_dead(@5) storage_dead(f@2) @@ -1033,12 +983,9 @@ fn {impl FnMut<(u32), u32> for test_crate::test_map_option2::closure}::call_mut< let state@1: &'_0 mut (test_crate::test_map_option2::closure); // arg #1 let args@2: (u32); // arg #2 let @3: &'_ (test_crate::test_map_option2::closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<(u32), u32> for test_crate::test_map_option2::closure}::call<'_>(move (@3), move (args@2)) return } @@ -1050,12 +997,9 @@ fn {impl FnOnce<(u32), u32> for test_crate::test_map_option2::closure}::call_onc let @1: test_crate::test_map_option2::closure; // arg #1 let @2: (u32); // arg #2 let @3: &'_ mut (test_crate::test_map_option2::closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(u32), u32> for test_crate::test_map_option2::closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return @@ -1190,12 +1134,9 @@ where let @0: T; // return let x@1: T; // arg #1 let @2: &'_ (T); // anonymous local - let @3: (); // anonymous local storage_live(@2) - storage_live(@3) - @3 := () - @2 := &(x@1, move (@3)) + @2 := &(x@1, copy (@Global0)) @0 := @TraitClause1::clone<'_>(move (@2)) storage_dead(@2) drop[Drop] x@1 @@ -1294,12 +1235,9 @@ fn {impl FnMut<(u32), u32> for test_crate::test_map_option3::closure}::call_mut< let state@1: &'_0 mut (test_crate::test_map_option3::closure); // arg #1 let args@2: (u32); // arg #2 let @3: &'_ (test_crate::test_map_option3::closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<(u32), u32> for test_crate::test_map_option3::closure}::call<'_>(move (@3), move (args@2)) return } @@ -1311,12 +1249,9 @@ fn {impl FnOnce<(u32), u32> for test_crate::test_map_option3::closure}::call_onc let @1: test_crate::test_map_option3::closure; // arg #1 let @2: (u32); // arg #2 let @3: &'_ mut (test_crate::test_map_option3::closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(u32), u32> for test_crate::test_map_option3::closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return @@ -1396,25 +1331,16 @@ pub fn test_regions<'a>(@1: &'a (u32)) -> u32 let @4: (&'_ (&'_ (u32))); // anonymous local let @5: &'_ (&'_ (u32)); // anonymous local let @6: &'_ (&'_ (u32)); // anonymous local - let @7: (); // anonymous local - let @8: (); // anonymous local - let @9: (); // anonymous local storage_live(f@2) f@2 := test_crate::test_regions::closure { } storage_live(@3) - storage_live(@9) - @9 := () - @3 := &(f@2, move (@9)) + @3 := &(f@2, copy (@Global0)) storage_live(@4) storage_live(@5) storage_live(@6) - storage_live(@8) - @8 := () - @6 := &(x@1, move (@8)) - storage_live(@7) - @7 := () - @5 := &(*(@6), move (@7)) + @6 := &(x@1, copy (@Global0)) + @5 := &(*(@6), copy (@Global0)) @4 := (move (@5)) @0 := {impl Fn<(&'_ (&'_ (u32))), u32> for test_crate::test_regions::closure}::call<'_, '_>(move (@3), move (@4)) storage_dead(@5) @@ -1432,12 +1358,9 @@ fn {impl FnMut<(&'_ (&'_ (u32))), u32> for test_crate::test_regions::closure}::c let state@1: &'_1 mut (test_crate::test_regions::closure); // arg #1 let args@2: (&'_0 (&'_ (u32))); // arg #2 let @3: &'_ (test_crate::test_regions::closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<(&'_ (&'_ (u32))), u32> for test_crate::test_regions::closure}::call<'_0, '_>(move (@3), move (args@2)) return } @@ -1449,12 +1372,9 @@ fn {impl FnOnce<(&'_ (&'_ (u32))), u32> for test_crate::test_regions::closure}:: let @1: test_crate::test_regions::closure; // arg #1 let @2: (&'_ (&'_ (u32))); // arg #2 let @3: &'_ mut (test_crate::test_regions::closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(&'_ (&'_ (u32))), u32> for test_crate::test_regions::closure}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop] @1 return @@ -1513,12 +1433,9 @@ fn {impl FnMut<(&'_ (&'_ (u32))), u32> for test_crate::test_regions_casted::clos let state@1: &'_1 mut (test_crate::test_regions_casted::closure); // arg #1 let args@2: (&'_0 (&'_ (u32))); // arg #2 let @3: &'_ (test_crate::test_regions_casted::closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<(&'_ (&'_ (u32))), u32> for test_crate::test_regions_casted::closure}::call<'_0, '_>(move (@3), move (args@2)) return } @@ -1530,12 +1447,9 @@ fn {impl FnOnce<(&'_ (&'_ (u32))), u32> for test_crate::test_regions_casted::clo let @1: test_crate::test_regions_casted::closure; // arg #1 let @2: (&'_ (&'_ (u32))); // arg #2 let @3: &'_ mut (test_crate::test_regions_casted::closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(&'_ (&'_ (u32))), u32> for test_crate::test_regions_casted::closure}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop] @1 return @@ -1566,8 +1480,6 @@ pub fn test_regions_casted<'a>(@1: &'a (u32)) -> u32 let @4: fn<'_0>(&'_0_0 (&'_ (u32))) -> u32; // anonymous local let @5: &'_ (&'_ (u32)); // anonymous local let @6: &'_ (&'_ (u32)); // anonymous local - let @7: (); // anonymous local - let @8: (); // anonymous local storage_live(f@2) storage_live(@3) @@ -1578,12 +1490,8 @@ pub fn test_regions_casted<'a>(@1: &'a (u32)) -> u32 @4 := copy (f@2) storage_live(@5) storage_live(@6) - storage_live(@8) - @8 := () - @6 := &(x@1, move (@8)) - storage_live(@7) - @7 := () - @5 := &(*(@6), move (@7)) + @6 := &(x@1, copy (@Global0)) + @5 := &(*(@6), copy (@Global0)) @0 := (move @4)(move (@5)) storage_dead(@5) storage_dead(@4) @@ -1675,31 +1583,19 @@ pub fn test_closure_capture(@1: u32, @2: u32) -> u32 let @6: &'_ (u32); // anonymous local let @7: &'_ (test_crate::test_closure_capture::closure<'_, '_>); // anonymous local let @8: (u32); // anonymous local - let @9: (); // anonymous local - let @10: (); // anonymous local - let @11: (); // anonymous local - let @12: (); // anonymous local storage_live(f@3) storage_live(@4) storage_live(@5) - storage_live(@12) - @12 := () - @5 := &(x@1, move (@12)) + @5 := &(x@1, copy (@Global0)) storage_live(@6) - storage_live(@11) - @11 := () - @6 := &(y@2, move (@11)) + @6 := &(y@2, copy (@Global0)) @4 := test_crate::test_closure_capture::closure { 0: move (@5), 1: move (@6) } storage_dead(@6) storage_dead(@5) - storage_live(@10) - @10 := () - f@3 := &(@4, move (@10)) + f@3 := &(@4, copy (@Global0)) storage_live(@7) - storage_live(@9) - @9 := () - @7 := &(*(f@3), move (@9)) + @7 := &(*(f@3), copy (@Global0)) storage_live(@8) @8 := (const (0 : u32)) @0 := {impl Fn<(u32), u32> for test_crate::test_closure_capture::closure<'_0, '_1>}::call<'_, '_, '_>(move (@7), move (@8)) @@ -1717,12 +1613,9 @@ fn {impl FnMut<(u32), u32> for test_crate::test_closure_capture::closure<'_0, '_ let state@1: &'_2 mut (test_crate::test_closure_capture::closure<'_0, '_1>); // arg #1 let args@2: (u32); // arg #2 let @3: &'_ (test_crate::test_closure_capture::closure<'_0, '_1>); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<(u32), u32> for test_crate::test_closure_capture::closure<'_0, '_1>}::call<'_0, '_1, '_>(move (@3), move (args@2)) return } @@ -1734,12 +1627,9 @@ fn {impl FnOnce<(u32), u32> for test_crate::test_closure_capture::closure<'_0, ' let @1: test_crate::test_closure_capture::closure<'_0, '_1>; // arg #1 let @2: (u32); // arg #2 let @3: &'_ mut (test_crate::test_closure_capture::closure<'_0, '_1>); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(u32), u32> for test_crate::test_closure_capture::closure<'_0, '_1>}::call_mut<'_0, '_1, '_>(move (@3), move (@2)) drop[Drop>] @1 return @@ -1792,14 +1682,11 @@ where let tupled_args@2: (T); // arg #2 let x@3: T; // local let @4: &'_ (T); // anonymous local - let @5: (); // anonymous local storage_live(x@3) x@3 := move ((tupled_args@2).0) storage_live(@4) - storage_live(@5) - @5 := () - @4 := &(x@3, move (@5)) + @4 := &(x@3, copy (@Global0)) @0 := @TraitClause1::clone<'_>(move (@4)) storage_dead(@4) drop[Drop] x@3 @@ -1819,19 +1706,13 @@ where let @4: &'_ (test_crate::test_closure_clone::closure[@TraitClause0, @TraitClause1]); // anonymous local let @5: (T); // anonymous local let @6: T; // anonymous local - let @7: (); // anonymous local - let @8: (); // anonymous local storage_live(f@2) f@2 := test_crate::test_closure_clone::closure { } storage_live(@3) storage_live(@4) - storage_live(@8) - @8 := () - @4 := &(f@2, move (@8)) - storage_live(@7) - @7 := () - @3 := &(*(@4), move (@7)) + @4 := &(f@2, copy (@Global0)) + @3 := &(*(@4), copy (@Global0)) storage_live(@5) storage_live(@6) @6 := move (x@1) @@ -1857,12 +1738,9 @@ where let state@1: &'_0 mut (test_crate::test_closure_clone::closure[@TraitClause0, @TraitClause1]); // arg #1 let args@2: (T); // arg #2 let @3: &'_ (test_crate::test_closure_clone::closure[@TraitClause0, @TraitClause1]); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<(T), T> for test_crate::test_closure_clone::closure[@TraitClause0, @TraitClause1]}::call<'_, T>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) return } @@ -1877,12 +1755,9 @@ where let @1: test_crate::test_closure_clone::closure[@TraitClause0, @TraitClause1]; // arg #1 let @2: (T); // arg #2 let @3: &'_ mut (test_crate::test_closure_clone::closure[@TraitClause0, @TraitClause1]); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(T), T> for test_crate::test_closure_clone::closure[@TraitClause0, @TraitClause1]}::call_mut<'_, T>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0, @TraitClause1]>] @1 return @@ -1953,12 +1828,9 @@ fn {impl FnOnce<(i32), i32> for test_crate::test_array_map::closure}::call_once( let @1: test_crate::test_array_map::closure; // arg #1 let @2: (i32); // arg #2 let @3: &'_ mut (test_crate::test_array_map::closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(i32), i32> for test_crate::test_array_map::closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return @@ -2042,36 +1914,24 @@ fn test_fnmut_with_ref() let @7: &'_ (usize); // anonymous local let @8: &'_ (usize); // anonymous local let @9: usize; // anonymous local - let @10: (); // anonymous local - let @11: (); // anonymous local - let @12: (); // anonymous local - let @13: (); // anonymous local storage_live(sum@1) sum@1 := const (0 : usize) storage_live(closure@2) storage_live(@3) - storage_live(@13) - @13 := () - @3 := &mut (sum@1, move (@13)) + @3 := &mut (sum@1, copy (@Global0)) closure@2 := test_crate::test_fnmut_with_ref::closure { 0: move (@3) } storage_dead(@3) storage_live(@4) storage_live(@5) - storage_live(@12) - @12 := () - @5 := &mut (closure@2, move (@12)) + @5 := &mut (closure@2, copy (@Global0)) storage_live(@6) storage_live(@7) storage_live(@8) storage_live(@9) @9 := const (15 : usize) - storage_live(@11) - @11 := () - @8 := &(@9, move (@11)) - storage_live(@10) - @10 := () - @7 := &(*(@8), move (@10)) + @8 := &(@9, copy (@Global0)) + @7 := &(*(@8), copy (@Global0)) @6 := (move (@7)) @4 := {impl FnMut<(&'_ (usize)), ()> for test_crate::test_fnmut_with_ref::closure<'_0>}::call_mut<'_, '_, '_>(move (@5), move (@6)) storage_dead(@7) @@ -2094,12 +1954,9 @@ fn {impl FnOnce<(&'_ (usize)), ()> for test_crate::test_fnmut_with_ref::closure< let @1: test_crate::test_fnmut_with_ref::closure<'_0>; // arg #1 let @2: (&'_ (usize)); // arg #2 let @3: &'_ mut (test_crate::test_fnmut_with_ref::closure<'_0>); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(&'_ (usize)), ()> for test_crate::test_fnmut_with_ref::closure<'_0>}::call_mut<'_0, '_1, '_>(move (@3), move (@2)) drop[Drop>] @1 @0 := () diff --git a/charon/tests/ui/closures_with_where.out b/charon/tests/ui/closures_with_where.out index c7c3715cc..7e7aaa28a 100644 --- a/charon/tests/ui/closures_with_where.out +++ b/charon/tests/ui/closures_with_where.out @@ -75,6 +75,16 @@ pub fn core::ops::function::FnOnce::call_once(@1: Self, @2: Args) -> where [@TraitClause0]: FnOnce, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Ops trait Ops { @@ -126,12 +136,9 @@ where let @1: closure[@TraitClause0, @TraitClause1]; // arg #1 let @2: (usize); // arg #2 let @3: &'_ mut (closure[@TraitClause0, @TraitClause1]); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(usize)> for closure[@TraitClause0, @TraitClause1]}::call_mut<'_, T, const K : usize>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0, @TraitClause1]>] @1 return diff --git a/charon/tests/ui/comments.out b/charon/tests/ui/comments.out index b5b4fb48a..59169ab0c 100644 --- a/charon/tests/ui/comments.out +++ b/charon/tests/ui/comments.out @@ -79,6 +79,16 @@ pub fn len<'_0, T>(@1: &'_0 (Slice)) -> usize where [@TraitClause0]: Sized, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::function_call fn function_call(@1: u32) { @@ -358,15 +368,8 @@ fn foo() let @31: &'_ (u32); // anonymous local let @32: &'_ (u32); // anonymous local let @33: Option>[Sized>]; // anonymous local - let @34: (); // anonymous local - let @35: (); // anonymous local - let @36: (); // anonymous local - let @37: (); // anonymous local - let @38: (); // anonymous local - let @39: (); // anonymous local - let @40: (); // anonymous local - let @41: &'_ (Array); // anonymous local - let @42: &'_ (u32); // anonymous local + let @34: &'_ (Array); // anonymous local + let @35: &'_ (u32); // anonymous local storage_live(kind@27) storage_live(@28) @@ -375,10 +378,6 @@ fn foo() storage_live(@31) storage_live(@32) storage_live(@33) - storage_live(@36) - storage_live(@37) - storage_live(@38) - storage_live(@39) storage_live(@3) // Call `default` and destructure the result @3 := {impl Default for Foo}::default() @@ -432,21 +431,15 @@ fn foo() storage_live(@19) // `assert_eq` @19 := const (9 : usize) + storage_live(@34) + @34 := &(a@15, const (@Global0)) storage_live(@35) - @35 := () - storage_live(@40) - @40 := () - storage_live(@41) - @41 := &(a@15, move (@40)) - storage_live(@42) - @42 := @ArrayIndexShared<'_, u32, 10 : usize>(move (@41), copy (@19)) - @18 := &(*(@42), move (@35)) + @35 := @ArrayIndexShared<'_, u32, 10 : usize>(move (@34), copy (@19)) + @18 := &(*(@35), copy (@Global0)) storage_live(@20) storage_live(@21) @21 := const (9 : u32) - storage_live(@34) - @34 := () - @20 := &(@21, move (@34)) + @20 := &(@21, copy (@Global0)) @17 := (move (@18), move (@20)) storage_dead(@20) storage_dead(@18) @@ -471,20 +464,12 @@ fn foo() @28 := move (kind@27) storage_live(@29) storage_live(@30) - storage_live(@39) - @39 := () - @30 := &(*(left_val@22), move (@39)) - storage_live(@38) - @38 := () - @29 := &(*(@30), move (@38)) + @30 := &(*(left_val@22), copy (@Global0)) + @29 := &(*(@30), copy (@Global0)) storage_live(@31) storage_live(@32) - storage_live(@37) - @37 := () - @32 := &(*(right_val@23), move (@37)) - storage_live(@36) - @36 := () - @31 := &(*(@32), move (@36)) + @32 := &(*(right_val@23), copy (@Global0)) + @31 := &(*(@32), copy (@Global0)) storage_live(@33) @33 := Option::None { } panic(core::panicking::assert_failed) diff --git a/charon/tests/ui/constants.out b/charon/tests/ui/constants.out index 0eaf38534..e568d3dab 100644 --- a/charon/tests/ui/constants.out +++ b/charon/tests/ui/constants.out @@ -32,6 +32,16 @@ pub fn drop<'_0, Self>(@1: &'_0 mut (Self)) where [@TraitClause0]: Drop, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::X0 pub fn X0() -> u32 { diff --git a/charon/tests/ui/copy_nonoverlapping.out b/charon/tests/ui/copy_nonoverlapping.out index 1bd51cedc..0c6360b64 100644 --- a/charon/tests/ui/copy_nonoverlapping.out +++ b/charon/tests/ui/copy_nonoverlapping.out @@ -61,6 +61,16 @@ where return } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::write fn write<'_0, '_1, T>(@1: &'_0 mut (T), @2: &'_1 (T)) where @@ -72,18 +82,12 @@ where let @3: (); // anonymous local let @4: *const T; // anonymous local let @5: *mut T; // anonymous local - let @6: (); // anonymous local - let @7: (); // anonymous local storage_live(@3) storage_live(@4) - storage_live(@7) - @7 := () - @4 := &raw const (*(y@2), move (@7)) + @4 := &raw const (*(y@2), copy (@Global0)) storage_live(@5) - storage_live(@6) - @6 := () - @5 := &raw mut (*(x@1), move (@6)) + @5 := &raw mut (*(x@1), copy (@Global0)) @3 := copy_nonoverlapping[@TraitClause0](move (@4), move (@5), const (1 : usize)) storage_dead(@5) storage_dead(@4) diff --git a/charon/tests/ui/cross_compile_32_bit.out b/charon/tests/ui/cross_compile_32_bit.out index e31e4a7e9..8e3b85e55 100644 --- a/charon/tests/ui/cross_compile_32_bit.out +++ b/charon/tests/ui/cross_compile_32_bit.out @@ -13,6 +13,16 @@ pub opaque type NonNull // Full name: core::ptr::non_null::{NonNull}::new_unchecked pub unsafe fn new_unchecked(@1: *mut T) -> NonNull +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::HasPointerNiche enum HasPointerNiche { First, @@ -32,7 +42,6 @@ fn main() let a@7: HasPointerNiche; // local let @8: NonNull; // anonymous local let @9: *mut usize; // anonymous local - let @10: (); // anonymous local storage_live(@6) storage_live(x@1) @@ -51,9 +60,7 @@ fn main() storage_live(a@7) storage_live(@8) storage_live(@9) - storage_live(@10) - @10 := () - @9 := &raw mut (x@1, move (@10)) + @9 := &raw mut (x@1, copy (@Global0)) @8 := new_unchecked(move (@9)) storage_dead(@9) a@7 := HasPointerNiche::Second { 0: move (@8) } diff --git a/charon/tests/ui/cross_compile_big_endian.out b/charon/tests/ui/cross_compile_big_endian.out index d6c8e8199..5beb77f12 100644 --- a/charon/tests/ui/cross_compile_big_endian.out +++ b/charon/tests/ui/cross_compile_big_endian.out @@ -9,6 +9,16 @@ pub const MAX: usize = MAX() // Full name: core::num::{u128}::to_ne_bytes pub fn to_ne_bytes(@1: u128) -> Array +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::S fn S() -> Array { diff --git a/charon/tests/ui/demo.out b/charon/tests/ui/demo.out index f04112ad8..9d0b3f253 100644 --- a/charon/tests/ui/demo.out +++ b/charon/tests/ui/demo.out @@ -16,6 +16,16 @@ pub trait Sized #[lang_item("global_alloc_ty")] pub struct Global {} +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::choose pub fn choose<'a, T>(@1: bool, @2: &'a mut (T), @3: &'a mut (T)) -> &'a mut (T) where @@ -29,42 +39,24 @@ where let @5: &'_ mut (T); // anonymous local let @6: bool; // anonymous local let @7: &'_ mut (T); // anonymous local - let @8: (); // anonymous local - let @9: (); // anonymous local - let @10: (); // anonymous local - let @11: (); // anonymous local - let @12: (); // anonymous local storage_live(@7) - storage_live(@8) - storage_live(@9) - storage_live(@10) storage_live(@4) storage_live(@5) storage_live(@6) @6 := copy (b@1) if move (@6) { storage_live(@7) - storage_live(@9) - @9 := () - @7 := &mut (*(x@2), move (@9)) - storage_live(@8) - @8 := () - @5 := &mut (*(@7), move (@8)) + @7 := &mut (*(x@2), copy (@Global0)) + @5 := &mut (*(@7), copy (@Global0)) storage_dead(@7) } else { - storage_live(@10) - @10 := () - @5 := &mut (*(y@3), move (@10)) + @5 := &mut (*(y@3), copy (@Global0)) } - storage_live(@12) - @12 := () - @4 := &mut (*(@5), move (@12)) + @4 := &mut (*(@5), copy (@Global0)) storage_dead(@6) - storage_live(@11) - @11 := () - @0 := &mut (*(@4), move (@11)) + @0 := &mut (*(@4), copy (@Global0)) storage_dead(@5) storage_dead(@4) return @@ -152,24 +144,14 @@ pub fn use_incr() let @8: (); // anonymous local let @9: &'_ mut (u32); // anonymous local let @10: &'_ mut (u32); // anonymous local - let @11: (); // anonymous local - let @12: (); // anonymous local - let @13: (); // anonymous local - let @14: (); // anonymous local - let @15: (); // anonymous local - let @16: (); // anonymous local storage_live(x@1) x@1 := const (0 : u32) storage_live(@2) storage_live(@3) storage_live(@4) - storage_live(@12) - @12 := () - @4 := &mut (x@1, move (@12)) - storage_live(@11) - @11 := () - @3 := &two-phase-mut (*(@4), move (@11)) + @4 := &mut (x@1, copy (@Global0)) + @3 := &two-phase-mut (*(@4), copy (@Global0)) @2 := test_crate::incr<'_>(move (@3)) storage_dead(@3) storage_dead(@4) @@ -177,12 +159,8 @@ pub fn use_incr() storage_live(@5) storage_live(@6) storage_live(@7) - storage_live(@14) - @14 := () - @7 := &mut (x@1, move (@14)) - storage_live(@13) - @13 := () - @6 := &two-phase-mut (*(@7), move (@13)) + @7 := &mut (x@1, copy (@Global0)) + @6 := &two-phase-mut (*(@7), copy (@Global0)) @5 := test_crate::incr<'_>(move (@6)) storage_dead(@6) storage_dead(@7) @@ -190,12 +168,8 @@ pub fn use_incr() storage_live(@8) storage_live(@9) storage_live(@10) - storage_live(@16) - @16 := () - @10 := &mut (x@1, move (@16)) - storage_live(@15) - @15 := () - @9 := &two-phase-mut (*(@10), move (@15)) + @10 := &mut (x@1, copy (@Global0)) + @9 := &two-phase-mut (*(@10), copy (@Global0)) @8 := test_crate::incr<'_>(move (@9)) storage_dead(@9) storage_dead(@10) @@ -232,20 +206,12 @@ where let @9: u32; // anonymous local let @10: u32; // anonymous local let @11: u32; // anonymous local - let @12: (); // anonymous local - let @13: (); // anonymous local - let @14: (); // anonymous local - let @15: (); // anonymous local - let @16: (); // anonymous local storage_live(@7) storage_live(@8) storage_live(@9) storage_live(@10) storage_live(@11) - storage_live(@14) - storage_live(@15) - storage_live(@16) match *(l@1) { CList::CCons => { }, @@ -254,30 +220,22 @@ where }, } storage_live(x@3) - storage_live(@13) - @13 := () - x@3 := &((*(l@1) as variant CList::CCons).0, move (@13)) + x@3 := &((*(l@1) as variant CList::CCons).0, copy (@Global0)) storage_live(tl@4) - storage_live(@12) - @12 := () - tl@4 := &((*(l@1) as variant CList::CCons).1, move (@12)) + tl@4 := &((*(l@1) as variant CList::CCons).1, copy (@Global0)) storage_live(@5) storage_live(@6) @6 := copy (i@2) @5 := move (@6) == const (0 : u32) if move (@5) { storage_dead(@6) - storage_live(@14) - @14 := () - @0 := &(*(x@3), move (@14)) + @0 := &(*(x@3), copy (@Global0)) } else { storage_dead(@6) storage_live(@7) storage_live(@8) - storage_live(@15) - @15 := () - @8 := &(*(*(tl@4)), move (@15)) + @8 := &(*(*(tl@4)), copy (@Global0)) storage_live(@9) storage_live(@10) @10 := copy (i@2) @@ -285,9 +243,7 @@ where @9 := move (@11) storage_dead(@10) @7 := list_nth<'_, T>[@TraitClause0](move (@8), move (@9)) - storage_live(@16) - @16 := () - @0 := &(*(@7), move (@16)) + @0 := &(*(@7), copy (@Global0)) storage_dead(@9) storage_dead(@8) storage_dead(@7) @@ -320,16 +276,6 @@ where let @14: u32; // anonymous local let @15: u32; // anonymous local let @16: u32; // anonymous local - let @17: (); // anonymous local - let @18: (); // anonymous local - let @19: (); // anonymous local - let @20: (); // anonymous local - let @21: (); // anonymous local - let @22: (); // anonymous local - let @23: (); // anonymous local - let @24: (); // anonymous local - let @25: (); // anonymous local - let @26: (); // anonymous local storage_live(@11) storage_live(@12) @@ -337,10 +283,6 @@ where storage_live(@14) storage_live(@15) storage_live(@16) - storage_live(@19) - storage_live(@20) - storage_live(@21) - storage_live(@26) storage_live(@3) storage_live(@4) match *(l@1) { @@ -351,13 +293,9 @@ where }, } storage_live(x@5) - storage_live(@18) - @18 := () - x@5 := &mut ((*(l@1) as variant CList::CCons).0, move (@18)) + x@5 := &mut ((*(l@1) as variant CList::CCons).0, copy (@Global0)) storage_live(tl@6) - storage_live(@17) - @17 := () - tl@6 := &mut ((*(l@1) as variant CList::CCons).1, move (@17)) + tl@6 := &mut ((*(l@1) as variant CList::CCons).1, copy (@Global0)) storage_live(@7) storage_live(@8) storage_live(@9) @@ -367,21 +305,15 @@ where if move (@9) { storage_dead(@10) storage_live(@11) - storage_live(@20) - @20 := () - @11 := &mut (*(x@5), move (@20)) - storage_live(@19) - @19 := () - @8 := &mut (*(@11), move (@19)) + @11 := &mut (*(x@5), copy (@Global0)) + @8 := &mut (*(@11), copy (@Global0)) storage_dead(@11) } else { storage_dead(@10) storage_live(@12) storage_live(@13) - storage_live(@21) - @21 := () - @13 := &two-phase-mut (*(*(tl@6)), move (@21)) + @13 := &two-phase-mut (*(*(tl@6)), copy (@Global0)) storage_live(@14) storage_live(@15) @15 := copy (i@2) @@ -389,30 +321,20 @@ where @14 := move (@16) storage_dead(@15) @12 := list_nth_mut<'_, T>[@TraitClause0](move (@13), move (@14)) - storage_live(@26) - @26 := () - @8 := &mut (*(@12), move (@26)) + @8 := &mut (*(@12), copy (@Global0)) storage_dead(@14) storage_dead(@13) storage_dead(@12) } - storage_live(@25) - @25 := () - @7 := &mut (*(@8), move (@25)) + @7 := &mut (*(@8), copy (@Global0)) storage_dead(@9) - storage_live(@24) - @24 := () - @4 := &mut (*(@7), move (@24)) + @4 := &mut (*(@7), copy (@Global0)) storage_dead(@8) storage_dead(@7) storage_dead(tl@6) storage_dead(x@5) - storage_live(@23) - @23 := () - @3 := &mut (*(@4), move (@23)) - storage_live(@22) - @22 := () - @0 := &mut (*(@3), move (@22)) + @3 := &mut (*(@4), copy (@Global0)) + @0 := &mut (*(@3), copy (@Global0)) storage_dead(@4) storage_dead(@3) return @@ -435,10 +357,6 @@ where let @9: u32; // anonymous local let @10: &'_ mut (CList[@TraitClause0]); // anonymous local let @11: (); // anonymous local - let @12: (); // anonymous local - let @13: (); // anonymous local - let @14: (); // anonymous local - let @15: (); // anonymous local storage_live(x@4) storage_live(tl@5) @@ -448,22 +366,14 @@ where storage_live(@9) storage_live(@10) storage_live(@11) - storage_live(@12) - storage_live(@13) - storage_live(@14) - storage_live(@15) storage_live(@3) loop { match *(l@1) { CList::CCons => { storage_live(x@4) - storage_live(@13) - @13 := () - x@4 := &mut ((*(l@1) as variant CList::CCons).0, move (@13)) + x@4 := &mut ((*(l@1) as variant CList::CCons).0, copy (@Global0)) storage_live(tl@5) - storage_live(@12) - @12 := () - tl@5 := &mut ((*(l@1) as variant CList::CCons).1, move (@12)) + tl@5 := &mut ((*(l@1) as variant CList::CCons).1, copy (@Global0)) storage_live(@6) storage_live(@7) storage_live(@8) @@ -478,9 +388,7 @@ where @9 := copy (i@2) panic.- const (1 : u32) i@2 := move (@9) storage_live(@10) - storage_live(@15) - @15 := () - @10 := &mut (*(*(tl@5)), move (@15)) + @10 := &mut (*(*(tl@5)), copy (@Global0)) l@1 := move (@10) storage_dead(@10) storage_dead(tl@5) @@ -488,9 +396,7 @@ where continue 0 } storage_dead(@8) - storage_live(@14) - @14 := () - @0 := &mut (*(x@4), move (@14)) + @0 := &mut (*(x@4), copy (@Global0)) storage_dead(@7) storage_dead(@6) storage_dead(tl@5) @@ -565,35 +471,21 @@ where let tl@4: &'_ mut (alloc::boxed::Box[@TraitClause0]>[MetaSized[@TraitClause0]>, Sized]); // local let @5: &'_ mut (CList[@TraitClause0]); // anonymous local let @6: &'_ mut (CList[@TraitClause0]); // anonymous local - let @7: (); // anonymous local - let @8: (); // anonymous local - let @9: (); // anonymous local - let @10: (); // anonymous local - let @11: (); // anonymous local storage_live(tl@4) storage_live(@5) storage_live(@6) - storage_live(@7) - storage_live(@8) - storage_live(@11) storage_live(@2) storage_live(@3) match *(l@1) { CList::CCons => { storage_live(tl@4) - storage_live(@8) - @8 := () - tl@4 := &mut ((*(l@1) as variant CList::CCons).1, move (@8)) + tl@4 := &mut ((*(l@1) as variant CList::CCons).1, copy (@Global0)) storage_live(@5) storage_live(@6) - storage_live(@7) - @7 := () - @6 := &two-phase-mut (*(*(tl@4)), move (@7)) + @6 := &two-phase-mut (*(*(tl@4)), copy (@Global0)) @5 := list_tail<'_, T>[@TraitClause0](move (@6)) - storage_live(@11) - @11 := () - @3 := &mut (*(@5), move (@11)) + @3 := &mut (*(@5), copy (@Global0)) storage_dead(@6) storage_dead(@5) storage_dead(tl@4) @@ -602,12 +494,8 @@ where @3 := move (l@1) }, } - storage_live(@10) - @10 := () - @2 := &mut (*(@3), move (@10)) - storage_live(@9) - @9 := () - @0 := &mut (*(@2), move (@9)) + @2 := &mut (*(@3), copy (@Global0)) + @0 := &mut (*(@2), copy (@Global0)) storage_dead(@3) storage_dead(@2) return @@ -659,12 +547,9 @@ where let @0: usize; // return let cnt@1: &'_ mut (T); // arg #1 let @2: &'_ mut (T); // anonymous local - let @3: (); // anonymous local storage_live(@2) - storage_live(@3) - @3 := () - @2 := &two-phase-mut (*(cnt@1), move (@3)) + @2 := &two-phase-mut (*(cnt@1), copy (@Global0)) @0 := @TraitClause1::incr<'_>(move (@2)) storage_dead(@2) return diff --git a/charon/tests/ui/dictionary_passing_style_woes.out b/charon/tests/ui/dictionary_passing_style_woes.out index 5f4deea98..34c3729a5 100644 --- a/charon/tests/ui/dictionary_passing_style_woes.out +++ b/charon/tests/ui/dictionary_passing_style_woes.out @@ -58,6 +58,16 @@ pub fn drop<'_0, Self>(@1: &'_0 mut (Self)) where [@TraitClause0]: Drop, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Iterator trait Iterator { @@ -161,12 +171,9 @@ where let @0: Clause1_Clause1_Assoc; // return let x@1: T; // arg #1 let @2: &'_ (T); // anonymous local - let @3: (); // anonymous local storage_live(@2) - storage_live(@3) - @3 := () - @2 := &(x@1, move (@3)) + @2 := &(x@1, copy (@Global0)) @0 := @TraitClause1::parent_clause1::method<'_>(move (@2)) storage_dead(@2) drop[Drop] x@1 @@ -182,12 +189,9 @@ where let @0: Clause1_Clause1_Assoc; // return let x@1: T; // arg #1 let @2: &'_ (T); // anonymous local - let @3: (); // anonymous local storage_live(@2) - storage_live(@3) - @3 := () - @2 := &(x@1, move (@3)) + @2 := &(x@1, copy (@Global0)) @0 := @TraitClause1::parent_clause1::method<'_>(move (@2)) storage_dead(@2) drop[Drop] x@1 diff --git a/charon/tests/ui/disambiguator.out b/charon/tests/ui/disambiguator.out index 8c1bef88f..da2cfdc44 100644 --- a/charon/tests/ui/disambiguator.out +++ b/charon/tests/ui/disambiguator.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + fn test_crate::nonzero_disambiguator::my_function() { let @0: (); // return diff --git a/charon/tests/ui/diverging.out b/charon/tests/ui/diverging.out index a9a08e7c7..9c50b32f0 100644 --- a/charon/tests/ui/diverging.out +++ b/charon/tests/ui/diverging.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::my_panic fn my_panic(@1: u32) -> ! { diff --git a/charon/tests/ui/dyn-trait.out b/charon/tests/ui/dyn-trait.out index fa4764c4d..71633c9bf 100644 --- a/charon/tests/ui/dyn-trait.out +++ b/charon/tests/ui/dyn-trait.out @@ -186,6 +186,16 @@ where vtable: {impl ToString for T}::{vtable}[@TraitClause0, @TraitClause1] } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::construct fn construct(@1: T) -> alloc::boxed::Box<(dyn exists<_dyn> [@TraitClause0]: Display<_dyn> + _dyn : 'static)>[MetaSized<(dyn exists<_dyn> [@TraitClause0]: Display<_dyn> + _dyn : '_)>, Sized] where diff --git a/charon/tests/ui/dyn-with-diamond-supertraits.out b/charon/tests/ui/dyn-with-diamond-supertraits.out index ae7c6c623..aa4e4fdfd 100644 --- a/charon/tests/ui/dyn-with-diamond-supertraits.out +++ b/charon/tests/ui/dyn-with-diamond-supertraits.out @@ -42,6 +42,16 @@ pub fn core::ops::arith::Add::add(@1: Self, @2: Rhs) -> @TraitClause0 where [@TraitClause0]: Add, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Super trait Super { @@ -221,8 +231,6 @@ fn {impl Right for i32}::right_method<'_0>(@1: &'_0 (i32)) -> i32 let @9: i32; // anonymous local let @10: &'_ (i32); // anonymous local let @11: i32; // anonymous local - let @12: (); // anonymous local - let @13: (); // anonymous local storage_live(@5) storage_live(@8) @@ -236,9 +244,7 @@ fn {impl Right for i32}::right_method<'_0>(@1: &'_0 (i32)) -> i32 storage_dead(@4) storage_live(@6) storage_live(@7) - storage_live(@12) - @12 := () - @7 := &(*(self@1), move (@12)) + @7 := &(*(self@1), copy (@Global0)) @6 := {impl Internal for i32}::internal_method<'_>(move (@7)) storage_dead(@7) @8 := copy (@3) panic.+ copy (@6) @@ -247,9 +253,7 @@ fn {impl Right for i32}::right_method<'_0>(@1: &'_0 (i32)) -> i32 storage_dead(@3) storage_live(@9) storage_live(@10) - storage_live(@13) - @13 := () - @10 := &(*(self@1), move (@13)) + @10 := &(*(self@1), copy (@Global0)) @9 := {impl Super for i32}::super_method<'_>(move (@10), const (10 : i32)) storage_dead(@10) @11 := copy (@2) panic.+ copy (@9) @@ -280,21 +284,15 @@ fn {impl Join for i32}::join_method<'_0>(@1: &'_0 (i32)) -> (i32, i32) let @3: &'_ (i32); // anonymous local let @4: i32; // anonymous local let @5: &'_ (i32); // anonymous local - let @6: (); // anonymous local - let @7: (); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@6) - @6 := () - @3 := &(*(self@1), move (@6)) + @3 := &(*(self@1), copy (@Global0)) @2 := {impl Left for i32}::left_method<'_>(move (@3)) storage_dead(@3) storage_live(@4) storage_live(@5) - storage_live(@7) - @7 := () - @5 := &(*(self@1), move (@7)) + @5 := &(*(self@1), copy (@Global0)) @4 := {impl Right for i32}::right_method<'_>(move (@5)) storage_dead(@5) @0 := (move (@2), move (@4)) @@ -348,20 +346,14 @@ fn main() let @5: (i32, i32); // anonymous local let @6: &'_ ((dyn exists<_dyn> [@TraitClause0]: Join<_dyn, i32> + _dyn : '_ + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause2::Right = i32 + @TraitClause1_0::parent_clause1::Left = i32)); // anonymous local let @7: &'static (test_crate::Join::{vtable}); // anonymous local - let @8: (); // anonymous local - let @9: (); // anonymous local storage_live(v@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := const (97 : i32) - storage_live(@9) - @9 := () - @3 := &(@4, move (@9)) - storage_live(@8) - @8 := () - @2 := &(*(@3), move (@8)) + @3 := &(@4, copy (@Global0)) + @2 := &(*(@3), copy (@Global0)) v@1 := unsize_cast<&'_ (i32), &'_ ((dyn exists<_dyn> [@TraitClause0]: Join<_dyn, i32> + _dyn : '_ + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause2::Right = i32 + @TraitClause1_0::parent_clause1::Left = i32)), {impl Join for i32}>(move (@2)) storage_dead(@2) storage_dead(@3) diff --git a/charon/tests/ui/explicit-drop-bounds.out b/charon/tests/ui/explicit-drop-bounds.out index e9130862e..5a4da2173 100644 --- a/charon/tests/ui/explicit-drop-bounds.out +++ b/charon/tests/ui/explicit-drop-bounds.out @@ -39,6 +39,16 @@ impl Drop for String { non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Trait trait Trait { diff --git a/charon/tests/ui/external.out b/charon/tests/ui/external.out index e8ffec531..050e66bc1 100644 --- a/charon/tests/ui/external.out +++ b/charon/tests/ui/external.out @@ -218,6 +218,16 @@ where vtable: {impl Drop for Vec[@TraitClause0, @TraitClause1]}::{vtable}[@TraitClause0, @TraitClause1] } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + pub fn test_crate::swap<'a, T>(@1: &'a mut (T), @2: &'a mut (T)) where [@TraitClause0]: Sized, @@ -227,17 +237,11 @@ where let y@2: &'_ mut (T); // arg #2 let @3: &'_ mut (T); // anonymous local let @4: &'_ mut (T); // anonymous local - let @5: (); // anonymous local - let @6: (); // anonymous local storage_live(@3) - storage_live(@6) - @6 := () - @3 := &two-phase-mut (*(x@1), move (@6)) + @3 := &two-phase-mut (*(x@1), copy (@Global0)) storage_live(@4) - storage_live(@5) - @5 := () - @4 := &two-phase-mut (*(y@2), move (@5)) + @4 := &two-phase-mut (*(y@2), copy (@Global0)) @0 := core::mem::swap<'_, '_, T>[@TraitClause0](move (@3), move (@4)) storage_dead(@4) storage_dead(@3) @@ -270,15 +274,12 @@ pub fn test_vec_push() let v@1: Vec[Sized, Sized]; // local let @2: (); // anonymous local let @3: &'_ mut (Vec[Sized, Sized]); // anonymous local - let @4: (); // anonymous local storage_live(v@1) v@1 := alloc::vec::{Vec[@TraitClause0, Sized]}::new[Sized]() storage_live(@2) storage_live(@3) - storage_live(@4) - @4 := () - @3 := &two-phase-mut (v@1, move (@4)) + @3 := &two-phase-mut (v@1, copy (@Global0)) @2 := push<'_, u32, Global>[Sized, Sized](move (@3), const (0 : u32)) storage_dead(@3) storage_dead(@2) @@ -295,12 +296,9 @@ pub fn use_get<'_0>(@1: &'_0 (Cell[MetaSized])) -> u32 let @0: u32; // return let rc@1: &'_ (Cell[MetaSized]); // arg #1 let @2: &'_ (Cell[MetaSized]); // anonymous local - let @3: (); // anonymous local storage_live(@2) - storage_live(@3) - @3 := () - @2 := &(*(rc@1), move (@3)) + @2 := &(*(rc@1), copy (@Global0)) @0 := get<'_, u32>[Sized, {impl Copy for u32}](move (@2)) storage_dead(@2) return @@ -314,14 +312,11 @@ pub fn incr<'_0>(@1: &'_0 mut (Cell[MetaSized])) let @2: &'_ mut (u32); // anonymous local let @3: &'_ mut (Cell[MetaSized]); // anonymous local let @4: u32; // anonymous local - let @5: (); // anonymous local storage_live(@4) storage_live(@2) storage_live(@3) - storage_live(@5) - @5 := () - @3 := &two-phase-mut (*(rc@1), move (@5)) + @3 := &two-phase-mut (*(rc@1), copy (@Global0)) @2 := get_mut<'_, u32>[MetaSized](move (@3)) storage_dead(@3) @4 := copy (*(@2)) panic.+ const (1 : u32) diff --git a/charon/tests/ui/find-sized-clause.out b/charon/tests/ui/find-sized-clause.out index bac3f30ec..29720bd02 100644 --- a/charon/tests/ui/find-sized-clause.out +++ b/charon/tests/ui/find-sized-clause.out @@ -22,6 +22,16 @@ where Some(T), } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Trait trait Trait { diff --git a/charon/tests/ui/float.out b/charon/tests/ui/float.out index 7fe90638b..115580076 100644 --- a/charon/tests/ui/float.out +++ b/charon/tests/ui/float.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::test_float fn test_float(@1: f64) -> f64 { diff --git a/charon/tests/ui/foreign-constant.out b/charon/tests/ui/foreign-constant.out index 659e9ee7d..4aa2f20b8 100644 --- a/charon/tests/ui/foreign-constant.out +++ b/charon/tests/ui/foreign-constant.out @@ -6,6 +6,16 @@ pub fn CONSTANT() -> u8 // Full name: foreign_constant_aux::CONSTANT pub const CONSTANT: u8 = CONSTANT() +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::foo fn foo() -> u8 { diff --git a/charon/tests/ui/gat-causes-unhandled-ty-clause.out b/charon/tests/ui/gat-causes-unhandled-ty-clause.out index 56d139f51..e6092e902 100644 --- a/charon/tests/ui/gat-causes-unhandled-ty-clause.out +++ b/charon/tests/ui/gat-causes-unhandled-ty-clause.out @@ -12,6 +12,16 @@ pub trait Sized non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::HasAssoc trait HasAssoc { diff --git a/charon/tests/ui/gosim-demo.out b/charon/tests/ui/gosim-demo.out index 351bad86c..b53e32752 100644 --- a/charon/tests/ui/gosim-demo.out +++ b/charon/tests/ui/gosim-demo.out @@ -490,6 +490,16 @@ where // Full name: std::io::stdio::_eprint pub fn _eprint<'_0>(@1: Arguments<'_0>) +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::debug_slice fn debug_slice<'_0, T>(@1: &'_0 (Slice)) where @@ -518,14 +528,6 @@ where let @19: Array<&'_ (Str), 2 : usize>; // anonymous local let @20: &'_ (Array, 1 : usize>); // anonymous local let @21: &'_ (Array, 1 : usize>); // anonymous local - let @22: (); // anonymous local - let @23: (); // anonymous local - let @24: (); // anonymous local - let @25: (); // anonymous local - let @26: (); // anonymous local - let @27: (); // anonymous local - let @28: (); // anonymous local - let @29: (); // anonymous local storage_live(@7) storage_live(x@9) @@ -541,14 +543,6 @@ where storage_live(@19) storage_live(@20) storage_live(@21) - storage_live(@22) - storage_live(@23) - storage_live(@24) - storage_live(@25) - storage_live(@26) - storage_live(@27) - storage_live(@28) - storage_live(@29) storage_live(@2) storage_live(@3) @3 := copy (slice@1) @@ -561,12 +555,8 @@ where storage_live(@6) storage_live(@7) storage_live(@8) - storage_live(@23) - @23 := () - @8 := &mut (iter@4, move (@23)) - storage_live(@22) - @22 := () - @7 := &two-phase-mut (*(@8), move (@22)) + @8 := &mut (iter@4, copy (@Global0)) + @7 := &two-phase-mut (*(@8), copy (@Global0)) @6 := {impl Iterator for Iter<'a, T>[@TraitClause0]}::next<'_, '_, T>[@TraitClause0](move (@7)) storage_dead(@7) match @6 { @@ -583,12 +573,8 @@ where storage_live(@14) storage_live(@15) storage_live(@16) - storage_live(@25) - @25 := () - @16 := &(x@9, move (@25)) - storage_live(@24) - @24 := () - @15 := &(*(@16), move (@24)) + @16 := &(x@9, copy (@Global0)) + @15 := &(*(@16), copy (@Global0)) @14 := new_debug<'_, '_, &'_ (T)>[Sized<&'_ (T)>, {impl Debug for &'_0 (T)}<'_, T>[@TraitClause1]](move (@15)) storage_dead(@15) args@13 := [move (@14)] @@ -597,20 +583,12 @@ where storage_live(@18) storage_live(@19) @19 := [const ("- "), const ("\n")] - storage_live(@29) - @29 := () - @18 := &(@19, move (@29)) - storage_live(@28) - @28 := () - @17 := &(*(@18), move (@28)) + @18 := &(@19, copy (@Global0)) + @17 := &(*(@18), copy (@Global0)) storage_live(@20) storage_live(@21) - storage_live(@27) - @27 := () - @21 := &(args@13, move (@27)) - storage_live(@26) - @26 := () - @20 := &(*(@21), move (@26)) + @21 := &(args@13, copy (@Global0)) + @20 := &(*(@21), copy (@Global0)) @12 := new_v1<'_, 2 : usize, 1 : usize>(move (@17), move (@20)) storage_dead(@21) storage_dead(@20) @@ -650,8 +628,6 @@ fn main() let @3: &'_ (Array); // anonymous local let @4: &'_ (Array); // anonymous local let @5: Array; // anonymous local - let @6: (); // anonymous local - let @7: (); // anonymous local storage_live(@1) storage_live(@2) @@ -659,12 +635,8 @@ fn main() storage_live(@4) storage_live(@5) @5 := [const (0 : i32), const (1 : i32), const (2 : i32)] - storage_live(@7) - @7 := () - @4 := &(@5, move (@7)) - storage_live(@6) - @6 := () - @3 := &(*(@4), move (@6)) + @4 := &(@5, copy (@Global0)) + @3 := &(*(@4), copy (@Global0)) @2 := @ArrayToSliceShared<'_, i32, 3 : usize>(move (@3)) storage_dead(@3) @1 := debug_slice<'_, i32>[Sized, {impl Debug for i32}](move (@2)) diff --git a/charon/tests/ui/hide-marker-traits.out b/charon/tests/ui/hide-marker-traits.out index af60ee085..52294188d 100644 --- a/charon/tests/ui/hide-marker-traits.out +++ b/charon/tests/ui/hide-marker-traits.out @@ -13,6 +13,16 @@ pub fn drop<'_0, Self>(@1: &'_0 mut (Self)) where [@TraitClause0]: Drop, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Idx trait Idx diff --git a/charon/tests/ui/impl-trait.out b/charon/tests/ui/impl-trait.out index 07f7b5a05..436c3aa89 100644 --- a/charon/tests/ui/impl-trait.out +++ b/charon/tests/ui/impl-trait.out @@ -94,6 +94,16 @@ pub fn core::ops::function::FnOnce::call_once(@1: Self, @2: Args) -> where [@TraitClause0]: FnOnce, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Foo pub trait Foo { @@ -116,18 +126,12 @@ pub fn {impl Foo for ()}::get_ty<'_0>(@1: &'_0 (())) -> &'_0 (u32) let self@1: &'_ (()); // arg #1 let @2: &'_ (u32); // anonymous local let @3: u32; // anonymous local - let @4: (); // anonymous local - let @5: (); // anonymous local storage_live(@2) storage_live(@3) @3 := const (42 : u32) - storage_live(@5) - @5 := () - @2 := &(@3, move (@5)) - storage_live(@4) - @4 := () - @0 := &(*(@2), move (@4)) + @2 := &(@3, copy (@Global0)) + @0 := &(*(@2), copy (@Global0)) storage_dead(@3) storage_dead(@2) return @@ -162,8 +166,6 @@ fn use_foo() let @3: &'_ (u32); // anonymous local let @4: &'_ (u32); // anonymous local let @5: &'_ (()); // anonymous local - let @6: (); // anonymous local - let @7: (); // anonymous local storage_live(foo@1) foo@1 := mk_foo() @@ -171,13 +173,9 @@ fn use_foo() storage_live(@3) storage_live(@4) storage_live(@5) - storage_live(@6) - @6 := () - @5 := &(foo@1, move (@6)) + @5 := &(foo@1, copy (@Global0)) @4 := {impl Foo for ()}::get_ty<'_>(move (@5)) - storage_live(@7) - @7 := () - @3 := &(*(@4), move (@7)) + @3 := &(*(@4), copy (@Global0)) storage_dead(@5) @2 := {impl Clone for u32}::clone<'_>(move (@3)) storage_dead(@3) @@ -245,8 +243,7 @@ where let @3: &'_ (@TraitClause1::parent_clause2::Type); // anonymous local let @4: &'_ (@TraitClause1::parent_clause2::Type); // anonymous local let @5: &'_ (@TraitClause1::); // anonymous local - let @6: (); // anonymous local - let @7: PtrMetadata<@TraitClause1::parent_clause2::Type>; // anonymous local + let @6: PtrMetadata<@TraitClause1::parent_clause2::Type>; // anonymous local storage_live(foo@1) foo@1 := @TraitClause1::make_foo() @@ -254,13 +251,11 @@ where storage_live(@3) storage_live(@4) storage_live(@5) - storage_live(@6) - @6 := () - @5 := &(foo@1, move (@6)) + @5 := &(foo@1, copy (@Global0)) @4 := @TraitClause1::parent_clause2::get_ty<'_>(move (@5)) - storage_live(@7) - @7 := ptr_metadata(copy (@4)) - @3 := &(*(@4), move (@7)) + storage_live(@6) + @6 := ptr_metadata(copy (@4)) + @3 := &(*(@4), move (@6)) storage_dead(@5) @2 := @TraitClause1::parent_clause2::parent_clause2::clone<'_>(move (@3)) storage_dead(@3) @@ -310,14 +305,11 @@ where let tupled_args@2: (&'_0 (U)); // arg #2 let x@3: &'_ (U); // local let @4: &'_ (U); // anonymous local - let @5: (); // anonymous local storage_live(x@3) x@3 := move ((tupled_args@2).0) storage_live(@4) - storage_live(@5) - @5 := () - @4 := &(*(x@3), move (@5)) + @4 := &(*(x@3), copy (@Global0)) @0 := WrapClone { 0: move (@4) } storage_dead(@4) return @@ -348,8 +340,6 @@ pub fn use_wrap() let @5: &'_ (u32); // anonymous local let @6: &'_ (u32); // anonymous local let @7: u32; // anonymous local - let @8: (); // anonymous local - let @9: (); // anonymous local storage_live(f@1) f@1 := wrap[Sized]() @@ -361,12 +351,8 @@ pub fn use_wrap() storage_live(@6) storage_live(@7) @7 := const (42 : u32) - storage_live(@9) - @9 := () - @6 := &(@7, move (@9)) - storage_live(@8) - @8 := () - @5 := &(*(@6), move (@8)) + @6 := &(@7, copy (@Global0)) + @5 := &(*(@6), copy (@Global0)) @4 := (move (@5)) @2 := {impl FnOnce<(&'_ (U))> for closure[@TraitClause0]}::call_once<'_, u32>[Sized](move (@3), move (@4)) storage_dead(@5) diff --git a/charon/tests/ui/issue-114-opaque-bodies.out b/charon/tests/ui/issue-114-opaque-bodies.out index e1b3ead69..cde049b3e 100644 --- a/charon/tests/ui/issue-114-opaque-bodies.out +++ b/charon/tests/ui/issue-114-opaque-bodies.out @@ -279,6 +279,16 @@ where return } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::use_inlines fn use_inlines() -> u32 { diff --git a/charon/tests/ui/issue-118-generic-copy.out b/charon/tests/ui/issue-118-generic-copy.out index ffc8cb293..68c3236fb 100644 --- a/charon/tests/ui/issue-118-generic-copy.out +++ b/charon/tests/ui/issue-118-generic-copy.out @@ -43,6 +43,16 @@ pub trait Destruct vtable: core::marker::Destruct::{vtable} } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Foo struct Foo {} diff --git a/charon/tests/ui/issue-120-bare-discriminant-read.out b/charon/tests/ui/issue-120-bare-discriminant-read.out index 956e56ea3..87e799d09 100644 --- a/charon/tests/ui/issue-120-bare-discriminant-read.out +++ b/charon/tests/ui/issue-120-bare-discriminant-read.out @@ -50,6 +50,16 @@ where non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::discriminant_value fn discriminant_value<'_0, T>(@1: &'_0 (Option[@TraitClause0])) -> isize where @@ -58,12 +68,9 @@ where let @0: isize; // return let opt@1: &'_ (Option[@TraitClause0]); // arg #1 let @2: &'_ (Option[@TraitClause0]); // anonymous local - let @3: (); // anonymous local storage_live(@2) - storage_live(@3) - @3 := () - @2 := &(*(opt@1), move (@3)) + @2 := &(*(opt@1), copy (@Global0)) @0 := @discriminant(*(@2)) storage_dead(@2) return @@ -79,18 +86,12 @@ where let @2: isize; // anonymous local let @3: &'_ (Option[@TraitClause0]); // anonymous local let @4: &'_ (Option[@TraitClause0]); // anonymous local - let @5: (); // anonymous local - let @6: (); // anonymous local storage_live(@2) storage_live(@3) storage_live(@4) - storage_live(@6) - @6 := () - @4 := &(opt@1, move (@6)) - storage_live(@5) - @5 := () - @3 := &(*(@4), move (@5)) + @4 := &(opt@1, copy (@Global0)) + @3 := &(*(@4), copy (@Global0)) @2 := discriminant_value<'_, T>[@TraitClause0](move (@3)) storage_dead(@3) @0 := move (@2) != const (0 : isize) diff --git a/charon/tests/ui/issue-159-heterogeneous-recursive-definitions.out b/charon/tests/ui/issue-159-heterogeneous-recursive-definitions.out index 91429c9a8..a0f1bfaa7 100644 --- a/charon/tests/ui/issue-159-heterogeneous-recursive-definitions.out +++ b/charon/tests/ui/issue-159-heterogeneous-recursive-definitions.out @@ -4,6 +4,16 @@ #[lang_item("meta_sized")] pub trait MetaSized +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Ops trait Ops { diff --git a/charon/tests/ui/issue-165-vec-macro.out b/charon/tests/ui/issue-165-vec-macro.out index fc0507916..fc778937c 100644 --- a/charon/tests/ui/issue-165-vec-macro.out +++ b/charon/tests/ui/issue-165-vec-macro.out @@ -120,6 +120,16 @@ where vtable: {impl Drop for Vec[@TraitClause0, @TraitClause1]}::{vtable}[@TraitClause0, @TraitClause1] } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::foo fn foo() { diff --git a/charon/tests/ui/issue-166-self-constructors.out b/charon/tests/ui/issue-166-self-constructors.out index 0b220da0d..4fee6f086 100644 --- a/charon/tests/ui/issue-166-self-constructors.out +++ b/charon/tests/ui/issue-166-self-constructors.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Foo enum Foo { A, diff --git a/charon/tests/ui/issue-297-cfg.out b/charon/tests/ui/issue-297-cfg.out index 22394989e..b9edba5b8 100644 --- a/charon/tests/ui/issue-297-cfg.out +++ b/charon/tests/ui/issue-297-cfg.out @@ -425,6 +425,16 @@ pub fn chunks<'_0, T>(@1: &'_0 (Slice), @2: usize) -> Chunks<'_0, T>[@TraitCl where [@TraitClause0]: Sized, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::f1 fn f1<'_0>(@1: &'_0 (Slice)) -> usize { @@ -573,25 +583,23 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize let @46: usize; // anonymous local let @47: usize; // anonymous local let @48: usize; // anonymous local - let @49: (); // anonymous local - let @50: (); // anonymous local + let @49: usize; // anonymous local + let @50: usize; // anonymous local let @51: usize; // anonymous local - let @52: usize; // anonymous local - let @53: usize; // anonymous local - let @54: &'_ mut (Slice); // anonymous local - let @55: &'_ mut (i16); // anonymous local - let @56: usize; // anonymous local - let @57: &'_ mut (Slice); // anonymous local - let @58: &'_ mut (i16); // anonymous local - let @59: usize; // anonymous local - let @60: &'_ (Slice); // anonymous local - let @61: &'_ (u8); // anonymous local - let @62: usize; // anonymous local - let @63: &'_ (Slice); // anonymous local - let @64: &'_ (u8); // anonymous local - let @65: usize; // anonymous local - let @66: &'_ (Slice); // anonymous local - let @67: &'_ (u8); // anonymous local + let @52: &'_ mut (Slice); // anonymous local + let @53: &'_ mut (i16); // anonymous local + let @54: usize; // anonymous local + let @55: &'_ mut (Slice); // anonymous local + let @56: &'_ mut (i16); // anonymous local + let @57: usize; // anonymous local + let @58: &'_ (Slice); // anonymous local + let @59: &'_ (u8); // anonymous local + let @60: usize; // anonymous local + let @61: &'_ (Slice); // anonymous local + let @62: &'_ (u8); // anonymous local + let @63: usize; // anonymous local + let @64: &'_ (Slice); // anonymous local + let @65: &'_ (u8); // anonymous local storage_live(@11) storage_live(bytes@13) @@ -646,8 +654,6 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@63) storage_live(@64) storage_live(@65) - storage_live(@66) - storage_live(@67) storage_live(sampled@3) sampled@3 := const (0 : usize) storage_live(@4) @@ -668,12 +674,8 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@10) storage_live(@11) storage_live(@12) - storage_live(@50) - @50 := () - @12 := &mut (iter@8, move (@50)) - storage_live(@49) - @49 := () - @11 := &two-phase-mut (*(@12), move (@49)) + @12 := &mut (iter@8, copy (@Global0)) + @11 := &two-phase-mut (*(@12), copy (@Global0)) @10 := {impl Iterator for Chunks<'a, T>[@TraitClause0]}::next<'_, '_, u8>[Sized](move (@11)) storage_dead(@11) match @10 { @@ -687,13 +689,13 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@15) storage_live(@16) @16 := const (0 : usize) + storage_live(@63) + @63 := ptr_metadata(copy (bytes@13)) + storage_live(@64) + @64 := &(*(bytes@13), move (@63)) storage_live(@65) - @65 := ptr_metadata(copy (bytes@13)) - storage_live(@66) - @66 := &(*(bytes@13), move (@65)) - storage_live(@67) - @67 := @SliceIndexShared<'_, u8>(move (@66), copy (@16)) - @15 := copy (*(@67)) + @65 := @SliceIndexShared<'_, u8>(move (@64), copy (@16)) + @15 := copy (*(@65)) b1@14 := cast(move (@15)) storage_dead(@15) storage_dead(@16) @@ -701,13 +703,13 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@18) storage_live(@19) @19 := const (1 : usize) + storage_live(@60) + @60 := ptr_metadata(copy (bytes@13)) + storage_live(@61) + @61 := &(*(bytes@13), move (@60)) storage_live(@62) - @62 := ptr_metadata(copy (bytes@13)) - storage_live(@63) - @63 := &(*(bytes@13), move (@62)) - storage_live(@64) - @64 := @SliceIndexShared<'_, u8>(move (@63), copy (@19)) - @18 := copy (*(@64)) + @62 := @SliceIndexShared<'_, u8>(move (@61), copy (@19)) + @18 := copy (*(@62)) b2@17 := cast(move (@18)) storage_dead(@18) storage_dead(@19) @@ -715,13 +717,13 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@21) storage_live(@22) @22 := const (2 : usize) + storage_live(@57) + @57 := ptr_metadata(copy (bytes@13)) + storage_live(@58) + @58 := &(*(bytes@13), move (@57)) storage_live(@59) - @59 := ptr_metadata(copy (bytes@13)) - storage_live(@60) - @60 := &(*(bytes@13), move (@59)) - storage_live(@61) - @61 := @SliceIndexShared<'_, u8>(move (@60), copy (@22)) - @21 := copy (*(@61)) + @59 := @SliceIndexShared<'_, u8>(move (@58), copy (@22)) + @21 := copy (*(@59)) b3@20 := cast(move (@21)) storage_dead(@21) storage_dead(@22) @@ -770,15 +772,15 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize @38 := copy (d1@23) storage_live(@39) @39 := copy (sampled@3) + storage_live(@49) + @49 := ptr_metadata(copy (result@2)) storage_live(@51) @51 := ptr_metadata(copy (result@2)) + storage_live(@52) + @52 := &mut (*(result@2), move (@51)) storage_live(@53) - @53 := ptr_metadata(copy (result@2)) - storage_live(@54) - @54 := &mut (*(result@2), move (@53)) - storage_live(@55) - @55 := @SliceIndexMut<'_, i16>(move (@54), copy (@39)) - *(@55) := move (@38) + @53 := @SliceIndexMut<'_, i16>(move (@52), copy (@39)) + *(@53) := move (@38) storage_dead(@38) storage_dead(@39) @40 := copy (sampled@3) panic.+ const (1 : usize) @@ -810,15 +812,15 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize @45 := copy (d2@28) storage_live(@46) @46 := copy (sampled@3) - storage_live(@52) - @52 := ptr_metadata(copy (result@2)) + storage_live(@50) + @50 := ptr_metadata(copy (result@2)) + storage_live(@54) + @54 := ptr_metadata(copy (result@2)) + storage_live(@55) + @55 := &mut (*(result@2), move (@54)) storage_live(@56) - @56 := ptr_metadata(copy (result@2)) - storage_live(@57) - @57 := &mut (*(result@2), move (@56)) - storage_live(@58) - @58 := @SliceIndexMut<'_, i16>(move (@57), copy (@46)) - *(@58) := move (@45) + @56 := @SliceIndexMut<'_, i16>(move (@55), copy (@46)) + *(@56) := move (@45) storage_dead(@45) storage_dead(@46) @47 := copy (sampled@3) panic.+ const (1 : usize) diff --git a/charon/tests/ui/issue-320-slice-pattern.out b/charon/tests/ui/issue-320-slice-pattern.out index 230a274fb..53894fb44 100644 --- a/charon/tests/ui/issue-320-slice-pattern.out +++ b/charon/tests/ui/issue-320-slice-pattern.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::slice_pat1 fn slice_pat1() { @@ -8,42 +18,33 @@ fn slice_pat1() let _a@2: i32; // local let _b@3: Array; // local let _c@4: i32; // local - let @5: (); // anonymous local - let @6: &'_ (Array); // anonymous local - let @7: &'_ (i32); // anonymous local - let @8: (); // anonymous local + let @5: &'_ (Array); // anonymous local + let @6: &'_ (i32); // anonymous local + let @7: &'_ (Array); // anonymous local + let @8: &'_ (Slice); // anonymous local let @9: &'_ (Array); // anonymous local - let @10: &'_ (Slice); // anonymous local - let @11: (); // anonymous local - let @12: &'_ (Array); // anonymous local - let @13: &'_ (i32); // anonymous local + let @10: &'_ (i32); // anonymous local storage_live(array@1) array@1 := @ArrayRepeat<'_, i32, 4 : usize>(const (0 : i32)) storage_live(_a@2) - storage_live(@11) - @11 := () - storage_live(@12) - @12 := &(array@1, move (@11)) - storage_live(@13) - @13 := @ArrayIndexShared<'_, i32, 4 : usize>(move (@12), const (0 : usize)) - _a@2 := copy (*(@13)) - storage_live(_b@3) - storage_live(@8) - @8 := () storage_live(@9) - @9 := &(array@1, move (@8)) + @9 := &(array@1, const (@Global0)) storage_live(@10) - @10 := @ArraySubSliceShared<'_, i32, 4 : usize>(move (@9), const (1 : usize), const (3 : usize)) - _b@3 := copy (*(@10)) + @10 := @ArrayIndexShared<'_, i32, 4 : usize>(move (@9), const (0 : usize)) + _a@2 := copy (*(@10)) + storage_live(_b@3) + storage_live(@7) + @7 := &(array@1, const (@Global0)) + storage_live(@8) + @8 := @ArraySubSliceShared<'_, i32, 4 : usize>(move (@7), const (1 : usize), const (3 : usize)) + _b@3 := copy (*(@8)) storage_live(_c@4) storage_live(@5) - @5 := () + @5 := &(array@1, const (@Global0)) storage_live(@6) - @6 := &(array@1, move (@5)) - storage_live(@7) - @7 := @ArrayIndexShared<'_, i32, 4 : usize>(move (@6), const (3 : usize)) - _c@4 := copy (*(@7)) + @6 := @ArrayIndexShared<'_, i32, 4 : usize>(move (@5), const (3 : usize)) + _c@4 := copy (*(@6)) @0 := () storage_dead(_c@4) storage_dead(_b@3) @@ -63,62 +64,38 @@ fn slice_pat2() let _a@4: &'_ (i32); // local let _b@5: &'_ (Array); // local let _c@6: &'_ (i32); // local - let @7: (); // anonymous local - let @8: (); // anonymous local - let @9: (); // anonymous local - let @10: (); // anonymous local - let @11: (); // anonymous local - let @12: (); // anonymous local - let @13: &'_ (Array); // anonymous local - let @14: &'_ (i32); // anonymous local - let @15: (); // anonymous local - let @16: &'_ (Array); // anonymous local - let @17: &'_ (Slice); // anonymous local - let @18: (); // anonymous local - let @19: &'_ (Array); // anonymous local - let @20: &'_ (i32); // anonymous local + let @7: &'_ (Array); // anonymous local + let @8: &'_ (i32); // anonymous local + let @9: &'_ (Array); // anonymous local + let @10: &'_ (Slice); // anonymous local + let @11: &'_ (Array); // anonymous local + let @12: &'_ (i32); // anonymous local storage_live(array_ref@1) storage_live(@2) storage_live(@3) @3 := @ArrayRepeat<'_, i32, 4 : usize>(const (0 : i32)) - storage_live(@11) - @11 := () - @2 := &(@3, move (@11)) - storage_live(@10) - @10 := () - array_ref@1 := &(*(@2), move (@10)) + @2 := &(@3, copy (@Global0)) + array_ref@1 := &(*(@2), copy (@Global0)) storage_dead(@2) storage_live(_a@4) - storage_live(@9) - @9 := () - storage_live(@18) - @18 := () - storage_live(@19) - @19 := &(*(array_ref@1), move (@18)) - storage_live(@20) - @20 := @ArrayIndexShared<'_, i32, 4 : usize>(move (@19), const (0 : usize)) - _a@4 := &(*(@20), move (@9)) + storage_live(@11) + @11 := &(*(array_ref@1), const (@Global0)) + storage_live(@12) + @12 := @ArrayIndexShared<'_, i32, 4 : usize>(move (@11), const (0 : usize)) + _a@4 := &(*(@12), copy (@Global0)) storage_live(_b@5) - storage_live(@8) - @8 := () - storage_live(@15) - @15 := () - storage_live(@16) - @16 := &(*(array_ref@1), move (@15)) - storage_live(@17) - @17 := @ArraySubSliceShared<'_, i32, 4 : usize>(move (@16), const (1 : usize), const (3 : usize)) - _b@5 := &(*(@17), move (@8)) + storage_live(@9) + @9 := &(*(array_ref@1), const (@Global0)) + storage_live(@10) + @10 := @ArraySubSliceShared<'_, i32, 4 : usize>(move (@9), const (1 : usize), const (3 : usize)) + _b@5 := &(*(@10), copy (@Global0)) storage_live(_c@6) storage_live(@7) - @7 := () - storage_live(@12) - @12 := () - storage_live(@13) - @13 := &(*(array_ref@1), move (@12)) - storage_live(@14) - @14 := @ArrayIndexShared<'_, i32, 4 : usize>(move (@13), const (3 : usize)) - _c@6 := &(*(@14), move (@7)) + @7 := &(*(array_ref@1), const (@Global0)) + storage_live(@8) + @8 := @ArrayIndexShared<'_, i32, 4 : usize>(move (@7), const (3 : usize)) + _c@6 := &(*(@8), copy (@Global0)) @0 := () storage_dead(_c@6) storage_dead(_b@5) @@ -143,27 +120,23 @@ fn slice_pat3() let @8: usize; // anonymous local let @9: usize; // anonymous local let @10: bool; // anonymous local - let @11: (); // anonymous local - let @12: (); // anonymous local - let @13: (); // anonymous local + let @11: usize; // anonymous local + let @12: usize; // anonymous local + let @13: usize; // anonymous local let @14: usize; // anonymous local let @15: usize; // anonymous local - let @16: usize; // anonymous local + let @16: &'_ (Slice); // anonymous local let @17: usize; // anonymous local - let @18: (); // anonymous local - let @19: usize; // anonymous local - let @20: &'_ (Slice); // anonymous local - let @21: usize; // anonymous local + let @18: usize; // anonymous local + let @19: &'_ (i32); // anonymous local + let @20: usize; // anonymous local + let @21: &'_ (Slice); // anonymous local let @22: usize; // anonymous local - let @23: &'_ (i32); // anonymous local - let @24: usize; // anonymous local - let @25: &'_ (Slice); // anonymous local - let @26: usize; // anonymous local - let @27: usize; // anonymous local - let @28: &'_ (Slice); // anonymous local - let @29: usize; // anonymous local - let @30: &'_ (Slice); // anonymous local - let @31: &'_ (i32); // anonymous local + let @23: usize; // anonymous local + let @24: &'_ (Slice); // anonymous local + let @25: usize; // anonymous local + let @26: &'_ (Slice); // anonymous local + let @27: &'_ (i32); // anonymous local storage_live(@8) storage_live(@9) @@ -173,12 +146,8 @@ fn slice_pat3() storage_live(@3) storage_live(@4) @4 := @ArrayRepeat<'_, i32, 4 : usize>(const (0 : i32)) - storage_live(@12) - @12 := () - @3 := &(@4, move (@12)) - storage_live(@11) - @11 := () - @2 := &(*(@3), move (@11)) + @3 := &(@4, copy (@Global0)) + @2 := &(*(@3), copy (@Global0)) slice@1 := @ArrayToSliceShared<'_, i32, 4 : usize>(move (@2)) storage_dead(@2) storage_dead(@3) @@ -196,50 +165,46 @@ fn slice_pat3() storage_dead(_a@5) panic(core::panicking::panic_explicit) } - storage_live(@18) - @18 := () - storage_live(@29) - @29 := ptr_metadata(copy (slice@1)) - storage_live(@30) - @30 := &(*(slice@1), move (@29)) - storage_live(@31) - @31 := @SliceIndexShared<'_, i32>(move (@30), const (0 : usize)) - _a@5 := &(*(@31), move (@18)) - storage_live(@14) - @14 := len(*(slice@1)) - storage_live(@15) - @15 := copy (@14) ub.- const (1 : usize) - storage_dead(@14) - storage_live(@16) - @16 := copy (@15) ub.- const (1 : usize) - storage_live(@17) - @17 := copy (@16) - storage_live(@24) - @24 := ptr_metadata(copy (slice@1)) storage_live(@25) - @25 := &(*(slice@1), move (@24)) + @25 := ptr_metadata(copy (slice@1)) storage_live(@26) - @26 := len(*(slice@1)) + @26 := &(*(slice@1), move (@25)) storage_live(@27) - @27 := copy (@26) ub.- const (1 : usize) - storage_dead(@26) - storage_live(@28) - @28 := @SliceSubSliceShared<'_, i32>(move (@25), const (1 : usize), copy (@27)) - _b@6 := &(*(@28), move (@17)) + @27 := @SliceIndexShared<'_, i32>(move (@26), const (0 : usize)) + _a@5 := &(*(@27), copy (@Global0)) + storage_live(@11) + @11 := len(*(slice@1)) + storage_live(@12) + @12 := copy (@11) ub.- const (1 : usize) + storage_dead(@11) storage_live(@13) - @13 := () - storage_live(@19) - @19 := ptr_metadata(copy (slice@1)) + @13 := copy (@12) ub.- const (1 : usize) + storage_live(@14) + @14 := copy (@13) storage_live(@20) - @20 := &(*(slice@1), move (@19)) + @20 := ptr_metadata(copy (slice@1)) storage_live(@21) - @21 := len(*(slice@1)) + @21 := &(*(slice@1), move (@20)) storage_live(@22) - @22 := copy (@21) ub.- const (1 : usize) - storage_dead(@21) + @22 := len(*(slice@1)) storage_live(@23) - @23 := @SliceIndexShared<'_, i32>(move (@20), copy (@22)) - _c@7 := &(*(@23), move (@13)) + @23 := copy (@22) ub.- const (1 : usize) + storage_dead(@22) + storage_live(@24) + @24 := @SliceSubSliceShared<'_, i32>(move (@21), const (1 : usize), copy (@23)) + _b@6 := &(*(@24), move (@14)) + storage_live(@15) + @15 := ptr_metadata(copy (slice@1)) + storage_live(@16) + @16 := &(*(slice@1), move (@15)) + storage_live(@17) + @17 := len(*(slice@1)) + storage_live(@18) + @18 := copy (@17) ub.- const (1 : usize) + storage_dead(@17) + storage_live(@19) + @19 := @SliceIndexShared<'_, i32>(move (@16), copy (@18)) + _c@7 := &(*(@19), copy (@Global0)) @0 := () storage_dead(_c@7) storage_dead(_b@6) diff --git a/charon/tests/ui/issue-322-macro-disambiguator.out b/charon/tests/ui/issue-322-macro-disambiguator.out index 20b198f0c..4a35431e1 100644 --- a/charon/tests/ui/issue-322-macro-disambiguator.out +++ b/charon/tests/ui/issue-322-macro-disambiguator.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + struct test_crate::main::AssertIsAsBytes {} struct test_crate::main::AssertIsAsBytes#1 {} diff --git a/charon/tests/ui/issue-323-closure-borrow.out b/charon/tests/ui/issue-323-closure-borrow.out index 8f66211db..edde2dc62 100644 --- a/charon/tests/ui/issue-323-closure-borrow.out +++ b/charon/tests/ui/issue-323-closure-borrow.out @@ -67,6 +67,16 @@ pub fn core::ops::function::FnOnce::call_once(@1: Self, @2: Args) -> where [@TraitClause0]: FnOnce, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Rng struct Rng {} @@ -93,13 +103,10 @@ fn new<'_0>(@1: &'_0 mut (Rng)) let rng@1: &'_ mut (Rng); // arg #1 let @2: closure<'_>; // anonymous local let @3: &'_ mut (Rng); // anonymous local - let @4: (); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@4) - @4 := () - @3 := &uniq (*(rng@1), move (@4)) + @3 := &uniq (*(rng@1), copy (@Global0)) @2 := closure { 0: move (@3) } storage_dead(@3) storage_dead(@2) @@ -116,13 +123,10 @@ fn {impl FnMut<()> for closure<'_0>}::call_mut<'_0, '_1>(@1: &'_1 mut (closure<' let tupled_args@2: (); // arg #2 let @3: (); // anonymous local let @4: &'_ mut (Rng); // anonymous local - let @5: (); // anonymous local storage_live(@3) storage_live(@4) - storage_live(@5) - @5 := () - @4 := &two-phase-mut (*((*(@1)).0), move (@5)) + @4 := &two-phase-mut (*((*(@1)).0), copy (@Global0)) @3 := next_u64<'_>(move (@4)) storage_dead(@4) storage_dead(@3) @@ -138,12 +142,9 @@ fn {impl FnOnce<()> for closure<'_0>}::call_once<'_0>(@1: closure<'_0>, @2: ()) let @1: closure<'_0>; // arg #1 let @2: (); // arg #2 let @3: &'_ mut (closure<'_0>); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<()> for closure<'_0>}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop>] @1 @0 := () diff --git a/charon/tests/ui/issue-369-mismatched-genericparams.out b/charon/tests/ui/issue-369-mismatched-genericparams.out index f8597f608..00094c08d 100644 --- a/charon/tests/ui/issue-369-mismatched-genericparams.out +++ b/charon/tests/ui/issue-369-mismatched-genericparams.out @@ -22,6 +22,16 @@ where Some(T), } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::FromResidual pub trait FromResidual { diff --git a/charon/tests/ui/issue-372-type-param-out-of-range.out b/charon/tests/ui/issue-372-type-param-out-of-range.out index ab6f0e8c8..9180bb3c6 100644 --- a/charon/tests/ui/issue-372-type-param-out-of-range.out +++ b/charon/tests/ui/issue-372-type-param-out-of-range.out @@ -55,6 +55,16 @@ pub fn call_once(@1: Self, @2: Args) -> @TraitClause0::Output where [@TraitClause0]: FnOnce, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::S pub struct S<'a, K> where diff --git a/charon/tests/ui/issue-378-ctor-as-fn.out b/charon/tests/ui/issue-378-ctor-as-fn.out index 948c72dc8..c984560f0 100644 --- a/charon/tests/ui/issue-378-ctor-as-fn.out +++ b/charon/tests/ui/issue-378-ctor-as-fn.out @@ -58,6 +58,16 @@ impl Drop for String { #[lang_item("string_new")] pub fn new() -> String +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::F fn F() -> fn(u8) -> Option[Sized] { @@ -82,12 +92,9 @@ fn {impl Drop for Foo}::drop<'_0>(@1: &'_0 mut (Foo)) let @0: (); // return let @1: *mut Foo; // arg #1 let @2: &'_ mut (Foo); // anonymous local - let @3: (); // anonymous local storage_live(@2) - storage_live(@3) - @3 := () - @2 := &mut (*(@1), move (@3)) + @2 := &mut (*(@1), copy (@Global0)) drop[{impl Drop for String}] (*(@2)).1 @0 := () return @@ -154,8 +161,6 @@ fn main() let @15: &'_ (i32); // anonymous local let @16: &'_ (i32); // anonymous local let @17: i32; // anonymous local - let @18: (); // anonymous local - let @19: (); // anonymous local storage_live(f@1) f@1 := const (Some[Sized]) @@ -197,12 +202,8 @@ fn main() storage_live(@16) storage_live(@17) @17 := const (42 : i32) - storage_live(@19) - @19 := () - @16 := &(@17, move (@19)) - storage_live(@18) - @18 := () - @15 := &(*(@16), move (@18)) + @16 := &(@17, copy (@Global0)) + @15 := &(*(@16), copy (@Global0)) @13 := Variant<'_, i32>[Sized](move (@15)) storage_dead(@15) storage_dead(@14) diff --git a/charon/tests/ui/issue-394-rpit-with-lifetime.out b/charon/tests/ui/issue-394-rpit-with-lifetime.out index f03c63ec7..4c7358a77 100644 --- a/charon/tests/ui/issue-394-rpit-with-lifetime.out +++ b/charon/tests/ui/issue-394-rpit-with-lifetime.out @@ -90,6 +90,16 @@ pub fn core::ops::function::FnOnce::call_once(@1: Self, @2: Args) -> where [@TraitClause0]: FnOnce, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::sparse_transitions::closure struct closure<'a> {} @@ -111,12 +121,9 @@ fn {impl FnOnce<()> for closure<'_>}::call_once<'a>(@1: closure<'_>, @2: ()) -> let @1: closure<'_>; // arg #1 let @2: (); // arg #2 let @3: &'_ mut (closure<'_>); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<()> for closure<'_>}::call_mut<'_, '_>(move (@3), move (@2)) drop[Drop>] @1 return diff --git a/charon/tests/ui/issue-395-failed-to-normalize.out b/charon/tests/ui/issue-395-failed-to-normalize.out index d6d50f21a..cbff4c642 100644 --- a/charon/tests/ui/issue-395-failed-to-normalize.out +++ b/charon/tests/ui/issue-395-failed-to-normalize.out @@ -376,6 +376,16 @@ where vtable: core::ops::try_trait::Residual::{vtable} } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Trait pub trait Trait { diff --git a/charon/tests/ui/issue-4-slice-try-into-array.out b/charon/tests/ui/issue-4-slice-try-into-array.out index 4da2692a2..b50d2cf85 100644 --- a/charon/tests/ui/issue-4-slice-try-into-array.out +++ b/charon/tests/ui/issue-4-slice-try-into-array.out @@ -180,6 +180,16 @@ where [@TraitClause1]: Sized, [@TraitClause2]: Debug, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::trait_error pub fn trait_error<'_0>(@1: &'_0 (Slice)) { diff --git a/charon/tests/ui/issue-4-traits.out b/charon/tests/ui/issue-4-traits.out index 2d79436f0..2b8e84ee6 100644 --- a/charon/tests/ui/issue-4-traits.out +++ b/charon/tests/ui/issue-4-traits.out @@ -180,6 +180,16 @@ where [@TraitClause1]: Sized, [@TraitClause2]: Debug, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::trait_error fn trait_error<'_0>(@1: &'_0 (Slice)) { diff --git a/charon/tests/ui/issue-45-misc.out b/charon/tests/ui/issue-45-misc.out index a02702182..961c9ef6a 100644 --- a/charon/tests/ui/issue-45-misc.out +++ b/charon/tests/ui/issue-45-misc.out @@ -536,6 +536,16 @@ pub fn core::slice::{Slice}::len<'_0, T>(@1: &'_0 (Slice)) -> usize where [@TraitClause0]: Sized, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::map::closure struct closure {} @@ -560,12 +570,9 @@ fn {impl FnOnce<(i32)> for closure}::call_once(@1: closure, @2: (i32)) -> i32 let @1: closure; // arg #1 let @2: (i32); // arg #2 let @3: &'_ mut (closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(i32)> for closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return @@ -633,11 +640,8 @@ fn cbd(@1: Array) let i@9: u8; // local let @10: u8; // anonymous local let @11: usize; // anonymous local - let @12: (); // anonymous local - let @13: (); // anonymous local - let @14: (); // anonymous local - let @15: &'_ mut (Array); // anonymous local - let @16: &'_ mut (u8); // anonymous local + let @12: &'_ mut (Array); // anonymous local + let @13: &'_ mut (u8); // anonymous local storage_live(@7) storage_live(i@9) @@ -645,9 +649,6 @@ fn cbd(@1: Array) storage_live(@11) storage_live(@12) storage_live(@13) - storage_live(@14) - storage_live(@15) - storage_live(@16) storage_live(@2) storage_live(@3) @3 := Range { start: const (0 : u8), end: const (3 : u8) } @@ -660,12 +661,8 @@ fn cbd(@1: Array) storage_live(@6) storage_live(@7) storage_live(@8) - storage_live(@13) - @13 := () - @8 := &mut (iter@4, move (@13)) - storage_live(@12) - @12 := () - @7 := &two-phase-mut (*(@8), move (@12)) + @8 := &mut (iter@4, copy (@Global0)) + @7 := &two-phase-mut (*(@8), copy (@Global0)) @6 := {impl Iterator for Range[@TraitClause0]}::next<'_, u8>[Sized, {impl Step for u8}](move (@7)) storage_dead(@7) match @6 { @@ -679,13 +676,11 @@ fn cbd(@1: Array) @10 := copy (i@9) storage_live(@11) @11 := const (0 : usize) - storage_live(@14) - @14 := () - storage_live(@15) - @15 := &mut (prf_input@1, move (@14)) - storage_live(@16) - @16 := @ArrayIndexMut<'_, u8, 33 : usize>(move (@15), copy (@11)) - *(@16) := move (@10) + storage_live(@12) + @12 := &mut (prf_input@1, const (@Global0)) + storage_live(@13) + @13 := @ArrayIndexMut<'_, u8, 33 : usize>(move (@12), copy (@11)) + *(@13) := move (@10) storage_dead(@10) storage_dead(@11) storage_dead(i@9) @@ -736,12 +731,6 @@ fn select<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) let @24: Option>[Sized>]; // anonymous local let @25: usize; // anonymous local let @26: usize; // anonymous local - let @27: (); // anonymous local - let @28: (); // anonymous local - let @29: (); // anonymous local - let @30: (); // anonymous local - let @31: (); // anonymous local - let @32: (); // anonymous local storage_live(@5) storage_live(@6) @@ -765,12 +754,6 @@ fn select<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) storage_live(@24) storage_live(@25) storage_live(@26) - storage_live(@27) - storage_live(@28) - storage_live(@29) - storage_live(@30) - storage_live(@31) - storage_live(@32) storage_live(@3) storage_live(@4) @4 := const (true) @@ -785,9 +768,7 @@ fn select<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) @9 := &(*(lhs@1), move (@25)) @8 := core::slice::{Slice}::len<'_, u8>[Sized](move (@9)) storage_dead(@9) - storage_live(@27) - @27 := () - @7 := &(@8, move (@27)) + @7 := &(@8, copy (@Global0)) storage_live(@10) storage_live(@11) storage_live(@12) @@ -796,9 +777,7 @@ fn select<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) @12 := &(*(rhs@2), move (@26)) @11 := core::slice::{Slice}::len<'_, u8>[Sized](move (@12)) storage_dead(@12) - storage_live(@28) - @28 := () - @10 := &(@11, move (@28)) + @10 := &(@11, copy (@Global0)) @6 := (move (@7), move (@10)) storage_dead(@10) storage_dead(@7) @@ -823,20 +802,12 @@ fn select<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) @19 := move (kind@18) storage_live(@20) storage_live(@21) - storage_live(@32) - @32 := () - @21 := &(*(left_val@13), move (@32)) - storage_live(@31) - @31 := () - @20 := &(*(@21), move (@31)) + @21 := &(*(left_val@13), copy (@Global0)) + @20 := &(*(@21), copy (@Global0)) storage_live(@22) storage_live(@23) - storage_live(@30) - @30 := () - @23 := &(*(right_val@14), move (@30)) - storage_live(@29) - @29 := () - @22 := &(*(@23), move (@29)) + @23 := &(*(right_val@14), copy (@Global0)) + @22 := &(*(@23), copy (@Global0)) storage_live(@24) @24 := Option::None { } panic(core::panicking::assert_failed) diff --git a/charon/tests/ui/issue-507-cfg.out b/charon/tests/ui/issue-507-cfg.out index afd4d489e..a697f95bf 100644 --- a/charon/tests/ui/issue-507-cfg.out +++ b/charon/tests/ui/issue-507-cfg.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::CONST fn CONST() -> u8 { diff --git a/charon/tests/ui/issue-70-override-provided-method.2.out b/charon/tests/ui/issue-70-override-provided-method.2.out index 615b8e36a..afeec4a35 100644 --- a/charon/tests/ui/issue-70-override-provided-method.2.out +++ b/charon/tests/ui/issue-70-override-provided-method.2.out @@ -4,6 +4,16 @@ #[lang_item("meta_sized")] pub trait MetaSized +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Trait trait Trait { @@ -97,13 +107,10 @@ fn {impl Trait for Foo}::required<'_0>(@1: &'_0 (Foo)) let self@1: &'_ (Foo); // arg #1 let @2: (); // anonymous local let @3: &'_ (Foo); // anonymous local - let @4: (); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(self@1), move (@4)) + @3 := &(*(self@1), copy (@Global0)) @2 := test_crate::{impl Trait for Foo}::provided1<'_>(move (@3)) storage_dead(@3) storage_dead(@2) @@ -120,22 +127,16 @@ fn test_crate::{impl Trait for Foo}::provided1<'_0>(@1: &'_0 (Foo)) let @3: &'_ (Foo); // anonymous local let @4: (); // anonymous local let @5: &'_ (Foo); // anonymous local - let @6: (); // anonymous local - let @7: (); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@6) - @6 := () - @3 := &(*(self@1), move (@6)) + @3 := &(*(self@1), copy (@Global0)) @2 := {impl Trait for Foo}::required<'_>(move (@3)) storage_dead(@3) storage_dead(@2) storage_live(@4) storage_live(@5) - storage_live(@7) - @7 := () - @5 := &(*(self@1), move (@7)) + @5 := &(*(self@1), copy (@Global0)) @4 := test_crate::{impl Trait for Foo}::provided2<'_>(move (@5)) storage_dead(@5) storage_dead(@4) @@ -152,22 +153,16 @@ fn test_crate::{impl Trait for Foo}::provided2<'_0>(@1: &'_0 (Foo)) let @3: &'_ (Foo); // anonymous local let @4: (); // anonymous local let @5: &'_ (Foo); // anonymous local - let @6: (); // anonymous local - let @7: (); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@6) - @6 := () - @3 := &(*(self@1), move (@6)) + @3 := &(*(self@1), copy (@Global0)) @2 := {impl Trait for Foo}::required<'_>(move (@3)) storage_dead(@3) storage_dead(@2) storage_live(@4) storage_live(@5) - storage_live(@7) - @7 := () - @5 := &(*(self@1), move (@7)) + @5 := &(*(self@1), copy (@Global0)) @4 := test_crate::{impl Trait for Foo}::provided1<'_>(move (@5)) storage_dead(@5) storage_dead(@4) @@ -195,13 +190,10 @@ fn {impl Trait for Bar}::required<'_0>(@1: &'_0 (Bar)) let self@1: &'_ (Bar); // arg #1 let @2: (); // anonymous local let @3: &'_ (Bar); // anonymous local - let @4: (); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(self@1), move (@4)) + @3 := &(*(self@1), copy (@Global0)) @2 := test_crate::{impl Trait for Bar}::provided2<'_>(move (@3)) storage_dead(@3) storage_dead(@2) @@ -217,13 +209,10 @@ fn {impl Trait for Bar}::provided1<'_0>(@1: &'_0 (Bar)) let self@1: &'_ (Bar); // arg #1 let @2: (); // anonymous local let @3: &'_ (Bar); // anonymous local - let @4: (); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(self@1), move (@4)) + @3 := &(*(self@1), copy (@Global0)) @2 := test_crate::{impl Trait for Bar}::provided2<'_>(move (@3)) storage_dead(@3) storage_dead(@2) @@ -240,22 +229,16 @@ fn test_crate::{impl Trait for Bar}::provided2<'_0>(@1: &'_0 (Bar)) let @3: &'_ (Bar); // anonymous local let @4: (); // anonymous local let @5: &'_ (Bar); // anonymous local - let @6: (); // anonymous local - let @7: (); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@6) - @6 := () - @3 := &(*(self@1), move (@6)) + @3 := &(*(self@1), copy (@Global0)) @2 := {impl Trait for Bar}::required<'_>(move (@3)) storage_dead(@3) storage_dead(@2) storage_live(@4) storage_live(@5) - storage_live(@7) - @7 := () - @5 := &(*(self@1), move (@7)) + @5 := &(*(self@1), copy (@Global0)) @4 := {impl Trait for Bar}::provided1<'_>(move (@5)) storage_dead(@5) storage_dead(@4) diff --git a/charon/tests/ui/issue-70-override-provided-method.3.out b/charon/tests/ui/issue-70-override-provided-method.3.out index da08d6f1f..4c12cbcbf 100644 --- a/charon/tests/ui/issue-70-override-provided-method.3.out +++ b/charon/tests/ui/issue-70-override-provided-method.3.out @@ -98,6 +98,16 @@ where non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::GenericTrait trait GenericTrait { @@ -125,18 +135,12 @@ where let @3: bool; // anonymous local let @4: &'_ (U); // anonymous local let @5: &'_ (T); // anonymous local - let @6: (); // anonymous local - let @7: (); // anonymous local storage_live(@3) storage_live(@4) - storage_live(@7) - @7 := () - @4 := &(y@2, move (@7)) + @4 := &(y@2, copy (@Global0)) storage_live(@5) - storage_live(@6) - @6 := () - @5 := &(x@1, move (@6)) + @5 := &(x@1, copy (@Global0)) @3 := @TraitClause2::eq<'_, '_>(move (@4), move (@5)) if move (@3) { storage_dead(@5) @@ -190,18 +194,12 @@ where let @3: bool; // anonymous local let @4: &'_ (U); // anonymous local let @5: &'_ (Option[@TraitClause0]); // anonymous local - let @6: (); // anonymous local - let @7: (); // anonymous local storage_live(@3) storage_live(@4) - storage_live(@7) - @7 := () - @4 := &(y@2, move (@7)) + @4 := &(y@2, copy (@Global0)) storage_live(@5) - storage_live(@6) - @6 := () - @5 := &(x@1, move (@6)) + @5 := &(x@1, copy (@Global0)) @3 := @TraitClause3::eq<'_, '_>(move (@4), move (@5)) if move (@3) { storage_dead(@5) @@ -267,18 +265,12 @@ where let @3: bool; // anonymous local let @4: &'_ (U); // anonymous local let @5: &'_ (Option[@TraitClause0]); // anonymous local - let @6: (); // anonymous local - let @7: (); // anonymous local storage_live(@3) storage_live(@4) - storage_live(@7) - @7 := () - @4 := &(y@2, move (@7)) + @4 := &(y@2, copy (@Global0)) storage_live(@5) - storage_live(@6) - @6 := () - @5 := &(x@1, move (@6)) + @5 := &(x@1, copy (@Global0)) @3 := @TraitClause3::eq<'_, '_>(move (@4), move (@5)) if move (@3) { storage_dead(@5) diff --git a/charon/tests/ui/issue-70-override-provided-method.out b/charon/tests/ui/issue-70-override-provided-method.out index 9354ae94d..d3bec1e07 100644 --- a/charon/tests/ui/issue-70-override-provided-method.out +++ b/charon/tests/ui/issue-70-override-provided-method.out @@ -109,6 +109,16 @@ where vtable: {impl PartialEq[@TraitClause0]> for Option[@TraitClause0]}::{vtable}[@TraitClause0, @TraitClause1] } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::main fn main() { @@ -118,22 +128,16 @@ fn main() let @3: Option[Sized]; // anonymous local let @4: &'_ (Option[Sized]); // anonymous local let @5: Option[Sized]; // anonymous local - let @6: (); // anonymous local - let @7: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) @3 := Option::Some { 0: const (1 : i32) } - storage_live(@7) - @7 := () - @2 := &(@3, move (@7)) + @2 := &(@3, copy (@Global0)) storage_live(@4) storage_live(@5) @5 := Option::Some { 0: const (1 : i32) } - storage_live(@6) - @6 := () - @4 := &(@5, move (@6)) + @4 := &(@5, copy (@Global0)) @1 := {impl PartialEq[@TraitClause0]> for Option[@TraitClause0]}::eq<'_, '_, i32>[Sized, {impl PartialEq for i32}](move (@2), move (@4)) storage_dead(@4) storage_dead(@2) @@ -191,27 +195,15 @@ pub fn {impl PartialOrd for Foo}::partial_cmp<'_0, '_1>(@1: &'_0 (Foo), @2: let @4: &'_ (u32); // anonymous local let @5: &'_ (u32); // anonymous local let @6: &'_ (u32); // anonymous local - let @7: (); // anonymous local - let @8: (); // anonymous local - let @9: (); // anonymous local - let @10: (); // anonymous local storage_live(@3) storage_live(@4) - storage_live(@10) - @10 := () - @4 := &((*(self@1)).0, move (@10)) - storage_live(@9) - @9 := () - @3 := &(*(@4), move (@9)) + @4 := &((*(self@1)).0, copy (@Global0)) + @3 := &(*(@4), copy (@Global0)) storage_live(@5) storage_live(@6) - storage_live(@8) - @8 := () - @6 := &((*(other@2)).0, move (@8)) - storage_live(@7) - @7 := () - @5 := &(*(@6), move (@7)) + @6 := &((*(other@2)).0, copy (@Global0)) + @5 := &(*(@6), copy (@Global0)) @0 := {impl PartialOrd for u32}::partial_cmp<'_, '_>(move (@3), move (@5)) storage_dead(@6) storage_dead(@5) diff --git a/charon/tests/ui/issue-72-hash-missing-impl.out b/charon/tests/ui/issue-72-hash-missing-impl.out index dcc450ec0..e4eddaafd 100644 --- a/charon/tests/ui/issue-72-hash-missing-impl.out +++ b/charon/tests/ui/issue-72-hash-missing-impl.out @@ -12,6 +12,16 @@ pub trait Sized non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Hasher pub trait Hasher { @@ -74,9 +84,6 @@ fn main() let @4: u32; // anonymous local let @5: &'_ mut (DefaultHasher); // anonymous local let @6: &'_ mut (DefaultHasher); // anonymous local - let @7: (); // anonymous local - let @8: (); // anonymous local - let @9: (); // anonymous local storage_live(hasher@1) hasher@1 := DefaultHasher { } @@ -84,17 +91,11 @@ fn main() storage_live(@3) storage_live(@4) @4 := const (0 : u32) - storage_live(@9) - @9 := () - @3 := &(@4, move (@9)) + @3 := &(@4, copy (@Global0)) storage_live(@5) storage_live(@6) - storage_live(@8) - @8 := () - @6 := &mut (hasher@1, move (@8)) - storage_live(@7) - @7 := () - @5 := &two-phase-mut (*(@6), move (@7)) + @6 := &mut (hasher@1, copy (@Global0)) + @5 := &two-phase-mut (*(@6), copy (@Global0)) @2 := {impl Hash for u32}::hash<'_, '_, DefaultHasher>[Sized, {impl Hasher for DefaultHasher}](move (@3), move (@5)) storage_dead(@5) storage_dead(@3) diff --git a/charon/tests/ui/issue-73-extern.out b/charon/tests/ui/issue-73-extern.out index 6e257f262..bb7ef7310 100644 --- a/charon/tests/ui/issue-73-extern.out +++ b/charon/tests/ui/issue-73-extern.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::foo unsafe fn foo(@1: i32) diff --git a/charon/tests/ui/issue-91-enum-to-discriminant-cast.out b/charon/tests/ui/issue-91-enum-to-discriminant-cast.out index 7004f68e8..e4cf7d938 100644 --- a/charon/tests/ui/issue-91-enum-to-discriminant-cast.out +++ b/charon/tests/ui/issue-91-enum-to-discriminant-cast.out @@ -43,6 +43,16 @@ pub trait Destruct vtable: core::marker::Destruct::{vtable} } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Foo enum Foo { A, diff --git a/charon/tests/ui/issue-92-nonpositive-variant-indices.out b/charon/tests/ui/issue-92-nonpositive-variant-indices.out index adfeca4e3..6507d665f 100644 --- a/charon/tests/ui/issue-92-nonpositive-variant-indices.out +++ b/charon/tests/ui/issue-92-nonpositive-variant-indices.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Ordering enum Ordering { Less, diff --git a/charon/tests/ui/issue-93-recursive-traits-with-assoc-types.out b/charon/tests/ui/issue-93-recursive-traits-with-assoc-types.out index 51fd22559..b858c561c 100644 --- a/charon/tests/ui/issue-93-recursive-traits-with-assoc-types.out +++ b/charon/tests/ui/issue-93-recursive-traits-with-assoc-types.out @@ -12,6 +12,16 @@ pub trait Sized non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Trait1 pub trait Trait1 { diff --git a/charon/tests/ui/issue-94-recursive-trait-defns.out b/charon/tests/ui/issue-94-recursive-trait-defns.out index 5a203b78a..8ae892433 100644 --- a/charon/tests/ui/issue-94-recursive-trait-defns.out +++ b/charon/tests/ui/issue-94-recursive-trait-defns.out @@ -12,6 +12,16 @@ pub trait Sized non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Trait1 pub trait Trait1 { diff --git a/charon/tests/ui/issue-97-missing-parent-item-clause.out b/charon/tests/ui/issue-97-missing-parent-item-clause.out index b36092498..1c20457ed 100644 --- a/charon/tests/ui/issue-97-missing-parent-item-clause.out +++ b/charon/tests/ui/issue-97-missing-parent-item-clause.out @@ -12,6 +12,16 @@ pub trait Sized non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Ord pub trait Ord { @@ -52,13 +62,10 @@ pub fn test(@1: AVLTree[Sized]) let tree@1: AVLTree[Sized]; // arg #1 let @2: (); // anonymous local let @3: &'_ mut (AVLTree[Sized]); // anonymous local - let @4: (); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@4) - @4 := () - @3 := &two-phase-mut (tree@1, move (@4)) + @3 := &two-phase-mut (tree@1, copy (@Global0)) @2 := insert<'_, u32>[Sized, {impl Ord for u32}](move (@3)) storage_dead(@3) storage_dead(@2) diff --git a/charon/tests/ui/iterator.out b/charon/tests/ui/iterator.out index 5809ff644..296f35b61 100644 --- a/charon/tests/ui/iterator.out +++ b/charon/tests/ui/iterator.out @@ -4499,6 +4499,16 @@ pub fn chunks_exact<'_0, T>(@1: &'_0 (Slice), @2: usize) -> ChunksExact<'_0, where [@TraitClause0]: Sized, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::main fn main() { @@ -4570,24 +4580,6 @@ fn main() let @65: &'_ (i32); // anonymous local let @66: &'_ (i32); // anonymous local let @67: Option>[Sized>]; // anonymous local - let @68: (); // anonymous local - let @69: (); // anonymous local - let @70: (); // anonymous local - let @71: (); // anonymous local - let @72: (); // anonymous local - let @73: (); // anonymous local - let @74: (); // anonymous local - let @75: (); // anonymous local - let @76: (); // anonymous local - let @77: (); // anonymous local - let @78: (); // anonymous local - let @79: (); // anonymous local - let @80: (); // anonymous local - let @81: (); // anonymous local - let @82: (); // anonymous local - let @83: (); // anonymous local - let @84: (); // anonymous local - let @85: (); // anonymous local storage_live(@10) storage_live(v@12) @@ -4609,19 +4601,6 @@ fn main() storage_live(@65) storage_live(@66) storage_live(@67) - storage_live(@68) - storage_live(@69) - storage_live(@71) - storage_live(@72) - storage_live(@73) - storage_live(@75) - storage_live(@76) - storage_live(@78) - storage_live(@79) - storage_live(@82) - storage_live(@83) - storage_live(@84) - storage_live(@85) storage_live(a@1) a@1 := [const (0 : i32), const (1 : i32), const (2 : i32), const (3 : i32), const (4 : i32), const (5 : i32), const (6 : i32)] storage_live(i@2) @@ -4642,12 +4621,8 @@ fn main() storage_live(@9) storage_live(@10) storage_live(@11) - storage_live(@69) - @69 := () - @11 := &mut (iter@7, move (@69)) - storage_live(@68) - @68 := () - @10 := &two-phase-mut (*(@11), move (@68)) + @11 := &mut (iter@7, copy (@Global0)) + @10 := &two-phase-mut (*(@11), copy (@Global0)) @9 := {impl Iterator for IntoIter[@TraitClause0]}::next<'_, i32, 7 : usize>[Sized](move (@10)) storage_dead(@10) match @9 { @@ -4683,9 +4658,7 @@ fn main() storage_live(@17) storage_live(@18) storage_live(@19) - storage_live(@70) - @70 := () - @19 := &(a@1, move (@70)) + @19 := &(a@1, copy (@Global0)) @18 := @ArrayToSliceShared<'_, i32, 7 : usize>(move (@19)) storage_dead(@19) @17 := iter<'_, i32>[Sized](move (@18)) @@ -4699,12 +4672,8 @@ fn main() storage_live(@22) storage_live(@23) storage_live(@24) - storage_live(@72) - @72 := () - @24 := &mut (iter@20, move (@72)) - storage_live(@71) - @71 := () - @23 := &two-phase-mut (*(@24), move (@71)) + @24 := &mut (iter@20, copy (@Global0)) + @23 := &two-phase-mut (*(@24), copy (@Global0)) @22 := {impl Iterator for Iter<'a, T>[@TraitClause0]}::next<'_, '_, i32>[Sized](move (@23)) storage_dead(@23) match @22 { @@ -4716,9 +4685,7 @@ fn main() v@25 := copy ((@22 as variant Option::Some).0) storage_live(@26) storage_live(@27) - storage_live(@73) - @73 := () - @27 := &two-phase-mut (i@2, move (@73)) + @27 := &two-phase-mut (i@2, copy (@Global0)) storage_live(@28) @28 := copy (v@25) @26 := {impl AddAssign<&'_0 (i32)> for i32}::add_assign<'_, '_>(move (@27), move (@28)) @@ -4744,9 +4711,7 @@ fn main() storage_live(@31) storage_live(@32) storage_live(@33) - storage_live(@74) - @74 := () - @33 := &(a@1, move (@74)) + @33 := &(a@1, copy (@Global0)) @32 := @ArrayToSliceShared<'_, i32, 7 : usize>(move (@33)) storage_dead(@33) @31 := chunks<'_, i32>[Sized](move (@32), const (2 : usize)) @@ -4760,12 +4725,8 @@ fn main() storage_live(@36) storage_live(@37) storage_live(@38) - storage_live(@76) - @76 := () - @38 := &mut (iter@34, move (@76)) - storage_live(@75) - @75 := () - @37 := &two-phase-mut (*(@38), move (@75)) + @38 := &mut (iter@34, copy (@Global0)) + @37 := &two-phase-mut (*(@38), copy (@Global0)) @36 := {impl Iterator for Chunks<'a, T>[@TraitClause0]}::next<'_, '_, i32>[Sized](move (@37)) storage_dead(@37) match @36 { @@ -4793,9 +4754,7 @@ fn main() storage_live(@42) storage_live(@43) storage_live(@44) - storage_live(@77) - @77 := () - @44 := &(a@1, move (@77)) + @44 := &(a@1, copy (@Global0)) @43 := @ArrayToSliceShared<'_, i32, 7 : usize>(move (@44)) storage_dead(@44) @42 := chunks_exact<'_, i32>[Sized](move (@43), const (2 : usize)) @@ -4809,12 +4768,8 @@ fn main() storage_live(@47) storage_live(@48) storage_live(@49) - storage_live(@79) - @79 := () - @49 := &mut (iter@45, move (@79)) - storage_live(@78) - @78 := () - @48 := &two-phase-mut (*(@49), move (@78)) + @49 := &mut (iter@45, copy (@Global0)) + @48 := &two-phase-mut (*(@49), copy (@Global0)) @47 := {impl Iterator for ChunksExact<'a, T>[@TraitClause0]}::next<'_, '_, i32>[Sized](move (@48)) storage_dead(@48) match @47 { @@ -4842,13 +4797,9 @@ fn main() storage_live(@52) storage_live(@53) storage_live(@54) - storage_live(@81) - @81 := () - @54 := &(i@2, move (@81)) + @54 := &(i@2, copy (@Global0)) storage_live(@55) - storage_live(@80) - @80 := () - @55 := &(expected@51, move (@80)) + @55 := &(expected@51, copy (@Global0)) @53 := (move (@54), move (@55)) storage_dead(@55) storage_dead(@54) @@ -4873,20 +4824,12 @@ fn main() @62 := move (kind@61) storage_live(@63) storage_live(@64) - storage_live(@85) - @85 := () - @64 := &(*(left_val@56), move (@85)) - storage_live(@84) - @84 := () - @63 := &(*(@64), move (@84)) + @64 := &(*(left_val@56), copy (@Global0)) + @63 := &(*(@64), copy (@Global0)) storage_live(@65) storage_live(@66) - storage_live(@83) - @83 := () - @66 := &(*(right_val@57), move (@83)) - storage_live(@82) - @82 := () - @65 := &(*(@66), move (@82)) + @66 := &(*(right_val@57), copy (@Global0)) + @65 := &(*(@66), copy (@Global0)) storage_live(@67) @67 := Option::None { } panic(core::panicking::assert_failed) diff --git a/charon/tests/ui/loops.out b/charon/tests/ui/loops.out index fcbe668d0..f72f81274 100644 --- a/charon/tests/ui/loops.out +++ b/charon/tests/ui/loops.out @@ -794,6 +794,16 @@ where vtable: {impl IndexMut for Vec[@TraitClause0, @TraitClause2]}::{vtable}[@TraitClause0, @TraitClause1, @TraitClause2, @TraitClause3] } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::test_loop1 pub fn test_loop1(@1: u32) -> u32 { @@ -1725,12 +1735,6 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize let @28: &'_ mut (Range[Sized]); // anonymous local let @29: &'_ mut (Range[Sized]); // anonymous local let @30: usize; // anonymous local - let @31: (); // anonymous local - let @32: (); // anonymous local - let @33: (); // anonymous local - let @34: (); // anonymous local - let @35: (); // anonymous local - let @36: (); // anonymous local storage_live(@10) storage_live(@12) @@ -1744,12 +1748,6 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize storage_live(@28) storage_live(@29) storage_live(@30) - storage_live(@31) - storage_live(@32) - storage_live(@33) - storage_live(@34) - storage_live(@35) - storage_live(@36) storage_live(s@3) s@3 := const (0 : usize) storage_live(@4) @@ -1765,12 +1763,8 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize storage_live(@9) storage_live(@10) storage_live(@11) - storage_live(@32) - @32 := () - @11 := &mut (iter@7, move (@32)) - storage_live(@31) - @31 := () - @10 := &two-phase-mut (*(@11), move (@31)) + @11 := &mut (iter@7, copy (@Global0)) + @10 := &two-phase-mut (*(@11), copy (@Global0)) @9 := {impl Iterator for Range[@TraitClause0]}::next<'_, i32>[Sized, {impl Step for i32}](move (@10)) storage_dead(@10) match @9 { @@ -1809,12 +1803,8 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize storage_live(@19) storage_live(@20) storage_live(@21) - storage_live(@34) - @34 := () - @21 := &mut (iter@17, move (@34)) - storage_live(@33) - @33 := () - @20 := &two-phase-mut (*(@21), move (@33)) + @21 := &mut (iter@17, copy (@Global0)) + @20 := &two-phase-mut (*(@21), copy (@Global0)) @19 := {impl Iterator for Range[@TraitClause0]}::next<'_, usize>[Sized, {impl Step for usize}](move (@20)) storage_dead(@20) match @19 { @@ -1837,12 +1827,8 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize storage_live(@27) storage_live(@28) storage_live(@29) - storage_live(@36) - @36 := () - @29 := &mut (iter@25, move (@36)) - storage_live(@35) - @35 := () - @28 := &two-phase-mut (*(@29), move (@35)) + @29 := &mut (iter@25, copy (@Global0)) + @28 := &two-phase-mut (*(@29), copy (@Global0)) @27 := {impl Iterator for Range[@TraitClause0]}::next<'_, usize>[Sized, {impl Step for usize}](move (@28)) storage_dead(@28) match @27 { @@ -1902,8 +1888,6 @@ pub fn loop_inside_if(@1: bool, @2: u32) -> u32 let i@14: u32; // local let @15: u32; // anonymous local let @16: u32; // anonymous local - let @17: (); // anonymous local - let @18: (); // anonymous local storage_live(s@4) storage_live(@5) @@ -1918,8 +1902,6 @@ pub fn loop_inside_if(@1: bool, @2: u32) -> u32 storage_live(i@14) storage_live(@15) storage_live(@16) - storage_live(@17) - storage_live(@18) storage_live(@3) @3 := copy (b@1) if move (@3) { @@ -1941,12 +1923,8 @@ pub fn loop_inside_if(@1: bool, @2: u32) -> u32 storage_live(@11) storage_live(@12) storage_live(@13) - storage_live(@18) - @18 := () - @13 := &mut (iter@9, move (@18)) - storage_live(@17) - @17 := () - @12 := &two-phase-mut (*(@13), move (@17)) + @13 := &mut (iter@9, copy (@Global0)) + @12 := &two-phase-mut (*(@13), copy (@Global0)) @11 := {impl Iterator for Range[@TraitClause0]}::next<'_, u32>[Sized, {impl Step for u32}](move (@12)) storage_dead(@12) match @11 { @@ -2063,9 +2041,8 @@ pub fn sum_array(@1: Array) -> u32 let @9: u32; // anonymous local let @10: usize; // anonymous local let @11: (); // anonymous local - let @12: (); // anonymous local - let @13: &'_ (Array); // anonymous local - let @14: &'_ (u32); // anonymous local + let @12: &'_ (Array); // anonymous local + let @13: &'_ (u32); // anonymous local storage_live(@7) storage_live(@8) @@ -2073,7 +2050,6 @@ pub fn sum_array(@1: Array) -> u32 storage_live(@10) storage_live(@12) storage_live(@13) - storage_live(@14) storage_live(i@2) i@2 := const (0 : usize) storage_live(s@3) @@ -2090,12 +2066,10 @@ pub fn sum_array(@1: Array) -> u32 storage_live(@8) @8 := copy (i@2) storage_live(@12) - @12 := () + @12 := &(a@1, const (@Global0)) storage_live(@13) - @13 := &(a@1, move (@12)) - storage_live(@14) - @14 := @ArrayIndexShared<'_, u32, const N : usize>(move (@13), copy (@8)) - @7 := copy (*(@14)) + @13 := @ArrayIndexShared<'_, u32, const N : usize>(move (@12), copy (@8)) + @7 := copy (*(@13)) @9 := copy (s@3) panic.+ copy (@7) s@3 := move (@9) storage_dead(@7) @@ -2135,16 +2109,12 @@ pub fn clear<'_0>(@1: &'_0 mut (Vec[Sized, Sized])) let @9: usize; // anonymous local let @10: usize; // anonymous local let @11: (); // anonymous local - let @12: (); // anonymous local - let @13: (); // anonymous local storage_live(@6) storage_live(@7) storage_live(@8) storage_live(@9) storage_live(@10) - storage_live(@12) - storage_live(@13) storage_live(i@2) i@2 := const (0 : usize) loop { @@ -2153,9 +2123,7 @@ pub fn clear<'_0>(@1: &'_0 mut (Vec[Sized, Sized])) @4 := copy (i@2) storage_live(@5) storage_live(@6) - storage_live(@12) - @12 := () - @6 := &(*(v@1), move (@12)) + @6 := &(*(v@1), copy (@Global0)) @5 := alloc::vec::{Vec[@TraitClause0, @TraitClause1]}::len<'_, u32, Global>[Sized, Sized](move (@6)) storage_dead(@6) @3 := move (@4) < move (@5) @@ -2168,9 +2136,7 @@ pub fn clear<'_0>(@1: &'_0 mut (Vec[Sized, Sized])) storage_dead(@4) storage_live(@7) storage_live(@8) - storage_live(@13) - @13 := () - @8 := &mut (*(v@1), move (@13)) + @8 := &mut (*(v@1), copy (@Global0)) storage_live(@9) @9 := copy (i@2) @7 := {impl IndexMut for Vec[@TraitClause0, @TraitClause2]}::index_mut<'_, u32, usize, Global>[Sized, Sized, Sized, {impl SliceIndex> for usize}[Sized]](move (@8), move (@9)) @@ -2215,10 +2181,6 @@ pub fn get_elem_mut<'_0>(@1: &'_0 mut (List[Sized]), @2: usize) -> let @6: usize; // anonymous local let @7: usize; // anonymous local let @8: &'_ mut (List[Sized]); // anonymous local - let @9: (); // anonymous local - let @10: (); // anonymous local - let @11: (); // anonymous local - let @12: (); // anonymous local storage_live(y@3) storage_live(tl@4) @@ -2226,21 +2188,13 @@ pub fn get_elem_mut<'_0>(@1: &'_0 mut (List[Sized]), @2: usize) -> storage_live(@6) storage_live(@7) storage_live(@8) - storage_live(@9) - storage_live(@10) - storage_live(@11) - storage_live(@12) loop { match *(ls@1) { List::Cons => { storage_live(y@3) - storage_live(@10) - @10 := () - y@3 := &mut ((*(ls@1) as variant List::Cons).0, move (@10)) + y@3 := &mut ((*(ls@1) as variant List::Cons).0, copy (@Global0)) storage_live(tl@4) - storage_live(@9) - @9 := () - tl@4 := &mut ((*(ls@1) as variant List::Cons).1, move (@9)) + tl@4 := &mut ((*(ls@1) as variant List::Cons).1, copy (@Global0)) storage_live(@5) storage_live(@6) @6 := copy (*(y@3)) @@ -2253,9 +2207,7 @@ pub fn get_elem_mut<'_0>(@1: &'_0 mut (List[Sized]), @2: usize) -> storage_dead(@7) storage_dead(@6) storage_live(@8) - storage_live(@12) - @12 := () - @8 := &mut (*(*(tl@4)), move (@12)) + @8 := &mut (*(*(tl@4)), copy (@Global0)) ls@1 := move (@8) storage_dead(@8) storage_dead(@5) @@ -2265,9 +2217,7 @@ pub fn get_elem_mut<'_0>(@1: &'_0 mut (List[Sized]), @2: usize) -> } storage_dead(@7) storage_dead(@6) - storage_live(@11) - @11 := () - @0 := &mut (*(y@3), move (@11)) + @0 := &mut (*(y@3), copy (@Global0)) storage_dead(@5) storage_dead(tl@4) storage_dead(y@3) @@ -2296,10 +2246,6 @@ where let @8: &'_ mut (List[@TraitClause0]); // anonymous local let @9: u32; // anonymous local let @10: (); // anonymous local - let @11: (); // anonymous local - let @12: (); // anonymous local - let @13: (); // anonymous local - let @14: (); // anonymous local storage_live(x@4) storage_live(tl@5) @@ -2308,22 +2254,14 @@ where storage_live(@8) storage_live(@9) storage_live(@10) - storage_live(@11) - storage_live(@12) - storage_live(@13) - storage_live(@14) storage_live(@3) loop { match *(ls@1) { List::Cons => { storage_live(x@4) - storage_live(@12) - @12 := () - x@4 := &mut ((*(ls@1) as variant List::Cons).0, move (@12)) + x@4 := &mut ((*(ls@1) as variant List::Cons).0, copy (@Global0)) storage_live(tl@5) - storage_live(@11) - @11 := () - tl@5 := &mut ((*(ls@1) as variant List::Cons).1, move (@11)) + tl@5 := &mut ((*(ls@1) as variant List::Cons).1, copy (@Global0)) storage_live(@6) storage_live(@7) @7 := copy (i@2) @@ -2333,9 +2271,7 @@ where else { storage_dead(@7) storage_live(@8) - storage_live(@14) - @14 := () - @8 := &mut (*(*(tl@5)), move (@14)) + @8 := &mut (*(*(tl@5)), copy (@Global0)) ls@1 := move (@8) storage_dead(@8) @9 := copy (i@2) panic.- const (1 : u32) @@ -2346,9 +2282,7 @@ where continue 0 } storage_dead(@7) - storage_live(@13) - @13 := () - @0 := &mut (*(x@4), move (@13)) + @0 := &mut (*(x@4), copy (@Global0)) storage_dead(@6) storage_dead(tl@5) storage_dead(x@4) diff --git a/charon/tests/ui/matches.out b/charon/tests/ui/matches.out index bec897c19..8ce7e708b 100644 --- a/charon/tests/ui/matches.out +++ b/charon/tests/ui/matches.out @@ -26,6 +26,16 @@ pub fn drop<'_0, Self>(@1: &'_0 mut (Self)) where [@TraitClause0]: Drop, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::E1 pub enum E1 { V1, diff --git a/charon/tests/ui/max_char.out b/charon/tests/ui/max_char.out index e743bf783..24b3787ec 100644 --- a/charon/tests/ui/max_char.out +++ b/charon/tests/ui/max_char.out @@ -20,6 +20,16 @@ pub fn core::char::MAX() -> char pub const core::char::MAX: char = core::char::MAX() +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::main fn main() { diff --git a/charon/tests/ui/method-impl-generalization.out b/charon/tests/ui/method-impl-generalization.out index da2bc708f..e3a1aa6cf 100644 --- a/charon/tests/ui/method-impl-generalization.out +++ b/charon/tests/ui/method-impl-generalization.out @@ -58,6 +58,16 @@ pub fn drop<'_0, Self>(@1: &'_0 mut (Self)) where [@TraitClause0]: Drop, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Trait trait Trait { @@ -158,11 +168,6 @@ fn main() let @9: &'_ (()); // anonymous local let @10: &'_ (()); // anonymous local let @11: (); // anonymous local - let @12: (); // anonymous local - let @13: (); // anonymous local - let @14: (); // anonymous local - let @15: (); // anonymous local - let @16: (); // anonymous local storage_live(@1) storage_live(@2) @@ -171,12 +176,8 @@ fn main() storage_live(@4) storage_live(@5) @5 := const (1 : u32) - storage_live(@13) - @13 := () - @4 := &(@5, move (@13)) - storage_live(@12) - @12 := () - @3 := &(*(@4), move (@12)) + @4 := &(@5, copy (@Global0)) + @3 := &(*(@4), copy (@Global0)) @1 := {impl Trait for ()}::method1(move (@2), move (@3)) storage_dead(@3) storage_dead(@2) @@ -191,19 +192,13 @@ fn main() // Not allowed to use the more precise signature. // let _ = ().method2(String::new()); @8 := () - storage_live(@16) - @16 := () - @7 := &(@8, move (@16)) + @7 := &(@8, copy (@Global0)) storage_live(@9) storage_live(@10) storage_live(@11) @11 := () - storage_live(@15) - @15 := () - @10 := &(@11, move (@15)) - storage_live(@14) - @14 := () - @9 := &(*(@10), move (@14)) + @10 := &(@11, copy (@Global0)) + @9 := &(*(@10), copy (@Global0)) @6 := {impl MyCompare<&'a (())> for &'a (())}::compare<'_>(move (@7), move (@9)) storage_dead(@9) storage_dead(@7) @@ -256,31 +251,19 @@ fn call_foo<'e>(@1: &'e (())) -> &'e (()) let @4: &'_ (()); // anonymous local let @5: &'_ (()); // anonymous local let @6: (); // anonymous local - let @7: (); // anonymous local - let @8: (); // anonymous local - let @9: (); // anonymous local - let @10: (); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@9) // Calls have erased lifetimes so we can't notice the discrepancy if there is one. - @9 := () - @3 := &(*(x@1), move (@9)) + @3 := &(*(x@1), copy (@Global0)) storage_live(@4) storage_live(@5) storage_live(@6) @6 := () - storage_live(@8) - @8 := () - @5 := &(@6, move (@8)) - storage_live(@7) - @7 := () - @4 := &(*(@5), move (@7)) + @5 := &(@6, copy (@Global0)) + @4 := &(*(@5), copy (@Global0)) @2 := {impl Foo for ()}::foo<'_, '_>(move (@3), move (@4)) - storage_live(@10) - @10 := () - @0 := &(*(@2), move (@10)) + @0 := &(*(@2), copy (@Global0)) storage_dead(@4) storage_dead(@3) storage_dead(@6) diff --git a/charon/tests/ui/method-ref.out b/charon/tests/ui/method-ref.out index e124a4f16..c9ef3d001 100644 --- a/charon/tests/ui/method-ref.out +++ b/charon/tests/ui/method-ref.out @@ -20,6 +20,16 @@ pub trait Sized non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Ord trait Ord { diff --git a/charon/tests/ui/ml-name-matcher-tests.out b/charon/tests/ui/ml-name-matcher-tests.out index 1521f5454..45b4f476d 100644 --- a/charon/tests/ui/ml-name-matcher-tests.out +++ b/charon/tests/ui/ml-name-matcher-tests.out @@ -182,6 +182,16 @@ where #[lang_item("global_alloc_ty")] pub struct Global {} +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::foo::bar fn bar() { @@ -271,19 +281,14 @@ fn foo() let @9: &'_ (Slice); // anonymous local let @10: &'_ (Slice); // anonymous local let @11: RangeFrom[Sized]; // anonymous local - let @12: (); // anonymous local + let @12: usize; // anonymous local let @13: usize; // anonymous local - let @14: (); // anonymous local - let @15: (); // anonymous local - let @16: usize; // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) @3 := Option::Some { 0: const (0 : i32) } - storage_live(@12) - @12 := () - @2 := &(@3, move (@12)) + @2 := &(@3, copy (@Global0)) @1 := is_some<'_, i32>[Sized](move (@2)) storage_dead(@2) storage_dead(@3) @@ -293,29 +298,25 @@ fn foo() storage_live(@6) storage_live(@7) @7 := [const (false)] - storage_live(@15) - @15 := () - @6 := &(@7, move (@15)) - storage_live(@14) - @14 := () - @5 := &(*(@6), move (@14)) + @6 := &(@7, copy (@Global0)) + @5 := &(*(@6), copy (@Global0)) slice@4 := @ArrayToSliceShared<'_, bool, 1 : usize>(move (@5)) storage_dead(@5) storage_dead(@6) storage_live(@8) storage_live(@9) storage_live(@10) - storage_live(@13) - @13 := ptr_metadata(copy (slice@4)) - @10 := &(*(slice@4), move (@13)) + storage_live(@12) + @12 := ptr_metadata(copy (slice@4)) + @10 := &(*(slice@4), move (@12)) storage_live(@11) @11 := RangeFrom { start: const (1 : usize) } @9 := {impl Index for Slice}::index<'_, bool, RangeFrom[Sized]>[Sized, Sized[Sized]>, {impl SliceIndex> for RangeFrom[Sized]}[Sized]](move (@10), move (@11)) storage_dead(@11) storage_dead(@10) - storage_live(@16) - @16 := ptr_metadata(copy (@9)) - @8 := &(*(@9), move (@16)) + storage_live(@13) + @13 := ptr_metadata(copy (@9)) + @8 := &(*(@9), move (@13)) storage_dead(@8) @0 := () storage_dead(@9) diff --git a/charon/tests/ui/monomorphization/adt_proj.out b/charon/tests/ui/monomorphization/adt_proj.out index e94b502a6..b0c23f964 100644 --- a/charon/tests/ui/monomorphization/adt_proj.out +++ b/charon/tests/ui/monomorphization/adt_proj.out @@ -19,6 +19,16 @@ pub enum Result:: { Err(u32), } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::main fn main() { diff --git a/charon/tests/ui/monomorphization/bound_lifetime.out b/charon/tests/ui/monomorphization/bound_lifetime.out index a51779581..870d2cb64 100644 --- a/charon/tests/ui/monomorphization/bound_lifetime.out +++ b/charon/tests/ui/monomorphization/bound_lifetime.out @@ -19,18 +19,25 @@ pub enum Option::<&'_ (u32)> { Some(&'_ (u32)), } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::foo fn foo<'_0>(@1: &'_0 (u32)) -> Option::<&'_ (u32)> { let @0: Option::<&'_ (u32)>; // return let x@1: &'_ (u32); // arg #1 let @2: &'_ (u32); // anonymous local - let @3: (); // anonymous local storage_live(@2) - storage_live(@3) - @3 := () - @2 := &(*(x@1), move (@3)) + @2 := &(*(x@1), copy (@Global0)) @0 := Option::<&'_ (u32)>::Some { 0: move (@2) } storage_dead(@2) return @@ -44,20 +51,14 @@ fn main() let @2: &'_ (u32); // anonymous local let @3: &'_ (u32); // anonymous local let @4: u32; // anonymous local - let @5: (); // anonymous local - let @6: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := const (42 : u32) - storage_live(@6) - @6 := () - @3 := &(@4, move (@6)) - storage_live(@5) - @5 := () - @2 := &(*(@3), move (@5)) + @3 := &(@4, copy (@Global0)) + @2 := &(*(@3), copy (@Global0)) @1 := foo<'_>(move (@2)) storage_dead(@2) storage_dead(@4) diff --git a/charon/tests/ui/monomorphization/closure-fn.out b/charon/tests/ui/monomorphization/closure-fn.out index ef35aed5f..b97d97da2 100644 --- a/charon/tests/ui/monomorphization/closure-fn.out +++ b/charon/tests/ui/monomorphization/closure-fn.out @@ -97,6 +97,16 @@ pub fn core::ops::function::FnOnce::call_once(@1: closure<'_, '_>, @2: (u8, u8)) pub fn core::ops::function::FnOnce::call_once::, (u8, u8)>(@1: closure<'_, '_>, @2: (u8, u8)) -> u8 +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun1() + // Full name: test_crate::main::{impl Fn::, (u8, u8)>}::call fn {impl Fn::, (u8, u8)>}::call<'_0, '_1, '_2>(@1: &'_2 (closure<'_0, '_1>), @2: (u8, u8)) -> u8 { @@ -154,12 +164,9 @@ fn apply_to::><'_0>(@1: &'_0 (closure<'_, '_>)) -> u8 let f@1: &'_ (closure<'_, '_>); // arg #1 let @2: &'_ (closure<'_, '_>); // anonymous local let @3: (u8, u8); // anonymous local - let @4: (); // anonymous local storage_live(@2) - storage_live(@4) - @4 := () - @2 := &(*(f@1), move (@4)) + @2 := &(*(f@1), copy (@Global0)) storage_live(@3) @3 := (const (10 : u8), const (20 : u8)) @0 := {impl Fn::, (u8, u8)>}::call<'_, '_, '_>(move (@2), move (@3)) @@ -175,12 +182,9 @@ fn {impl FnMut::, (u8, u8)>}::call_mut<'_0, '_1, '_2>(@1: &'_2 m let state@1: &'_2 mut (closure<'_0, '_1>); // arg #1 let args@2: (u8, u8); // arg #2 let @3: &'_ (closure<'_0, '_1>); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn::, (u8, u8)>}::call<'_0, '_1, '_>(move (@3), move (args@2)) return } @@ -192,12 +196,9 @@ fn apply_to_mut::><'_0>(@1: &'_0 mut (closure<'_, '_>)) -> u8 let f@1: &'_ mut (closure<'_, '_>); // arg #1 let @2: &'_ mut (closure<'_, '_>); // anonymous local let @3: (u8, u8); // anonymous local - let @4: (); // anonymous local storage_live(@2) - storage_live(@4) - @4 := () - @2 := &mut (*(f@1), move (@4)) + @2 := &mut (*(f@1), copy (@Global0)) storage_live(@3) @3 := (const (10 : u8), const (20 : u8)) @0 := {impl FnMut::, (u8, u8)>}::call_mut<'_, '_, '_>(move (@2), move (@3)) @@ -213,12 +214,9 @@ fn {impl FnOnce::, (u8, u8)>}::call_once<'_0, '_1>(@1: closure<' let @1: closure<'_0, '_1>; // arg #1 let @2: (u8, u8); // arg #2 let @3: &'_ mut (closure<'_0, '_1>); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut::, (u8, u8)>}::call_mut<'_0, '_1, '_>(move (@3), move (@2)) drop[Drop::>] @1 return @@ -263,13 +261,6 @@ fn main() let @14: &'_ mut (closure<'_, '_>); // anonymous local let @15: u8; // anonymous local let @16: closure<'_, '_>; // anonymous local - let @17: (); // anonymous local - let @18: (); // anonymous local - let @19: (); // anonymous local - let @20: (); // anonymous local - let @21: (); // anonymous local - let @22: (); // anonymous local - let @23: (); // anonymous local storage_live(v@1) v@1 := const (5 : u8) @@ -277,21 +268,15 @@ fn main() z@2 := const (1 : u8) storage_live(f@3) storage_live(@4) - storage_live(@19) - @19 := () - @4 := &(v@1, move (@19)) + @4 := &(v@1, copy (@Global0)) storage_live(@5) - storage_live(@18) - @18 := () - @5 := &(z@2, move (@18)) + @5 := &(z@2, copy (@Global0)) f@3 := closure { 0: move (@4), 1: move (@5) } storage_dead(@5) storage_dead(@4) storage_live(@6) storage_live(@7) - storage_live(@17) - @17 := () - @7 := &(f@3, move (@17)) + @7 := &(f@3, copy (@Global0)) storage_live(@8) @8 := (const (10 : u8), const (20 : u8)) @6 := {impl Fn::, (u8, u8)>}::call<'_, '_, '_>(move (@7), move (@8)) @@ -301,12 +286,8 @@ fn main() storage_live(@9) storage_live(@10) storage_live(@11) - storage_live(@21) - @21 := () - @11 := &(f@3, move (@21)) - storage_live(@20) - @20 := () - @10 := &(*(@11), move (@20)) + @11 := &(f@3, copy (@Global0)) + @10 := &(*(@11), copy (@Global0)) @9 := apply_to::><'_>(move (@10)) storage_dead(@10) storage_dead(@11) @@ -314,12 +295,8 @@ fn main() storage_live(@12) storage_live(@13) storage_live(@14) - storage_live(@23) - @23 := () - @14 := &mut (f@3, move (@23)) - storage_live(@22) - @22 := () - @13 := &two-phase-mut (*(@14), move (@22)) + @14 := &mut (f@3, copy (@Global0)) + @13 := &two-phase-mut (*(@14), copy (@Global0)) @12 := apply_to_mut::><'_>(move (@13)) storage_dead(@13) storage_dead(@14) diff --git a/charon/tests/ui/monomorphization/closure-fnonce.out b/charon/tests/ui/monomorphization/closure-fnonce.out index 4187da696..e5621c7bc 100644 --- a/charon/tests/ui/monomorphization/closure-fnonce.out +++ b/charon/tests/ui/monomorphization/closure-fnonce.out @@ -81,6 +81,16 @@ pub fn core::ops::function::FnOnce::call_once(@1: closure, @2: (u8)) -> u8 pub fn core::ops::function::FnOnce::call_once::(@1: closure, @2: (u8)) -> u8 +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun1() + // Full name: test_crate::main::{impl FnOnce::}::call_once fn {impl FnOnce::}::call_once(@1: closure, @2: (u8)) -> u8 { diff --git a/charon/tests/ui/monomorphization/closures.out b/charon/tests/ui/monomorphization/closures.out index e6f8db60b..e39e397f0 100644 --- a/charon/tests/ui/monomorphization/closures.out +++ b/charon/tests/ui/monomorphization/closures.out @@ -208,6 +208,16 @@ pub fn core::ops::function::FnOnce::call_once::, ( pub fn core::ops::function::FnOnce::call_once::, (u8)>(@1: test_crate::main::closure#1<'_>, @2: (u8)) -> u8 +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun1() + // Full name: test_crate::main::{impl Fn::, (u8)>}::call fn {impl Fn::, (u8)>}::call<'_0, '_1>(@1: &'_1 (test_crate::main::closure<'_0>), @2: (u8)) -> u8 { @@ -240,12 +250,9 @@ fn apply_to_zero::>(@1: test_crate::main::closure< let f@1: test_crate::main::closure<'_>; // arg #1 let @2: &'_ (test_crate::main::closure<'_>); // anonymous local let @3: (u8); // anonymous local - let @4: (); // anonymous local storage_live(@2) - storage_live(@4) - @4 := () - @2 := &(f@1, move (@4)) + @2 := &(f@1, copy (@Global0)) storage_live(@3) @3 := (const (0 : u8)) @0 := {impl Fn::, (u8)>}::call<'_, '_>(move (@2), move (@3)) @@ -291,12 +298,9 @@ fn apply_to_zero_mut::>(@1: test_crate::main::cl let f@1: test_crate::main::closure#1<'_>; // arg #1 let @2: &'_ mut (test_crate::main::closure#1<'_>); // anonymous local let @3: (u8); // anonymous local - let @4: (); // anonymous local storage_live(@2) - storage_live(@4) - @4 := () - @2 := &mut (f@1, move (@4)) + @2 := &mut (f@1, copy (@Global0)) storage_live(@3) @3 := (const (0 : u8)) @0 := {impl FnMut::, (u8)>}::call_mut<'_, '_>(move (@2), move (@3)) @@ -369,17 +373,13 @@ fn main() let z@9: Thing; // local let @10: u8; // anonymous local let @11: test_crate::main::closure#2; // anonymous local - let @12: (); // anonymous local - let @13: (); // anonymous local storage_live(z@1) z@1 := const (1 : u8) storage_live(@2) storage_live(@3) storage_live(@4) - storage_live(@12) - @12 := () - @4 := &(z@1, move (@12)) + @4 := &(z@1, copy (@Global0)) @3 := test_crate::main::closure { 0: move (@4) } storage_dead(@4) @2 := apply_to_zero::>(move (@3)) @@ -390,9 +390,7 @@ fn main() storage_live(@6) storage_live(@7) storage_live(@8) - storage_live(@13) - @13 := () - @8 := &mut (z@5, move (@13)) + @8 := &mut (z@5, copy (@Global0)) @7 := test_crate::main::closure#1 { 0: move (@8) } storage_dead(@8) @6 := apply_to_zero_mut::>(move (@7)) @@ -421,12 +419,9 @@ fn {impl FnMut::, (u8)>}::call_mut<'_0, '_1>(@1: & let state@1: &'_1 mut (test_crate::main::closure<'_0>); // arg #1 let args@2: (u8); // arg #2 let @3: &'_ (test_crate::main::closure<'_0>); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn::, (u8)>}::call<'_0, '_>(move (@3), move (args@2)) return } @@ -438,12 +433,9 @@ fn {impl FnOnce::, (u8)>}::call_once<'_0>(@1: test let @1: test_crate::main::closure<'_0>; // arg #1 let @2: (u8); // arg #2 let @3: &'_ mut (test_crate::main::closure<'_0>); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut::, (u8)>}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop::>] @1 return @@ -485,12 +477,9 @@ fn {impl FnOnce::, (u8)>}::call_once<'_0>(@1: te let @1: test_crate::main::closure#1<'_0>; // arg #1 let @2: (u8); // arg #2 let @3: &'_ mut (test_crate::main::closure#1<'_0>); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut::, (u8)>}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop::>] @1 return diff --git a/charon/tests/ui/monomorphization/fn_ptr_generics.out b/charon/tests/ui/monomorphization/fn_ptr_generics.out index 0134a172a..a48f4bf24 100644 --- a/charon/tests/ui/monomorphization/fn_ptr_generics.out +++ b/charon/tests/ui/monomorphization/fn_ptr_generics.out @@ -19,6 +19,16 @@ pub enum Option:: { Some(u8), } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::init_option fn init_option() { @@ -27,9 +37,8 @@ fn init_option() let @2: Option::; // anonymous local let b@3: Option::; // local let @4: usize; // anonymous local - let @5: (); // anonymous local - let @6: &'_ (Array, 6 : usize>); // anonymous local - let @7: &'_ (Option::); // anonymous local + let @5: &'_ (Array, 6 : usize>); // anonymous local + let @6: &'_ (Option::); // anonymous local storage_live(a@1) storage_live(@2) @@ -40,12 +49,10 @@ fn init_option() storage_live(@4) @4 := const (0 : usize) storage_live(@5) - @5 := () + @5 := &(a@1, const (@Global0)) storage_live(@6) - @6 := &(a@1, move (@5)) - storage_live(@7) - @7 := @ArrayIndexShared<'_, Option::, 6 : usize>(move (@6), copy (@4)) - b@3 := copy (*(@7)) + @6 := @ArrayIndexShared<'_, Option::, 6 : usize>(move (@5), copy (@4)) + b@3 := copy (*(@6)) storage_dead(@4) @0 := () storage_dead(b@3) diff --git a/charon/tests/ui/monomorphization/fndefs-casts.out b/charon/tests/ui/monomorphization/fndefs-casts.out index a38ee9594..f776d2301 100644 --- a/charon/tests/ui/monomorphization/fndefs-casts.out +++ b/charon/tests/ui/monomorphization/fndefs-casts.out @@ -150,6 +150,16 @@ pub fn call_mut:: foo::<'_0>, (&'_ (u32))><'_0>(@1: &'_0 mut (for< // Full name: core::ops::function::FnOnce::call_once:: foo::<'_0>, (&'_ (u32))> pub fn call_once:: foo::<'_0>, (&'_ (u32))>(@1: for<'_0> foo::<'_0_0>, @2: (&'_ (u32))) +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun1() + // Full name: test_crate::foo:: fn foo::<'_0>(@1: &'_0 (u8)) { @@ -182,25 +192,16 @@ fn takes_closure:: foo::<'_0>>(@1: for<'_0> foo::<'_0_0>) let @4: &'_ (u32); // anonymous local let @5: &'_ (u32); // anonymous local let @6: u32; // anonymous local - let @7: (); // anonymous local - let @8: (); // anonymous local - let @9: (); // anonymous local storage_live(@2) - storage_live(@9) - @9 := () - @2 := &(c@1, move (@9)) + @2 := &(c@1, copy (@Global0)) storage_live(@3) storage_live(@4) storage_live(@5) storage_live(@6) @6 := const (13 : u32) - storage_live(@8) - @8 := () - @5 := &(@6, move (@8)) - storage_live(@7) - @7 := () - @4 := &(*(@5), move (@7)) + @5 := &(@6, copy (@Global0)) + @4 := &(*(@5), copy (@Global0)) @3 := (move (@4)) @0 := Fn:: foo::<'_0_0>, (&'_ (u32))>::call<'_>(move (@2), move (@3)) storage_dead(@4) @@ -244,16 +245,6 @@ fn main() let @25: &'_ (char); // anonymous local let @26: char; // anonymous local let @27: (); // anonymous local - let @28: (); // anonymous local - let @29: (); // anonymous local - let @30: (); // anonymous local - let @31: (); // anonymous local - let @32: (); // anonymous local - let @33: (); // anonymous local - let @34: (); // anonymous local - let @35: (); // anonymous local - let @36: (); // anonymous local - let @37: (); // anonymous local storage_live(fooint1@1) fooint1@1 := cast foo::<'_0_0>, fn<'_0>(&'_0_0 (u8))>(const (foo::<'_>)) @@ -268,12 +259,8 @@ fn main() @6 := copy (fooint1@1) storage_live(@7) storage_live(@8) - storage_live(@29) - @29 := () - @8 := &(a@4, move (@29)) - storage_live(@28) - @28 := () - @7 := &(*(@8), move (@28)) + @8 := &(a@4, copy (@Global0)) + @7 := &(*(@8), copy (@Global0)) @5 := (move @6)(move (@7)) storage_dead(@7) storage_dead(@6) @@ -286,12 +273,8 @@ fn main() @11 := copy (fooint1@1) storage_live(@12) storage_live(@13) - storage_live(@31) - @31 := () - @13 := &(a@4, move (@31)) - storage_live(@30) - @30 := () - @12 := &(*(@13), move (@30)) + @13 := &(a@4, copy (@Global0)) + @12 := &(*(@13), copy (@Global0)) @10 := (move @11)(move (@12)) storage_dead(@12) storage_dead(@11) @@ -302,12 +285,8 @@ fn main() @15 := copy (fooint1@1) storage_live(@16) storage_live(@17) - storage_live(@33) - @33 := () - @17 := &(b@9, move (@33)) - storage_live(@32) - @32 := () - @16 := &(*(@17), move (@32)) + @17 := &(b@9, copy (@Global0)) + @16 := &(*(@17), copy (@Global0)) @14 := (move @15)(move (@16)) storage_dead(@16) storage_dead(@15) @@ -318,12 +297,8 @@ fn main() @19 := copy (fooint2@2) storage_live(@20) storage_live(@21) - storage_live(@35) - @35 := () - @21 := &(b@9, move (@35)) - storage_live(@34) - @34 := () - @20 := &(*(@21), move (@34)) + @21 := &(b@9, copy (@Global0)) + @20 := &(*(@21), copy (@Global0)) @18 := (move @19)(move (@20)) storage_dead(@20) storage_dead(@19) @@ -336,12 +311,8 @@ fn main() storage_live(@25) storage_live(@26) @26 := const (x) - storage_live(@37) - @37 := () - @25 := &(@26, move (@37)) - storage_live(@36) - @36 := () - @24 := &(*(@25), move (@36)) + @25 := &(@26, copy (@Global0)) + @24 := &(*(@25), copy (@Global0)) @22 := (move @23)(move (@24)) storage_dead(@24) storage_dead(@23) diff --git a/charon/tests/ui/monomorphization/global_with_generics.out b/charon/tests/ui/monomorphization/global_with_generics.out index 776f5c754..52c94db5f 100644 --- a/charon/tests/ui/monomorphization/global_with_generics.out +++ b/charon/tests/ui/monomorphization/global_with_generics.out @@ -24,6 +24,16 @@ pub trait Sized:: non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun1() + // Full name: test_crate::Foo:: struct Foo:: { value: i32, diff --git a/charon/tests/ui/monomorphization/rec-adt.out b/charon/tests/ui/monomorphization/rec-adt.out index 3170a999f..67b4dd6dd 100644 --- a/charon/tests/ui/monomorphization/rec-adt.out +++ b/charon/tests/ui/monomorphization/rec-adt.out @@ -61,6 +61,16 @@ pub enum Option::>> { #[lang_item("NonNull")] pub opaque type NonNull +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun1() + // Full name: test_crate::LinkedList:: pub struct LinkedList:: { head: Option::>>, diff --git a/charon/tests/ui/monomorphization/trait_impls.out b/charon/tests/ui/monomorphization/trait_impls.out index 125e5cd29..a15ebb94d 100644 --- a/charon/tests/ui/monomorphization/trait_impls.out +++ b/charon/tests/ui/monomorphization/trait_impls.out @@ -24,6 +24,16 @@ pub trait Drop:: // Full name: core::ops::drop::Drop::drop:: pub fn drop::<'_0>(@1: &'_0 mut (bool)) +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun1() + // Full name: test_crate::Trait:: pub trait Trait:: { @@ -60,12 +70,9 @@ fn do_test::(@1: bool) let @0: (); // return let x@1: bool; // arg #1 let @2: &'_ (bool); // anonymous local - let @3: (); // anonymous local storage_live(@2) - storage_live(@3) - @3 := () - @2 := &(x@1, move (@3)) + @2 := &(x@1, copy (@Global0)) @0 := {impl Trait::}::method<'_>(move (@2)) storage_dead(@2) drop[Drop::] x@1 diff --git a/charon/tests/ui/monomorphization/trait_impls_ullbc.out b/charon/tests/ui/monomorphization/trait_impls_ullbc.out index aac4de7d6..aa2bb9568 100644 --- a/charon/tests/ui/monomorphization/trait_impls_ullbc.out +++ b/charon/tests/ui/monomorphization/trait_impls_ullbc.out @@ -61,6 +61,18 @@ pub trait Drop:: // Full name: core::ops::drop::Drop::drop:: pub fn drop::<'_0>(@1: &'_0 mut (bool)) +fn UNIT_METADATA() +{ + let @0: (); // return + + bb0: { + @0 := (); + return; + } +} + +const UNIT_METADATA: () = @Fun1() + // Full name: test_crate::do_test:: fn do_test::(@1: bool, @2: bool) { @@ -71,20 +83,14 @@ fn do_test::(@1: bool, @2: bool) let @4: bool; // anonymous local let @5: &'_ (bool); // anonymous local let @6: &'_ (bool); // anonymous local - let @7: (); // anonymous local - let @8: (); // anonymous local bb0: { storage_live(@3); storage_live(@4); storage_live(@5); - storage_live(@8); - @8 := (); - @5 := &(expected@2, move (@8)); + @5 := &(expected@2, copy (@Global0)); storage_live(@6); - storage_live(@7); - @7 := (); - @6 := &(init@1, move (@7)); + @6 := &(init@1, copy (@Global0)); @4 := {impl PartialEq::}::eq<'_, '_>(move (@5), move (@6)) -> bb1 (unwind: bb2); } diff --git a/charon/tests/ui/no_nested_borrows.out b/charon/tests/ui/no_nested_borrows.out index 9a8dd2d45..a688ecc42 100644 --- a/charon/tests/ui/no_nested_borrows.out +++ b/charon/tests/ui/no_nested_borrows.out @@ -110,6 +110,16 @@ where vtable: {impl DerefMut for alloc::boxed::Box[@TraitClause0, @TraitClause1]}::{vtable}[@TraitClause0, @TraitClause1] } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Pair pub struct Pair where @@ -459,24 +469,18 @@ pub fn test_box1() let @6: (); // anonymous local let @7: bool; // anonymous local let @8: i32; // anonymous local - let @9: (); // anonymous local - let @10: (); // anonymous local storage_live(b@1) b@1 := @BoxNew[Sized](const (0 : i32)) storage_live(x@2) storage_live(@3) - storage_live(@9) - @9 := () - @3 := &two-phase-mut (b@1, move (@9)) + @3 := &two-phase-mut (b@1, copy (@Global0)) x@2 := {impl DerefMut for alloc::boxed::Box[@TraitClause0, @TraitClause1]}::deref_mut<'_, i32, Global>[MetaSized, Sized](move (@3)) storage_dead(@3) *(x@2) := const (1 : i32) storage_live(x@4) storage_live(@5) - storage_live(@10) - @10 := () - @5 := &(b@1, move (@10)) + @5 := &(b@1, copy (@Global0)) x@4 := {impl Deref for alloc::boxed::Box[@TraitClause0, @TraitClause1]}::deref<'_, i32, Global>[MetaSized, Sized](move (@5)) storage_dead(@5) storage_live(@6) diff --git a/charon/tests/ui/opacity.out b/charon/tests/ui/opacity.out index 77d0ef985..83ab7373d 100644 --- a/charon/tests/ui/opacity.out +++ b/charon/tests/ui/opacity.out @@ -111,6 +111,16 @@ where return } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::foo fn foo() { @@ -123,17 +133,12 @@ fn foo() let @6: &'_ (i32); // anonymous local let @7: &'_ (i32); // anonymous local let @8: i32; // anonymous local - let @9: (); // anonymous local - let @10: (); // anonymous local - let @11: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) @3 := Option::Some { 0: const (0 : i32) } - storage_live(@9) - @9 := () - @2 := &(@3, move (@9)) + @2 := &(@3, copy (@Global0)) @1 := is_some<'_, i32>[Sized](move (@2)) storage_dead(@2) storage_dead(@3) @@ -146,12 +151,8 @@ fn foo() storage_live(@7) storage_live(@8) @8 := const (0 : i32) - storage_live(@11) - @11 := () - @7 := &(@8, move (@11)) - storage_live(@10) - @10 := () - @6 := &(*(@7), move (@10)) + @7 := &(@8, copy (@Global0)) + @6 := &(*(@7), copy (@Global0)) @5 := from_ref<'_, i32>[Sized](move (@6)) storage_dead(@6) storage_dead(@8) diff --git a/charon/tests/ui/opaque-trait.out b/charon/tests/ui/opaque-trait.out index 5997e9a26..f491df8b3 100644 --- a/charon/tests/ui/opaque-trait.out +++ b/charon/tests/ui/opaque-trait.out @@ -12,6 +12,16 @@ pub trait Sized non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Trait trait Trait { diff --git a/charon/tests/ui/opaque_attribute.out b/charon/tests/ui/opaque_attribute.out index 7a459eac8..38a35d66a 100644 --- a/charon/tests/ui/opaque_attribute.out +++ b/charon/tests/ui/opaque_attribute.out @@ -22,6 +22,16 @@ where Some(T), } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::BoolTrait pub trait BoolTrait { @@ -61,25 +71,17 @@ where let self@1: &'_ (Option[@TraitClause0]); // arg #1 let x@2: &'_ (T); // local let @3: &'_ (T); // anonymous local - let @4: (); // anonymous local - let @5: (); // anonymous local storage_live(x@2) storage_live(@3) - storage_live(@4) - storage_live(@5) match *(self@1) { Option::None => { }, Option::Some => { storage_live(x@2) - storage_live(@5) - @5 := () - x@2 := &((*(self@1) as variant Option::Some).0, move (@5)) + x@2 := &((*(self@1) as variant Option::Some).0, copy (@Global0)) storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(x@2), move (@4)) + @3 := &(*(x@2), copy (@Global0)) @0 := @TraitClause1::get_bool<'_>(move (@3)) storage_dead(@3) storage_dead(x@2) diff --git a/charon/tests/ui/panics.out b/charon/tests/ui/panics.out index 67ca6aa31..ad144173f 100644 --- a/charon/tests/ui/panics.out +++ b/charon/tests/ui/panics.out @@ -16,6 +16,16 @@ pub fn new_const<'a, const N : usize>(@1: &'a (Array<&'static (Str), const N : u // Full name: core::fmt::rt::{Arguments<'a>}::new_v1 pub fn new_v1<'a, const P : usize, const A : usize>(@1: &'a (Array<&'static (Str), const P : usize>), @2: &'a (Array, const A : usize>)) -> Arguments<'a> +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::panic1 fn panic1() { @@ -32,20 +42,14 @@ fn panic2() let @2: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @3: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @4: Array<&'_ (Str), 1 : usize>; // anonymous local - let @5: (); // anonymous local - let @6: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := [const ("O no!")] - storage_live(@6) - @6 := () - @3 := &(@4, move (@6)) - storage_live(@5) - @5 := () - @2 := &(*(@3), move (@5)) + @3 := &(@4, copy (@Global0)) + @2 := &(*(@3), copy (@Global0)) @1 := new_const<'_, 1 : usize>(move (@2)) storage_dead(@2) panic(core::panicking::panic_fmt) @@ -62,32 +66,20 @@ fn panic3() let @5: &'_ (Array, 0 : usize>); // anonymous local let @6: &'_ (Array, 0 : usize>); // anonymous local let @7: Array, 0 : usize>; // anonymous local - let @8: (); // anonymous local - let @9: (); // anonymous local - let @10: (); // anonymous local - let @11: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := [const ("O no!")] - storage_live(@11) - @11 := () - @3 := &(@4, move (@11)) - storage_live(@10) - @10 := () - @2 := &(*(@3), move (@10)) + @3 := &(@4, copy (@Global0)) + @2 := &(*(@3), copy (@Global0)) storage_live(@5) storage_live(@6) storage_live(@7) @7 := [] - storage_live(@9) - @9 := () - @6 := &(@7, move (@9)) - storage_live(@8) - @8 := () - @5 := &(*(@6), move (@8)) + @6 := &(@7, copy (@Global0)) + @5 := &(*(@6), copy (@Global0)) @1 := new_v1<'_, 1 : usize, 0 : usize>(move (@2), move (@5)) storage_dead(@5) storage_dead(@2) @@ -122,15 +114,11 @@ fn panic5() let @4: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @5: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @6: Array<&'_ (Str), 1 : usize>; // anonymous local - let @7: (); // anonymous local - let @8: (); // anonymous local storage_live(@3) storage_live(@4) storage_live(@5) storage_live(@6) - storage_live(@7) - storage_live(@8) storage_live(@1) storage_live(@2) @2 := const (false) @@ -142,12 +130,8 @@ fn panic5() storage_live(@5) storage_live(@6) @6 := [const ("assert failed")] - storage_live(@8) - @8 := () - @5 := &(@6, move (@8)) - storage_live(@7) - @7 := () - @4 := &(*(@5), move (@7)) + @5 := &(@6, copy (@Global0)) + @4 := &(*(@5), copy (@Global0)) @3 := new_const<'_, 1 : usize>(move (@4)) storage_dead(@4) panic(core::panicking::panic_fmt) @@ -178,32 +162,20 @@ fn panic7() let @5: &'_ (Array, 0 : usize>); // anonymous local let @6: &'_ (Array, 0 : usize>); // anonymous local let @7: Array, 0 : usize>; // anonymous local - let @8: (); // anonymous local - let @9: (); // anonymous local - let @10: (); // anonymous local - let @11: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := [const ("internal error: entered unreachable code: can't reach this")] - storage_live(@11) - @11 := () - @3 := &(@4, move (@11)) - storage_live(@10) - @10 := () - @2 := &(*(@3), move (@10)) + @3 := &(@4, copy (@Global0)) + @2 := &(*(@3), copy (@Global0)) storage_live(@5) storage_live(@6) storage_live(@7) @7 := [] - storage_live(@9) - @9 := () - @6 := &(@7, move (@9)) - storage_live(@8) - @8 := () - @5 := &(*(@6), move (@8)) + @6 := &(@7, copy (@Global0)) + @5 := &(*(@6), copy (@Global0)) @1 := new_v1<'_, 1 : usize, 0 : usize>(move (@2), move (@5)) storage_dead(@5) storage_dead(@2) diff --git a/charon/tests/ui/params.out b/charon/tests/ui/params.out index 591594a13..e71a2ef61 100644 --- a/charon/tests/ui/params.out +++ b/charon/tests/ui/params.out @@ -16,6 +16,16 @@ pub trait Sized #[lang_item("global_alloc_ty")] pub struct Global {} +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::test_static fn test_static(@1: &'static (u32)) -> &'static (u32) { diff --git a/charon/tests/ui/plain-panic-str.out b/charon/tests/ui/plain-panic-str.out index 82e7f043f..7e37e2526 100644 --- a/charon/tests/ui/plain-panic-str.out +++ b/charon/tests/ui/plain-panic-str.out @@ -9,6 +9,16 @@ where // Full name: core::fmt::rt::{Arguments<'a>}::new_const pub fn new_const<'a, const N : usize>(@1: &'a (Array<&'static (Str), const N : usize>)) -> Arguments<'a> +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::main fn main() { @@ -17,20 +27,14 @@ fn main() let @2: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @3: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @4: Array<&'_ (Str), 1 : usize>; // anonymous local - let @5: (); // anonymous local - let @6: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := [const ("O no")] - storage_live(@6) - @6 := () - @3 := &(@4, move (@6)) - storage_live(@5) - @5 := () - @2 := &(*(@3), move (@5)) + @3 := &(@4, copy (@Global0)) + @2 := &(*(@3), copy (@Global0)) @1 := new_const<'_, 1 : usize>(move (@2)) storage_dead(@2) panic(core::panicking::panic_fmt) diff --git a/charon/tests/ui/pointers-in-consts-no-warns.out b/charon/tests/ui/pointers-in-consts-no-warns.out index ffff62d44..ee0059e9b 100644 --- a/charon/tests/ui/pointers-in-consts-no-warns.out +++ b/charon/tests/ui/pointers-in-consts-no-warns.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::DISGUISED_INT fn DISGUISED_INT() -> *const () { diff --git a/charon/tests/ui/polonius_map.out b/charon/tests/ui/polonius_map.out index 53f91be0a..5ae87b244 100644 --- a/charon/tests/ui/polonius_map.out +++ b/charon/tests/ui/polonius_map.out @@ -265,6 +265,16 @@ impl BuildHasher for RandomState { vtable: {impl BuildHasher for RandomState}::{vtable} } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::get_or_insert pub fn get_or_insert<'_0>(@1: &'_0 mut (HashMap[Sized, Sized, Sized])) -> &'_0 (u32) { @@ -284,16 +294,6 @@ pub fn get_or_insert<'_0>(@1: &'_0 mut (HashMap[Sized(@1: &'_0 mut (HashMap[Sized[Sized, Sized, Sized, {impl Eq for u32}, {impl Hash for u32}, {impl BuildHasher for RandomState}, MetaSized, {impl Borrow for T}[MetaSized], {impl Hash for u32}, {impl Eq for u32}](move (@3), move (@4)) storage_dead(@4) storage_dead(@3) @@ -333,37 +320,25 @@ pub fn get_or_insert<'_0>(@1: &'_0 mut (HashMap[Sized { storage_live(@8) storage_live(@9) - storage_live(@19) - @19 := () - @9 := &two-phase-mut (*(map@1), move (@19)) + @9 := &two-phase-mut (*(map@1), copy (@Global0)) @8 := insert<'_, u32, u32, RandomState>[Sized, Sized, Sized, {impl Eq for u32}, {impl Hash for u32}, {impl BuildHasher for RandomState}](move (@9), const (22 : u32), const (33 : u32)) storage_dead(@9) storage_dead(@8) storage_live(@10) storage_live(@11) storage_live(@12) - storage_live(@22) - @22 := () - @12 := &(*(map@1), move (@22)) + @12 := &(*(map@1), copy (@Global0)) storage_live(@13) storage_live(@14) storage_live(@15) @15 := const (22 : u32) - storage_live(@21) - @21 := () - @14 := &(@15, move (@21)) - storage_live(@20) - @20 := () - @13 := &(*(@14), move (@20)) + @14 := &(@15, copy (@Global0)) + @13 := &(*(@14), copy (@Global0)) @11 := {impl Index<&'_0 (Q)> for HashMap[@TraitClause0, @TraitClause2, @TraitClause3]}::index<'_, '_, u32, u32, u32, RandomState>[Sized, MetaSized, Sized, Sized, {impl Eq for u32}, {impl Hash for u32}, {impl Borrow for T}[MetaSized], {impl Eq for u32}, {impl Hash for u32}, {impl BuildHasher for RandomState}](move (@12), move (@13)) storage_dead(@13) storage_dead(@12) - storage_live(@25) - @25 := () - @10 := &(*(@11), move (@25)) - storage_live(@24) - @24 := () - @0 := &(*(@10), move (@24)) + @10 := &(*(@11), copy (@Global0)) + @0 := &(*(@10), copy (@Global0)) storage_dead(@15) storage_dead(@14) storage_dead(@11) @@ -372,9 +347,7 @@ pub fn get_or_insert<'_0>(@1: &'_0 mut (HashMap[Sized { storage_live(v@7) v@7 := copy ((@2 as variant Option::Some).0) - storage_live(@23) - @23 := () - @0 := &(*(v@7), move (@23)) + @0 := &(*(v@7), copy (@Global0)) storage_dead(v@7) }, } diff --git a/charon/tests/ui/predicates-on-late-bound-vars.out b/charon/tests/ui/predicates-on-late-bound-vars.out index a1cf39993..3e1ac47ad 100644 --- a/charon/tests/ui/predicates-on-late-bound-vars.out +++ b/charon/tests/ui/predicates-on-late-bound-vars.out @@ -112,18 +112,25 @@ where non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::wrap fn wrap<'a>(@1: &'a (u32)) -> Option<&'a (u32)>[Sized<&'a (u32)>] { let @0: Option<&'_ (u32)>[Sized<&'_ (u32)>]; // return let x@1: &'_ (u32); // arg #1 let @2: &'_ (u32); // anonymous local - let @3: (); // anonymous local storage_live(@2) - storage_live(@3) - @3 := () - @2 := &(*(x@1), move (@3)) + @2 := &(*(x@1), copy (@Global0)) @0 := Option::Some { 0: move (@2) } storage_dead(@2) return @@ -137,12 +144,9 @@ where let @0: Option<&'_ (u32)>[Sized<&'_ (u32)>]; // return let x@1: &'_ (u32); // arg #1 let @2: &'_ (u32); // anonymous local - let @3: (); // anonymous local storage_live(@2) - storage_live(@3) - @3 := () - @2 := &(*(x@1), move (@3)) + @2 := &(*(x@1), copy (@Global0)) @0 := Option::Some { 0: move (@2) } storage_dead(@2) return @@ -155,16 +159,13 @@ fn foo() let ref_b@1: RefCell[MetaSized]; // local let @2: Result[MetaSized], BorrowError>[Sized[MetaSized]>, Sized]; // anonymous local let @3: &'_ (RefCell[MetaSized]); // anonymous local - let @4: (); // anonymous local storage_live(ref_b@1) ref_b@1 := new[Sized](const (false)) storage_live(@2) storage_live(@3) - storage_live(@4) // `try_borrow` has a type that includes predicates on late bound regions. - @4 := () - @3 := &(ref_b@1, move (@4)) + @3 := &(ref_b@1, copy (@Global0)) @2 := try_borrow<'_, bool>[MetaSized](move (@3)) storage_dead(@3) drop[{impl Drop for Result[@TraitClause0, @TraitClause1]}[MetaSized], BorrowError>[Sized[MetaSized]>, Sized]] @2 diff --git a/charon/tests/ui/projection-index-from-end.out b/charon/tests/ui/projection-index-from-end.out index 0d5ecd03d..5e1de61bb 100644 --- a/charon/tests/ui/projection-index-from-end.out +++ b/charon/tests/ui/projection-index-from-end.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::slice_pattern_end fn slice_pattern_end<'_0>(@1: &'_0 (Slice<()>)) { @@ -9,12 +19,11 @@ fn slice_pattern_end<'_0>(@1: &'_0 (Slice<()>)) let @3: usize; // anonymous local let @4: bool; // anonymous local let _named@5: &'_ (()); // local - let @6: (); // anonymous local - let @7: usize; // anonymous local - let @8: &'_ (Slice<()>); // anonymous local + let @6: usize; // anonymous local + let @7: &'_ (Slice<()>); // anonymous local + let @8: usize; // anonymous local let @9: usize; // anonymous local - let @10: usize; // anonymous local - let @11: &'_ (()); // anonymous local + let @10: &'_ (()); // anonymous local storage_live(@2) storage_live(@3) @@ -31,19 +40,17 @@ fn slice_pattern_end<'_0>(@1: &'_0 (Slice<()>)) } storage_live(_named@5) storage_live(@6) - @6 := () + @6 := ptr_metadata(copy (x@1)) storage_live(@7) - @7 := ptr_metadata(copy (x@1)) + @7 := &(*(x@1), move (@6)) storage_live(@8) - @8 := &(*(x@1), move (@7)) + @8 := len(*(x@1)) storage_live(@9) - @9 := len(*(x@1)) + @9 := copy (@8) ub.- const (1 : usize) + storage_dead(@8) storage_live(@10) - @10 := copy (@9) ub.- const (1 : usize) - storage_dead(@9) - storage_live(@11) - @11 := @SliceIndexShared<'_, ()>(move (@8), copy (@10)) - _named@5 := &(*(@11), move (@6)) + @10 := @SliceIndexShared<'_, ()>(move (@7), copy (@9)) + _named@5 := &(*(@10), copy (@Global0)) @0 := () storage_dead(_named@5) @0 := () diff --git a/charon/tests/ui/ptr-offset.out b/charon/tests/ui/ptr-offset.out index a8460bc38..8030583b8 100644 --- a/charon/tests/ui/ptr-offset.out +++ b/charon/tests/ui/ptr-offset.out @@ -55,6 +55,16 @@ where // Full name: core::panicking::panic_nounwind_fmt pub fn panic_nounwind_fmt<'_0>(@1: Arguments<'_0>, @2: bool) -> ! +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: core::ptr::const_ptr::{*const T}::offset::precondition_check fn precondition_check(@1: *const (), @2: isize, @3: usize) { @@ -85,8 +95,7 @@ fn precondition_check(@1: *const (), @2: isize, @3: usize) let @24: u64; // anonymous local let @25: &'_ (Slice<&'_ (Str)>); // anonymous local let @26: &'_ (Slice>); // anonymous local - let @27: (); // anonymous local - let @28: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @27: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@5) storage_live(pieces@7) @@ -99,7 +108,7 @@ fn precondition_check(@1: *const (), @2: isize, @3: usize) storage_live(@22) storage_live(@23) storage_live(@24) - storage_live(@28) + storage_live(@27) storage_live(@4) storage_live(overflow@19) storage_live(rhs@9) @@ -163,15 +172,13 @@ fn precondition_check(@1: *const (), @2: isize, @3: usize) storage_live(@6) storage_live(@8) @8 := [const ("unsafe precondition(s) violated: ptr::offset requires the address calculation to not overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - storage_live(@27) - @27 := () - pieces@7 := &(@8, move (@27)) + pieces@7 := &(@8, copy (@Global0)) storage_live(@25) @25 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@7)) storage_live(@26) @26 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(copy ({promoted_const}<'_, 1 : usize>)) - @28 := Option::None { } - @6 := Arguments { 0: move (@25), 1: move (@28), 2: move (@26) } + @27 := Option::None { } + @6 := Arguments { 0: move (@25), 1: move (@27), 2: move (@26) } storage_dead(@26) storage_dead(@25) @5 := panic_nounwind_fmt<'_>(move (@6), const (false)) @@ -228,16 +235,13 @@ fn main() let @7: i32; // anonymous local let @8: *const i32; // anonymous local let @9: *const i32; // anonymous local - let @10: (); // anonymous local storage_live(s@1) s@1 := [const (11 : i32), const (42 : i32)] storage_live(ptr@2) storage_live(@3) storage_live(@4) - storage_live(@10) - @10 := () - @4 := &(s@1, move (@10)) + @4 := &(s@1, copy (@Global0)) @3 := @ArrayToSliceShared<'_, i32, 2 : usize>(move (@4)) storage_dead(@4) ptr@2 := as_ptr<'_, i32>[Sized](move (@3)) diff --git a/charon/tests/ui/ptr_no_provenance.out b/charon/tests/ui/ptr_no_provenance.out index 429bc6a34..0968ab1be 100644 --- a/charon/tests/ui/ptr_no_provenance.out +++ b/charon/tests/ui/ptr_no_provenance.out @@ -295,6 +295,16 @@ where return } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::main fn main() { diff --git a/charon/tests/ui/quantified-clause.out b/charon/tests/ui/quantified-clause.out index 8bcdfe3f9..42cb1f4bc 100644 --- a/charon/tests/ui/quantified-clause.out +++ b/charon/tests/ui/quantified-clause.out @@ -401,6 +401,16 @@ where Err(E), } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::foo fn foo(@1: F) where diff --git a/charon/tests/ui/raw-boxes.out b/charon/tests/ui/raw-boxes.out index 445c7fe4d..5e9ad60bf 100644 --- a/charon/tests/ui/raw-boxes.out +++ b/charon/tests/ui/raw-boxes.out @@ -257,6 +257,16 @@ where args: &'a (Slice>), } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: core::panicking::panic_nounwind_fmt::compiletime fn compiletime<'_0>(@1: Arguments<'_0>, @2: bool) -> ! { @@ -299,11 +309,9 @@ fn core::ptr::alignment::{Alignment}::new_unchecked::precondition_check(@1: usiz let @6: u32; // anonymous local let @7: &'_ (Slice<&'_ (Str)>); // anonymous local let @8: &'_ (Slice>); // anonymous local - let @9: (); // anonymous local - let @10: &'_ (Array, 0 : usize>); // anonymous local - let @11: Array, 0 : usize>; // anonymous local - let @12: (); // anonymous local - let @13: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @9: &'_ (Array, 0 : usize>); // anonymous local + let @10: Array, 0 : usize>; // anonymous local + let @11: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@2) storage_live(@3) @@ -314,31 +322,25 @@ fn core::ptr::alignment::{Alignment}::new_unchecked::precondition_check(@1: usiz storage_live(@9) storage_live(@10) storage_live(@11) - storage_live(@12) - storage_live(@13) storage_live(@6) @6 := ctpop[Sized, {impl Copy for usize}](move (align@1)) switch move (@6) { 1 : u32 => { }, _ => { - @11 := [] - storage_live(@12) - @12 := () - @10 := &(@11, move (@12)) + @10 := [] + @9 := &(@10, copy (@Global0)) storage_dead(@6) storage_live(@3) storage_live(@5) @5 := [const ("unsafe precondition(s) violated: Alignment::new_unchecked requires a power of two\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - storage_live(@9) - @9 := () - pieces@4 := &(@5, move (@9)) + pieces@4 := &(@5, copy (@Global0)) storage_live(@7) @7 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@4)) storage_live(@8) - @8 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@10)) - @13 := Option::None { } - @3 := Arguments { pieces: move (@7), fmt: move (@13), args: move (@8) } + @8 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@9)) + @11 := Option::None { } + @3 := Arguments { pieces: move (@7), fmt: move (@11), args: move (@8) } storage_dead(@8) storage_dead(@7) @2 := panic_nounwind_fmt<'_>(move (@3), const (false)) @@ -544,18 +546,14 @@ fn core::ptr::write_bytes::precondition_check(@1: *const (), @2: usize, @3: bool let @16: &'_ (Slice>); // anonymous local let @17: &'_ (Slice<&'_ (Str)>); // anonymous local let @18: &'_ (Slice>); // anonymous local - let @19: (); // anonymous local - let @20: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local - let @21: Array<&'_ (Str), 1 : usize>; // anonymous local - let @22: (); // anonymous local + let @19: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local + let @20: Array<&'_ (Str), 1 : usize>; // anonymous local + let @21: &'_ (Array, 0 : usize>); // anonymous local + let @22: Array, 0 : usize>; // anonymous local let @23: &'_ (Array, 0 : usize>); // anonymous local let @24: Array, 0 : usize>; // anonymous local - let @25: (); // anonymous local - let @26: &'_ (Array, 0 : usize>); // anonymous local - let @27: Array, 0 : usize>; // anonymous local - let @28: (); // anonymous local - let @29: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local - let @30: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @25: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @26: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@5) storage_live(pieces@7) @@ -563,6 +561,7 @@ fn core::ptr::write_bytes::precondition_check(@1: *const (), @2: usize, @3: bool storage_live(@10) storage_live(@15) storage_live(@16) + storage_live(@19) storage_live(@20) storage_live(@21) storage_live(@22) @@ -570,9 +569,6 @@ fn core::ptr::write_bytes::precondition_check(@1: *const (), @2: usize, @3: bool storage_live(@24) storage_live(@25) storage_live(@26) - storage_live(@27) - storage_live(@29) - storage_live(@30) storage_live(@4) storage_live(@12) storage_live(@14) @@ -581,22 +577,18 @@ fn core::ptr::write_bytes::precondition_check(@1: *const (), @2: usize, @3: bool 1 : u32 => { }, _ => { - @21 := [const ("is_aligned_to: align is not a power-of-two")] - storage_live(@22) - @22 := () - @20 := &(@21, move (@22)) - @24 := [] - storage_live(@25) - @25 := () - @23 := &(@24, move (@25)) + @20 := [const ("is_aligned_to: align is not a power-of-two")] + @19 := &(@20, copy (@Global0)) + @22 := [] + @21 := &(@22, copy (@Global0)) storage_dead(@14) storage_live(@10) storage_live(@15) - @15 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@20)) + @15 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@19)) storage_live(@16) - @16 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@23)) - @29 := Option::None { } - @10 := Arguments { pieces: move (@15), fmt: move (@29), args: move (@16) } + @16 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@21)) + @25 := Option::None { } + @10 := Arguments { pieces: move (@15), fmt: move (@25), args: move (@16) } storage_dead(@16) storage_dead(@15) panic(core::panicking::panic_fmt) @@ -638,22 +630,18 @@ fn core::ptr::write_bytes::precondition_check(@1: *const (), @2: usize, @3: bool storage_dead(@12) }, } - @27 := [] - storage_live(@28) - @28 := () - @26 := &(@27, move (@28)) + @24 := [] + @23 := &(@24, copy (@Global0)) storage_live(@6) storage_live(@8) @8 := [const ("unsafe precondition(s) violated: ptr::write_bytes requires that the destination pointer is aligned and non-null\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - storage_live(@19) - @19 := () - pieces@7 := &(@8, move (@19)) + pieces@7 := &(@8, copy (@Global0)) storage_live(@17) @17 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@7)) storage_live(@18) - @18 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@26)) - @30 := Option::None { } - @6 := Arguments { pieces: move (@17), fmt: move (@30), args: move (@18) } + @18 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@23)) + @26 := Option::None { } + @6 := Arguments { pieces: move (@17), fmt: move (@26), args: move (@18) } storage_dead(@18) storage_dead(@17) @5 := panic_nounwind_fmt<'_>(move (@6), const (false)) @@ -785,22 +773,19 @@ pub fn new_const<'a, const N : usize>(@1: &'a (Array<&'static (Str), const N : u let @3: &'_ (Slice>); // anonymous local let @4: &'_ (Array, 0 : usize>); // anonymous local let @5: Array, 0 : usize>; // anonymous local - let @6: (); // anonymous local - let @7: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @6: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@4) storage_live(@5) - storage_live(@7) - @5 := [] storage_live(@6) - @6 := () - @4 := &(@5, move (@6)) + @5 := [] + @4 := &(@5, copy (@Global0)) storage_live(@2) @2 := @ArrayToSliceShared<'_, &'_ (Str), const N : usize>(copy (pieces@1)) storage_live(@3) @3 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@4)) - @7 := Option::None { } - @0 := Arguments { pieces: move (@2), fmt: move (@7), args: move (@3) } + @6 := Option::None { } + @0 := Arguments { pieces: move (@2), fmt: move (@6), args: move (@3) } storage_dead(@3) storage_dead(@2) return @@ -818,8 +803,6 @@ pub fn panic_nounwind(@1: &'static (Str)) -> ! let @5: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @6: Array<&'_ (Str), 1 : usize>; // anonymous local let @7: &'_ (Str); // anonymous local - let @8: (); // anonymous local - let @9: (); // anonymous local storage_live(@2) storage_live(@3) @@ -830,12 +813,8 @@ pub fn panic_nounwind(@1: &'static (Str)) -> ! @7 := copy (expr@1) @6 := [move (@7)] storage_dead(@7) - storage_live(@9) - @9 := () - @5 := &(@6, move (@9)) - storage_live(@8) - @8 := () - @4 := &(*(@5), move (@8)) + @5 := &(@6, copy (@Global0)) + @4 := &(*(@5), copy (@Global0)) @3 := new_const<'_, 1 : usize>(move (@4)) storage_dead(@4) @2 := panic_nounwind_fmt<'_>(move (@3), const (false)) @@ -973,25 +952,19 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () let @32: &'_ (Slice>); // anonymous local let @33: &'_ (Slice<&'_ (Str)>); // anonymous local let @34: &'_ (Slice>); // anonymous local - let @35: (); // anonymous local - let @36: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local - let @37: Array<&'_ (Str), 1 : usize>; // anonymous local - let @38: (); // anonymous local + let @35: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local + let @36: Array<&'_ (Str), 1 : usize>; // anonymous local + let @37: &'_ (Array, 0 : usize>); // anonymous local + let @38: Array, 0 : usize>; // anonymous local let @39: &'_ (Array, 0 : usize>); // anonymous local let @40: Array, 0 : usize>; // anonymous local - let @41: (); // anonymous local - let @42: &'_ (Array, 0 : usize>); // anonymous local - let @43: Array, 0 : usize>; // anonymous local - let @44: (); // anonymous local - let @45: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local - let @46: Array<&'_ (Str), 1 : usize>; // anonymous local - let @47: (); // anonymous local - let @48: &'_ (Array, 0 : usize>); // anonymous local - let @49: Array, 0 : usize>; // anonymous local - let @50: (); // anonymous local - let @51: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local - let @52: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local - let @53: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @41: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local + let @42: Array<&'_ (Str), 1 : usize>; // anonymous local + let @43: &'_ (Array, 0 : usize>); // anonymous local + let @44: Array, 0 : usize>; // anonymous local + let @45: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @46: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @47: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@11) storage_live(ptr@12) @@ -1010,6 +983,7 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_live(@30) storage_live(@31) storage_live(@32) + storage_live(@35) storage_live(@36) storage_live(@37) storage_live(@38) @@ -1018,15 +992,10 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_live(@41) storage_live(@42) storage_live(@43) + storage_live(@44) storage_live(@45) storage_live(@46) storage_live(@47) - storage_live(@48) - storage_live(@49) - storage_live(@50) - storage_live(@51) - storage_live(@52) - storage_live(@53) storage_live(@6) storage_live(zero_size@7) switch copy (count@5) { @@ -1046,22 +1015,18 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () 1 : u32 => { }, _ => { - @37 := [const ("is_aligned_to: align is not a power-of-two")] - storage_live(@38) - @38 := () - @36 := &(@37, move (@38)) - @40 := [] - storage_live(@41) - @41 := () - @39 := &(@40, move (@41)) + @36 := [const ("is_aligned_to: align is not a power-of-two")] + @35 := &(@36, copy (@Global0)) + @38 := [] + @37 := &(@38, copy (@Global0)) storage_dead(@23) storage_live(@19) storage_live(@24) - @24 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@36)) + @24 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@35)) storage_live(@25) - @25 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) - @51 := Option::None { } - @19 := Arguments { pieces: move (@24), fmt: move (@51), args: move (@25) } + @25 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@37)) + @45 := Option::None { } + @19 := Arguments { pieces: move (@24), fmt: move (@45), args: move (@25) } storage_dead(@25) storage_dead(@24) panic(core::panicking::panic_fmt) @@ -1090,22 +1055,18 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () 1 : u32 => { }, _ => { - @46 := [const ("is_aligned_to: align is not a power-of-two")] - storage_live(@47) - @47 := () - @45 := &(@46, move (@47)) - @49 := [] - storage_live(@50) - @50 := () - @48 := &(@49, move (@50)) + @42 := [const ("is_aligned_to: align is not a power-of-two")] + @41 := &(@42, copy (@Global0)) + @44 := [] + @43 := &(@44, copy (@Global0)) storage_dead(@30) storage_live(@27) storage_live(@31) - @31 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@45)) + @31 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@41)) storage_live(@32) - @32 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@48)) - @53 := Option::None { } - @27 := Arguments { pieces: move (@31), fmt: move (@53), args: move (@32) } + @32 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@43)) + @47 := Option::None { } + @27 := Arguments { pieces: move (@31), fmt: move (@47), args: move (@32) } storage_dead(@32) storage_dead(@31) panic(core::panicking::panic_fmt) @@ -1131,22 +1092,18 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () return } else { - @43 := [] - storage_live(@44) - @44 := () - @42 := &(@43, move (@44)) + @40 := [] + @39 := &(@40, copy (@Global0)) storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - storage_live(@35) - @35 := () - pieces@16 := &(@17, move (@35)) + pieces@16 := &(@17, copy (@Global0)) storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) - @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@42)) - @52 := Option::None { } - @15 := Arguments { pieces: move (@33), fmt: move (@52), args: move (@34) } + @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) + @46 := Option::None { } + @15 := Arguments { pieces: move (@33), fmt: move (@46), args: move (@34) } storage_dead(@34) storage_dead(@33) @14 := panic_nounwind_fmt<'_>(move (@15), const (false)) @@ -1170,22 +1127,18 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () return } else { - @43 := [] - storage_live(@44) - @44 := () - @42 := &(@43, move (@44)) + @40 := [] + @39 := &(@40, copy (@Global0)) storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - storage_live(@35) - @35 := () - pieces@16 := &(@17, move (@35)) + pieces@16 := &(@17, copy (@Global0)) storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) - @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@42)) - @52 := Option::None { } - @15 := Arguments { pieces: move (@33), fmt: move (@52), args: move (@34) } + @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) + @46 := Option::None { } + @15 := Arguments { pieces: move (@33), fmt: move (@46), args: move (@34) } storage_dead(@34) storage_dead(@33) @14 := panic_nounwind_fmt<'_>(move (@15), const (false)) @@ -1196,22 +1149,18 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_dead(@11) storage_dead(@8) storage_dead(zero_size@7) - @43 := [] - storage_live(@44) - @44 := () - @42 := &(@43, move (@44)) + @40 := [] + @39 := &(@40, copy (@Global0)) storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - storage_live(@35) - @35 := () - pieces@16 := &(@17, move (@35)) + pieces@16 := &(@17, copy (@Global0)) storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) - @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@42)) - @52 := Option::None { } - @15 := Arguments { pieces: move (@33), fmt: move (@52), args: move (@34) } + @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) + @46 := Option::None { } + @15 := Arguments { pieces: move (@33), fmt: move (@46), args: move (@34) } storage_dead(@34) storage_dead(@33) @14 := panic_nounwind_fmt<'_>(move (@15), const (false)) @@ -1225,22 +1174,18 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_dead(@11) storage_dead(@8) storage_dead(zero_size@7) - @43 := [] - storage_live(@44) - @44 := () - @42 := &(@43, move (@44)) + @40 := [] + @39 := &(@40, copy (@Global0)) storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - storage_live(@35) - @35 := () - pieces@16 := &(@17, move (@35)) + pieces@16 := &(@17, copy (@Global0)) storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) - @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@42)) - @52 := Option::None { } - @15 := Arguments { pieces: move (@33), fmt: move (@52), args: move (@34) } + @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) + @46 := Option::None { } + @15 := Arguments { pieces: move (@33), fmt: move (@46), args: move (@34) } storage_dead(@34) storage_dead(@33) @14 := panic_nounwind_fmt<'_>(move (@15), const (false)) @@ -1267,22 +1212,18 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () 1 : u32 => { }, _ => { - @46 := [const ("is_aligned_to: align is not a power-of-two")] - storage_live(@47) - @47 := () - @45 := &(@46, move (@47)) - @49 := [] - storage_live(@50) - @50 := () - @48 := &(@49, move (@50)) + @42 := [const ("is_aligned_to: align is not a power-of-two")] + @41 := &(@42, copy (@Global0)) + @44 := [] + @43 := &(@44, copy (@Global0)) storage_dead(@30) storage_live(@27) storage_live(@31) - @31 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@45)) + @31 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@41)) storage_live(@32) - @32 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@48)) - @53 := Option::None { } - @27 := Arguments { pieces: move (@31), fmt: move (@53), args: move (@32) } + @32 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@43)) + @47 := Option::None { } + @27 := Arguments { pieces: move (@31), fmt: move (@47), args: move (@32) } storage_dead(@32) storage_dead(@31) panic(core::panicking::panic_fmt) @@ -1308,22 +1249,18 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () return } else { - @43 := [] - storage_live(@44) - @44 := () - @42 := &(@43, move (@44)) + @40 := [] + @39 := &(@40, copy (@Global0)) storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - storage_live(@35) - @35 := () - pieces@16 := &(@17, move (@35)) + pieces@16 := &(@17, copy (@Global0)) storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) - @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@42)) - @52 := Option::None { } - @15 := Arguments { pieces: move (@33), fmt: move (@52), args: move (@34) } + @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) + @46 := Option::None { } + @15 := Arguments { pieces: move (@33), fmt: move (@46), args: move (@34) } storage_dead(@34) storage_dead(@33) @14 := panic_nounwind_fmt<'_>(move (@15), const (false)) @@ -1347,22 +1284,18 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () return } else { - @43 := [] - storage_live(@44) - @44 := () - @42 := &(@43, move (@44)) + @40 := [] + @39 := &(@40, copy (@Global0)) storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - storage_live(@35) - @35 := () - pieces@16 := &(@17, move (@35)) + pieces@16 := &(@17, copy (@Global0)) storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) - @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@42)) - @52 := Option::None { } - @15 := Arguments { pieces: move (@33), fmt: move (@52), args: move (@34) } + @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) + @46 := Option::None { } + @15 := Arguments { pieces: move (@33), fmt: move (@46), args: move (@34) } storage_dead(@34) storage_dead(@33) @14 := panic_nounwind_fmt<'_>(move (@15), const (false)) @@ -1373,22 +1306,18 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_dead(@11) storage_dead(@8) storage_dead(zero_size@7) - @43 := [] - storage_live(@44) - @44 := () - @42 := &(@43, move (@44)) + @40 := [] + @39 := &(@40, copy (@Global0)) storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - storage_live(@35) - @35 := () - pieces@16 := &(@17, move (@35)) + pieces@16 := &(@17, copy (@Global0)) storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) - @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@42)) - @52 := Option::None { } - @15 := Arguments { pieces: move (@33), fmt: move (@52), args: move (@34) } + @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) + @46 := Option::None { } + @15 := Arguments { pieces: move (@33), fmt: move (@46), args: move (@34) } storage_dead(@34) storage_dead(@33) @14 := panic_nounwind_fmt<'_>(move (@15), const (false)) @@ -1402,22 +1331,18 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_dead(@11) storage_dead(@8) storage_dead(zero_size@7) - @43 := [] - storage_live(@44) - @44 := () - @42 := &(@43, move (@44)) + @40 := [] + @39 := &(@40, copy (@Global0)) storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - storage_live(@35) - @35 := () - pieces@16 := &(@17, move (@35)) + pieces@16 := &(@17, copy (@Global0)) storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) - @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@42)) - @52 := Option::None { } - @15 := Arguments { pieces: move (@33), fmt: move (@52), args: move (@34) } + @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) + @46 := Option::None { } + @15 := Arguments { pieces: move (@33), fmt: move (@46), args: move (@34) } storage_dead(@34) storage_dead(@33) @14 := panic_nounwind_fmt<'_>(move (@15), const (false)) @@ -1430,22 +1355,18 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_dead(@11) storage_dead(@8) storage_dead(zero_size@7) - @43 := [] - storage_live(@44) - @44 := () - @42 := &(@43, move (@44)) + @40 := [] + @39 := &(@40, copy (@Global0)) storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - storage_live(@35) - @35 := () - pieces@16 := &(@17, move (@35)) + pieces@16 := &(@17, copy (@Global0)) storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) - @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@42)) - @52 := Option::None { } - @15 := Arguments { pieces: move (@33), fmt: move (@52), args: move (@34) } + @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) + @46 := Option::None { } + @15 := Arguments { pieces: move (@33), fmt: move (@46), args: move (@34) } storage_dead(@34) storage_dead(@33) @14 := panic_nounwind_fmt<'_>(move (@15), const (false)) @@ -1460,22 +1381,18 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_dead(@11) storage_dead(@8) storage_dead(zero_size@7) - @43 := [] - storage_live(@44) - @44 := () - @42 := &(@43, move (@44)) + @40 := [] + @39 := &(@40, copy (@Global0)) storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - storage_live(@35) - @35 := () - pieces@16 := &(@17, move (@35)) + pieces@16 := &(@17, copy (@Global0)) storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) - @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@42)) - @52 := Option::None { } - @15 := Arguments { pieces: move (@33), fmt: move (@52), args: move (@34) } + @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) + @46 := Option::None { } + @15 := Arguments { pieces: move (@33), fmt: move (@46), args: move (@34) } storage_dead(@34) storage_dead(@33) @14 := panic_nounwind_fmt<'_>(move (@15), const (false)) @@ -1496,22 +1413,18 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () 1 : u32 => { }, _ => { - @37 := [const ("is_aligned_to: align is not a power-of-two")] - storage_live(@38) - @38 := () - @36 := &(@37, move (@38)) - @40 := [] - storage_live(@41) - @41 := () - @39 := &(@40, move (@41)) + @36 := [const ("is_aligned_to: align is not a power-of-two")] + @35 := &(@36, copy (@Global0)) + @38 := [] + @37 := &(@38, copy (@Global0)) storage_dead(@23) storage_live(@19) storage_live(@24) - @24 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@36)) + @24 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@35)) storage_live(@25) - @25 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) - @51 := Option::None { } - @19 := Arguments { pieces: move (@24), fmt: move (@51), args: move (@25) } + @25 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@37)) + @45 := Option::None { } + @19 := Arguments { pieces: move (@24), fmt: move (@45), args: move (@25) } storage_dead(@25) storage_dead(@24) panic(core::panicking::panic_fmt) @@ -1539,22 +1452,18 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () 1 : u32 => { }, _ => { - @46 := [const ("is_aligned_to: align is not a power-of-two")] - storage_live(@47) - @47 := () - @45 := &(@46, move (@47)) - @49 := [] - storage_live(@50) - @50 := () - @48 := &(@49, move (@50)) + @42 := [const ("is_aligned_to: align is not a power-of-two")] + @41 := &(@42, copy (@Global0)) + @44 := [] + @43 := &(@44, copy (@Global0)) storage_dead(@30) storage_live(@27) storage_live(@31) - @31 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@45)) + @31 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(move (@41)) storage_live(@32) - @32 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@48)) - @53 := Option::None { } - @27 := Arguments { pieces: move (@31), fmt: move (@53), args: move (@32) } + @32 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@43)) + @47 := Option::None { } + @27 := Arguments { pieces: move (@31), fmt: move (@47), args: move (@32) } storage_dead(@32) storage_dead(@31) panic(core::panicking::panic_fmt) @@ -1630,22 +1539,18 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_dead(zero_size@7) }, } - @43 := [] - storage_live(@44) - @44 := () - @42 := &(@43, move (@44)) + @40 := [] + @39 := &(@40, copy (@Global0)) storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - storage_live(@35) - @35 := () - pieces@16 := &(@17, move (@35)) + pieces@16 := &(@17, copy (@Global0)) storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) - @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@42)) - @52 := Option::None { } - @15 := Arguments { pieces: move (@33), fmt: move (@52), args: move (@34) } + @34 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@39)) + @46 := Option::None { } + @15 := Arguments { pieces: move (@33), fmt: move (@46), args: move (@34) } storage_dead(@34) storage_dead(@33) @14 := panic_nounwind_fmt<'_>(move (@15), const (false)) @@ -1675,9 +1580,8 @@ where let @17: *const (); // anonymous local let @18: *mut (); // anonymous local let @19: bool; // anonymous local - let @20: (); // anonymous local - let @21: AllocError; // anonymous local - let @22: Result>, AllocError>[Sized>>, Sized]; // anonymous local + let @20: AllocError; // anonymous local + let @21: Result>, AllocError>[Sized>>, Sized]; // anonymous local storage_live(new_ptr@7) storage_live(@12) @@ -1685,8 +1589,8 @@ where storage_live(@16) storage_live(@17) storage_live(@18) + storage_live(@20) storage_live(@21) - storage_live(@22) storage_live(@5) storage_live(self@6) self@6 := @TraitClause0::allocate<'_>(copy (self@1), move (new_layout@4)) @@ -1699,9 +1603,9 @@ where storage_dead(v@14) storage_dead(@13) storage_dead(self@6) - @21 := AllocError { } - @22 := Result::Err { 0: move (@21) } - @0 := move (@22) + @20 := AllocError { } + @21 := Result::Err { 0: move (@20) } + @0 := move (@21) storage_dead(@5) return }, @@ -1720,9 +1624,7 @@ where dst@9 := cast<*mut Slice, *mut u8>(copy (@15)) storage_live(count@10) storage_live(self@11) - storage_live(@20) - @20 := () - self@11 := &(old_layout@3, move (@20)) + self@11 := &(old_layout@3, copy (@Global0)) count@10 := copy ((old_layout@3).size) storage_dead(self@11) storage_live(@19) @@ -1772,9 +1674,8 @@ where let @17: *const (); // anonymous local let @18: *mut (); // anonymous local let @19: bool; // anonymous local - let @20: (); // anonymous local - let @21: AllocError; // anonymous local - let @22: Result>, AllocError>[Sized>>, Sized]; // anonymous local + let @20: AllocError; // anonymous local + let @21: Result>, AllocError>[Sized>>, Sized]; // anonymous local storage_live(new_ptr@7) storage_live(@12) @@ -1782,8 +1683,8 @@ where storage_live(@16) storage_live(@17) storage_live(@18) + storage_live(@20) storage_live(@21) - storage_live(@22) storage_live(@5) storage_live(self@6) self@6 := @TraitClause0::allocate_zeroed<'_>(copy (self@1), move (new_layout@4)) @@ -1796,9 +1697,9 @@ where storage_dead(v@14) storage_dead(@13) storage_dead(self@6) - @21 := AllocError { } - @22 := Result::Err { 0: move (@21) } - @0 := move (@22) + @20 := AllocError { } + @21 := Result::Err { 0: move (@20) } + @0 := move (@21) storage_dead(@5) return }, @@ -1817,9 +1718,7 @@ where dst@9 := cast<*mut Slice, *mut u8>(copy (@15)) storage_live(count@10) storage_live(self@11) - storage_live(@20) - @20 := () - self@11 := &(old_layout@3, move (@20)) + self@11 := &(old_layout@3, copy (@Global0)) count@10 := copy ((old_layout@3).size) storage_dead(self@11) storage_live(@19) @@ -1869,9 +1768,8 @@ where let @17: *const (); // anonymous local let @18: *mut (); // anonymous local let @19: bool; // anonymous local - let @20: (); // anonymous local - let @21: AllocError; // anonymous local - let @22: Result>, AllocError>[Sized>>, Sized]; // anonymous local + let @20: AllocError; // anonymous local + let @21: Result>, AllocError>[Sized>>, Sized]; // anonymous local storage_live(new_ptr@7) storage_live(@12) @@ -1879,8 +1777,8 @@ where storage_live(@16) storage_live(@17) storage_live(@18) + storage_live(@20) storage_live(@21) - storage_live(@22) storage_live(@5) storage_live(self@6) self@6 := @TraitClause0::allocate<'_>(copy (self@1), copy (new_layout@4)) @@ -1893,9 +1791,9 @@ where storage_dead(v@14) storage_dead(@13) storage_dead(self@6) - @21 := AllocError { } - @22 := Result::Err { 0: move (@21) } - @0 := move (@22) + @20 := AllocError { } + @21 := Result::Err { 0: move (@20) } + @0 := move (@21) storage_dead(@5) return }, @@ -1914,9 +1812,7 @@ where dst@9 := cast<*mut Slice, *mut u8>(copy (@15)) storage_live(count@10) storage_live(self@11) - storage_live(@20) - @20 := () - self@11 := &(new_layout@4, move (@20)) + self@11 := &(new_layout@4, copy (@Global0)) count@10 := copy ((new_layout@4).size) storage_dead(self@11) storage_live(@19) @@ -2127,17 +2023,15 @@ fn core::ptr::non_null::{NonNull}::new_unchecked::precondition_check(@1: *mut let @6: usize; // anonymous local let @7: &'_ (Slice<&'_ (Str)>); // anonymous local let @8: &'_ (Slice>); // anonymous local - let @9: (); // anonymous local - let @10: &'_ (Array, 0 : usize>); // anonymous local - let @11: Array, 0 : usize>; // anonymous local - let @12: (); // anonymous local - let @13: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @9: &'_ (Array, 0 : usize>); // anonymous local + let @10: Array, 0 : usize>; // anonymous local + let @11: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@2) storage_live(pieces@4) + storage_live(@9) storage_live(@10) storage_live(@11) - storage_live(@13) storage_live(@6) @6 := transmute<*mut (), usize>(copy (ptr@1)) switch move (@6) { @@ -2149,23 +2043,19 @@ fn core::ptr::non_null::{NonNull}::new_unchecked::precondition_check(@1: *mut return }, } - @11 := [] - storage_live(@12) - @12 := () - @10 := &(@11, move (@12)) + @10 := [] + @9 := &(@10, copy (@Global0)) storage_dead(@6) storage_live(@3) storage_live(@5) @5 := [const ("unsafe precondition(s) violated: NonNull::new_unchecked requires that the pointer is non-null\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - storage_live(@9) - @9 := () - pieces@4 := &(@5, move (@9)) + pieces@4 := &(@5, copy (@Global0)) storage_live(@7) @7 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@4)) storage_live(@8) - @8 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@10)) - @13 := Option::None { } - @3 := Arguments { pieces: move (@7), fmt: move (@13), args: move (@8) } + @8 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@9)) + @11 := Option::None { } + @3 := Arguments { pieces: move (@7), fmt: move (@11), args: move (@8) } storage_dead(@8) storage_dead(@7) @2 := panic_nounwind_fmt<'_>(move (@3), const (false)) @@ -2181,11 +2071,9 @@ fn core::hint::assert_unchecked::precondition_check(@1: bool) let @5: Array<&'_ (Str), 1 : usize>; // anonymous local let @6: &'_ (Slice<&'_ (Str)>); // anonymous local let @7: &'_ (Slice>); // anonymous local - let @8: (); // anonymous local - let @9: &'_ (Array, 0 : usize>); // anonymous local - let @10: Array, 0 : usize>; // anonymous local - let @11: (); // anonymous local - let @12: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @8: &'_ (Array, 0 : usize>); // anonymous local + let @9: Array, 0 : usize>; // anonymous local + let @10: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@2) storage_live(@3) @@ -2196,27 +2084,21 @@ fn core::hint::assert_unchecked::precondition_check(@1: bool) storage_live(@8) storage_live(@9) storage_live(@10) - storage_live(@11) - storage_live(@12) if copy (cond@1) { } else { - @10 := [] - storage_live(@11) - @11 := () - @9 := &(@10, move (@11)) + @9 := [] + @8 := &(@9, copy (@Global0)) storage_live(@3) storage_live(@5) @5 := [const ("unsafe precondition(s) violated: hint::assert_unchecked must never be called when the condition is false\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - storage_live(@8) - @8 := () - pieces@4 := &(@5, move (@8)) + pieces@4 := &(@5, copy (@Global0)) storage_live(@6) @6 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@4)) storage_live(@7) - @7 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@9)) - @12 := Option::None { } - @3 := Arguments { pieces: move (@6), fmt: move (@12), args: move (@7) } + @7 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@8)) + @10 := Option::None { } + @3 := Arguments { pieces: move (@6), fmt: move (@10), args: move (@7) } storage_dead(@7) storage_dead(@6) @2 := panic_nounwind_fmt<'_>(move (@3), const (false)) @@ -2237,11 +2119,9 @@ fn core::alloc::layout::{Layout}::from_size_align_unchecked::precondition_check( let @7: Array<&'_ (Str), 1 : usize>; // anonymous local let @8: &'_ (Slice<&'_ (Str)>); // anonymous local let @9: &'_ (Slice>); // anonymous local - let @10: (); // anonymous local - let @11: &'_ (Array, 0 : usize>); // anonymous local - let @12: Array, 0 : usize>; // anonymous local - let @13: (); // anonymous local - let @14: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @10: &'_ (Array, 0 : usize>); // anonymous local + let @11: Array, 0 : usize>; // anonymous local + let @12: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@4) storage_live(@5) @@ -2252,29 +2132,23 @@ fn core::alloc::layout::{Layout}::from_size_align_unchecked::precondition_check( storage_live(@10) storage_live(@11) storage_live(@12) - storage_live(@13) - storage_live(@14) storage_live(@3) @3 := is_size_align_valid(move (size@1), move (align@2)) if move (@3) { } else { - @12 := [] - storage_live(@13) - @13 := () - @11 := &(@12, move (@13)) + @11 := [] + @10 := &(@11, copy (@Global0)) storage_live(@5) storage_live(@7) @7 := [const ("unsafe precondition(s) violated: Layout::from_size_align_unchecked requires that align is a power of 2 and the rounded-up allocation size does not exceed isize::MAX\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - storage_live(@10) - @10 := () - pieces@6 := &(@7, move (@10)) + pieces@6 := &(@7, copy (@Global0)) storage_live(@8) @8 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@6)) storage_live(@9) - @9 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@11)) - @14 := Option::None { } - @5 := Arguments { pieces: move (@8), fmt: move (@14), args: move (@9) } + @9 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@10)) + @12 := Option::None { } + @5 := Arguments { pieces: move (@8), fmt: move (@12), args: move (@9) } storage_dead(@9) storage_dead(@8) @4 := panic_nounwind_fmt<'_>(move (@5), const (false)) @@ -2367,17 +2241,11 @@ fn alloc_impl<'_0>(@1: &'_0 (Global), @2: Layout, @3: bool) -> Result; // anonymous local let @60: bool; // anonymous local - let @61: (); // anonymous local - let @62: (); // anonymous local - let @63: (); // anonymous local - let @64: (); // anonymous local - let @65: (); // anonymous local - let @66: (); // anonymous local - let @67: Option>[Sized>]; // anonymous local - let @68: AllocError; // anonymous local - let @69: Result, AllocError>[Sized>, Sized]; // anonymous local - let @70: AllocError; // anonymous local - let @71: Result>, AllocError>[Sized>>, Sized]; // anonymous local + let @61: Option>[Sized>]; // anonymous local + let @62: AllocError; // anonymous local + let @63: Result, AllocError>[Sized>, Sized]; // anonymous local + let @64: AllocError; // anonymous local + let @65: Result>, AllocError>[Sized>>, Sized]; // anonymous local storage_live(size@4) storage_live(raw_ptr@9) @@ -2426,19 +2294,13 @@ fn alloc_impl<'_0>(@1: &'_0 (Global), @2: Layout, @3: bool) -> Result(@1: &'_0 (Global), @2: Layout, @3: bool) -> Result(@1: &'_0 (Global), @2: Layout, @3: bool) -> Result(@1: &'_0 (Global), @2: Layout, @3: bool) -> Result(@1: &'_0 (Global), @2: Layout, @3: bool) -> Result[Sized, {impl ZeroablePrimitive for usize}]>(copy (@19)) @@ -2741,26 +2593,13 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay let layout@82: Layout; // local let self@83: &'_ (Layout); // local let self@84: &'_ (Layout); // local - let @85: (); // anonymous local - let @86: (); // anonymous local - let @87: (); // anonymous local - let @88: (); // anonymous local - let @89: (); // anonymous local - let @90: (); // anonymous local - let @91: (); // anonymous local - let @92: (); // anonymous local - let @93: (); // anonymous local - let @94: (); // anonymous local - let @95: (); // anonymous local - let @96: (); // anonymous local - let @97: (); // anonymous local - let @98: AllocError; // anonymous local - let @99: Result>, AllocError>[Sized>>, Sized]; // anonymous local - let @100: Option>[Sized>]; // anonymous local - let @101: AllocError; // anonymous local - let @102: Result, AllocError>[Sized>, Sized]; // anonymous local - let @103: AllocError; // anonymous local - let @104: Result>, AllocError>[Sized>>, Sized]; // anonymous local + let @85: AllocError; // anonymous local + let @86: Result>, AllocError>[Sized>>, Sized]; // anonymous local + let @87: Option>[Sized>]; // anonymous local + let @88: AllocError; // anonymous local + let @89: Result, AllocError>[Sized>, Sized]; // anonymous local + let @90: AllocError; // anonymous local + let @91: Result>, AllocError>[Sized>>, Sized]; // anonymous local storage_live(old_size@6) storage_live(old_size@8) @@ -2840,29 +2679,15 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_live(layout@82) storage_live(self@83) storage_live(self@84) + storage_live(@85) storage_live(@86) storage_live(@87) storage_live(@88) storage_live(@89) storage_live(@90) storage_live(@91) - storage_live(@92) - storage_live(@93) - storage_live(@94) - storage_live(@95) - storage_live(@96) - storage_live(@97) - storage_live(@98) - storage_live(@99) - storage_live(@100) - storage_live(@101) - storage_live(@102) - storage_live(@103) - storage_live(@104) storage_live(self@7) - storage_live(@85) - @85 := () - self@7 := &(old_layout@3, move (@85)) + self@7 := &(old_layout@3, copy (@Global0)) old_size@6 := copy ((old_layout@3).size) storage_dead(self@7) switch copy (old_size@6) { @@ -2870,14 +2695,10 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay }, _ => { storage_live(old_size@8) - storage_live(@88) - @88 := () - old_size@8 := &(old_size@6, move (@88)) + old_size@8 := &(old_size@6, copy (@Global0)) storage_live(@9) storage_live(self@11) - storage_live(@87) - @87 := () - self@11 := &(old_layout@3, move (@87)) + self@11 := &(old_layout@3, copy (@Global0)) @41 := copy ((old_layout@3).align) @42 := copy ((@41).0) @43 := @discriminant(@42) @@ -2889,9 +2710,7 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_dead(self@11) storage_live(@12) storage_live(self@13) - storage_live(@86) - @86 := () - self@13 := &(new_layout@4, move (@86)) + self@13 := &(new_layout@4, copy (@Global0)) storage_live(@47) @47 := copy ((new_layout@4).align) storage_live(@49) @@ -2932,9 +2751,9 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_dead(v@75) storage_dead(@74) storage_dead(self@34) - @98 := AllocError { } - @99 := Result::Err { 0: move (@98) } - @0 := move (@99) + @85 := AllocError { } + @86 := Result::Err { 0: move (@85) } + @0 := move (@86) storage_dead(@33) return }, @@ -2972,9 +2791,7 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_live(layout@40) layout@40 := copy (old_layout@3) storage_live(self@81) - storage_live(@95) - @95 := () - self@81 := &(layout@40, move (@95)) + self@81 := &(layout@40, copy (@Global0)) storage_dead(self@81) switch copy (old_size@6) { 0 : usize => { @@ -2983,14 +2800,10 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_live(layout@82) layout@82 := copy (old_layout@3) storage_live(self@83) - storage_live(@97) - @97 := () - self@83 := &(layout@82, move (@97)) + self@83 := &(layout@82, copy (@Global0)) storage_dead(self@83) storage_live(self@84) - storage_live(@96) - @96 := () - self@84 := &(layout@82, move (@96)) + self@84 := &(layout@82, copy (@Global0)) assert(copy (@46) == true) storage_dead(self@84) @39 := __rust_dealloc(move (ptr@37), copy (old_size@6), move (@10)) @@ -3004,16 +2817,12 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_dead(@12) storage_dead(@9) storage_live(self@15) - storage_live(@90) - @90 := () - self@15 := &(new_layout@4, move (@90)) + self@15 := &(new_layout@4, copy (@Global0)) new_size@14 := copy ((new_layout@4).size) storage_dead(self@15) storage_live(cond@16) storage_live(self@17) - storage_live(@89) - @89 := () - self@17 := &(old_layout@3, move (@89)) + self@17 := &(old_layout@3, copy (@Global0)) storage_dead(self@17) cond@16 := copy (new_size@14) >= copy (old_size@6) @54 := ub_checks @@ -3031,14 +2840,10 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_live(new_size@22) new_size@22 := copy (new_size@14) storage_live(self@55) - storage_live(@94) - @94 := () - self@55 := &(layout@21, move (@94)) + self@55 := &(layout@21, copy (@Global0)) storage_dead(self@55) storage_live(self@56) - storage_live(@93) - @93 := () - self@56 := &(layout@21, move (@93)) + self@56 := &(layout@21, copy (@Global0)) assert(copy (@46) == true) storage_dead(self@56) raw_ptr@18 := __rust_realloc(move (ptr@19), copy (old_size@6), move (@10), copy (new_size@14)) @@ -3056,8 +2861,8 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay switch move (@59) { 0 : usize => { storage_dead(@59) - @100 := Option::None { } - self@25 := move (@100) + @87 := Option::None { } + self@25 := move (@87) }, _ => { storage_dead(@59) @@ -3085,14 +2890,10 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_live(new_size@22) new_size@22 := copy (new_size@14) storage_live(self@55) - storage_live(@92) - @92 := () - self@55 := &(layout@21, move (@92)) + self@55 := &(layout@21, copy (@Global0)) storage_dead(self@55) storage_live(self@56) - storage_live(@91) - @91 := () - self@56 := &(layout@21, move (@91)) + self@56 := &(layout@21, copy (@Global0)) assert(copy (@46) == true) storage_dead(self@56) raw_ptr@18 := __rust_realloc(move (ptr@19), copy (old_size@6), move (@10), copy (new_size@14)) @@ -3110,8 +2911,8 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay switch move (@59) { 0 : usize => { storage_dead(@59) - @100 := Option::None { } - self@25 := move (@100) + @87 := Option::None { } + self@25 := move (@87) }, _ => { storage_dead(@59) @@ -3135,9 +2936,9 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_live(v@63) match self@25 { Option::None => { - @101 := AllocError { } - @102 := Result::Err { 0: move (@101) } - self@24 := move (@102) + @88 := AllocError { } + @89 := Result::Err { 0: move (@88) } + self@24 := move (@89) }, Option::Some => { v@63 := move ((self@25 as variant Option::Some).0) @@ -3156,9 +2957,9 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_dead(v@65) storage_dead(@64) storage_dead(self@24) - @103 := AllocError { } - @104 := Result::Err { 0: move (@103) } - @0 := move (@104) + @90 := AllocError { } + @91 := Result::Err { 0: move (@90) } + @0 := move (@91) storage_dead(@23) storage_dead(old_size@8) return @@ -3267,9 +3068,6 @@ pub unsafe fn {impl Allocator for Global}::deallocate<'_0>(@1: &'_0 (Global), @2 let @14: bool; // anonymous local let @15: bool; // anonymous local let @16: bool; // anonymous local - let @17: (); // anonymous local - let @18: (); // anonymous local - let @19: (); // anonymous local storage_live(@4) storage_live(ptr@6) @@ -3283,12 +3081,8 @@ pub unsafe fn {impl Allocator for Global}::deallocate<'_0>(@1: &'_0 (Global), @2 storage_live(@14) storage_live(@15) storage_live(@16) - storage_live(@18) - storage_live(@19) storage_live(self@5) - storage_live(@17) - @17 := () - self@5 := &(layout@3, move (@17)) + self@5 := &(layout@3, copy (@Global0)) @4 := copy ((layout@3).size) storage_dead(self@5) switch move (@4) { @@ -3300,15 +3094,11 @@ pub unsafe fn {impl Allocator for Global}::deallocate<'_0>(@1: &'_0 (Global), @2 storage_live(layout@7) layout@7 := copy (layout@3) storage_live(self@8) - storage_live(@19) - @19 := () - self@8 := &(layout@7, move (@19)) + self@8 := &(layout@7, copy (@Global0)) storage_dead(self@8) storage_live(@9) storage_live(self@10) - storage_live(@18) - @18 := () - self@10 := &(layout@7, move (@18)) + self@10 := &(layout@7, copy (@Global0)) storage_live(@11) @11 := copy ((layout@3).align) storage_live(@13) @@ -3475,35 +3265,19 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No let layout@101: Layout; // local let self@102: &'_ (Layout); // local let self@103: &'_ (Layout); // local - let @104: (); // anonymous local - let @105: (); // anonymous local - let @106: (); // anonymous local - let @107: (); // anonymous local - let @108: (); // anonymous local - let @109: (); // anonymous local - let @110: (); // anonymous local - let @111: (); // anonymous local - let @112: (); // anonymous local - let @113: (); // anonymous local - let @114: (); // anonymous local - let @115: (); // anonymous local - let @116: (); // anonymous local - let @117: (); // anonymous local - let @118: (); // anonymous local - let @119: (); // anonymous local - let @120: AllocError; // anonymous local - let @121: Result[Sized, Sized]; // anonymous local - let @122: ControlFlow[Sized, Sized], NonNull>>[Sized[Sized, Sized]>, Sized>>]; // anonymous local - let @123: Option>[Sized>]; // anonymous local - let @124: AllocError; // anonymous local - let @125: Result>, AllocError>[Sized>>, Sized]; // anonymous local - let @126: AllocError; // anonymous local - let @127: Result, AllocError>[Sized>, Sized]; // anonymous local - let @128: AllocError; // anonymous local - let @129: Result[Sized, Sized]; // anonymous local - let @130: ControlFlow[Sized, Sized], NonNull>[Sized[Sized, Sized]>, Sized>]; // anonymous local - let @131: AllocError; // anonymous local - let @132: Result>, AllocError>[Sized>>, Sized]; // anonymous local + let @104: AllocError; // anonymous local + let @105: Result[Sized, Sized]; // anonymous local + let @106: ControlFlow[Sized, Sized], NonNull>>[Sized[Sized, Sized]>, Sized>>]; // anonymous local + let @107: Option>[Sized>]; // anonymous local + let @108: AllocError; // anonymous local + let @109: Result>, AllocError>[Sized>>, Sized]; // anonymous local + let @110: AllocError; // anonymous local + let @111: Result, AllocError>[Sized>, Sized]; // anonymous local + let @112: AllocError; // anonymous local + let @113: Result[Sized, Sized]; // anonymous local + let @114: ControlFlow[Sized, Sized], NonNull>[Sized[Sized, Sized]>, Sized>]; // anonymous local + let @115: AllocError; // anonymous local + let @116: Result>, AllocError>[Sized>>, Sized]; // anonymous local storage_live(new_size@5) storage_live(@7) @@ -3591,9 +3365,12 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(layout@101) storage_live(self@102) storage_live(self@103) + storage_live(@104) + storage_live(@105) storage_live(@106) storage_live(@107) storage_live(@108) + storage_live(@109) storage_live(@110) storage_live(@111) storage_live(@112) @@ -3601,26 +3378,8 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(@114) storage_live(@115) storage_live(@116) - storage_live(@117) - storage_live(@118) - storage_live(@119) - storage_live(@120) - storage_live(@121) - storage_live(@122) - storage_live(@123) - storage_live(@124) - storage_live(@125) - storage_live(@126) - storage_live(@127) - storage_live(@128) - storage_live(@129) - storage_live(@130) - storage_live(@131) - storage_live(@132) storage_live(self@6) - storage_live(@104) - @104 := () - self@6 := &(new_layout@4, move (@104)) + self@6 := &(new_layout@4, copy (@Global0)) new_size@5 := copy ((new_layout@4).size) storage_dead(self@6) switch copy (new_size@5) { @@ -3628,14 +3387,10 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No }, _ => { storage_live(new_size@12) - storage_live(@108) - @108 := () - new_size@12 := &(new_size@5, move (@108)) + new_size@12 := &(new_size@5, copy (@Global0)) storage_live(@13) storage_live(self@15) - storage_live(@107) - @107 := () - self@15 := &(old_layout@3, move (@107)) + self@15 := &(old_layout@3, copy (@Global0)) @40 := copy ((old_layout@3).align) @41 := copy ((@40).0) @42 := @discriminant(@41) @@ -3647,9 +3402,7 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_dead(self@15) storage_live(@16) storage_live(self@17) - storage_live(@106) - @106 := () - self@17 := &(new_layout@4, move (@106)) + self@17 := &(new_layout@4, copy (@Global0)) storage_live(@68) @68 := copy ((new_layout@4).align) storage_live(@70) @@ -3677,9 +3430,7 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_dead(@13) storage_live(cond@18) storage_live(self@20) - storage_live(@112) - @112 := () - self@20 := &(old_layout@3, move (@112)) + self@20 := &(old_layout@3, copy (@Global0)) @19 := copy ((old_layout@3).size) storage_dead(self@20) cond@18 := copy (new_size@5) <= copy (@19) @@ -3698,14 +3449,10 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(new_size@25) new_size@25 := copy (new_size@5) storage_live(self@76) - storage_live(@116) - @116 := () - self@76 := &(layout@24, move (@116)) + self@76 := &(layout@24, copy (@Global0)) storage_dead(self@76) storage_live(self@77) - storage_live(@115) - @115 := () - self@77 := &(layout@24, move (@115)) + self@77 := &(layout@24, copy (@Global0)) assert(copy (@45) == true) storage_dead(self@77) raw_ptr@21 := __rust_realloc(move (ptr@22), move (@19), move (@14), copy (new_size@5)) @@ -3723,8 +3470,8 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No switch move (@80) { 0 : usize => { storage_dead(@80) - @123 := Option::None { } - self@28 := move (@123) + @107 := Option::None { } + self@28 := move (@107) }, _ => { storage_dead(@80) @@ -3752,14 +3499,10 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(new_size@25) new_size@25 := copy (new_size@5) storage_live(self@76) - storage_live(@114) - @114 := () - self@76 := &(layout@24, move (@114)) + self@76 := &(layout@24, copy (@Global0)) storage_dead(self@76) storage_live(self@77) - storage_live(@113) - @113 := () - self@77 := &(layout@24, move (@113)) + self@77 := &(layout@24, copy (@Global0)) assert(copy (@45) == true) storage_dead(self@77) raw_ptr@21 := __rust_realloc(move (ptr@22), move (@19), move (@14), copy (new_size@5)) @@ -3777,8 +3520,8 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No switch move (@80) { 0 : usize => { storage_dead(@80) - @123 := Option::None { } - self@28 := move (@123) + @107 := Option::None { } + self@28 := move (@107) }, _ => { storage_dead(@80) @@ -3802,9 +3545,9 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(v@84) match self@28 { Option::None => { - @126 := AllocError { } - @127 := Result::Err { 0: move (@126) } - self@27 := move (@127) + @110 := AllocError { } + @111 := Result::Err { 0: move (@110) } + self@27 := move (@111) storage_dead(v@84) storage_dead(@83) storage_dead(self@28) @@ -3846,9 +3589,9 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No return }, ControlFlow::Break => { - @131 := AllocError { } - @132 := Result::Err { 0: move (@131) } - @0 := move (@132) + @115 := AllocError { } + @116 := Result::Err { 0: move (@115) } + @0 := move (@116) storage_dead(@26) storage_dead(new_size@12) return @@ -3856,10 +3599,10 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No } }, Result::Err => { - @128 := AllocError { } - @129 := Result::Err { 0: move (@128) } - @130 := ControlFlow::Break { 0: move (@129) } - @26 := move (@130) + @112 := AllocError { } + @113 := Result::Err { 0: move (@112) } + @114 := ControlFlow::Break { 0: move (@113) } + @26 := move (@114) storage_dead(v@86) storage_dead(@85) storage_dead(self@27) @@ -3892,9 +3635,9 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No return }, ControlFlow::Break => { - @131 := AllocError { } - @132 := Result::Err { 0: move (@131) } - @0 := move (@132) + @115 := AllocError { } + @116 := Result::Err { 0: move (@115) } + @0 := move (@116) storage_dead(@26) storage_dead(new_size@12) return @@ -3947,9 +3690,9 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No return }, ControlFlow::Break => { - @131 := AllocError { } - @132 := Result::Err { 0: move (@131) } - @0 := move (@132) + @115 := AllocError { } + @116 := Result::Err { 0: move (@115) } + @0 := move (@116) storage_dead(@26) storage_dead(new_size@12) return @@ -3957,10 +3700,10 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No } }, Result::Err => { - @128 := AllocError { } - @129 := Result::Err { 0: move (@128) } - @130 := ControlFlow::Break { 0: move (@129) } - @26 := move (@130) + @112 := AllocError { } + @113 := Result::Err { 0: move (@112) } + @114 := ControlFlow::Break { 0: move (@113) } + @26 := move (@114) storage_dead(v@86) storage_dead(@85) storage_dead(self@27) @@ -3993,9 +3736,9 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No return }, ControlFlow::Break => { - @131 := AllocError { } - @132 := Result::Err { 0: move (@131) } - @0 := move (@132) + @115 := AllocError { } + @116 := Result::Err { 0: move (@115) } + @0 := move (@116) storage_dead(@26) storage_dead(new_size@12) return @@ -4053,9 +3796,7 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No layout@39 := copy (old_layout@3) storage_live(@99) storage_live(self@100) - storage_live(@117) - @117 := () - self@100 := &(layout@39, move (@117)) + self@100 := &(layout@39, copy (@Global0)) @99 := copy ((old_layout@3).size) storage_dead(self@100) switch move (@99) { @@ -4065,14 +3806,10 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(layout@101) layout@101 := copy (old_layout@3) storage_live(self@102) - storage_live(@119) - @119 := () - self@102 := &(layout@101, move (@119)) + self@102 := &(layout@101, copy (@Global0)) storage_dead(self@102) storage_live(self@103) - storage_live(@118) - @118 := () - self@103 := &(layout@101, move (@118)) + self@103 := &(layout@101, copy (@Global0)) assert(copy (@45) == true) storage_dead(self@103) @38 := __rust_dealloc(move (ptr@36), move (@99), move (@14)) @@ -4085,19 +3822,19 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No return }, ControlFlow::Break => { - @124 := AllocError { } - @125 := Result::Err { 0: move (@124) } - @0 := move (@125) + @108 := AllocError { } + @109 := Result::Err { 0: move (@108) } + @0 := move (@109) storage_dead(@32) return }, } }, Result::Err => { - @120 := AllocError { } - @121 := Result::Err { 0: move (@120) } - @122 := ControlFlow::Break { 0: move (@121) } - @32 := move (@122) + @104 := AllocError { } + @105 := Result::Err { 0: move (@104) } + @106 := ControlFlow::Break { 0: move (@105) } + @32 := move (@106) storage_dead(v@93) storage_dead(@92) storage_dead(self@33) @@ -4132,9 +3869,7 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No layout@39 := copy (old_layout@3) storage_live(@99) storage_live(self@100) - storage_live(@117) - @117 := () - self@100 := &(layout@39, move (@117)) + self@100 := &(layout@39, copy (@Global0)) @99 := copy ((old_layout@3).size) storage_dead(self@100) switch move (@99) { @@ -4144,14 +3879,10 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(layout@101) layout@101 := copy (old_layout@3) storage_live(self@102) - storage_live(@119) - @119 := () - self@102 := &(layout@101, move (@119)) + self@102 := &(layout@101, copy (@Global0)) storage_dead(self@102) storage_live(self@103) - storage_live(@118) - @118 := () - self@103 := &(layout@101, move (@118)) + self@103 := &(layout@101, copy (@Global0)) assert(copy (@45) == true) storage_dead(self@103) @38 := __rust_dealloc(move (ptr@36), move (@99), move (@14)) @@ -4164,9 +3895,9 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No return }, ControlFlow::Break => { - @124 := AllocError { } - @125 := Result::Err { 0: move (@124) } - @0 := move (@125) + @108 := AllocError { } + @109 := Result::Err { 0: move (@108) } + @0 := move (@109) storage_dead(@32) return }, @@ -4181,9 +3912,7 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No layout@8 := copy (old_layout@3) storage_live(@46) storage_live(self@47) - storage_live(@105) - @105 := () - self@47 := &(layout@8, move (@105)) + self@47 := &(layout@8, copy (@Global0)) @46 := copy ((old_layout@3).size) storage_dead(self@47) switch move (@46) { @@ -4195,15 +3924,11 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(layout@49) layout@49 := copy (old_layout@3) storage_live(self@50) - storage_live(@111) - @111 := () - self@50 := &(layout@49, move (@111)) + self@50 := &(layout@49, copy (@Global0)) storage_dead(self@50) storage_live(@51) storage_live(self@52) - storage_live(@110) - @110 := () - self@52 := &(layout@49, move (@110)) + self@52 := &(layout@49, copy (@Global0)) storage_live(@53) @53 := copy ((old_layout@3).align) storage_live(@55) @@ -4236,9 +3961,7 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(@9) storage_live(data@10) storage_live(self@11) - storage_live(@109) - @109 := () - self@11 := &(new_layout@4, move (@109)) + self@11 := &(new_layout@4, copy (@Global0)) storage_live(@60) @60 := copy ((new_layout@4).align) @59 := transmute[Sized, {impl ZeroablePrimitive for usize}]>(copy (@60)) @@ -4308,29 +4031,20 @@ fn ct_error(@1: Layout) -> ! let @3: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @4: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @5: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local - let @6: (); // anonymous local - let @7: (); // anonymous local - let @8: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local - let @9: Array<&'_ (Str), 1 : usize>; // anonymous local - let @10: (); // anonymous local + let @6: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local + let @7: Array<&'_ (Str), 1 : usize>; // anonymous local storage_live(@5) - storage_live(@8) - storage_live(@9) - @9 := [const ("allocation failed")] - storage_live(@10) - @10 := () - @8 := &(@9, move (@10)) + storage_live(@6) + storage_live(@7) + @7 := [const ("allocation failed")] + @6 := &(@7, copy (@Global0)) storage_live(@2) storage_live(@3) storage_live(@4) - @5 := move (@8) - storage_live(@7) - @7 := () - @4 := &(*(@5), move (@7)) - storage_live(@6) - @6 := () - @3 := &(*(@4), move (@6)) + @5 := move (@6) + @4 := &(*(@5), copy (@Global0)) + @3 := &(*(@4), copy (@Global0)) @2 := new_const<'_, 1 : usize>(move (@3)) storage_dead(@3) panic(core::panicking::panic_fmt) @@ -4369,7 +4083,6 @@ unsafe fn exchange_malloc(@1: usize, @2: usize) -> *mut u8 let @10: *mut Slice; // anonymous local let @11: &'_ (Global); // anonymous local let @12: Global; // anonymous local - let @13: (); // anonymous local storage_live(layout@3) storage_live(ptr@5) @@ -4385,9 +4098,7 @@ unsafe fn exchange_malloc(@1: usize, @2: usize) -> *mut u8 else { } @12 := Global { } - storage_live(@13) - @13 := () - @11 := &(@12, move (@13)) + @11 := &(@12, copy (@Global0)) storage_dead(@7) storage_live(@9) @9 := transmute(copy (align@2)) @@ -4575,8 +4286,6 @@ where let @14: *const u8; // anonymous local let ptr@15: NonNull; // local let ptr@16: PhantomData; // local - let @17: (); // anonymous local - let @18: (); // anonymous local storage_live(layout@2) storage_live(@4) @@ -4587,7 +4296,6 @@ where storage_live(unique@13) storage_live(@14) storage_live(ptr@15) - storage_live(@18) storage_live(ptr@16) ptr@15 := copy (((*(self@1)).0).pointer) ptr@16 := copy (((*(self@1)).0)._marker) @@ -4612,18 +4320,14 @@ where storage_dead(align@9) storage_dead(t@3) storage_live(self@5) - storage_live(@17) - @17 := () - self@5 := &(layout@2, move (@17)) + self@5 := &(layout@2, copy (@Global0)) storage_dead(self@5) switch move (size@8) { 0 : usize => { }, _ => { storage_live(@7) - storage_live(@18) - @18 := () - @7 := &((*(self@1)).1, move (@18)) + @7 := &((*(self@1)).1, copy (@Global0)) storage_live(@14) @14 := cast<*mut T, *const u8>(copy (@4)) unique@13 := NonNull { pointer: move (@14) } diff --git a/charon/tests/ui/reconstruct_early_return.out b/charon/tests/ui/reconstruct_early_return.out index fa7a8cafe..7943325de 100644 --- a/charon/tests/ui/reconstruct_early_return.out +++ b/charon/tests/ui/reconstruct_early_return.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::f fn f() -> usize { diff --git a/charon/tests/ui/region-inference-vars.out b/charon/tests/ui/region-inference-vars.out index fc8a6dfc3..e1bac621c 100644 --- a/charon/tests/ui/region-inference-vars.out +++ b/charon/tests/ui/region-inference-vars.out @@ -23,6 +23,16 @@ where Err(E), } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::MyTryFrom pub trait MyTryFrom { diff --git a/charon/tests/ui/regressions/closure-inside-impl-with-bound-with-assoc-ty.out b/charon/tests/ui/regressions/closure-inside-impl-with-bound-with-assoc-ty.out index c84fd9e0e..b9c54301c 100644 --- a/charon/tests/ui/regressions/closure-inside-impl-with-bound-with-assoc-ty.out +++ b/charon/tests/ui/regressions/closure-inside-impl-with-bound-with-assoc-ty.out @@ -82,6 +82,16 @@ pub fn core::ops::function::FnOnce::call_once(@1: Se where [@TraitClause0]: FnOnce, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::PrimeField pub trait PrimeField { @@ -150,12 +160,9 @@ where let state@1: &'_0 mut (closure[@TraitClause0, @TraitClause1]); // arg #1 let args@2: (()); // arg #2 let @3: &'_ (closure[@TraitClause0, @TraitClause1]); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<(()), ()> for closure[@TraitClause0, @TraitClause1]}::call<'_, F, Clause1_Repr>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) @0 := () return @@ -171,12 +178,9 @@ where let @1: closure[@TraitClause0, @TraitClause1]; // arg #1 let @2: (()); // arg #2 let @3: &'_ mut (closure[@TraitClause0, @TraitClause1]); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(()), ()> for closure[@TraitClause0, @TraitClause1]}::call_mut<'_, F, Clause1_Repr>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0, @TraitClause1]>] @1 @0 := () diff --git a/charon/tests/ui/remove-dynamic-checks.out b/charon/tests/ui/remove-dynamic-checks.out index a0aa2f30c..256a13b35 100644 --- a/charon/tests/ui/remove-dynamic-checks.out +++ b/charon/tests/ui/remove-dynamic-checks.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::neg_test pub fn neg_test(@1: i32) -> i32 { diff --git a/charon/tests/ui/rename_attribute.out b/charon/tests/ui/rename_attribute.out index 2a85711a2..576c15918 100644 --- a/charon/tests/ui/rename_attribute.out +++ b/charon/tests/ui/rename_attribute.out @@ -12,6 +12,16 @@ pub trait Sized non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::BoolTrait pub trait BoolTrait { @@ -74,23 +84,16 @@ where let @2: bool; // anonymous local let @3: &'_ (bool); // anonymous local let @4: &'_ (bool); // anonymous local - let @5: (); // anonymous local - let @6: (); // anonymous local storage_live(@4) - storage_live(@6) storage_live(@2) storage_live(@3) - storage_live(@5) - @5 := () - @3 := &(x@1, move (@5)) + @3 := &(x@1, copy (@Global0)) @2 := {impl BoolTrait for bool}::get_bool<'_>(move (@3)) if move (@2) { storage_dead(@3) storage_live(@4) - storage_live(@6) - @6 := () - @4 := &(x@1, move (@6)) + @4 := &(x@1, copy (@Global0)) @0 := test_crate::{impl BoolTrait for bool}::ret_true<'_>(move (@4)) storage_dead(@4) } diff --git a/charon/tests/ui/result-unwrap.out b/charon/tests/ui/result-unwrap.out index 98457e861..891b10dc1 100644 --- a/charon/tests/ui/result-unwrap.out +++ b/charon/tests/ui/result-unwrap.out @@ -201,6 +201,16 @@ pub fn drop<'_0, Self>(@1: &'_0 mut (Self)) where [@TraitClause0]: Drop, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: core::result::unwrap_failed fn unwrap_failed<'_0, '_1>(@1: &'_0 (Str), @2: &'_1 ((dyn exists<_dyn> [@TraitClause0]: Debug<_dyn> + _dyn : '_1))) -> ! @@ -216,13 +226,11 @@ where let @3: !; // anonymous local let @4: &'_ ((dyn exists<_dyn> [@TraitClause0]: Debug<_dyn> + _dyn : '_)); // anonymous local let @5: &'_ (E); // anonymous local - let @6: (); // anonymous local storage_live(e@2) storage_live(@3) storage_live(@4) storage_live(@5) - storage_live(@6) match self@1 { Result::Ok => { }, @@ -230,9 +238,7 @@ where storage_live(e@2) e@2 := move ((self@1 as variant Result::Err).0) storage_live(@4) - storage_live(@6) - @6 := () - @5 := &(e@2, move (@6)) + @5 := &(e@2, copy (@Global0)) @4 := unsize_cast<&'_ (E), &'_ ((dyn exists<_dyn> [@TraitClause0]: Debug<_dyn> + _dyn : '_)), @TraitClause2>(copy (@5)) @3 := unwrap_failed<'_, '_>(const ("called `Result::unwrap()` on an `Err` value"), move (@4)) }, diff --git a/charon/tests/ui/rust-name-matcher-tests.out b/charon/tests/ui/rust-name-matcher-tests.out index bd4b0bf57..3e970f2e7 100644 --- a/charon/tests/ui/rust-name-matcher-tests.out +++ b/charon/tests/ui/rust-name-matcher-tests.out @@ -26,6 +26,16 @@ where #[lang_item("global_alloc_ty")] pub struct Global {} +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::foo::bar fn bar() { diff --git a/charon/tests/ui/rvalues.out b/charon/tests/ui/rvalues.out index 92bdeacf1..26ae8bda5 100644 --- a/charon/tests/ui/rvalues.out +++ b/charon/tests/ui/rvalues.out @@ -131,6 +131,16 @@ where vtable: {impl Drop for alloc::boxed::Box[@TraitClause0, @TraitClause1]}::{vtable}[@TraitClause0, @TraitClause1] } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::addr_of fn addr_of() { @@ -140,32 +150,20 @@ fn addr_of() let @3: &'_ (u32); // anonymous local let @4: *const u32; // anonymous local let @5: *mut u32; // anonymous local - let @6: (); // anonymous local - let @7: (); // anonymous local - let @8: (); // anonymous local - let @9: (); // anonymous local storage_live(x@1) x@1 := const (0 : u32) storage_live(@2) storage_live(@3) - storage_live(@9) - @9 := () - @3 := &(x@1, move (@9)) - storage_live(@8) - @8 := () - @2 := &raw const (*(@3), move (@8)) + @3 := &(x@1, copy (@Global0)) + @2 := &raw const (*(@3), copy (@Global0)) storage_dead(@3) storage_dead(@2) storage_live(@4) - storage_live(@7) - @7 := () - @4 := &raw const (x@1, move (@7)) + @4 := &raw const (x@1, copy (@Global0)) storage_dead(@4) storage_live(@5) - storage_live(@6) - @6 := () - @5 := &raw mut (x@1, move (@6)) + @5 := &raw mut (x@1, copy (@Global0)) storage_dead(@5) @0 := () storage_dead(x@1) @@ -233,21 +231,13 @@ fn ptr_casts() let @15: *const u8; // anonymous local let @16: *const u8; // anonymous local let @17: fn(); // anonymous local - let @18: (); // anonymous local - let @19: (); // anonymous local - let @20: (); // anonymous local - let @21: (); // anonymous local storage_live(array_ptr@1) storage_live(@2) storage_live(@3) @3 := @ArrayRepeat<'_, u32, 64 : usize>(const (0 : u32)) - storage_live(@21) - @21 := () - @2 := &(@3, move (@21)) - storage_live(@20) - @20 := () - array_ptr@1 := &raw const (*(@2), move (@20)) + @2 := &(@3, copy (@Global0)) + array_ptr@1 := &raw const (*(@2), copy (@Global0)) storage_dead(@2) storage_live(@4) storage_live(@5) @@ -259,12 +249,8 @@ fn ptr_casts() x@6 := const (0 : u8) storage_live(x@7) storage_live(@8) - storage_live(@19) - @19 := () - @8 := &(x@6, move (@19)) - storage_live(@18) - @18 := () - x@7 := &raw const (*(@8), move (@18)) + @8 := &(x@6, copy (@Global0)) + x@7 := &raw const (*(@8), copy (@Global0)) storage_dead(@8) storage_live(@9) storage_live(@10) @@ -346,12 +332,9 @@ fn {impl FnMut<(u8)> for closure}::call_mut<'_0>(@1: &'_0 mut (closure), @2: (u8 let state@1: &'_0 mut (closure); // arg #1 let args@2: (u8); // arg #2 let @3: &'_ (closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<(u8)> for closure}::call<'_>(move (@3), move (args@2)) @0 := () return @@ -364,12 +347,9 @@ fn {impl FnOnce<(u8)> for closure}::call_once(@1: closure, @2: (u8)) let @1: closure; // arg #1 let @2: (u8); // arg #2 let @3: &'_ mut (closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(u8)> for closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 @0 := () diff --git a/charon/tests/ui/scopes.out b/charon/tests/ui/scopes.out index 167edacf2..7abce1c26 100644 --- a/charon/tests/ui/scopes.out +++ b/charon/tests/ui/scopes.out @@ -4,6 +4,16 @@ #[lang_item("meta_sized")] pub trait MetaSized +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Trait trait Trait<'a, Self> { diff --git a/charon/tests/ui/send_bound.out b/charon/tests/ui/send_bound.out index a250b53bf..7023f5695 100644 --- a/charon/tests/ui/send_bound.out +++ b/charon/tests/ui/send_bound.out @@ -30,6 +30,16 @@ pub fn drop<'_0, Self>(@1: &'_0 mut (Self)) where [@TraitClause0]: Drop, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::foo fn foo(@1: M) where diff --git a/charon/tests/ui/simple-cmp.out b/charon/tests/ui/simple-cmp.out index 32bc7b380..faa04bf42 100644 --- a/charon/tests/ui/simple-cmp.out +++ b/charon/tests/ui/simple-cmp.out @@ -136,6 +136,16 @@ impl Ord for i32 { non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::main fn main() { @@ -146,9 +156,6 @@ fn main() let @4: &'_ (i32); // anonymous local let @5: &'_ (i32); // anonymous local let @6: &'_ (i32); // anonymous local - let @7: (); // anonymous local - let @8: (); // anonymous local - let @9: (); // anonymous local storage_live(x@1) x@1 := const (11 : i32) @@ -156,17 +163,11 @@ fn main() y@2 := const (22 : i32) storage_live(@3) storage_live(@4) - storage_live(@9) - @9 := () - @4 := &(x@1, move (@9)) + @4 := &(x@1, copy (@Global0)) storage_live(@5) storage_live(@6) - storage_live(@8) - @8 := () - @6 := &(y@2, move (@8)) - storage_live(@7) - @7 := () - @5 := &(*(@6), move (@7)) + @6 := &(y@2, copy (@Global0)) + @5 := &(*(@6), copy (@Global0)) @3 := {impl Ord for i32}::cmp<'_, '_>(move (@4), move (@5)) storage_dead(@5) storage_dead(@4) diff --git a/charon/tests/ui/simple/addition.out b/charon/tests/ui/simple/addition.out index 113ceb3d9..bf81070d4 100644 --- a/charon/tests/ui/simple/addition.out +++ b/charon/tests/ui/simple/addition.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::main fn main() { diff --git a/charon/tests/ui/simple/additions.out b/charon/tests/ui/simple/additions.out index 9f93d7773..cd51da622 100644 --- a/charon/tests/ui/simple/additions.out +++ b/charon/tests/ui/simple/additions.out @@ -165,6 +165,16 @@ pub fn drop<'_0, Self>(@1: &'_0 mut (Self)) where [@TraitClause0]: Drop, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::main fn main() { diff --git a/charon/tests/ui/simple/array_index.out b/charon/tests/ui/simple/array_index.out index 8652b4f6a..1c16bbc87 100644 --- a/charon/tests/ui/simple/array_index.out +++ b/charon/tests/ui/simple/array_index.out @@ -1,24 +1,31 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::first pub fn first(@1: Array) -> u32 { let @0: u32; // return let s@1: Array; // arg #1 let @2: usize; // anonymous local - let @3: (); // anonymous local - let @4: &'_ (Array); // anonymous local - let @5: &'_ (u32); // anonymous local + let @3: &'_ (Array); // anonymous local + let @4: &'_ (u32); // anonymous local storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := () + @3 := &(s@1, const (@Global0)) storage_live(@4) - @4 := &(s@1, move (@3)) - storage_live(@5) - @5 := @ArrayIndexShared<'_, u32, 0 : usize>(move (@4), copy (@2)) - @0 := copy (*(@5)) + @4 := @ArrayIndexShared<'_, u32, 0 : usize>(move (@3), copy (@2)) + @0 := copy (*(@4)) storage_dead(@2) return } diff --git a/charon/tests/ui/simple/assoc-constraint-on-assoc-ty-nested.out b/charon/tests/ui/simple/assoc-constraint-on-assoc-ty-nested.out index 56c1071e0..402af3e0e 100644 --- a/charon/tests/ui/simple/assoc-constraint-on-assoc-ty-nested.out +++ b/charon/tests/ui/simple/assoc-constraint-on-assoc-ty-nested.out @@ -12,6 +12,16 @@ pub trait Sized non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Trait trait Trait { diff --git a/charon/tests/ui/simple/assoc-constraint-on-assoc-ty.2.out b/charon/tests/ui/simple/assoc-constraint-on-assoc-ty.2.out index 394812fee..acd158098 100644 --- a/charon/tests/ui/simple/assoc-constraint-on-assoc-ty.2.out +++ b/charon/tests/ui/simple/assoc-constraint-on-assoc-ty.2.out @@ -12,6 +12,16 @@ pub trait Sized non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Trait trait Trait { diff --git a/charon/tests/ui/simple/assoc-constraint-on-assoc-ty.out b/charon/tests/ui/simple/assoc-constraint-on-assoc-ty.out index d137bc3b4..1513b8d31 100644 --- a/charon/tests/ui/simple/assoc-constraint-on-assoc-ty.out +++ b/charon/tests/ui/simple/assoc-constraint-on-assoc-ty.out @@ -26,6 +26,16 @@ pub fn drop<'_0, Self>(@1: &'_0 mut (Self)) where [@TraitClause0]: Drop, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Trait trait Trait { diff --git a/charon/tests/ui/simple/assoc-ty-via-supertrait-and-bounds.out b/charon/tests/ui/simple/assoc-ty-via-supertrait-and-bounds.out index 920370008..80996f5b1 100644 --- a/charon/tests/ui/simple/assoc-ty-via-supertrait-and-bounds.out +++ b/charon/tests/ui/simple/assoc-ty-via-supertrait-and-bounds.out @@ -12,6 +12,16 @@ pub trait Sized non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::HasOutput pub trait HasOutput { diff --git a/charon/tests/ui/simple/assoc-type-with-fn-bound.out b/charon/tests/ui/simple/assoc-type-with-fn-bound.out index 8bc9a9110..9d9f60c58 100644 --- a/charon/tests/ui/simple/assoc-type-with-fn-bound.out +++ b/charon/tests/ui/simple/assoc-type-with-fn-bound.out @@ -70,6 +70,16 @@ pub fn call_once(@1: Self, @2: Args) -> Clause0_Outp where [@TraitClause0]: FnOnce, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Trait pub trait Trait { @@ -94,12 +104,9 @@ where let self@1: &'_ (F); // arg #1 let @2: &'_ (F); // anonymous local let @3: (); // anonymous local - let @4: (); // anonymous local storage_live(@2) - storage_live(@4) - @4 := () - @2 := &(*(self@1), move (@4)) + @2 := &(*(self@1), copy (@Global0)) storage_live(@3) @3 := () @0 := @TraitClause0::call<'_>(move (@2), move (@3)) diff --git a/charon/tests/ui/simple/basic-mono.out b/charon/tests/ui/simple/basic-mono.out index 75dfaa50c..c226c9e14 100644 --- a/charon/tests/ui/simple/basic-mono.out +++ b/charon/tests/ui/simple/basic-mono.out @@ -12,6 +12,16 @@ pub trait Sized:: non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::foo::<10 : usize> fn foo::<10 : usize>() { diff --git a/charon/tests/ui/simple/box-into-inner.out b/charon/tests/ui/simple/box-into-inner.out index 8d364dc79..f6512b31a 100644 --- a/charon/tests/ui/simple/box-into-inner.out +++ b/charon/tests/ui/simple/box-into-inner.out @@ -68,6 +68,16 @@ impl Drop for String { non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::into_inner fn into_inner(@1: alloc::boxed::Box[MetaSized, Sized]) { @@ -85,7 +95,6 @@ fn into_inner(@1: alloc::boxed::Box[MetaSized, Sized]) let @11: bool; // anonymous local let @12: bool; // anonymous local let @13: bool; // anonymous local - let @14: (); // anonymous local storage_live(@3) storage_live(@4) @@ -113,9 +122,7 @@ fn into_inner(@1: alloc::boxed::Box[MetaSized, Sized]) drop[{impl Drop for String}] _x@2 storage_dead(_x@2) @5 := transmute, *const String>(copy ((*(b@1)).0)) - storage_live(@14) - @14 := () - @3 := &mut (b@1, move (@14)) + @3 := &mut (b@1, copy (@Global0)) @4 := {impl Drop for alloc::boxed::Box[@TraitClause0, @TraitClause1]}::drop<'_, String, Global>[MetaSized, Sized](move (@3)) @0 := () return diff --git a/charon/tests/ui/simple/box-new.out b/charon/tests/ui/simple/box-new.out index 217375633..bde5f69b2 100644 --- a/charon/tests/ui/simple/box-new.out +++ b/charon/tests/ui/simple/box-new.out @@ -101,6 +101,16 @@ where vtable: {impl Drop for alloc::boxed::Box[@TraitClause0, @TraitClause1, @TraitClause2]}::{vtable}[@TraitClause0, @TraitClause1, @TraitClause2] } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::main fn main() { diff --git a/charon/tests/ui/simple/call-foreign-defaulted-method.out b/charon/tests/ui/simple/call-foreign-defaulted-method.out index adaee05fd..cd39c6a63 100644 --- a/charon/tests/ui/simple/call-foreign-defaulted-method.out +++ b/charon/tests/ui/simple/call-foreign-defaulted-method.out @@ -4,6 +4,16 @@ #[lang_item("meta_sized")] pub trait MetaSized +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + pub fn test_crate::foo::{impl Trait for ()}::defaulted<'_0>(@1: &'_0 (())) { let @0: (); // return @@ -21,15 +31,12 @@ fn main() let @1: (); // anonymous local let @2: &'_ (()); // anonymous local let @3: (); // anonymous local - let @4: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) @3 := () - storage_live(@4) - @4 := () - @2 := &(@3, move (@4)) + @2 := &(@3, copy (@Global0)) @1 := test_crate::foo::{impl Trait for ()}::defaulted<'_>(move (@2)) storage_dead(@2) storage_dead(@3) diff --git a/charon/tests/ui/simple/call-inherent-method-with-trait-bound.out b/charon/tests/ui/simple/call-inherent-method-with-trait-bound.out index 542842267..b5fdaa11f 100644 --- a/charon/tests/ui/simple/call-inherent-method-with-trait-bound.out +++ b/charon/tests/ui/simple/call-inherent-method-with-trait-bound.out @@ -25,6 +25,16 @@ pub fn core::ops::drop::Drop::drop<'_0, Self>(@1: &'_0 mut (Self)) where [@TraitClause0]: Drop, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Trait pub trait Trait { diff --git a/charon/tests/ui/simple/call-method-via-supertrait-bound.out b/charon/tests/ui/simple/call-method-via-supertrait-bound.out index 45711b32b..77b1b0a89 100644 --- a/charon/tests/ui/simple/call-method-via-supertrait-bound.out +++ b/charon/tests/ui/simple/call-method-via-supertrait-bound.out @@ -26,6 +26,16 @@ pub fn drop<'_0, Self>(@1: &'_0 mut (Self)) where [@TraitClause0]: Drop, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::OtherTrait trait OtherTrait { @@ -88,13 +98,10 @@ where let x@1: T; // arg #1 let @2: (); // anonymous local let @3: &'_ (T); // anonymous local - let @4: (); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(x@1, move (@4)) + @3 := &(x@1, copy (@Global0)) @2 := {impl HasMethod for T}::method<'_, T>[@TraitClause0, @TraitClause1::parent_clause1](move (@3)) storage_dead(@3) storage_dead(@2) diff --git a/charon/tests/ui/simple/closure-capture-ref-by-move.out b/charon/tests/ui/simple/closure-capture-ref-by-move.out index a1bea4f48..ff75434b5 100644 --- a/charon/tests/ui/simple/closure-capture-ref-by-move.out +++ b/charon/tests/ui/simple/closure-capture-ref-by-move.out @@ -67,6 +67,16 @@ pub fn core::ops::function::FnOnce::call_once(@1: Self, @2: Args) -> where [@TraitClause0]: FnOnce, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::foo::closure struct closure<'_0> { &'_0 mut (i32), @@ -98,22 +108,16 @@ fn foo() let @4: (); // anonymous local let @5: &'_ mut (closure<'_>); // anonymous local let @6: (); // anonymous local - let @7: (); // anonymous local - let @8: (); // anonymous local storage_live(x@1) x@1 := const (0 : i32) storage_live(rx@2) - storage_live(@8) - @8 := () - rx@2 := &mut (x@1, move (@8)) + rx@2 := &mut (x@1, copy (@Global0)) storage_live(closure@3) closure@3 := closure { 0: move (rx@2) } storage_live(@4) storage_live(@5) - storage_live(@7) - @7 := () - @5 := &mut (closure@3, move (@7)) + @5 := &mut (closure@3, copy (@Global0)) storage_live(@6) @6 := () @4 := {impl FnMut<()> for closure<'_0>}::call_mut<'_, '_>(move (@5), move (@6)) @@ -135,12 +139,9 @@ fn {impl FnOnce<()> for closure<'_0>}::call_once<'_0>(@1: closure<'_0>, @2: ()) let @1: closure<'_0>; // arg #1 let @2: (); // arg #2 let @3: &'_ mut (closure<'_0>); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<()> for closure<'_0>}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop>] @1 @0 := () diff --git a/charon/tests/ui/simple/closure-fn.out b/charon/tests/ui/simple/closure-fn.out index fcb67d20f..e68da5df5 100644 --- a/charon/tests/ui/simple/closure-fn.out +++ b/charon/tests/ui/simple/closure-fn.out @@ -83,6 +83,16 @@ pub fn core::ops::function::FnOnce::call_once(@1: Self, @2: Args) -> where [@TraitClause0]: FnOnce, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::apply_to fn apply_to<'_0, impl Fn(u8, u8) -> u8>(@1: &'_0 (impl Fn(u8, u8) -> u8)) -> u8 where @@ -94,12 +104,9 @@ where let f@1: &'_ (impl Fn(u8, u8) -> u8); // arg #1 let @2: &'_ (impl Fn(u8, u8) -> u8); // anonymous local let @3: (u8, u8); // anonymous local - let @4: (); // anonymous local storage_live(@2) - storage_live(@4) - @4 := () - @2 := &(*(f@1), move (@4)) + @2 := &(*(f@1), copy (@Global0)) storage_live(@3) @3 := (const (10 : u8), const (20 : u8)) @0 := @TraitClause1::call<'_>(move (@2), move (@3)) @@ -119,12 +126,9 @@ where let f@1: &'_ mut (impl FnMut(u8, u8) -> u8); // arg #1 let @2: &'_ mut (impl FnMut(u8, u8) -> u8); // anonymous local let @3: (u8, u8); // anonymous local - let @4: (); // anonymous local storage_live(@2) - storage_live(@4) - @4 := () - @2 := &mut (*(f@1), move (@4)) + @2 := &mut (*(f@1), copy (@Global0)) storage_live(@3) @3 := (const (10 : u8), const (20 : u8)) @0 := @TraitClause1::call_mut<'_>(move (@2), move (@3)) @@ -219,12 +223,9 @@ fn {impl FnMut<(u8, u8)> for closure<'_0, '_1>}::call_mut<'_0, '_1, '_2>(@1: &'_ let state@1: &'_2 mut (closure<'_0, '_1>); // arg #1 let args@2: (u8, u8); // arg #2 let @3: &'_ (closure<'_0, '_1>); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<(u8, u8)> for closure<'_0, '_1>}::call<'_0, '_1, '_>(move (@3), move (args@2)) return } @@ -236,12 +237,9 @@ fn {impl FnOnce<(u8, u8)> for closure<'_0, '_1>}::call_once<'_0, '_1>(@1: closur let @1: closure<'_0, '_1>; // arg #1 let @2: (u8, u8); // arg #2 let @3: &'_ mut (closure<'_0, '_1>); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(u8, u8)> for closure<'_0, '_1>}::call_mut<'_0, '_1, '_>(move (@3), move (@2)) drop[Drop>] @1 return @@ -298,13 +296,6 @@ fn main() let @14: &'_ mut (closure<'_, '_>); // anonymous local let @15: u8; // anonymous local let @16: closure<'_, '_>; // anonymous local - let @17: (); // anonymous local - let @18: (); // anonymous local - let @19: (); // anonymous local - let @20: (); // anonymous local - let @21: (); // anonymous local - let @22: (); // anonymous local - let @23: (); // anonymous local storage_live(v@1) v@1 := const (5 : u8) @@ -312,21 +303,15 @@ fn main() z@2 := const (1 : u8) storage_live(f@3) storage_live(@4) - storage_live(@19) - @19 := () - @4 := &(v@1, move (@19)) + @4 := &(v@1, copy (@Global0)) storage_live(@5) - storage_live(@18) - @18 := () - @5 := &(z@2, move (@18)) + @5 := &(z@2, copy (@Global0)) f@3 := closure { 0: move (@4), 1: move (@5) } storage_dead(@5) storage_dead(@4) storage_live(@6) storage_live(@7) - storage_live(@17) - @17 := () - @7 := &(f@3, move (@17)) + @7 := &(f@3, copy (@Global0)) storage_live(@8) @8 := (const (10 : u8), const (20 : u8)) @6 := {impl Fn<(u8, u8)> for closure<'_0, '_1>}::call<'_, '_, '_>(move (@7), move (@8)) @@ -336,12 +321,8 @@ fn main() storage_live(@9) storage_live(@10) storage_live(@11) - storage_live(@21) - @21 := () - @11 := &(f@3, move (@21)) - storage_live(@20) - @20 := () - @10 := &(*(@11), move (@20)) + @11 := &(f@3, copy (@Global0)) + @10 := &(*(@11), copy (@Global0)) @9 := apply_to<'_, closure<'_, '_>>[Sized>, {impl Fn<(u8, u8)> for closure<'_0, '_1>}<'_, '_>](move (@10)) storage_dead(@10) storage_dead(@11) @@ -349,12 +330,8 @@ fn main() storage_live(@12) storage_live(@13) storage_live(@14) - storage_live(@23) - @23 := () - @14 := &mut (f@3, move (@23)) - storage_live(@22) - @22 := () - @13 := &two-phase-mut (*(@14), move (@22)) + @14 := &mut (f@3, copy (@Global0)) + @13 := &two-phase-mut (*(@14), copy (@Global0)) @12 := apply_to_mut<'_, closure<'_, '_>>[Sized>, {impl FnMut<(u8, u8)> for closure<'_0, '_1>}<'_, '_>](move (@13)) storage_dead(@13) storage_dead(@14) diff --git a/charon/tests/ui/simple/closure-fnmut.out b/charon/tests/ui/simple/closure-fnmut.out index c0c890438..fa4bca1dc 100644 --- a/charon/tests/ui/simple/closure-fnmut.out +++ b/charon/tests/ui/simple/closure-fnmut.out @@ -67,6 +67,16 @@ pub fn core::ops::function::FnOnce::call_once(@1: Self, @2: Args) -> where [@TraitClause0]: FnOnce, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::apply_to_zero_mut fn apply_to_zero_mut u8>(@1: impl FnMut(u8) -> u8) -> u8 where @@ -78,12 +88,9 @@ where let f@1: impl FnMut(u8) -> u8; // arg #1 let @2: &'_ mut (impl FnMut(u8) -> u8); // anonymous local let @3: (u8); // anonymous local - let @4: (); // anonymous local storage_live(@2) - storage_live(@4) - @4 := () - @2 := &mut (f@1, move (@4)) + @2 := &mut (f@1, copy (@Global0)) storage_live(@3) @3 := (const (0 : u8)) @0 := @TraitClause1::call_mut<'_>(move (@2), move (@3)) @@ -134,12 +141,9 @@ fn {impl FnOnce<(u8)> for closure<'_0>}::call_once<'_0>(@1: closure<'_0>, @2: (u let @1: closure<'_0>; // arg #1 let @2: (u8); // arg #2 let @3: &'_ mut (closure<'_0>); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(u8)> for closure<'_0>}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop>] @1 return @@ -174,16 +178,13 @@ fn main() let @2: u8; // anonymous local let @3: closure<'_>; // anonymous local let @4: &'_ mut (u8); // anonymous local - let @5: (); // anonymous local storage_live(z@1) z@1 := const (3 : u8) storage_live(@2) storage_live(@3) storage_live(@4) - storage_live(@5) - @5 := () - @4 := &mut (z@1, move (@5)) + @4 := &mut (z@1, copy (@Global0)) @3 := closure { 0: move (@4) } storage_dead(@4) @2 := apply_to_zero_mut>[Sized>, {impl FnMut<(u8)> for closure<'_0>}<'_>](move (@3)) diff --git a/charon/tests/ui/simple/closure-fnonce.out b/charon/tests/ui/simple/closure-fnonce.out index a4892b9e2..72d829ec6 100644 --- a/charon/tests/ui/simple/closure-fnonce.out +++ b/charon/tests/ui/simple/closure-fnonce.out @@ -55,6 +55,16 @@ pub fn core::ops::function::FnOnce::call_once(@1: Self, @2: Args) -> where [@TraitClause0]: FnOnce, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::apply_to_zero_once fn apply_to_zero_once u8>(@1: impl FnOnce(u8) -> u8) -> u8 where diff --git a/charon/tests/ui/simple/closure-inside-impl.out b/charon/tests/ui/simple/closure-inside-impl.out index 7391c2baf..7fdf14f5a 100644 --- a/charon/tests/ui/simple/closure-inside-impl.out +++ b/charon/tests/ui/simple/closure-inside-impl.out @@ -83,6 +83,16 @@ pub fn core::ops::function::FnOnce::call_once(@1: Self, @2: Args) -> where [@TraitClause0]: FnOnce, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Foo pub struct Foo where @@ -143,12 +153,9 @@ where let state@1: &'_0 mut (closure[@TraitClause0, @TraitClause1]); // arg #1 let args@2: (()); // arg #2 let @3: &'_ (closure[@TraitClause0, @TraitClause1]); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<(())> for closure[@TraitClause0, @TraitClause1]}::call<'_, F, T>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) @0 := () return @@ -164,12 +171,9 @@ where let @1: closure[@TraitClause0, @TraitClause1]; // arg #1 let @2: (()); // arg #2 let @3: &'_ mut (closure[@TraitClause0, @TraitClause1]); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(())> for closure[@TraitClause0, @TraitClause1]}::call_mut<'_, F, T>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0, @TraitClause1]>] @1 @0 := () diff --git a/charon/tests/ui/simple/closure-uses-ambient-self-clause.out b/charon/tests/ui/simple/closure-uses-ambient-self-clause.out index 2cc3119e4..810f1bb9f 100644 --- a/charon/tests/ui/simple/closure-uses-ambient-self-clause.out +++ b/charon/tests/ui/simple/closure-uses-ambient-self-clause.out @@ -83,6 +83,16 @@ pub fn core::ops::function::FnOnce::call_once(@1: Self, @2: Args) -> where [@TraitClause0]: FnOnce, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Thing trait Thing { @@ -128,14 +138,11 @@ where let @3: closure[@TraitClause0]; // anonymous local let @4: (@TraitClause0::Item); // anonymous local let @5: @TraitClause0::Item; // anonymous local - let @6: (); // anonymous local storage_live(@2) storage_live(@3) @3 := closure { } - storage_live(@6) - @6 := () - @2 := &(@3, move (@6)) + @2 := &(@3, copy (@Global0)) storage_live(@4) storage_live(@5) @5 := move (i@1) @@ -160,12 +167,9 @@ where let state@1: &'_0 mut (closure[@TraitClause0]); // arg #1 let args@2: (@TraitClause0::Item); // arg #2 let @3: &'_ (closure[@TraitClause0]); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<(@TraitClause0::Item)> for closure[@TraitClause0]}::call<'_, Self>[@TraitClause0](move (@3), move (args@2)) @0 := () return @@ -180,12 +184,9 @@ where let @1: closure[@TraitClause0]; // arg #1 let @2: (@TraitClause0::Item); // arg #2 let @3: &'_ mut (closure[@TraitClause0]); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(@TraitClause0::Item)> for closure[@TraitClause0]}::call_mut<'_, Self>[@TraitClause0](move (@3), move (@2)) drop[Drop[@TraitClause0]>] @1 @0 := () diff --git a/charon/tests/ui/simple/closure-with-drops.out b/charon/tests/ui/simple/closure-with-drops.out index ba4b391a0..80dd1876e 100644 --- a/charon/tests/ui/simple/closure-with-drops.out +++ b/charon/tests/ui/simple/closure-with-drops.out @@ -95,6 +95,16 @@ pub fn core::ops::function::FnOnce::call_once(@1: Self, @2: Args) -> where [@TraitClause0]: FnOnce, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + struct test_crate::foo::closure where [@TraitClause0]: Sized, @@ -196,12 +206,9 @@ fn {impl FnMut<()> for test_crate::bar::closure}::call_mut<'_0>(@1: &'_0 mut (te let state@1: &'_0 mut (test_crate::bar::closure); // arg #1 let args@2: (); // arg #2 let @3: &'_ (test_crate::bar::closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<()> for test_crate::bar::closure}::call<'_>(move (@3), move (args@2)) @0 := () return @@ -214,12 +221,9 @@ fn {impl FnOnce<()> for test_crate::bar::closure}::call_once(@1: test_crate::bar let @1: test_crate::bar::closure; // arg #1 let @2: (); // arg #2 let @3: &'_ mut (test_crate::bar::closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<()> for test_crate::bar::closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 @0 := () diff --git a/charon/tests/ui/simple/conditional-drop.out b/charon/tests/ui/simple/conditional-drop.out index 68abfc93e..6cc274f5b 100644 --- a/charon/tests/ui/simple/conditional-drop.out +++ b/charon/tests/ui/simple/conditional-drop.out @@ -60,6 +60,16 @@ where vtable: {impl Drop for alloc::boxed::Box[@TraitClause0, @TraitClause1, @TraitClause3, @TraitClause4]}::{vtable}[@TraitClause0, @TraitClause1, @TraitClause3, @TraitClause4] } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::use_box fn use_box(@1: alloc::boxed::Box[MetaSized, Sized, Drop, {impl Drop for Global}]) { diff --git a/charon/tests/ui/simple/const-subslice.out b/charon/tests/ui/simple/const-subslice.out index ad3641324..62c3a8501 100644 --- a/charon/tests/ui/simple/const-subslice.out +++ b/charon/tests/ui/simple/const-subslice.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::main fn main() { diff --git a/charon/tests/ui/simple/default-method-with-clause-and-marker-trait.out b/charon/tests/ui/simple/default-method-with-clause-and-marker-trait.out index 964dd7a06..23bb0e41b 100644 --- a/charon/tests/ui/simple/default-method-with-clause-and-marker-trait.out +++ b/charon/tests/ui/simple/default-method-with-clause-and-marker-trait.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::HasAssoc trait HasAssoc { diff --git a/charon/tests/ui/simple/drop-string.out b/charon/tests/ui/simple/drop-string.out index 0201d0833..33ea71bf4 100644 --- a/charon/tests/ui/simple/drop-string.out +++ b/charon/tests/ui/simple/drop-string.out @@ -54,6 +54,16 @@ pub struct String { vec: Vec[Sized, Sized, Drop, {impl Drop for Global}], } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: alloc::vec::{impl Drop for Vec[@TraitClause0, @TraitClause1, @TraitClause3, @TraitClause4]}::drop pub fn {impl Drop for Vec[@TraitClause0, @TraitClause1, @TraitClause3, @TraitClause4]}::drop<'_0, T, A>(@1: &'_0 mut (Vec[@TraitClause0, @TraitClause1, @TraitClause3, @TraitClause4])) where @@ -81,12 +91,9 @@ fn {impl Drop for String}::drop<'_0>(@1: &'_0 mut (String)) let @0: (); // return let @1: *mut String; // arg #1 let @2: &'_ mut (String); // anonymous local - let @3: (); // anonymous local storage_live(@2) - storage_live(@3) - @3 := () - @2 := &mut (*(@1), move (@3)) + @2 := &mut (*(@1), copy (@Global0)) drop[{impl Drop for Vec[@TraitClause0, @TraitClause1, @TraitClause3, @TraitClause4]}[Sized, Sized, Drop, {impl Drop for Global}]] (*(@2)).vec @0 := () return diff --git a/charon/tests/ui/simple/dyn-fn.out b/charon/tests/ui/simple/dyn-fn.out index 38fddcb4a..49361d107 100644 --- a/charon/tests/ui/simple/dyn-fn.out +++ b/charon/tests/ui/simple/dyn-fn.out @@ -92,6 +92,16 @@ pub fn core::ops::function::FnOnce::call_once(@1: Self, @2: Args) -> where [@TraitClause0]: FnOnce, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::takes_fn fn takes_fn<'_0>(@1: &'_0 ((dyn exists<_dyn> [@TraitClause0]: for<'a> Fn<_dyn, (&'a mut (u32))> + _dyn : '_0 + for<'a> @TraitClause1_0::parent_clause1::parent_clause1::Output = bool))) { @@ -103,26 +113,20 @@ fn takes_fn<'_0>(@1: &'_0 ((dyn exists<_dyn> [@TraitClause0]: for<'a> Fn<_dyn, ( let @5: (&'_ mut (u32)); // anonymous local let @6: &'_ mut (u32); // anonymous local let @7: &'_ mut (u32); // anonymous local - let @8: (); // anonymous local - let @9: (); // anonymous local - let @10: &'static (core::ops::function::Fn::{vtable}<(&'_ mut (u32)), bool>); // anonymous local + let @8: &'static (core::ops::function::Fn::{vtable}<(&'_ mut (u32)), bool>); // anonymous local storage_live(counter@2) counter@2 := const (0 : u32) storage_live(@3) storage_live(@4) - storage_live(@10) - @10 := ptr_metadata(copy (f@1)) - @4 := &(*(f@1), move (@10)) + storage_live(@8) + @8 := ptr_metadata(copy (f@1)) + @4 := &(*(f@1), move (@8)) storage_live(@5) storage_live(@6) storage_live(@7) - storage_live(@9) - @9 := () - @7 := &mut (counter@2, move (@9)) - storage_live(@8) - @8 := () - @6 := &two-phase-mut (*(@7), move (@8)) + @7 := &mut (counter@2, copy (@Global0)) + @6 := &two-phase-mut (*(@7), copy (@Global0)) @5 := (move (@6)) @3 := Fn<(dyn exists<_dyn> [@TraitClause0]: for<'a> Fn<_dyn, (&'a mut (u32))> + _dyn : '_ + for<'a> @TraitClause1_0::parent_clause1::parent_clause1::Output = bool), (&'_ mut (u32))>::call<'_>(move (@4), move (@5)) if move (@3) { @@ -173,12 +177,9 @@ fn {impl FnMut<(&'_ mut (u32))> for closure}::call_mut<'_0, '_1>(@1: &'_1 mut (c let state@1: &'_1 mut (closure); // arg #1 let args@2: (&'_0 mut (u32)); // arg #2 let @3: &'_ (closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<(&'_ mut (u32))> for closure}::call<'_0, '_>(move (@3), move (args@2)) return } @@ -190,12 +191,9 @@ fn {impl FnOnce<(&'_ mut (u32))> for closure}::call_once<'_0>(@1: closure, @2: ( let @1: closure; // arg #1 let @2: (&'_ mut (u32)); // arg #2 let @3: &'_ mut (closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(&'_ mut (u32))> for closure}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop] @1 return @@ -240,20 +238,14 @@ fn gives_fn() let @2: &'_ (closure); // anonymous local let @3: &'_ (closure); // anonymous local let @4: closure; // anonymous local - let @5: (); // anonymous local - let @6: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := closure { } - storage_live(@6) - @6 := () - @3 := &(@4, move (@6)) - storage_live(@5) - @5 := () - @2 := &(*(@3), move (@5)) + @3 := &(@4, copy (@Global0)) + @2 := &(*(@3), copy (@Global0)) @1 := unsize_cast<&'_ (closure), &'_ ((dyn exists<_dyn> [@TraitClause0]: for<'a> Fn<_dyn, (&'a mut (u32))> + _dyn : '_ + for<'a> @TraitClause1_0::parent_clause1::parent_clause1::Output = bool)), {impl Fn<(&'_ mut (u32))> for closure}<'_>>(move (@2)) storage_dead(@2) @0 := takes_fn<'_>(move (@1)) diff --git a/charon/tests/ui/simple/gat-check-binder-levels.out b/charon/tests/ui/simple/gat-check-binder-levels.out index 0827934b5..958e5790a 100644 --- a/charon/tests/ui/simple/gat-check-binder-levels.out +++ b/charon/tests/ui/simple/gat-check-binder-levels.out @@ -22,6 +22,16 @@ where Some(T), } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Link pub trait Link { diff --git a/charon/tests/ui/simple/gat-complex-lifetimes.out b/charon/tests/ui/simple/gat-complex-lifetimes.out index 62e4dee7f..3c3d3c87a 100644 --- a/charon/tests/ui/simple/gat-complex-lifetimes.out +++ b/charon/tests/ui/simple/gat-complex-lifetimes.out @@ -26,6 +26,16 @@ pub fn drop<'_0, Self>(@1: &'_0 mut (Self)) where [@TraitClause0]: Drop, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Foo pub trait Foo { @@ -62,15 +72,12 @@ where let x@1: @TraitClause1::Type; // arg #1 let @2: &'_ (&'_ (&'_ (()))); // anonymous local let @3: @TraitClause1::Type; // anonymous local - let @4: (); // anonymous local storage_live(@2) storage_live(@3) @3 := move (x@1) @2 := (@TraitClause1::Type::[@TraitClause1])::foo(move (@3)) - storage_live(@4) - @4 := () - @0 := &(*(@2), move (@4)) + @0 := &(*(@2), copy (@Global0)) storage_dead(@3) storage_dead(@2) drop[Drop<@TraitClause1::Type>] x@1 diff --git a/charon/tests/ui/simple/gat-implied-clause.out b/charon/tests/ui/simple/gat-implied-clause.out index 1940d784d..3c0b4cecf 100644 --- a/charon/tests/ui/simple/gat-implied-clause.out +++ b/charon/tests/ui/simple/gat-implied-clause.out @@ -49,6 +49,16 @@ pub fn drop<'_0, Self>(@1: &'_0 mut (Self)) where [@TraitClause0]: Drop, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Trait trait Trait { @@ -76,13 +86,10 @@ where let x@1: @TraitClause1::LifetimeGat; // arg #1 let @2: @TraitClause1::LifetimeGat; // anonymous local let @3: &'_ (@TraitClause1::LifetimeGat); // anonymous local - let @4: (); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(x@1, move (@4)) + @3 := &(x@1, copy (@Global0)) @2 := (@TraitClause1::LifetimeGat::[@TraitClause1])::clone<'_>(move (@3)) storage_dead(@3) drop[Drop<@TraitClause1::LifetimeGat>] @2 @@ -103,13 +110,10 @@ where let x@1: @TraitClause1::NonLifetimeGat; // arg #1 let @2: @TraitClause1::NonLifetimeGat; // anonymous local let @3: &'_ (@TraitClause1::NonLifetimeGat); // anonymous local - let @4: (); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(x@1, move (@4)) + @3 := &(x@1, copy (@Global0)) @2 := (@TraitClause1::NonLifetimeGat::[@TraitClause1])::clone<'_>(move (@3)) storage_dead(@3) drop[Drop<@TraitClause1::NonLifetimeGat>] @2 diff --git a/charon/tests/ui/simple/generic-cast-to-dyn.out b/charon/tests/ui/simple/generic-cast-to-dyn.out index 11ec3eb74..24d10e6ea 100644 --- a/charon/tests/ui/simple/generic-cast-to-dyn.out +++ b/charon/tests/ui/simple/generic-cast-to-dyn.out @@ -40,6 +40,16 @@ pub trait Sized non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::foo fn foo<'_0, T>(@1: &'_0 (T)) -> &'_0 ((dyn exists<_dyn> [@TraitClause0]: Any<_dyn> + _dyn : 'static)) where @@ -52,14 +62,11 @@ where let @3: &'_ ((dyn exists<_dyn> [@TraitClause0]: Any<_dyn> + _dyn : '_)); // anonymous local let @4: &'_ (T); // anonymous local let @5: &'static (core::any::Any::{vtable}); // anonymous local - let @6: (); // anonymous local storage_live(@2) storage_live(@3) storage_live(@4) - storage_live(@6) - @6 := () - @4 := &(*(x@1), move (@6)) + @4 := &(*(x@1), copy (@Global0)) @3 := unsize_cast<&'_ (T), &'_ ((dyn exists<_dyn> [@TraitClause0]: Any<_dyn> + _dyn : '_)), @TraitClause1>(move (@4)) storage_dead(@4) storage_live(@5) diff --git a/charon/tests/ui/simple/generic-impl-with-defaulted-method-with-clause-with-assoc-ty.out b/charon/tests/ui/simple/generic-impl-with-defaulted-method-with-clause-with-assoc-ty.out index 1cae97af2..be915f334 100644 --- a/charon/tests/ui/simple/generic-impl-with-defaulted-method-with-clause-with-assoc-ty.out +++ b/charon/tests/ui/simple/generic-impl-with-defaulted-method-with-clause-with-assoc-ty.out @@ -22,6 +22,16 @@ where Some(T), } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::HasType trait HasType { diff --git a/charon/tests/ui/simple/generic-impl-with-defaulted-method.out b/charon/tests/ui/simple/generic-impl-with-defaulted-method.out index 7e27ea309..9619da6ef 100644 --- a/charon/tests/ui/simple/generic-impl-with-defaulted-method.out +++ b/charon/tests/ui/simple/generic-impl-with-defaulted-method.out @@ -22,6 +22,16 @@ where Some(T), } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::BoolTrait pub trait BoolTrait { diff --git a/charon/tests/ui/simple/generic-impl-with-method.out b/charon/tests/ui/simple/generic-impl-with-method.out index e81b29965..95f91ac79 100644 --- a/charon/tests/ui/simple/generic-impl-with-method.out +++ b/charon/tests/ui/simple/generic-impl-with-method.out @@ -12,6 +12,16 @@ pub trait Sized non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Trait pub trait Trait { diff --git a/charon/tests/ui/simple/hide-drops.out b/charon/tests/ui/simple/hide-drops.out index f77962d93..4769312f9 100644 --- a/charon/tests/ui/simple/hide-drops.out +++ b/charon/tests/ui/simple/hide-drops.out @@ -25,6 +25,16 @@ pub opaque type String #[lang_item("string_new")] pub fn new() -> String +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::use_string fn use_string(@1: String) { diff --git a/charon/tests/ui/simple/lending-iterator-gat.out b/charon/tests/ui/simple/lending-iterator-gat.out index 72fef8cad..98d31fe8b 100644 --- a/charon/tests/ui/simple/lending-iterator-gat.out +++ b/charon/tests/ui/simple/lending-iterator-gat.out @@ -104,6 +104,16 @@ pub enum AssertKind { Match, } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::LendingIterator pub trait LendingIterator { @@ -131,9 +141,6 @@ where let item@3: &'_ (T); // local let @4: Option<&'_ (T)>[Sized<&'_ (T)>]; // anonymous local let @5: &'_ (T); // anonymous local - let @6: (); // anonymous local - let @7: (); // anonymous local - let @8: (); // anonymous local match *(self@1) { Option::Some => { @@ -144,21 +151,15 @@ where }, } storage_live(item@2) - storage_live(@8) - @8 := () - item@2 := &mut ((*(self@1) as variant Option::Some).0, move (@8)) + item@2 := &mut ((*(self@1) as variant Option::Some).0, copy (@Global0)) storage_live(item@3) - storage_live(@7) - @7 := () - item@3 := &(*(*(item@2)), move (@7)) + item@3 := &(*(*(item@2)), copy (@Global0)) storage_live(@4) @4 := Option::None { } *(self@1) := move (@4) storage_dead(@4) storage_live(@5) - storage_live(@6) - @6 := () - @5 := &(*(item@3), move (@6)) + @5 := &(*(item@3), copy (@Global0)) @0 := Option::Some { 0: move (@5) } storage_dead(@5) storage_dead(item@3) @@ -197,8 +198,6 @@ where let @8: (@TraitClause2::Item); // anonymous local let @9: @TraitClause2::Item; // anonymous local let @10: (); // anonymous local - let @11: (); // anonymous local - let @12: (); // anonymous local storage_live(@3) storage_live(@5) @@ -206,14 +205,10 @@ where storage_live(@7) storage_live(@8) storage_live(@9) - storage_live(@11) - storage_live(@12) loop { storage_live(@4) storage_live(@5) - storage_live(@11) - @11 := () - @5 := &two-phase-mut (iter@1, move (@11)) + @5 := &two-phase-mut (iter@1, copy (@Global0)) @4 := @TraitClause2::next<'_>(move (@5)) storage_dead(@5) match @4 { @@ -226,9 +221,7 @@ where storage_live(item@6) item@6 := move ((@4 as variant Option::Some).0) storage_live(@7) - storage_live(@12) - @12 := () - @7 := &mut (f@2, move (@12)) + @7 := &mut (f@2, copy (@Global0)) storage_live(@8) storage_live(@9) @9 := move (item@6) @@ -290,12 +283,9 @@ fn {impl FnOnce<(&'_ (i32))> for closure<'_0>}::call_once<'_0, '_1>(@1: closure< let @1: closure<'_0>; // arg #1 let @2: (&'_ (i32)); // arg #2 let @3: &'_ mut (closure<'_0>); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(&'_ (i32))> for closure<'_0>}::call_mut<'_0, '_1, '_>(move (@3), move (@2)) drop[Drop>] @1 @0 := () @@ -353,14 +343,6 @@ pub fn main() let @24: &'_ (i32); // anonymous local let @25: &'_ (i32); // anonymous local let @26: Option>[Sized>]; // anonymous local - let @27: (); // anonymous local - let @28: (); // anonymous local - let @29: (); // anonymous local - let @30: (); // anonymous local - let @31: (); // anonymous local - let @32: (); // anonymous local - let @33: (); // anonymous local - let @34: (); // anonymous local storage_live(kind@20) storage_live(@21) @@ -369,19 +351,13 @@ pub fn main() storage_live(@24) storage_live(@25) storage_live(@26) - storage_live(@31) - storage_live(@32) - storage_live(@33) - storage_live(@34) storage_live(x@1) x@1 := const (42 : i32) storage_live(iter@2) storage_live(@3) storage_live(@4) @4 := const (42 : i32) - storage_live(@28) - @28 := () - @3 := &(@4, move (@28)) + @3 := &(@4, copy (@Global0)) iter@2 := Option::Some { 0: move (@3) } storage_dead(@3) storage_live(sum@5) @@ -391,9 +367,7 @@ pub fn main() @7 := copy (iter@2) storage_live(@8) storage_live(@9) - storage_live(@27) - @27 := () - @9 := &mut (sum@5, move (@27)) + @9 := &mut (sum@5, copy (@Global0)) @8 := closure { 0: move (@9) } storage_dead(@9) @6 := for_each[Sized<&'_ (i32)>], closure<'_>>[Sized[Sized<&'_ (i32)>]>, Sized>, {impl LendingIterator for Option<&'a (T)>[Sized<&'_ (T)>]}<'_, i32>[Sized], {impl FnMut<(&'_ (i32))> for closure<'_0>}<'_, '_>](move (@7), move (@8)) @@ -403,15 +377,11 @@ pub fn main() storage_live(@10) storage_live(@11) storage_live(@12) - storage_live(@30) - @30 := () - @12 := &(sum@5, move (@30)) + @12 := &(sum@5, copy (@Global0)) storage_live(@13) storage_live(@14) @14 := const (42 : i32) - storage_live(@29) - @29 := () - @13 := &(@14, move (@29)) + @13 := &(@14, copy (@Global0)) @11 := (move (@12), move (@13)) storage_dead(@13) storage_dead(@12) @@ -436,20 +406,12 @@ pub fn main() @21 := move (kind@20) storage_live(@22) storage_live(@23) - storage_live(@34) - @34 := () - @23 := &(*(left_val@15), move (@34)) - storage_live(@33) - @33 := () - @22 := &(*(@23), move (@33)) + @23 := &(*(left_val@15), copy (@Global0)) + @22 := &(*(@23), copy (@Global0)) storage_live(@24) storage_live(@25) - storage_live(@32) - @32 := () - @25 := &(*(right_val@16), move (@32)) - storage_live(@31) - @31 := () - @24 := &(*(@25), move (@31)) + @25 := &(*(right_val@16), copy (@Global0)) + @24 := &(*(@25), copy (@Global0)) storage_live(@26) @26 := Option::None { } panic(core::panicking::assert_failed) diff --git a/charon/tests/ui/simple/match-on-char.out b/charon/tests/ui/simple/match-on-char.out index 45290e351..fa6dc69b7 100644 --- a/charon/tests/ui/simple/match-on-char.out +++ b/charon/tests/ui/simple/match-on-char.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::main fn main() { diff --git a/charon/tests/ui/simple/match-on-float.out b/charon/tests/ui/simple/match-on-float.out index 69cd3fe6c..8f1408b54 100644 --- a/charon/tests/ui/simple/match-on-float.out +++ b/charon/tests/ui/simple/match-on-float.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::main fn main() { diff --git a/charon/tests/ui/simple/mem-discriminant-from-derive.out b/charon/tests/ui/simple/mem-discriminant-from-derive.out index 780e968ca..83d9162ef 100644 --- a/charon/tests/ui/simple/mem-discriminant-from-derive.out +++ b/charon/tests/ui/simple/mem-discriminant-from-derive.out @@ -193,6 +193,16 @@ pub trait Destruct vtable: core::marker::Destruct::{vtable} } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Enum enum Enum { Some(u8), @@ -225,12 +235,6 @@ pub fn {impl PartialEq for Enum}::eq<'_0, '_1>(@1: &'_0 (Enum), @2: &'_1 ( let __arg1_0@14: &'_ (u8); // local let @15: &'_ (&'_ (u8)); // anonymous local let @16: &'_ (&'_ (u8)); // anonymous local - let @17: (); // anonymous local - let @18: (); // anonymous local - let @19: (); // anonymous local - let @20: (); // anonymous local - let @21: (); // anonymous local - let @22: (); // anonymous local storage_live(@10) storage_live(@11) @@ -239,22 +243,14 @@ pub fn {impl PartialEq for Enum}::eq<'_0, '_1>(@1: &'_0 (Enum), @2: &'_1 ( storage_live(__arg1_0@14) storage_live(@15) storage_live(@16) - storage_live(@19) - storage_live(@20) - storage_live(@21) - storage_live(@22) storage_live(__self_discr@3) storage_live(@4) - storage_live(@17) - @17 := () - @4 := &(*(self@1), move (@17)) + @4 := &(*(self@1), copy (@Global0)) __self_discr@3 := @discriminant(*(@4)) storage_dead(@4) storage_live(__arg1_discr@5) storage_live(@6) - storage_live(@18) - @18 := () - @6 := &(*(other@2), move (@18)) + @6 := &(*(other@2), copy (@Global0)) __arg1_discr@5 := @discriminant(*(@6)) storage_dead(@6) storage_live(@7) @@ -279,21 +275,13 @@ pub fn {impl PartialEq for Enum}::eq<'_0, '_1>(@1: &'_0 (Enum), @2: &'_1 ( match *((@10).1) { Enum::Some => { storage_live(__self_0@13) - storage_live(@22) - @22 := () - __self_0@13 := &((*((@10).0) as variant Enum::Some).0, move (@22)) + __self_0@13 := &((*((@10).0) as variant Enum::Some).0, copy (@Global0)) storage_live(__arg1_0@14) - storage_live(@21) - @21 := () - __arg1_0@14 := &((*((@10).1) as variant Enum::Some).0, move (@21)) + __arg1_0@14 := &((*((@10).1) as variant Enum::Some).0, copy (@Global0)) storage_live(@15) - storage_live(@20) - @20 := () - @15 := &(__self_0@13, move (@20)) + @15 := &(__self_0@13, copy (@Global0)) storage_live(@16) - storage_live(@19) - @19 := () - @16 := &(__arg1_0@14, move (@19)) + @16 := &(__arg1_0@14, copy (@Global0)) @0 := {impl PartialEq<&'_0 (B)> for &'_1 (A)}::eq<'_, '_, '_, '_, u8, u8>[{impl PartialEq for u8}](move (@15), move (@16)) storage_dead(@16) storage_dead(@15) diff --git a/charon/tests/ui/simple/method-with-assoc-type-constraint.out b/charon/tests/ui/simple/method-with-assoc-type-constraint.out index de0725d0b..ec45cf8b1 100644 --- a/charon/tests/ui/simple/method-with-assoc-type-constraint.out +++ b/charon/tests/ui/simple/method-with-assoc-type-constraint.out @@ -26,6 +26,16 @@ pub fn drop<'_0, Self>(@1: &'_0 mut (Self)) where [@TraitClause0]: Drop, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::IntoIterator pub trait IntoIterator { diff --git a/charon/tests/ui/simple/multiple-promoteds.out b/charon/tests/ui/simple/multiple-promoteds.out index cbe64140d..0aa14cb3b 100644 --- a/charon/tests/ui/simple/multiple-promoteds.out +++ b/charon/tests/ui/simple/multiple-promoteds.out @@ -42,6 +42,16 @@ pub fn core::ops::arith::Add::add(@1: Self, @2: Rhs) -> @TraitClause0 where [@TraitClause0]: Add, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::six fn six() -> u32 { @@ -54,49 +64,37 @@ fn six() -> u32 let @6: &'_ (u32); // anonymous local let @7: &'_ (u32); // anonymous local let @8: &'_ (u32); // anonymous local - let @9: (); // anonymous local - let @10: (); // anonymous local - let @11: &'_ (u32); // anonymous local - let @12: u32; // anonymous local + let @9: &'_ (u32); // anonymous local + let @10: u32; // anonymous local + let @11: u32; // anonymous local + let @12: &'_ (u32); // anonymous local let @13: u32; // anonymous local - let @14: (); // anonymous local - let @15: &'_ (u32); // anonymous local - let @16: u32; // anonymous local - let @17: u32; // anonymous local - let @18: (); // anonymous local + let @14: u32; // anonymous local storage_live(@2) storage_live(@4) storage_live(@7) storage_live(@8) + storage_live(@9) + storage_live(@10) storage_live(@11) storage_live(@12) storage_live(@13) - storage_live(@15) - storage_live(@16) - storage_live(@17) + storage_live(@14) storage_live(x@1) @2 := const (0 : u32) panic.+ const (1 : u32) - @13 := const (0 : u32) wrap.+ const (1 : u32) - @12 := move (@13) - storage_live(@14) - @14 := () - @11 := &(@12, move (@14)) - @8 := move (@11) - storage_live(@9) - @9 := () - x@1 := &(*(@8), move (@9)) + @11 := const (0 : u32) wrap.+ const (1 : u32) + @10 := move (@11) + @9 := &(@10, copy (@Global0)) + @8 := move (@9) + x@1 := &(*(@8), copy (@Global0)) storage_live(y@3) @4 := const (2 : u32) panic.+ const (3 : u32) - @17 := const (2 : u32) wrap.+ const (3 : u32) - @16 := move (@17) - storage_live(@18) - @18 := () - @15 := &(@16, move (@18)) - @7 := move (@15) - storage_live(@10) - @10 := () - y@3 := &(*(@7), move (@10)) + @14 := const (2 : u32) wrap.+ const (3 : u32) + @13 := move (@14) + @12 := &(@13, copy (@Global0)) + @7 := move (@12) + y@3 := &(*(@7), copy (@Global0)) storage_live(@5) @5 := copy (x@1) storage_live(@6) diff --git a/charon/tests/ui/simple/nested-closure-trait-ref.out b/charon/tests/ui/simple/nested-closure-trait-ref.out index 771d1b595..15de9f426 100644 --- a/charon/tests/ui/simple/nested-closure-trait-ref.out +++ b/charon/tests/ui/simple/nested-closure-trait-ref.out @@ -106,6 +106,16 @@ pub fn core::ops::function::FnOnce::call_once(@1: Self, @2: Args) -> where [@TraitClause0]: FnOnce, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + struct test_crate::foo::closure::closure where [@TraitClause0]: Sized, @@ -186,12 +196,9 @@ where let @1: &'_ (test_crate::foo::closure::closure[@TraitClause0, @TraitClause1]); // arg #1 let tupled_args@2: (); // arg #2 let @3: &'_ (T); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &((*(@1)).0, move (@4)) + @3 := &((*(@1)).0, copy (@Global0)) @0 := @TraitClause1::clone<'_>(move (@3)) storage_dead(@3) return @@ -207,12 +214,9 @@ where let state@1: &'_0 mut (test_crate::foo::closure::closure[@TraitClause0, @TraitClause1]); // arg #1 let args@2: (); // arg #2 let @3: &'_ (test_crate::foo::closure::closure[@TraitClause0, @TraitClause1]); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<()> for test_crate::foo::closure::closure[@TraitClause0, @TraitClause1]}::call<'_, T>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) return } @@ -227,12 +231,9 @@ where let @1: test_crate::foo::closure::closure[@TraitClause0, @TraitClause1]; // arg #1 let @2: (); // arg #2 let @3: &'_ mut (test_crate::foo::closure::closure[@TraitClause0, @TraitClause1]); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<()> for test_crate::foo::closure::closure[@TraitClause0, @TraitClause1]}::call_mut<'_, T>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0, @TraitClause1]>] @1 return diff --git a/charon/tests/ui/simple/nested-closure.out b/charon/tests/ui/simple/nested-closure.out index 3dab22bbe..cf4a353d9 100644 --- a/charon/tests/ui/simple/nested-closure.out +++ b/charon/tests/ui/simple/nested-closure.out @@ -106,6 +106,16 @@ pub fn core::ops::function::FnOnce::call_once(@1: Self, @2: Args) -> where [@TraitClause0]: FnOnce, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Foo struct Foo<'a, T> where @@ -149,12 +159,9 @@ where let @1: &'_ (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // arg #1 let tupled_args@2: (); // arg #2 let @3: &'_ (T); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*((*(@1)).0), move (@4)) + @3 := &(*((*(@1)).0), copy (@Global0)) @0 := test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure { 0: move (@3) } storage_dead(@3) return @@ -171,14 +178,11 @@ where let tupled_args@2: (&'_2 (u32)); // arg #2 let _y@3: &'_ (u32); // local let @4: &'_ (T); // anonymous local - let @5: (); // anonymous local storage_live(_y@3) _y@3 := move ((tupled_args@2).0) storage_live(@4) - storage_live(@5) - @5 := () - @4 := &(*((*(@1)).0), move (@5)) + @4 := &(*((*(@1)).0), copy (@Global0)) @0 := test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure::closure { 0: move (@4) } storage_dead(@4) return @@ -195,14 +199,11 @@ where let tupled_args@2: (&'_2 (u32)); // arg #2 let _z@3: &'_ (u32); // local let @4: &'_ (T); // anonymous local - let @5: (); // anonymous local storage_live(_z@3) _z@3 := move ((tupled_args@2).0) storage_live(@4) - storage_live(@5) - @5 := () - @4 := &(*((*(@1)).0), move (@5)) + @4 := &(*((*(@1)).0), copy (@Global0)) @0 := @TraitClause1::clone<'_>(move (@4)) storage_dead(@4) return @@ -232,20 +233,10 @@ where let @15: &'_ (u32); // anonymous local let @16: &'_ (u32); // anonymous local let @17: u32; // anonymous local - let @18: (); // anonymous local - let @19: (); // anonymous local - let @20: (); // anonymous local - let @21: (); // anonymous local - let @22: (); // anonymous local - let @23: (); // anonymous local - let @24: (); // anonymous local - let @25: (); // anonymous local storage_live(clo@2) storage_live(@3) - storage_live(@19) - @19 := () - @3 := &(*(*(x@1)), move (@19)) + @3 := &(*(*(x@1)), copy (@Global0)) clo@2 := test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure { 0: move (@3) } storage_dead(@3) storage_live(@4) @@ -253,15 +244,11 @@ where storage_live(@6) storage_live(@7) storage_live(@8) - storage_live(@18) - @18 := () - @8 := &(clo@2, move (@18)) + @8 := &(clo@2, copy (@Global0)) storage_live(@9) @9 := () @7 := {impl Fn<()> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call<'_, '_, '_, T>[@TraitClause0, @TraitClause1](move (@8), move (@9)) - storage_live(@22) - @22 := () - @6 := &(@7, move (@22)) + @6 := &(@7, copy (@Global0)) storage_dead(@9) storage_dead(@8) storage_live(@10) @@ -269,17 +256,11 @@ where storage_live(@12) storage_live(@13) @13 := const (0 : u32) - storage_live(@21) - @21 := () - @12 := &(@13, move (@21)) - storage_live(@20) - @20 := () - @11 := &(*(@12), move (@20)) + @12 := &(@13, copy (@Global0)) + @11 := &(*(@12), copy (@Global0)) @10 := (move (@11)) @5 := {impl Fn<(&'_ (u32))> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call<'_, '_, '_, '_, T>[@TraitClause0, @TraitClause1](move (@6), move (@10)) - storage_live(@25) - @25 := () - @4 := &(@5, move (@25)) + @4 := &(@5, copy (@Global0)) storage_dead(@11) storage_dead(@10) storage_dead(@6) @@ -288,12 +269,8 @@ where storage_live(@16) storage_live(@17) @17 := const (1 : u32) - storage_live(@24) - @24 := () - @16 := &(@17, move (@24)) - storage_live(@23) - @23 := () - @15 := &(*(@16), move (@23)) + @16 := &(@17, copy (@Global0)) + @15 := &(*(@16), copy (@Global0)) @14 := (move (@15)) @0 := {impl Fn<(&'_ (u32))> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call<'_, '_, '_, '_, T>[@TraitClause0, @TraitClause1](move (@4), move (@14)) storage_dead(@15) @@ -319,12 +296,9 @@ where let state@1: &'_2 mut (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // arg #1 let args@2: (); // arg #2 let @3: &'_ (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<()> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call<'_, '_1, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) return } @@ -339,12 +313,9 @@ where let @1: test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]; // arg #1 let @2: (); // arg #2 let @3: &'_ mut (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<()> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call_mut<'_, '_1, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]>] @1 return @@ -403,12 +374,9 @@ where let state@1: &'_3 mut (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // arg #1 let args@2: (&'_2 (u32)); // arg #2 let @3: &'_ (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<(&'_ (u32))> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call<'_, '_1, '_2, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) return } @@ -423,12 +391,9 @@ where let @1: test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]; // arg #1 let @2: (&'_ (u32)); // arg #2 let @3: &'_ mut (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(&'_ (u32))> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call_mut<'_, '_1, '_2, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0]}::test_nested_closures::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]>] @1 return @@ -487,12 +452,9 @@ where let state@1: &'_3 mut (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // arg #1 let args@2: (&'_2 (u32)); // arg #2 let @3: &'_ (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<(&'_ (u32))> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call<'_, '_1, '_2, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) return } @@ -507,12 +469,9 @@ where let @1: test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]; // arg #1 let @2: (&'_ (u32)); // arg #2 let @3: &'_ mut (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(&'_ (u32))> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call_mut<'_, '_1, '_2, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0]}::test_nested_closures::closure::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]>] @1 return diff --git a/charon/tests/ui/simple/nested-inline-const.out b/charon/tests/ui/simple/nested-inline-const.out index a6638e379..81b13991c 100644 --- a/charon/tests/ui/simple/nested-inline-const.out +++ b/charon/tests/ui/simple/nested-inline-const.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::main fn main() { diff --git a/charon/tests/ui/simple/non-lifetime-gats.out b/charon/tests/ui/simple/non-lifetime-gats.out index ca5260a20..8c00f0f60 100644 --- a/charon/tests/ui/simple/non-lifetime-gats.out +++ b/charon/tests/ui/simple/non-lifetime-gats.out @@ -79,6 +79,16 @@ where vtable: {impl Deref for alloc::boxed::Box[@TraitClause0, @TraitClause1]}::{vtable}[@TraitClause0, @TraitClause1] } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::PointerFamily pub trait PointerFamily { diff --git a/charon/tests/ui/simple/opaque-trait-with-clause-in-method.out b/charon/tests/ui/simple/opaque-trait-with-clause-in-method.out index 0a22ff9a4..844a3dc03 100644 --- a/charon/tests/ui/simple/opaque-trait-with-clause-in-method.out +++ b/charon/tests/ui/simple/opaque-trait-with-clause-in-method.out @@ -12,6 +12,16 @@ pub trait Sized non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::opaque::Product pub trait Product { diff --git a/charon/tests/ui/simple/pass-higher-kinded-fn-item-as-closure.out b/charon/tests/ui/simple/pass-higher-kinded-fn-item-as-closure.out index 5db65e5b3..c992fa70c 100644 --- a/charon/tests/ui/simple/pass-higher-kinded-fn-item-as-closure.out +++ b/charon/tests/ui/simple/pass-higher-kinded-fn-item-as-closure.out @@ -84,6 +84,16 @@ pub fn call_once(@1: Self, @2: Args) -> Clause0_Outp where [@TraitClause0]: FnOnce, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::flabada pub fn flabada<'a>(@1: &'a (())) -> &'a (()) { diff --git a/charon/tests/ui/simple/pointee_metadata.out b/charon/tests/ui/simple/pointee_metadata.out index e8431b228..4c075b3c7 100644 --- a/charon/tests/ui/simple/pointee_metadata.out +++ b/charon/tests/ui/simple/pointee_metadata.out @@ -212,6 +212,16 @@ pub trait Pointee // Full name: core::ptr::const_ptr::{*const T}::to_raw_parts pub fn to_raw_parts(@1: *const T) -> (*const (), Pointee::Metadata) +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::empty_metadata fn empty_metadata() { @@ -220,20 +230,14 @@ fn empty_metadata() let @2: *const u32; // anonymous local let @3: &'_ (u32); // anonymous local let @4: u32; // anonymous local - let @5: (); // anonymous local - let @6: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := const (0 : u32) - storage_live(@6) - @6 := () - @3 := &(@4, move (@6)) - storage_live(@5) - @5 := () - @2 := &raw const (*(@3), move (@5)) + @3 := &(@4, copy (@Global0)) + @2 := &raw const (*(@3), copy (@Global0)) @1 := to_raw_parts(move (@2)) storage_dead(@2) storage_dead(@4) @@ -253,8 +257,6 @@ fn slice_metadata() let @3: *const Array; // anonymous local let @4: &'_ (Array); // anonymous local let @5: Array; // anonymous local - let @6: (); // anonymous local - let @7: (); // anonymous local storage_live(@1) storage_live(@2) @@ -262,12 +264,8 @@ fn slice_metadata() storage_live(@4) storage_live(@5) @5 := [const (0 : u32), const (1 : u32)] - storage_live(@7) - @7 := () - @4 := &(@5, move (@7)) - storage_live(@6) - @6 := () - @3 := &raw const (*(@4), move (@6)) + @4 := &(@5, copy (@Global0)) + @3 := &raw const (*(@4), copy (@Global0)) @2 := unsize_cast<*const Array, *const Slice, 2 : usize>(move (@3)) storage_dead(@3) @1 := to_raw_parts>(move (@2)) diff --git a/charon/tests/ui/simple/promoted-closure-no-warns.out b/charon/tests/ui/simple/promoted-closure-no-warns.out index 1c6f8e285..6c1d77b2d 100644 --- a/charon/tests/ui/simple/promoted-closure-no-warns.out +++ b/charon/tests/ui/simple/promoted-closure-no-warns.out @@ -83,6 +83,16 @@ pub fn core::ops::function::FnOnce::call_once(@1: Self, @2: Args) -> where [@TraitClause0]: FnOnce, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::foo::closure struct closure {} @@ -93,32 +103,20 @@ pub fn foo() -> &'static (closure) let @1: &'_ (closure); // anonymous local let @2: &'_ (closure); // anonymous local let @3: &'_ (closure); // anonymous local - let @4: (); // anonymous local - let @5: (); // anonymous local - let @6: (); // anonymous local - let @7: &'_ (closure); // anonymous local - let @8: closure; // anonymous local - let @9: (); // anonymous local + let @4: &'_ (closure); // anonymous local + let @5: closure; // anonymous local storage_live(@3) - storage_live(@7) - storage_live(@8) - @8 := closure { } - storage_live(@9) - @9 := () - @7 := &(@8, move (@9)) + storage_live(@4) + storage_live(@5) + @5 := closure { } + @4 := &(@5, copy (@Global0)) storage_live(@1) storage_live(@2) - @3 := move (@7) - storage_live(@6) - @6 := () - @2 := &(*(@3), move (@6)) - storage_live(@5) - @5 := () - @1 := &(*(@2), move (@5)) - storage_live(@4) - @4 := () - @0 := &(*(@1), move (@4)) + @3 := move (@4) + @2 := &(*(@3), copy (@Global0)) + @1 := &(*(@2), copy (@Global0)) + @0 := &(*(@1), copy (@Global0)) storage_dead(@2) storage_dead(@1) return @@ -145,12 +143,9 @@ fn {impl FnMut<(u32)> for closure}::call_mut<'_0>(@1: &'_0 mut (closure), @2: (u let state@1: &'_0 mut (closure); // arg #1 let args@2: (u32); // arg #2 let @3: &'_ (closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<(u32)> for closure}::call<'_>(move (@3), move (args@2)) return } @@ -162,12 +157,9 @@ fn {impl FnOnce<(u32)> for closure}::call_once(@1: closure, @2: (u32)) -> u32 let @1: closure; // arg #1 let @2: (u32); // arg #2 let @3: &'_ mut (closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(u32)> for closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return diff --git a/charon/tests/ui/simple/promoted-closure.out b/charon/tests/ui/simple/promoted-closure.out index 1c6f8e285..6c1d77b2d 100644 --- a/charon/tests/ui/simple/promoted-closure.out +++ b/charon/tests/ui/simple/promoted-closure.out @@ -83,6 +83,16 @@ pub fn core::ops::function::FnOnce::call_once(@1: Self, @2: Args) -> where [@TraitClause0]: FnOnce, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::foo::closure struct closure {} @@ -93,32 +103,20 @@ pub fn foo() -> &'static (closure) let @1: &'_ (closure); // anonymous local let @2: &'_ (closure); // anonymous local let @3: &'_ (closure); // anonymous local - let @4: (); // anonymous local - let @5: (); // anonymous local - let @6: (); // anonymous local - let @7: &'_ (closure); // anonymous local - let @8: closure; // anonymous local - let @9: (); // anonymous local + let @4: &'_ (closure); // anonymous local + let @5: closure; // anonymous local storage_live(@3) - storage_live(@7) - storage_live(@8) - @8 := closure { } - storage_live(@9) - @9 := () - @7 := &(@8, move (@9)) + storage_live(@4) + storage_live(@5) + @5 := closure { } + @4 := &(@5, copy (@Global0)) storage_live(@1) storage_live(@2) - @3 := move (@7) - storage_live(@6) - @6 := () - @2 := &(*(@3), move (@6)) - storage_live(@5) - @5 := () - @1 := &(*(@2), move (@5)) - storage_live(@4) - @4 := () - @0 := &(*(@1), move (@4)) + @3 := move (@4) + @2 := &(*(@3), copy (@Global0)) + @1 := &(*(@2), copy (@Global0)) + @0 := &(*(@1), copy (@Global0)) storage_dead(@2) storage_dead(@1) return @@ -145,12 +143,9 @@ fn {impl FnMut<(u32)> for closure}::call_mut<'_0>(@1: &'_0 mut (closure), @2: (u let state@1: &'_0 mut (closure); // arg #1 let args@2: (u32); // arg #2 let @3: &'_ (closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(state@1), move (@4)) + @3 := &(*(state@1), copy (@Global0)) @0 := {impl Fn<(u32)> for closure}::call<'_>(move (@3), move (args@2)) return } @@ -162,12 +157,9 @@ fn {impl FnOnce<(u32)> for closure}::call_once(@1: closure, @2: (u32)) -> u32 let @1: closure; // arg #1 let @2: (u32); // arg #2 let @3: &'_ mut (closure); // anonymous local - let @4: (); // anonymous local storage_live(@3) - storage_live(@4) - @4 := () - @3 := &mut (@1, move (@4)) + @3 := &mut (@1, copy (@Global0)) @0 := {impl FnMut<(u32)> for closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return diff --git a/charon/tests/ui/simple/promoted-in-generic-fn.out b/charon/tests/ui/simple/promoted-in-generic-fn.out index 7bb000d14..c5c74d64f 100644 --- a/charon/tests/ui/simple/promoted-in-generic-fn.out +++ b/charon/tests/ui/simple/promoted-in-generic-fn.out @@ -18,6 +18,16 @@ pub fn size_of() -> usize where [@TraitClause0]: Sized, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::f fn f() where @@ -26,24 +36,18 @@ where let @0: (); // return let @1: &'_ (usize); // anonymous local let @2: &'_ (usize); // anonymous local - let @3: (); // anonymous local - let @4: &'_ (usize); // anonymous local - let @5: usize; // anonymous local - let @6: (); // anonymous local + let @3: &'_ (usize); // anonymous local + let @4: usize; // anonymous local storage_live(@2) + storage_live(@3) storage_live(@4) - storage_live(@5) // This can't be evaluated generically. - @5 := size_of[@TraitClause0]() - storage_live(@6) - @6 := () - @4 := &(@5, move (@6)) + @4 := size_of[@TraitClause0]() + @3 := &(@4, copy (@Global0)) storage_live(@1) - @2 := move (@4) - storage_live(@3) - @3 := () - @1 := &(*(@2), move (@3)) + @2 := move (@3) + @1 := &(*(@2), copy (@Global0)) storage_dead(@1) @0 := () @0 := () diff --git a/charon/tests/ui/simple/promoted-inside-impl.out b/charon/tests/ui/simple/promoted-inside-impl.out index 464377ab5..b119cf3b4 100644 --- a/charon/tests/ui/simple/promoted-inside-impl.out +++ b/charon/tests/ui/simple/promoted-inside-impl.out @@ -12,6 +12,16 @@ pub trait Sized non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Foo pub struct Foo where @@ -29,23 +39,17 @@ where let @0: (); // return let _promoted@1: &'_ (i32); // local let @2: &'_ (i32); // anonymous local - let @3: (); // anonymous local - let @4: &'_ (i32); // anonymous local - let @5: i32; // anonymous local - let @6: (); // anonymous local + let @3: &'_ (i32); // anonymous local + let @4: i32; // anonymous local storage_live(@2) + storage_live(@3) storage_live(@4) - storage_live(@5) - @5 := const (0 : i32) - storage_live(@6) - @6 := () - @4 := &(@5, move (@6)) + @4 := const (0 : i32) + @3 := &(@4, copy (@Global0)) storage_live(_promoted@1) - @2 := move (@4) - storage_live(@3) - @3 := () - _promoted@1 := &(*(@2), move (@3)) + @2 := move (@3) + _promoted@1 := &(*(@2), copy (@Global0)) @0 := () storage_dead(_promoted@1) @0 := () diff --git a/charon/tests/ui/simple/promoted-literal-addition-overflow.out b/charon/tests/ui/simple/promoted-literal-addition-overflow.out index da9c68774..03ee20e76 100644 --- a/charon/tests/ui/simple/promoted-literal-addition-overflow.out +++ b/charon/tests/ui/simple/promoted-literal-addition-overflow.out @@ -6,6 +6,16 @@ pub fn MAX() -> u32 // Full name: core::num::{u32}::MAX pub const MAX: u32 = MAX() +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::overflow fn overflow() -> &'static (u32) { @@ -13,32 +23,23 @@ fn overflow() -> &'static (u32) let @1: &'_ (u32); // anonymous local let @2: u32; // anonymous local let @3: &'_ (u32); // anonymous local - let @4: (); // anonymous local - let @5: (); // anonymous local - let @6: &'_ (u32); // anonymous local - let @7: u32; // anonymous local - let @8: u32; // anonymous local - let @9: (); // anonymous local + let @4: &'_ (u32); // anonymous local + let @5: u32; // anonymous local + let @6: u32; // anonymous local storage_live(@2) storage_live(@3) + storage_live(@4) + storage_live(@5) storage_live(@6) - storage_live(@7) - storage_live(@8) storage_live(@1) @2 := copy (MAX) panic.+ const (1 : u32) - @8 := copy (MAX) wrap.+ const (1 : u32) - @7 := move (@8) - storage_live(@9) - @9 := () - @6 := &(@7, move (@9)) - @3 := move (@6) - storage_live(@5) - @5 := () - @1 := &(*(@3), move (@5)) - storage_live(@4) - @4 := () - @0 := &(*(@1), move (@4)) + @6 := copy (MAX) wrap.+ const (1 : u32) + @5 := move (@6) + @4 := &(@5, copy (@Global0)) + @3 := move (@4) + @1 := &(*(@3), copy (@Global0)) + @0 := &(*(@1), copy (@Global0)) storage_dead(@1) return } diff --git a/charon/tests/ui/simple/promoted-literal-addition.out b/charon/tests/ui/simple/promoted-literal-addition.out index 3acb630a5..82d77f2c2 100644 --- a/charon/tests/ui/simple/promoted-literal-addition.out +++ b/charon/tests/ui/simple/promoted-literal-addition.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::two fn two() -> &'static (u32) { @@ -7,32 +17,23 @@ fn two() -> &'static (u32) let @1: &'_ (u32); // anonymous local let @2: u32; // anonymous local let @3: &'_ (u32); // anonymous local - let @4: (); // anonymous local - let @5: (); // anonymous local - let @6: &'_ (u32); // anonymous local - let @7: u32; // anonymous local - let @8: u32; // anonymous local - let @9: (); // anonymous local + let @4: &'_ (u32); // anonymous local + let @5: u32; // anonymous local + let @6: u32; // anonymous local storage_live(@2) storage_live(@3) + storage_live(@4) + storage_live(@5) storage_live(@6) - storage_live(@7) - storage_live(@8) storage_live(@1) @2 := const (1 : u32) panic.+ const (1 : u32) - @8 := const (1 : u32) wrap.+ const (1 : u32) - @7 := move (@8) - storage_live(@9) - @9 := () - @6 := &(@7, move (@9)) - @3 := move (@6) - storage_live(@5) - @5 := () - @1 := &(*(@3), move (@5)) - storage_live(@4) - @4 := () - @0 := &(*(@1), move (@4)) + @6 := const (1 : u32) wrap.+ const (1 : u32) + @5 := move (@6) + @4 := &(@5, copy (@Global0)) + @3 := move (@4) + @1 := &(*(@3), copy (@Global0)) + @0 := &(*(@1), copy (@Global0)) storage_dead(@1) return } diff --git a/charon/tests/ui/simple/promoted-u32-slice.out b/charon/tests/ui/simple/promoted-u32-slice.out index e2b967342..790ce69e4 100644 --- a/charon/tests/ui/simple/promoted-u32-slice.out +++ b/charon/tests/ui/simple/promoted-u32-slice.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::foo pub fn foo() -> &'static (Slice) { @@ -7,28 +17,19 @@ pub fn foo() -> &'static (Slice) let @1: &'_ (Array); // anonymous local let @2: &'_ (Array); // anonymous local let @3: &'_ (Array); // anonymous local - let @4: (); // anonymous local - let @5: (); // anonymous local - let @6: &'_ (Array); // anonymous local - let @7: Array; // anonymous local - let @8: (); // anonymous local + let @4: &'_ (Array); // anonymous local + let @5: Array; // anonymous local storage_live(@3) - storage_live(@6) - storage_live(@7) - @7 := [const (0 : u32), const (1 : u32), const (2 : u32), const (3 : u32)] - storage_live(@8) - @8 := () - @6 := &(@7, move (@8)) + storage_live(@4) + storage_live(@5) + @5 := [const (0 : u32), const (1 : u32), const (2 : u32), const (3 : u32)] + @4 := &(@5, copy (@Global0)) storage_live(@1) storage_live(@2) - @3 := move (@6) - storage_live(@5) - @5 := () - @2 := &(*(@3), move (@5)) - storage_live(@4) - @4 := () - @1 := &(*(@2), move (@4)) + @3 := move (@4) + @2 := &(*(@3), copy (@Global0)) + @1 := &(*(@2), copy (@Global0)) @0 := @ArrayToSliceShared<'_, u32, 4 : usize>(move (@1)) storage_dead(@1) storage_dead(@2) diff --git a/charon/tests/ui/simple/ptr-from-raw-parts.out b/charon/tests/ui/simple/ptr-from-raw-parts.out index a1d9a9abc..09c2813c2 100644 --- a/charon/tests/ui/simple/ptr-from-raw-parts.out +++ b/charon/tests/ui/simple/ptr-from-raw-parts.out @@ -258,6 +258,16 @@ where return } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::main fn main() { @@ -265,15 +275,12 @@ fn main() let a@1: Array; // local let @2: *const Slice; // anonymous local let @3: *const Array; // anonymous local - let @4: (); // anonymous local storage_live(a@1) a@1 := @ArrayRepeat<'_, u32, 2 : usize>(const (1 : u32)) storage_live(@2) storage_live(@3) - storage_live(@4) - @4 := () - @3 := &raw const (a@1, move (@4)) + @3 := &raw const (a@1, copy (@Global0)) @2 := from_raw_parts, Array>[Sized>, {impl#0}>[Pointee> where Metadata = ()]](move (@3), const (2 : usize)) storage_dead(@3) storage_dead(@2) diff --git a/charon/tests/ui/simple/ptr_metadata.out b/charon/tests/ui/simple/ptr_metadata.out index 877654e79..5ea1839d7 100644 --- a/charon/tests/ui/simple/ptr_metadata.out +++ b/charon/tests/ui/simple/ptr_metadata.out @@ -286,6 +286,16 @@ pub fn null() -> *const T where [@TraitClause0]: Thin, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::main fn main() { diff --git a/charon/tests/ui/simple/ptr_to_promoted.out b/charon/tests/ui/simple/ptr_to_promoted.out index d251aaf72..33fa39be4 100644 --- a/charon/tests/ui/simple/ptr_to_promoted.out +++ b/charon/tests/ui/simple/ptr_to_promoted.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::main fn main() { @@ -9,28 +19,19 @@ fn main() let @3: usize; // anonymous local let @4: *const u8; // anonymous local let @5: &'_ (u8); // anonymous local - let @6: (); // anonymous local - let @7: (); // anonymous local - let @8: &'_ (u8); // anonymous local - let @9: u8; // anonymous local - let @10: (); // anonymous local + let @6: &'_ (u8); // anonymous local + let @7: u8; // anonymous local storage_live(@5) - storage_live(@8) - storage_live(@9) - @9 := const (0 : u8) - storage_live(@10) - @10 := () - @8 := &(@9, move (@10)) + storage_live(@6) + storage_live(@7) + @7 := const (0 : u8) + @6 := &(@7, copy (@Global0)) storage_live(x@1) storage_live(@2) - @5 := move (@8) - storage_live(@7) - @7 := () - @2 := &(*(@5), move (@7)) - storage_live(@6) - @6 := () - x@1 := &raw const (*(@2), move (@6)) + @5 := move (@6) + @2 := &(*(@5), copy (@Global0)) + x@1 := &raw const (*(@2), copy (@Global0)) storage_dead(@2) storage_live(@3) storage_live(@4) diff --git a/charon/tests/ui/simple/quantified-trait-type-constraint.out b/charon/tests/ui/simple/quantified-trait-type-constraint.out index 8d078c0d4..caf19335f 100644 --- a/charon/tests/ui/simple/quantified-trait-type-constraint.out +++ b/charon/tests/ui/simple/quantified-trait-type-constraint.out @@ -12,6 +12,16 @@ pub trait Sized non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Trait trait Trait<'a, Self, Self_Type> { diff --git a/charon/tests/ui/simple/ref-in-const.out b/charon/tests/ui/simple/ref-in-const.out index 3c2475278..49cf21817 100644 --- a/charon/tests/ui/simple/ref-in-const.out +++ b/charon/tests/ui/simple/ref-in-const.out @@ -1,38 +1,36 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::SOME_INT fn SOME_INT() -> &'static (&'static (i32)) { let @0: &'_ (&'_ (i32)); // return let @1: &'_ (&'_ (i32)); // anonymous local let @2: &'_ (&'_ (i32)); // anonymous local - let @3: (); // anonymous local - let @4: (); // anonymous local - let @5: &'_ (&'_ (i32)); // anonymous local - let @6: &'_ (i32); // anonymous local - let @7: i32; // anonymous local - let @8: (); // anonymous local - let @9: (); // anonymous local + let @3: &'_ (&'_ (i32)); // anonymous local + let @4: &'_ (i32); // anonymous local + let @5: i32; // anonymous local storage_live(@2) + storage_live(@3) + storage_live(@4) storage_live(@5) - storage_live(@6) - storage_live(@7) - @7 := const (0 : i32) - storage_live(@9) - @9 := () - @6 := &(@7, move (@9)) - storage_live(@8) - @8 := () - @5 := &(@6, move (@8)) + @5 := const (0 : i32) + @4 := &(@5, copy (@Global0)) + @3 := &(@4, copy (@Global0)) storage_live(@1) - @2 := move (@5) - storage_live(@4) - @4 := () - @1 := &(*(@2), move (@4)) - storage_live(@3) - @3 := () - @0 := &(*(@1), move (@3)) + @2 := move (@3) + @1 := &(*(@2), copy (@Global0)) + @0 := &(*(@1), copy (@Global0)) storage_dead(@1) return } diff --git a/charon/tests/ui/simple/slice_increment.out b/charon/tests/ui/simple/slice_increment.out index 4b168ef25..2dfc69637 100644 --- a/charon/tests/ui/simple/slice_increment.out +++ b/charon/tests/ui/simple/slice_increment.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::incr pub fn incr<'_0>(@1: &'_0 mut (Slice)) { diff --git a/charon/tests/ui/simple/slice_index.out b/charon/tests/ui/simple/slice_index.out index b512f3807..34cc27551 100644 --- a/charon/tests/ui/simple/slice_index.out +++ b/charon/tests/ui/simple/slice_index.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::first pub fn first<'_0>(@1: &'_0 (Slice)) -> u32 { diff --git a/charon/tests/ui/simple/slice_index_range.out b/charon/tests/ui/simple/slice_index_range.out index 2b4e8132d..17d884b57 100644 --- a/charon/tests/ui/simple/slice_index_range.out +++ b/charon/tests/ui/simple/slice_index_range.out @@ -86,6 +86,16 @@ where args: &'a (Slice>), } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: core::fmt::rt::{Arguments<'a>}::new_const pub fn new_const<'a, const N : usize>(@1: &'a (Array<&'static (Str), const N : usize>)) -> Arguments<'a> { @@ -95,22 +105,19 @@ pub fn new_const<'a, const N : usize>(@1: &'a (Array<&'static (Str), const N : u let @3: &'_ (Slice>); // anonymous local let @4: &'_ (Array, 0 : usize>); // anonymous local let @5: Array, 0 : usize>; // anonymous local - let @6: (); // anonymous local - let @7: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @6: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@4) storage_live(@5) - storage_live(@7) - @5 := [] storage_live(@6) - @6 := () - @4 := &(@5, move (@6)) + @5 := [] + @4 := &(@5, copy (@Global0)) storage_live(@2) @2 := @ArrayToSliceShared<'_, &'_ (Str), const N : usize>(copy (pieces@1)) storage_live(@3) @3 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@4)) - @7 := Option::None { } - @0 := Arguments { pieces: move (@2), fmt: move (@7), args: move (@3) } + @6 := Option::None { } + @0 := Arguments { pieces: move (@2), fmt: move (@6), args: move (@3) } storage_dead(@3) storage_dead(@2) return @@ -331,29 +338,20 @@ fn slice_end_index_overflow_fail() -> ! let @2: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @3: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @4: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local - let @5: (); // anonymous local - let @6: (); // anonymous local - let @7: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local - let @8: Array<&'_ (Str), 1 : usize>; // anonymous local - let @9: (); // anonymous local + let @5: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local + let @6: Array<&'_ (Str), 1 : usize>; // anonymous local storage_live(@4) - storage_live(@7) - storage_live(@8) - @8 := [const ("attempted to index slice up to maximum usize")] - storage_live(@9) - @9 := () - @7 := &(@8, move (@9)) + storage_live(@5) + storage_live(@6) + @6 := [const ("attempted to index slice up to maximum usize")] + @5 := &(@6, copy (@Global0)) storage_live(@1) storage_live(@2) storage_live(@3) - @4 := move (@7) - storage_live(@6) - @6 := () - @3 := &(*(@4), move (@6)) - storage_live(@5) - @5 := () - @2 := &(*(@3), move (@5)) + @4 := move (@5) + @3 := &(*(@4), copy (@Global0)) + @2 := &(*(@3), copy (@Global0)) @1 := new_const<'_, 1 : usize>(move (@2)) storage_dead(@2) panic(core::panicking::panic_fmt) @@ -592,18 +590,16 @@ fn {impl SliceIndex> for Range[Sized]}::get_unchecked::pr let @9: Array<&'_ (Str), 1 : usize>; // anonymous local let @10: &'_ (Slice<&'_ (Str)>); // anonymous local let @11: &'_ (Slice>); // anonymous local - let @12: (); // anonymous local - let @13: &'_ (Array, 0 : usize>); // anonymous local - let @14: Array, 0 : usize>; // anonymous local - let @15: (); // anonymous local - let @16: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @12: &'_ (Array, 0 : usize>); // anonymous local + let @13: Array, 0 : usize>; // anonymous local + let @14: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@5) storage_live(@6) storage_live(pieces@8) + storage_live(@12) storage_live(@13) storage_live(@14) - storage_live(@16) storage_live(@4) @4 := copy (end@2) >= copy (start@1) if move (@4) { @@ -620,22 +616,18 @@ fn {impl SliceIndex> for Range[Sized]}::get_unchecked::pr } else { } - @14 := [] - storage_live(@15) - @15 := () - @13 := &(@14, move (@15)) + @13 := [] + @12 := &(@13, copy (@Global0)) storage_live(@7) storage_live(@9) @9 := [const ("unsafe precondition(s) violated: slice::get_unchecked requires that the range is within the slice\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - storage_live(@12) - @12 := () - pieces@8 := &(@9, move (@12)) + pieces@8 := &(@9, copy (@Global0)) storage_live(@10) @10 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@8)) storage_live(@11) - @11 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@13)) - @16 := Option::None { } - @7 := Arguments { pieces: move (@10), fmt: move (@16), args: move (@11) } + @11 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@12)) + @14 := Option::None { } + @7 := Arguments { pieces: move (@10), fmt: move (@14), args: move (@11) } storage_dead(@11) storage_dead(@10) @6 := panic_nounwind_fmt<'_>(move (@7), const (false)) @@ -713,18 +705,16 @@ fn {impl SliceIndex> for Range[Sized]}::get_unchecked_mut let @9: Array<&'_ (Str), 1 : usize>; // anonymous local let @10: &'_ (Slice<&'_ (Str)>); // anonymous local let @11: &'_ (Slice>); // anonymous local - let @12: (); // anonymous local - let @13: &'_ (Array, 0 : usize>); // anonymous local - let @14: Array, 0 : usize>; // anonymous local - let @15: (); // anonymous local - let @16: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @12: &'_ (Array, 0 : usize>); // anonymous local + let @13: Array, 0 : usize>; // anonymous local + let @14: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@5) storage_live(@6) storage_live(pieces@8) + storage_live(@12) storage_live(@13) storage_live(@14) - storage_live(@16) storage_live(@4) @4 := copy (end@2) >= copy (start@1) if move (@4) { @@ -741,22 +731,18 @@ fn {impl SliceIndex> for Range[Sized]}::get_unchecked_mut } else { } - @14 := [] - storage_live(@15) - @15 := () - @13 := &(@14, move (@15)) + @13 := [] + @12 := &(@13, copy (@Global0)) storage_live(@7) storage_live(@9) @9 := [const ("unsafe precondition(s) violated: slice::get_unchecked_mut requires that the range is within the slice\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - storage_live(@12) - @12 := () - pieces@8 := &(@9, move (@12)) + pieces@8 := &(@9, copy (@Global0)) storage_live(@10) @10 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@8)) storage_live(@11) - @11 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@13)) - @16 := Option::None { } - @7 := Arguments { pieces: move (@10), fmt: move (@16), args: move (@11) } + @11 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(move (@12)) + @14 := Option::None { } + @7 := Arguments { pieces: move (@10), fmt: move (@14), args: move (@11) } storage_dead(@11) storage_dead(@10) @6 := panic_nounwind_fmt<'_>(move (@7), const (false)) @@ -1037,11 +1023,10 @@ where let @17: *const T; // anonymous local let self@18: usize; // local let self@19: bool; // local - let @20: (); // anonymous local + let @20: usize; // anonymous local let @21: usize; // anonymous local - let @22: usize; // anonymous local + let @22: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local let @23: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local - let @24: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(self@4) storage_live(exclusive_end@6) @@ -1058,21 +1043,19 @@ where storage_live(@17) storage_live(self@18) storage_live(self@19) + storage_live(@20) storage_live(@21) storage_live(@22) storage_live(@23) - storage_live(@24) storage_live(@3) storage_live(self@5) - storage_live(@20) - @20 := () - self@5 := &(self@1, move (@20)) + self@5 := &(self@1, copy (@Global0)) storage_dead(self@5) self@4 := copy ((self@1).end) @3 := copy (self@4) == copy (MAX) if move (@3) { - @23 := Option::None { } - @0 := move (@23) + @22 := Option::None { } + @0 := move (@22) } else { storage_live(self@18) @@ -1094,8 +1077,8 @@ where @14 := copy (exclusive_end@6) < copy (self@8) if move (@14) { storage_dead(@14) - @24 := Option::None { } - @0 := move (@24) + @23 := Option::None { } + @0 := move (@23) storage_dead(@9) storage_dead(@11) } @@ -1110,9 +1093,9 @@ where storage_dead(@10) storage_live(@12) storage_live(@13) - storage_live(@22) - @22 := ptr_metadata(copy (slice@2)) - @13 := &raw const (*(slice@2), move (@22)) + storage_live(@21) + @21 := ptr_metadata(copy (slice@2)) + @13 := &raw const (*(slice@2), move (@21)) storage_live(@16) storage_live(@17) @16 := cast<*const Slice, *const T>(copy (@13)) @@ -1121,16 +1104,16 @@ where storage_dead(@17) storage_dead(@16) storage_dead(@13) - storage_live(@21) - @21 := ptr_metadata(copy (@12)) - @11 := &(*(@12), move (@21)) + storage_live(@20) + @20 := ptr_metadata(copy (@12)) + @11 := &(*(@12), move (@20)) @0 := Option::Some { 0: copy (@11) } storage_dead(@12) } else { storage_dead(@10) - @24 := Option::None { } - @0 := move (@24) + @23 := Option::None { } + @0 := move (@23) } storage_dead(@9) storage_dead(@11) @@ -1165,11 +1148,10 @@ where let @17: *mut T; // anonymous local let self@18: usize; // local let self@19: bool; // local - let @20: (); // anonymous local + let @20: usize; // anonymous local let @21: usize; // anonymous local - let @22: usize; // anonymous local + let @22: Option<&'_ mut (Slice)>[Sized<&'_ mut (Slice)>]; // anonymous local let @23: Option<&'_ mut (Slice)>[Sized<&'_ mut (Slice)>]; // anonymous local - let @24: Option<&'_ mut (Slice)>[Sized<&'_ mut (Slice)>]; // anonymous local storage_live(self@4) storage_live(exclusive_end@6) @@ -1186,21 +1168,19 @@ where storage_live(@17) storage_live(self@18) storage_live(self@19) + storage_live(@20) storage_live(@21) storage_live(@22) storage_live(@23) - storage_live(@24) storage_live(@3) storage_live(self@5) - storage_live(@20) - @20 := () - self@5 := &(self@1, move (@20)) + self@5 := &(self@1, copy (@Global0)) storage_dead(self@5) self@4 := copy ((self@1).end) @3 := copy (self@4) == copy (MAX) if move (@3) { - @23 := Option::None { } - @0 := move (@23) + @22 := Option::None { } + @0 := move (@22) } else { storage_live(self@18) @@ -1222,8 +1202,8 @@ where @14 := copy (exclusive_end@6) < copy (self@8) if move (@14) { storage_dead(@14) - @24 := Option::None { } - @0 := move (@24) + @23 := Option::None { } + @0 := move (@23) storage_dead(@9) storage_dead(@11) } @@ -1238,9 +1218,9 @@ where storage_dead(@10) storage_live(@12) storage_live(ptr@13) - storage_live(@22) - @22 := ptr_metadata(copy (slice@2)) - ptr@13 := &raw mut (*(slice@2), move (@22)) + storage_live(@21) + @21 := ptr_metadata(copy (slice@2)) + ptr@13 := &raw mut (*(slice@2), move (@21)) storage_live(@16) storage_live(@17) @16 := cast<*mut Slice, *mut T>(copy (ptr@13)) @@ -1249,16 +1229,16 @@ where storage_dead(@17) storage_dead(@16) storage_dead(ptr@13) - storage_live(@21) - @21 := ptr_metadata(copy (@12)) - @11 := &mut (*(@12), move (@21)) + storage_live(@20) + @20 := ptr_metadata(copy (@12)) + @11 := &mut (*(@12), move (@20)) @0 := Option::Some { 0: copy (@11) } storage_dead(@12) } else { storage_dead(@10) - @24 := Option::None { } - @0 := move (@24) + @23 := Option::None { } + @0 := move (@23) } storage_dead(@9) storage_dead(@11) @@ -1418,7 +1398,6 @@ where let @10: usize; // anonymous local let self@11: usize; // local let self@12: bool; // local - let @13: (); // anonymous local storage_live(self@4) storage_live(@6) @@ -1430,9 +1409,7 @@ where storage_live(self@12) storage_live(@3) storage_live(self@5) - storage_live(@13) - @13 := () - self@5 := &(self@1, move (@13)) + self@5 := &(self@1, copy (@Global0)) storage_dead(self@5) self@4 := copy ((self@1).end) @3 := copy (self@4) == copy (MAX) @@ -1485,7 +1462,6 @@ where let @10: usize; // anonymous local let self@11: usize; // local let self@12: bool; // local - let @13: (); // anonymous local storage_live(self@4) storage_live(@6) @@ -1497,9 +1473,7 @@ where storage_live(self@12) storage_live(@3) storage_live(self@5) - storage_live(@13) - @13 := () - self@5 := &(self@1, move (@13)) + self@5 := &(self@1, copy (@Global0)) storage_dead(self@5) self@4 := copy ((self@1).end) @3 := copy (self@4) == copy (MAX) diff --git a/charon/tests/ui/simple/supertrait-impl-with-assoc-type-constraint.out b/charon/tests/ui/simple/supertrait-impl-with-assoc-type-constraint.out index e00f1fd97..707795d40 100644 --- a/charon/tests/ui/simple/supertrait-impl-with-assoc-type-constraint.out +++ b/charon/tests/ui/simple/supertrait-impl-with-assoc-type-constraint.out @@ -12,6 +12,16 @@ pub trait Sized non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::HasAssoc trait HasAssoc { diff --git a/charon/tests/ui/simple/trait-alias.out b/charon/tests/ui/simple/trait-alias.out index 40c5cbd3b..d0f892a61 100644 --- a/charon/tests/ui/simple/trait-alias.out +++ b/charon/tests/ui/simple/trait-alias.out @@ -58,6 +58,16 @@ where Some(T), } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Trait trait Trait { @@ -133,13 +143,10 @@ where let x@1: T; // arg #1 let @2: T; // anonymous local let @3: &'_ (T); // anonymous local - let @4: (); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(x@1, move (@4)) + @3 := &(x@1, copy (@Global0)) @2 := @TraitClause1::parent_clause2::clone<'_>(move (@3)) storage_dead(@3) drop[Drop] @2 diff --git a/charon/tests/ui/simple/trait-default-const-cross-crate.out b/charon/tests/ui/simple/trait-default-const-cross-crate.out index 69f2b318e..94a02dbd3 100644 --- a/charon/tests/ui/simple/trait-default-const-cross-crate.out +++ b/charon/tests/ui/simple/trait-default-const-cross-crate.out @@ -12,6 +12,16 @@ pub trait Sized non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: trait_default_const::Trait trait Trait { diff --git a/charon/tests/ui/simple/trait-default-const.out b/charon/tests/ui/simple/trait-default-const.out index 94836fbc7..8ab054ada 100644 --- a/charon/tests/ui/simple/trait-default-const.out +++ b/charon/tests/ui/simple/trait-default-const.out @@ -12,6 +12,16 @@ pub trait Sized non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Trait trait Trait { diff --git a/charon/tests/ui/simple/uncheck-ops.out b/charon/tests/ui/simple/uncheck-ops.out index c95c33585..380aef859 100644 --- a/charon/tests/ui/simple/uncheck-ops.out +++ b/charon/tests/ui/simple/uncheck-ops.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::main fn main() { diff --git a/charon/tests/ui/simple/vec-push.out b/charon/tests/ui/simple/vec-push.out index d5e51ece8..2c4b67660 100644 --- a/charon/tests/ui/simple/vec-push.out +++ b/charon/tests/ui/simple/vec-push.out @@ -69,6 +69,16 @@ where len: usize, } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: alloc::vec::{Vec[@TraitClause0, @TraitClause1]}::push pub fn push<'_0, T, A>(@1: &'_0 mut (Vec[@TraitClause0, @TraitClause1]), @2: T) where @@ -91,27 +101,19 @@ where let elem_size@13: usize; // local let self@14: UsizeNoHighBit; // local let @15: NonNull; // anonymous local - let @16: (); // anonymous local - let @17: (); // anonymous local - let @18: (); // anonymous local storage_live(len@3) storage_live(@7) storage_live(@8) storage_live(end@9) storage_live(self@14) - storage_live(@18) len@3 := copy ((*(self@1)).len) storage_live(@4) storage_live(@5) storage_live(self@6) - storage_live(@17) - @17 := () - self@6 := &((*(self@1)).buf, move (@17)) + self@6 := &((*(self@1)).buf, copy (@Global0)) storage_live(self@12) - storage_live(@16) - @16 := () - self@12 := &(((*(self@1)).buf).0, move (@16)) + self@12 := &(((*(self@1)).buf).0, copy (@Global0)) storage_live(elem_size@13) elem_size@13 := size_of switch move (elem_size@13) { @@ -132,9 +134,7 @@ where if move (@4) { storage_dead(@5) storage_live(@8) - storage_live(@18) - @18 := () - @8 := &two-phase-mut ((*(self@1)).buf, move (@18)) + @8 := &two-phase-mut ((*(self@1)).buf, copy (@Global0)) @7 := grow_one<'_, T, A>[@TraitClause0, @TraitClause1](move (@8)) storage_dead(@8) } @@ -164,12 +164,9 @@ fn vec<'_0>(@1: &'_0 mut (Vec[Sized, Sized])) let @0: (); // return let x@1: &'_ mut (Vec[Sized, Sized]); // arg #1 let @2: &'_ mut (Vec[Sized, Sized]); // anonymous local - let @3: (); // anonymous local storage_live(@2) - storage_live(@3) - @3 := () - @2 := &two-phase-mut (*(x@1), move (@3)) + @2 := &two-phase-mut (*(x@1), copy (@Global0)) @0 := push<'_, u32, Global>[Sized, Sized](move (@2), const (42 : u32)) storage_dead(@2) @0 := () diff --git a/charon/tests/ui/simple/vec-with-capacity.out b/charon/tests/ui/simple/vec-with-capacity.out index 618112055..692a52a72 100644 --- a/charon/tests/ui/simple/vec-with-capacity.out +++ b/charon/tests/ui/simple/vec-with-capacity.out @@ -199,6 +199,16 @@ where vtable: {impl Drop for Vec[@TraitClause0, @TraitClause1]}::{vtable}[@TraitClause0, @TraitClause1] } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::vec fn vec() { diff --git a/charon/tests/ui/simple/wrapping-ops.out b/charon/tests/ui/simple/wrapping-ops.out index 5b0eacce4..f5033d022 100644 --- a/charon/tests/ui/simple/wrapping-ops.out +++ b/charon/tests/ui/simple/wrapping-ops.out @@ -33,6 +33,16 @@ pub fn wrapping_mul(@1: u8, @2: u8) -> u8 return } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::main fn main() { diff --git a/charon/tests/ui/skip-borrowck.out b/charon/tests/ui/skip-borrowck.out index 5584b2334..7718a2647 100644 --- a/charon/tests/ui/skip-borrowck.out +++ b/charon/tests/ui/skip-borrowck.out @@ -12,6 +12,16 @@ pub trait Sized non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::choose fn choose<'a, T>(@1: bool, @2: &'a mut (T), @3: &'a mut (T)) -> &'a mut (T) where @@ -25,42 +35,24 @@ where let @5: &'_ mut (T); // anonymous local let @6: bool; // anonymous local let @7: &'_ mut (T); // anonymous local - let @8: (); // anonymous local - let @9: (); // anonymous local - let @10: (); // anonymous local - let @11: (); // anonymous local - let @12: (); // anonymous local storage_live(@7) - storage_live(@8) - storage_live(@9) - storage_live(@10) storage_live(@4) storage_live(@5) storage_live(@6) @6 := copy (b@1) if move (@6) { storage_live(@7) - storage_live(@9) - @9 := () - @7 := &mut (*(x@2), move (@9)) - storage_live(@8) - @8 := () - @5 := &mut (*(@7), move (@8)) + @7 := &mut (*(x@2), copy (@Global0)) + @5 := &mut (*(@7), copy (@Global0)) storage_dead(@7) } else { - storage_live(@10) - @10 := () - @5 := &mut (*(y@3), move (@10)) + @5 := &mut (*(y@3), copy (@Global0)) } - storage_live(@12) - @12 := () - @4 := &mut (*(@5), move (@12)) + @4 := &mut (*(@5), copy (@Global0)) storage_dead(@6) - storage_live(@11) - @11 := () - @0 := &mut (*(@4), move (@11)) + @0 := &mut (*(@4), copy (@Global0)) storage_dead(@5) storage_dead(@4) return @@ -90,10 +82,6 @@ pub fn choose_test() let @18: (); // anonymous local let @19: bool; // anonymous local let @20: i32; // anonymous local - let @21: (); // anonymous local - let @22: (); // anonymous local - let @23: (); // anonymous local - let @24: (); // anonymous local storage_live(@8) storage_live(x@1) @@ -103,20 +91,12 @@ pub fn choose_test() storage_live(z@3) storage_live(@4) storage_live(@5) - storage_live(@24) - @24 := () - @5 := &mut (x@1, move (@24)) - storage_live(@23) - @23 := () - @4 := &two-phase-mut (*(@5), move (@23)) + @5 := &mut (x@1, copy (@Global0)) + @4 := &two-phase-mut (*(@5), copy (@Global0)) storage_live(@6) storage_live(@7) - storage_live(@22) - @22 := () - @7 := &mut (y@2, move (@22)) - storage_live(@21) - @21 := () - @6 := &two-phase-mut (*(@7), move (@21)) + @7 := &mut (y@2, copy (@Global0)) + @6 := &two-phase-mut (*(@7), copy (@Global0)) z@3 := choose<'_, i32>[Sized](const (true), move (@4), move (@6)) storage_dead(@6) storage_dead(@4) diff --git a/charon/tests/ui/slice-index-range.out b/charon/tests/ui/slice-index-range.out index 753aa3216..894c4a701 100644 --- a/charon/tests/ui/slice-index-range.out +++ b/charon/tests/ui/slice-index-range.out @@ -425,6 +425,16 @@ where return } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: core::slice::index::{impl SliceIndex> for Range[Sized]}::get_unchecked::precondition_check fn {impl SliceIndex> for Range[Sized]}::get_unchecked::precondition_check(@1: usize, @2: usize, @3: usize) { @@ -440,13 +450,12 @@ fn {impl SliceIndex> for Range[Sized]}::get_unchecked::pr let @9: Array<&'_ (Str), 1 : usize>; // anonymous local let @10: &'_ (Slice<&'_ (Str)>); // anonymous local let @11: &'_ (Slice>); // anonymous local - let @12: (); // anonymous local - let @13: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @12: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@5) storage_live(@6) storage_live(pieces@8) - storage_live(@13) + storage_live(@12) storage_live(@4) @4 := copy (end@2) >= copy (start@1) if move (@4) { @@ -466,15 +475,13 @@ fn {impl SliceIndex> for Range[Sized]}::get_unchecked::pr storage_live(@7) storage_live(@9) @9 := [const ("unsafe precondition(s) violated: slice::get_unchecked requires that the range is within the slice\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - storage_live(@12) - @12 := () - pieces@8 := &(@9, move (@12)) + pieces@8 := &(@9, copy (@Global0)) storage_live(@10) @10 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@8)) storage_live(@11) @11 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(copy ({promoted_const}<'_, 1 : usize>)) - @13 := Option::None { } - @7 := Arguments { 0: move (@10), 1: move (@13), 2: move (@11) } + @12 := Option::None { } + @7 := Arguments { 0: move (@10), 1: move (@12), 2: move (@11) } storage_dead(@11) storage_dead(@10) @6 := panic_nounwind_fmt<'_>(move (@7), const (false)) @@ -552,13 +559,12 @@ fn {impl SliceIndex> for Range[Sized]}::get_unchecked_mut let @9: Array<&'_ (Str), 1 : usize>; // anonymous local let @10: &'_ (Slice<&'_ (Str)>); // anonymous local let @11: &'_ (Slice>); // anonymous local - let @12: (); // anonymous local - let @13: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @12: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(@5) storage_live(@6) storage_live(pieces@8) - storage_live(@13) + storage_live(@12) storage_live(@4) @4 := copy (end@2) >= copy (start@1) if move (@4) { @@ -578,15 +584,13 @@ fn {impl SliceIndex> for Range[Sized]}::get_unchecked_mut storage_live(@7) storage_live(@9) @9 := [const ("unsafe precondition(s) violated: slice::get_unchecked_mut requires that the range is within the slice\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - storage_live(@12) - @12 := () - pieces@8 := &(@9, move (@12)) + pieces@8 := &(@9, copy (@Global0)) storage_live(@10) @10 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@8)) storage_live(@11) @11 := @ArrayToSliceShared<'_, Argument<'_>, 0 : usize>(copy ({promoted_const}<'_, 1 : usize>)) - @13 := Option::None { } - @7 := Arguments { 0: move (@10), 1: move (@13), 2: move (@11) } + @12 := Option::None { } + @7 := Arguments { 0: move (@10), 1: move (@12), 2: move (@11) } storage_dead(@11) storage_dead(@10) @6 := panic_nounwind_fmt<'_>(move (@7), const (false)) @@ -855,40 +859,37 @@ fn main() let @7: bool; // anonymous local let @8: i32; // anonymous local let @9: usize; // anonymous local - let @10: (); // anonymous local + let @10: usize; // anonymous local let @11: usize; // anonymous local - let @12: usize; // anonymous local - let @13: &'_ (Slice); // anonymous local - let @14: &'_ (i32); // anonymous local + let @12: &'_ (Slice); // anonymous local + let @13: &'_ (i32); // anonymous local storage_live(array@1) array@1 := [const (1 : i32), const (2 : i32), const (3 : i32), const (4 : i32), const (5 : i32), const (6 : i32)] storage_live(slice@2) storage_live(@3) storage_live(@4) - storage_live(@10) - @10 := () - @4 := &(array@1, move (@10)) + @4 := &(array@1, copy (@Global0)) storage_live(@5) @5 := Range { start: const (2 : usize), end: const (5 : usize) } @3 := {impl Index for Array}::index<'_, i32, Range[Sized], 6 : usize>[Sized, Sized[Sized]>, {impl Index for Slice}[Sized]>[Sized, Sized[Sized]>, {impl SliceIndex> for Range[Sized]}[Sized]]](move (@4), move (@5)) storage_dead(@5) storage_dead(@4) - storage_live(@11) - @11 := ptr_metadata(copy (@3)) - slice@2 := &(*(@3), move (@11)) + storage_live(@10) + @10 := ptr_metadata(copy (@3)) + slice@2 := &(*(@3), move (@10)) storage_live(@6) storage_live(@7) storage_live(@8) storage_live(@9) @9 := const (0 : usize) + storage_live(@11) + @11 := ptr_metadata(copy (slice@2)) storage_live(@12) - @12 := ptr_metadata(copy (slice@2)) + @12 := &(*(slice@2), move (@11)) storage_live(@13) - @13 := &(*(slice@2), move (@12)) - storage_live(@14) - @14 := @SliceIndexShared<'_, i32>(move (@13), copy (@9)) - @8 := copy (*(@14)) + @13 := @SliceIndexShared<'_, i32>(move (@12), copy (@9)) + @8 := copy (*(@13)) @7 := move (@8) == const (3 : i32) if move (@7) { } diff --git a/charon/tests/ui/start_from.out b/charon/tests/ui/start_from.out index 3fd12a9a5..0dedd42bb 100644 --- a/charon/tests/ui/start_from.out +++ b/charon/tests/ui/start_from.out @@ -42,6 +42,16 @@ where [@TraitClause0]: Clone, [@TraitClause1]: Destruct, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun4() + // Full name: core::iter::sources::once::Once #[lang_item("IterOnce")] pub opaque type Once diff --git a/charon/tests/ui/statics.out b/charon/tests/ui/statics.out index 58d8c9e1a..5c4a6b8ac 100644 --- a/charon/tests/ui/statics.out +++ b/charon/tests/ui/statics.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::constant::CONST fn CONST() -> usize { @@ -21,23 +31,17 @@ fn constant() let @3: usize; // anonymous local let _ref_mut@4: &'_ mut (usize); // local let @5: usize; // anonymous local - let @6: (); // anonymous local - let @7: (); // anonymous local storage_live(_val@1) _val@1 := copy (CONST) storage_live(_ref@2) storage_live(@3) @3 := copy (CONST) - storage_live(@7) - @7 := () - _ref@2 := &(@3, move (@7)) + _ref@2 := &(@3, copy (@Global0)) storage_live(_ref_mut@4) storage_live(@5) @5 := copy (CONST) - storage_live(@6) - @6 := () - _ref_mut@4 := &mut (@5, move (@6)) + _ref_mut@4 := &mut (@5, copy (@Global0)) @0 := () storage_dead(@5) storage_dead(_ref_mut@4) @@ -71,43 +75,37 @@ fn shared_static() let _ptr@5: *const usize; // local let @6: &'_ (usize); // anonymous local let @7: (); // anonymous local - let @8: (); // anonymous local + let @8: &'_ (usize); // anonymous local let @9: (); // anonymous local let @10: &'_ (usize); // anonymous local let @11: (); // anonymous local let @12: &'_ (usize); // anonymous local - let @13: (); // anonymous local - let @14: &'_ (usize); // anonymous local + storage_live(@7) + storage_live(@8) storage_live(@9) storage_live(@10) storage_live(@11) storage_live(@12) - storage_live(@13) - storage_live(@14) storage_live(_val@1) storage_live(@2) - @9 := () - @10 := &(SHARED_STATIC, move (@9)) - @2 := move (@10) + @7 := () + @8 := &(SHARED_STATIC, move (@7)) + @2 := move (@8) _val@1 := copy (*(@2)) storage_dead(@2) storage_live(_ref@3) storage_live(@4) - @11 := () - @12 := &(SHARED_STATIC, move (@11)) - @4 := move (@12) - storage_live(@8) - @8 := () - _ref@3 := &(*(@4), move (@8)) + @9 := () + @10 := &(SHARED_STATIC, move (@9)) + @4 := move (@10) + _ref@3 := &(*(@4), copy (@Global0)) storage_live(_ptr@5) storage_live(@6) - @13 := () - @14 := &(SHARED_STATIC, move (@13)) - @6 := move (@14) - storage_live(@7) - @7 := () - _ptr@5 := &raw const (*(@6), move (@7)) + @11 := () + @12 := &(SHARED_STATIC, move (@11)) + @6 := move (@12) + _ptr@5 := &raw const (*(@6), copy (@Global0)) @0 := () storage_dead(@6) storage_dead(_ptr@5) @@ -145,69 +143,57 @@ fn mut_static() let _ptr_mut@9: *mut usize; // local let @10: *mut usize; // anonymous local let @11: (); // anonymous local - let @12: (); // anonymous local + let @12: *mut usize; // anonymous local let @13: (); // anonymous local - let @14: (); // anonymous local + let @14: *mut usize; // anonymous local let @15: (); // anonymous local let @16: *mut usize; // anonymous local let @17: (); // anonymous local let @18: *mut usize; // anonymous local let @19: (); // anonymous local let @20: *mut usize; // anonymous local - let @21: (); // anonymous local - let @22: *mut usize; // anonymous local - let @23: (); // anonymous local - let @24: *mut usize; // anonymous local + storage_live(@11) + storage_live(@12) + storage_live(@13) + storage_live(@14) storage_live(@15) storage_live(@16) storage_live(@17) storage_live(@18) storage_live(@19) storage_live(@20) - storage_live(@21) - storage_live(@22) - storage_live(@23) - storage_live(@24) storage_live(_val@1) storage_live(@2) - @15 := () - @16 := &raw mut (MUT_STATIC, move (@15)) - @2 := move (@16) + @11 := () + @12 := &raw mut (MUT_STATIC, move (@11)) + @2 := move (@12) _val@1 := copy (*(@2)) storage_dead(@2) storage_live(_ref@3) storage_live(@4) - @17 := () - @18 := &raw mut (MUT_STATIC, move (@17)) - @4 := move (@18) - storage_live(@14) - @14 := () - _ref@3 := &(*(@4), move (@14)) + @13 := () + @14 := &raw mut (MUT_STATIC, move (@13)) + @4 := move (@14) + _ref@3 := &(*(@4), copy (@Global0)) storage_live(_ref_mut@5) storage_live(@6) - @19 := () - @20 := &raw mut (MUT_STATIC, move (@19)) - @6 := move (@20) - storage_live(@13) - @13 := () - _ref_mut@5 := &mut (*(@6), move (@13)) + @15 := () + @16 := &raw mut (MUT_STATIC, move (@15)) + @6 := move (@16) + _ref_mut@5 := &mut (*(@6), copy (@Global0)) storage_live(_ptr@7) storage_live(@8) - @21 := () - @22 := &raw mut (MUT_STATIC, move (@21)) - @8 := move (@22) - storage_live(@12) - @12 := () - _ptr@7 := &raw const (*(@8), move (@12)) + @17 := () + @18 := &raw mut (MUT_STATIC, move (@17)) + @8 := move (@18) + _ptr@7 := &raw const (*(@8), copy (@Global0)) storage_live(_ptr_mut@9) storage_live(@10) - @23 := () - @24 := &raw mut (MUT_STATIC, move (@23)) - @10 := move (@24) - storage_live(@11) - @11 := () - _ptr_mut@9 := &raw mut (*(@10), move (@11)) + @19 := () + @20 := &raw mut (MUT_STATIC, move (@19)) + @10 := move (@20) + _ptr_mut@9 := &raw mut (*(@10), copy (@Global0)) @0 := () storage_dead(@10) storage_dead(_ptr_mut@9) @@ -255,19 +241,16 @@ fn non_copy_static() let @1: &'_ (Foo); // anonymous local let @2: &'_ (Foo); // anonymous local let @3: (); // anonymous local - let @4: (); // anonymous local - let @5: &'_ (Foo); // anonymous local + let @4: &'_ (Foo); // anonymous local + storage_live(@3) storage_live(@4) - storage_live(@5) storage_live(@1) storage_live(@2) - @4 := () - @5 := &(FOO, move (@4)) - @2 := move (@5) - storage_live(@3) @3 := () - @1 := &(*(@2), move (@3)) + @4 := &(FOO, move (@3)) + @2 := move (@4) + @1 := &(*(@2), copy (@Global0)) @0 := method<'_>(move (@1)) storage_dead(@1) storage_dead(@2) diff --git a/charon/tests/ui/stealing.out b/charon/tests/ui/stealing.out index 2f407e4f1..6827b5f5c 100644 --- a/charon/tests/ui/stealing.out +++ b/charon/tests/ui/stealing.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::SLICE fn SLICE() -> Array<(), 4 : usize> { diff --git a/charon/tests/ui/string-literal.out b/charon/tests/ui/string-literal.out index 59f0d5c56..7f42b4328 100644 --- a/charon/tests/ui/string-literal.out +++ b/charon/tests/ui/string-literal.out @@ -105,6 +105,16 @@ where vtable: {impl ToString for T}::{vtable}[@TraitClause0, @TraitClause1] } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::FOO fn FOO() -> &'static (Str) { @@ -123,23 +133,20 @@ fn BAR() -> &'static (Slice) let @0: &'_ (Slice); // return let @1: &'_ (Array); // anonymous local let @2: &'_ (Array); // anonymous local - let @3: (); // anonymous local - let @4: Array; // anonymous local - let @5: (); // anonymous local - let @6: &'_ (Array); // anonymous local + let @3: Array; // anonymous local + let @4: (); // anonymous local + let @5: &'_ (Array); // anonymous local + storage_live(@3) storage_live(@4) storage_live(@5) - storage_live(@6) storage_live(@1) storage_live(@2) - @4 := [const (104 : u8), const (101 : u8), const (108 : u8), const (108 : u8), const (111 : u8)] - @5 := () - @6 := &(@4, move (@5)) - @2 := move (@6) - storage_live(@3) - @3 := () - @1 := &(*(@2), move (@3)) + @3 := [const (104 : u8), const (101 : u8), const (108 : u8), const (108 : u8), const (111 : u8)] + @4 := () + @5 := &(@3, move (@4)) + @2 := move (@5) + @1 := &(*(@2), copy (@Global0)) @0 := @ArrayToSliceShared<'_, u8, 5 : usize>(move (@1)) storage_dead(@2) storage_dead(@1) diff --git a/charon/tests/ui/traits.out b/charon/tests/ui/traits.out index eec32d8f8..49d7cf382 100644 --- a/charon/tests/ui/traits.out +++ b/charon/tests/ui/traits.out @@ -122,6 +122,16 @@ where #[lang_item("String")] pub opaque type String +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::BoolTrait pub trait BoolTrait { @@ -182,23 +192,16 @@ pub fn test_bool_trait_bool(@1: bool) -> bool let @2: bool; // anonymous local let @3: &'_ (bool); // anonymous local let @4: &'_ (bool); // anonymous local - let @5: (); // anonymous local - let @6: (); // anonymous local storage_live(@4) - storage_live(@6) storage_live(@2) storage_live(@3) - storage_live(@5) - @5 := () - @3 := &(x@1, move (@5)) + @3 := &(x@1, copy (@Global0)) @2 := {impl BoolTrait for bool}::get_bool<'_>(move (@3)) if move (@2) { storage_dead(@3) storage_live(@4) - storage_live(@6) - @6 := () - @4 := &(x@1, move (@6)) + @4 := &(x@1, copy (@Global0)) @0 := test_crate::{impl BoolTrait for bool}::ret_true<'_>(move (@4)) storage_dead(@4) } @@ -262,23 +265,16 @@ where let @2: bool; // anonymous local let @3: &'_ (Option[@TraitClause0]); // anonymous local let @4: &'_ (Option[@TraitClause0]); // anonymous local - let @5: (); // anonymous local - let @6: (); // anonymous local storage_live(@4) - storage_live(@6) storage_live(@2) storage_live(@3) - storage_live(@5) - @5 := () - @3 := &(x@1, move (@5)) + @3 := &(x@1, copy (@Global0)) @2 := {impl BoolTrait for Option[@TraitClause0]}::get_bool<'_, T>[@TraitClause0](move (@3)) if move (@2) { storage_dead(@3) storage_live(@4) - storage_live(@6) - @6 := () - @4 := &(x@1, move (@6)) + @4 := &(x@1, copy (@Global0)) @0 := test_crate::{impl BoolTrait for Option[@TraitClause0]}::ret_true<'_, T>[@TraitClause0](move (@4)) storage_dead(@4) } @@ -300,12 +296,9 @@ where let @0: bool; // return let x@1: T; // arg #1 let @2: &'_ (T); // anonymous local - let @3: (); // anonymous local storage_live(@2) - storage_live(@3) - @3 := () - @2 := &(x@1, move (@3)) + @2 := &(x@1, copy (@Global0)) @0 := @TraitClause1::get_bool<'_>(move (@2)) storage_dead(@2) drop[Drop] x@1 @@ -665,10 +658,8 @@ where let @6: bool; // anonymous local let @7: u64; // anonymous local let @8: &'_ (TestType1); // anonymous local - let @9: (); // anonymous local storage_live(@8) - storage_live(@9) storage_live(x@3) storage_live(@4) // Remark: we can't write: impl TestTrait for TestType, @@ -688,9 +679,7 @@ where if move (@6) { storage_dead(@7) storage_live(@8) - storage_live(@9) - @9 := () - @8 := &(y@5, move (@9)) + @8 := &(y@5, copy (@Global0)) @0 := {impl TestTrait for TestType1}::test<'_>(move (@8)) storage_dead(@8) } @@ -951,12 +940,9 @@ where let @0: String; // return let x@1: &'_ (T); // arg #1 let @2: &'_ (T); // anonymous local - let @3: (); // anonymous local storage_live(@2) - storage_live(@3) - @3 := () - @2 := &(*(x@1), move (@3)) + @2 := &(*(x@1), copy (@Global0)) @0 := @TraitClause1::parent_clause1::get_name<'_>(move (@2)) storage_dead(@2) return @@ -971,12 +957,9 @@ where let @0: @TraitClause1::parent_clause1::W; // return let x@1: &'_ (T); // arg #1 let @2: &'_ (T); // anonymous local - let @3: (); // anonymous local storage_live(@2) - storage_live(@3) - @3 := () - @2 := &(*(x@1), move (@3)) + @2 := &(*(x@1), copy (@Global0)) @0 := @TraitClause1::parent_clause1::get_w<'_>(move (@2)) storage_dead(@2) return @@ -1199,12 +1182,9 @@ where let @0: @TraitClause1::W; // return let x@1: &'_ (T); // arg #1 let @2: &'_ (T); // anonymous local - let @3: (); // anonymous local storage_live(@2) - storage_live(@3) - @3 := () - @2 := &(*(x@1), move (@3)) + @2 := &(*(x@1), copy (@Global0)) @0 := @TraitClause1::get_w<'_>(move (@2)) storage_dead(@2) return diff --git a/charon/tests/ui/traits_special.out b/charon/tests/ui/traits_special.out index b57479284..b464eb410 100644 --- a/charon/tests/ui/traits_special.out +++ b/charon/tests/ui/traits_special.out @@ -23,6 +23,16 @@ where Err(E), } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::From pub trait From { diff --git a/charon/tests/ui/type_alias.out b/charon/tests/ui/type_alias.out index 98daa8bf3..3c89e0b3c 100644 --- a/charon/tests/ui/type_alias.out +++ b/charon/tests/ui/type_alias.out @@ -128,6 +128,16 @@ where non-dyn-compatible } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Generic2 struct Generic2<'a, T> where diff --git a/charon/tests/ui/type_inference_is_order_dependent.out b/charon/tests/ui/type_inference_is_order_dependent.out index 5861ee7bf..ae2063a7c 100644 --- a/charon/tests/ui/type_inference_is_order_dependent.out +++ b/charon/tests/ui/type_inference_is_order_dependent.out @@ -107,6 +107,16 @@ where // Full name: std::io::stdio::_print pub fn _print<'_0>(@1: Arguments<'_0>) +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Left trait Left { @@ -159,12 +169,6 @@ where let @10: Array<&'_ (Str), 2 : usize>; // anonymous local let @11: &'_ (Array, 1 : usize>); // anonymous local let @12: &'_ (Array, 1 : usize>); // anonymous local - let @13: (); // anonymous local - let @14: (); // anonymous local - let @15: (); // anonymous local - let @16: (); // anonymous local - let @17: (); // anonymous local - let @18: (); // anonymous local storage_live(@1) storage_live(@2) @@ -174,12 +178,8 @@ where storage_live(@6) storage_live(@7) @7 := @TraitClause4::default() - storage_live(@14) - @14 := () - @6 := &(@7, move (@14)) - storage_live(@13) - @13 := () - @5 := &(*(@6), move (@13)) + @6 := &(@7, copy (@Global0)) + @5 := &(*(@6), copy (@Global0)) @4 := new_debug<'_, '_, U>[@TraitClause1, @TraitClause5](move (@5)) storage_dead(@5) args@3 := [move (@4)] @@ -188,20 +188,12 @@ where storage_live(@9) storage_live(@10) @10 := [const (""), const ("\n")] - storage_live(@18) - @18 := () - @9 := &(@10, move (@18)) - storage_live(@17) - @17 := () - @8 := &(*(@9), move (@17)) + @9 := &(@10, copy (@Global0)) + @8 := &(*(@9), copy (@Global0)) storage_live(@11) storage_live(@12) - storage_live(@16) - @16 := () - @12 := &(args@3, move (@16)) - storage_live(@15) - @15 := () - @11 := &(*(@12), move (@15)) + @12 := &(args@3, copy (@Global0)) + @11 := &(*(@12), copy (@Global0)) @2 := new_v1<'_, 2 : usize, 1 : usize>(move (@8), move (@11)) storage_dead(@12) storage_dead(@11) diff --git a/charon/tests/ui/typenum.out b/charon/tests/ui/typenum.out index 2a68cbc59..2bb5ff9e8 100644 --- a/charon/tests/ui/typenum.out +++ b/charon/tests/ui/typenum.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::UInt pub struct UInt { U, diff --git a/charon/tests/ui/ullbc-control-flow.out b/charon/tests/ui/ullbc-control-flow.out index b92a5ca5b..199d6ff79 100644 --- a/charon/tests/ui/ullbc-control-flow.out +++ b/charon/tests/ui/ullbc-control-flow.out @@ -547,6 +547,18 @@ where vtable: core::ops::try_trait::Residual::{vtable} } +fn UNIT_METADATA() +{ + let @0: (); // return + + bb0: { + @0 := (); + return; + } +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::nested_loops_enum pub fn nested_loops_enum(@1: usize, @2: usize) -> usize { @@ -587,12 +599,6 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize let @34: (); // anonymous local let @35: bool; // anonymous local let @36: usize; // anonymous local - let @37: (); // anonymous local - let @38: (); // anonymous local - let @39: (); // anonymous local - let @40: (); // anonymous local - let @41: (); // anonymous local - let @42: (); // anonymous local bb0: { storage_live(@12); @@ -625,12 +631,8 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize storage_live(@9); storage_live(@10); storage_live(@11); - storage_live(@38); - @38 := (); - @11 := &mut (iter@7, move (@38)); - storage_live(@37); - @37 := (); - @10 := &two-phase-mut (*(@11), move (@37)); + @11 := &mut (iter@7, copy (@Global0)); + @10 := &two-phase-mut (*(@11), copy (@Global0)); @9 := {impl Iterator for Range[@TraitClause0]}::next<'_, i32>[Sized, {impl Step for i32}](move (@10)) -> bb4 (unwind: bb2); } @@ -682,12 +684,8 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize storage_live(@20); storage_live(@21); storage_live(@22); - storage_live(@40); - @40 := (); - @22 := &mut (iter@18, move (@40)); - storage_live(@39); - @39 := (); - @21 := &two-phase-mut (*(@22), move (@39)); + @22 := &mut (iter@18, copy (@Global0)); + @21 := &two-phase-mut (*(@22), copy (@Global0)); @20 := {impl Iterator for Range[@TraitClause0]}::next<'_, usize>[Sized, {impl Step for usize}](move (@21)) -> bb10 (unwind: bb2); } @@ -736,12 +734,8 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize storage_live(@29); storage_live(@30); storage_live(@31); - storage_live(@42); - @42 := (); - @31 := &mut (iter@27, move (@42)); - storage_live(@41); - @41 := (); - @30 := &two-phase-mut (*(@31), move (@41)); + @31 := &mut (iter@27, copy (@Global0)); + @30 := &two-phase-mut (*(@31), copy (@Global0)); @29 := {impl Iterator for Range[@TraitClause0]}::next<'_, usize>[Sized, {impl Step for usize}](move (@30)) -> bb16 (unwind: bb2); } diff --git a/charon/tests/ui/unions.out b/charon/tests/ui/unions.out index 996c76f25..034255397 100644 --- a/charon/tests/ui/unions.out +++ b/charon/tests/ui/unions.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Foo union Foo { one: u64, diff --git a/charon/tests/ui/unsafe-impl-send.out b/charon/tests/ui/unsafe-impl-send.out index 437c18fca..4de681dfc 100644 --- a/charon/tests/ui/unsafe-impl-send.out +++ b/charon/tests/ui/unsafe-impl-send.out @@ -4,6 +4,16 @@ #[lang_item("Send")] pub trait Send +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Foo struct Foo { *const (), diff --git a/charon/tests/ui/unsafe.out b/charon/tests/ui/unsafe.out index 754a27ff5..60d7945fc 100644 --- a/charon/tests/ui/unsafe.out +++ b/charon/tests/ui/unsafe.out @@ -274,6 +274,16 @@ pub fn null() -> *const T where [@TraitClause0]: Thin, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::call_unsafe_fn fn call_unsafe_fn() { diff --git a/charon/tests/ui/unsize.out b/charon/tests/ui/unsize.out index a25adf583..511b0f2da 100644 --- a/charon/tests/ui/unsize.out +++ b/charon/tests/ui/unsize.out @@ -177,6 +177,16 @@ impl Display for String { vtable: {impl Display for String}::{vtable} } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::foo fn foo() { @@ -203,24 +213,14 @@ fn foo() let @20: Rc[MetaSized, Sized]; // anonymous local let @21: String; // anonymous local let @22: &'_ (String); // anonymous local - let @23: (); // anonymous local - let @24: (); // anonymous local - let @25: (); // anonymous local - let @26: (); // anonymous local - let @27: (); // anonymous local - let @28: (); // anonymous local storage_live(array@1) array@1 := @ArrayRepeat<'_, i32, 2 : usize>(const (0 : i32)) storage_live(@2) storage_live(@3) storage_live(@4) - storage_live(@24) - @24 := () - @4 := &(array@1, move (@24)) - storage_live(@23) - @23 := () - @3 := &(*(@4), move (@23)) + @4 := &(array@1, copy (@Global0)) + @3 := &(*(@4), copy (@Global0)) @2 := @ArrayToSliceShared<'_, i32, 2 : usize>(move (@3)) storage_dead(@3) storage_dead(@4) @@ -252,12 +252,8 @@ fn foo() storage_live(@12) storage_live(@13) storage_live(@14) - storage_live(@27) - @27 := () - @14 := &(string@11, move (@27)) - storage_live(@26) - @26 := () - @13 := &(*(@14), move (@26)) + @14 := &(string@11, copy (@Global0)) + @13 := &(*(@14), copy (@Global0)) @12 := unsize_cast<&'_ (String), &'_ ((dyn exists<_dyn> [@TraitClause0]: Display<_dyn> + _dyn : '_)), {impl Display for String}>(move (@13)) storage_dead(@13) storage_dead(@14) @@ -266,9 +262,7 @@ fn foo() storage_live(@16) storage_live(@17) storage_live(@18) - storage_live(@25) - @25 := () - @18 := &(string@11, move (@25)) + @18 := &(string@11, copy (@Global0)) @17 := {impl Clone for String}::clone<'_>(move (@18)) storage_dead(@18) @16 := @BoxNew[Sized](move (@17)) @@ -282,9 +276,7 @@ fn foo() storage_live(@20) storage_live(@21) storage_live(@22) - storage_live(@28) - @28 := () - @22 := &(string@11, move (@28)) + @22 := &(string@11, copy (@Global0)) @21 := {impl Clone for String}::clone<'_>(move (@22)) storage_dead(@22) @20 := alloc::rc::{Rc[@TraitClause0::parent_clause0, Sized]}::new[Sized](move (@21)) diff --git a/charon/tests/ui/unsupported/issue-79-bound-regions.out b/charon/tests/ui/unsupported/issue-79-bound-regions.out index 222dadb4e..20713a002 100644 --- a/charon/tests/ui/unsupported/issue-79-bound-regions.out +++ b/charon/tests/ui/unsupported/issue-79-bound-regions.out @@ -406,6 +406,16 @@ pub fn iter<'_0, T>(@1: &'_0 (Slice)) -> Iter<'_0, T>[@TraitClause0] where [@TraitClause0]: Sized, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::main fn main() { @@ -419,21 +429,14 @@ fn main() let @7: Iter<'_, i32>[Sized]; // anonymous local let @8: &'_ (Slice); // anonymous local let @9: usize; // anonymous local - let @10: (); // anonymous local - let @11: (); // anonymous local - let @12: (); // anonymous local storage_live(slice@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := [const (0 : i32)] - storage_live(@11) - @11 := () - @3 := &(@4, move (@11)) - storage_live(@10) - @10 := () - @2 := &(*(@3), move (@10)) + @3 := &(@4, copy (@Global0)) + @2 := &(*(@3), copy (@Global0)) slice@1 := @ArrayToSliceShared<'_, i32, 1 : usize>(move (@2)) storage_dead(@2) storage_dead(@3) @@ -445,9 +448,7 @@ fn main() @9 := ptr_metadata(copy (slice@1)) @8 := &(*(slice@1), move (@9)) @7 := iter<'_, i32>[Sized](move (@8)) - storage_live(@12) - @12 := () - @6 := &two-phase-mut (@7, move (@12)) + @6 := &two-phase-mut (@7, copy (@Global0)) storage_dead(@8) @5 := {impl Iterator for Iter<'a, T>[@TraitClause0]}::next<'_, '_, i32>[Sized](move (@6)) storage_dead(@6) diff --git a/charon/tests/ui/vtables.out b/charon/tests/ui/vtables.out index 4e2c863ab..1976f130d 100644 --- a/charon/tests/ui/vtables.out +++ b/charon/tests/ui/vtables.out @@ -173,6 +173,16 @@ where vtable: {impl ToString for T}::{vtable}[@TraitClause0, @TraitClause1] } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_crate::Super trait Super { @@ -246,13 +256,10 @@ fn {impl Checkable for i32}::check<'_0>(@1: &'_0 (i32)) -> bool let self@1: &'_ (i32); // arg #1 let @2: i32; // anonymous local let @3: &'_ (i32); // anonymous local - let @4: (); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@4) - @4 := () - @3 := &(*(self@1), move (@4)) + @3 := &(*(self@1), copy (@Global0)) @2 := {impl Super for i32}::super_method<'_>(move (@3), const (10 : i32)) storage_dead(@3) @0 := move (@2) > const (0 : i32) @@ -354,14 +361,11 @@ where let @3: &'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)); // anonymous local let @4: &'_ (T); // anonymous local let @5: &'static (test_crate::NoParam::{vtable}); // anonymous local - let @6: (); // anonymous local storage_live(@2) storage_live(@3) storage_live(@4) - storage_live(@6) - @6 := () - @4 := &(*(arg@1), move (@6)) + @4 := &(*(arg@1), copy (@Global0)) @3 := unsize_cast<&'_ (T), &'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)), @TraitClause1>(move (@4)) storage_dead(@4) storage_live(@5) @@ -405,15 +409,12 @@ where let arg@2: &'_ (T); // arg #2 let @3: i32; // anonymous local let @4: &'_ (T); // anonymous local - let @5: (); // anonymous local storage_live(@3) @3 := copy (*(self@1)) panic.+ const (1 : i32) *(self@1) := move (@3) storage_live(@4) - storage_live(@5) - @5 := () - @4 := &(*(arg@2), move (@5)) + @4 := &(*(arg@2), copy (@Global0)) @0 := @TraitClause1::clone<'_>(move (@4)) storage_dead(@4) return @@ -464,33 +465,24 @@ where let @5: i32; // anonymous local let @6: &'_ mut ((dyn exists<_dyn> [@TraitClause0]: Modifiable<_dyn, T> + _dyn : '_)); // anonymous local let @7: &'_ (T); // anonymous local - let @8: (); // anonymous local - let @9: &'static (test_crate::Modifiable::{vtable}); // anonymous local - let @10: (); // anonymous local - let @11: (); // anonymous local + let @8: &'static (test_crate::Modifiable::{vtable}); // anonymous local storage_live(x@2) storage_live(@3) storage_live(@4) storage_live(@5) @5 := const (199 : i32) - storage_live(@11) - @11 := () - @4 := &mut (@5, move (@11)) - storage_live(@10) - @10 := () - @3 := &mut (*(@4), move (@10)) + @4 := &mut (@5, copy (@Global0)) + @3 := &mut (*(@4), copy (@Global0)) x@2 := unsize_cast<&'_ mut (i32), &'_ mut ((dyn exists<_dyn> [@TraitClause0]: Modifiable<_dyn, T> + _dyn : '_)), {impl Modifiable for i32}[@TraitClause0, @TraitClause1]>(move (@3)) storage_dead(@3) storage_dead(@4) storage_live(@6) - storage_live(@9) - @9 := ptr_metadata(copy (x@2)) - @6 := &two-phase-mut (*(x@2), move (@9)) - storage_live(@7) storage_live(@8) - @8 := () - @7 := &(*(arg@1), move (@8)) + @8 := ptr_metadata(copy (x@2)) + @6 := &two-phase-mut (*(x@2), move (@8)) + storage_live(@7) + @7 := &(*(arg@1), copy (@Global0)) @0 := Modifiable<(dyn exists<_dyn> [@TraitClause0]: Modifiable<_dyn, T> + _dyn : '_), T>::modify<'_, '_>(move (@6), move (@7)) storage_dead(@7) storage_dead(@6) @@ -547,33 +539,27 @@ where let @7: (); // anonymous local let @8: &'_ (Self); // anonymous local let @9: &'_ (i64); // anonymous local - let @10: (); // anonymous local + let @10: PtrMetadata; // anonymous local let @11: PtrMetadata; // anonymous local - let @12: (); // anonymous local - let @13: PtrMetadata; // anonymous local storage_live(@4) storage_live(@5) - storage_live(@11) - @11 := ptr_metadata(copy (self@1)) - @5 := &(*(self@1), move (@11)) - storage_live(@6) storage_live(@10) - @10 := () - @6 := &(*(t32@2), move (@10)) + @10 := ptr_metadata(copy (self@1)) + @5 := &(*(self@1), move (@10)) + storage_live(@6) + @6 := &(*(t32@2), copy (@Global0)) @4 := @TraitClause0::parent_clause1::operate_on<'_, '_>(move (@5), move (@6)) storage_dead(@6) storage_dead(@5) storage_dead(@4) storage_live(@7) storage_live(@8) - storage_live(@13) - @13 := ptr_metadata(copy (self@1)) - @8 := &(*(self@1), move (@13)) + storage_live(@11) + @11 := ptr_metadata(copy (self@1)) + @8 := &(*(self@1), move (@11)) storage_live(@9) - storage_live(@12) - @12 := () - @9 := &(*(t64@3), move (@12)) + @9 := &(*(t64@3), copy (@Global0)) @7 := @TraitClause0::parent_clause2::operate_on<'_, '_>(move (@8), move (@9)) storage_dead(@9) storage_dead(@8) @@ -683,33 +669,21 @@ fn test_crate::{impl Both32And64 for i32}::both_operate<'_0, '_1, '_2>(@1: &'_0 let @7: (); // anonymous local let @8: &'_ (i32); // anonymous local let @9: &'_ (i64); // anonymous local - let @10: (); // anonymous local - let @11: (); // anonymous local - let @12: (); // anonymous local - let @13: (); // anonymous local storage_live(@4) storage_live(@5) - storage_live(@11) - @11 := () - @5 := &(*(self@1), move (@11)) + @5 := &(*(self@1), copy (@Global0)) storage_live(@6) - storage_live(@10) - @10 := () - @6 := &(*(t32@2), move (@10)) + @6 := &(*(t32@2), copy (@Global0)) @4 := {impl Both32And64 for i32}::parent_clause1::operate_on<'_, '_>(move (@5), move (@6)) storage_dead(@6) storage_dead(@5) storage_dead(@4) storage_live(@7) storage_live(@8) - storage_live(@13) - @13 := () - @8 := &(*(self@1), move (@13)) + @8 := &(*(self@1), copy (@Global0)) storage_live(@9) - storage_live(@12) - @12 := () - @9 := &(*(t64@3), move (@12)) + @9 := &(*(t64@3), copy (@Global0)) @7 := {impl Both32And64 for i32}::parent_clause2::operate_on<'_, '_>(move (@8), move (@9)) storage_dead(@9) storage_dead(@8) @@ -773,37 +747,25 @@ fn use_alias<'_0>(@1: &'_0 ((dyn exists<_dyn> [@TraitClause0]: Both32And64<_dyn> let @7: &'_ (i64); // anonymous local let @8: &'_ (i64); // anonymous local let @9: i64; // anonymous local - let @10: (); // anonymous local - let @11: (); // anonymous local - let @12: (); // anonymous local - let @13: (); // anonymous local - let @14: &'static (test_crate::Both32And64::{vtable}); // anonymous local + let @10: &'static (test_crate::Both32And64::{vtable}); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@14) - @14 := ptr_metadata(copy (x@1)) - @3 := &(*(x@1), move (@14)) + storage_live(@10) + @10 := ptr_metadata(copy (x@1)) + @3 := &(*(x@1), move (@10)) storage_live(@4) storage_live(@5) storage_live(@6) @6 := const (100 : i32) - storage_live(@13) - @13 := () - @5 := &(@6, move (@13)) - storage_live(@12) - @12 := () - @4 := &(*(@5), move (@12)) + @5 := &(@6, copy (@Global0)) + @4 := &(*(@5), copy (@Global0)) storage_live(@7) storage_live(@8) storage_live(@9) @9 := const (200 : i64) - storage_live(@11) - @11 := () - @8 := &(@9, move (@11)) - storage_live(@10) - @10 := () - @7 := &(*(@8), move (@10)) + @8 := &(@9, copy (@Global0)) + @7 := &(*(@8), copy (@Global0)) @2 := Both32And64<(dyn exists<_dyn> [@TraitClause0]: Both32And64<_dyn> + _dyn : '_)>::both_operate<'_, '_, '_>(move (@3), move (@4), move (@7)) storage_dead(@7) storage_dead(@4) @@ -885,34 +847,11 @@ fn main() let @61: &'_ (i64); // anonymous local let @62: i64; // anonymous local let @63: &'static (test_crate::Checkable::{vtable}); // anonymous local - let @64: (); // anonymous local - let @65: (); // anonymous local - let @66: usize; // anonymous local - let @67: (); // anonymous local - let @68: (); // anonymous local - let @69: (); // anonymous local - let @70: (); // anonymous local - let @71: (); // anonymous local - let @72: (); // anonymous local - let @73: (); // anonymous local - let @74: &'static (test_crate::Modifiable::{vtable}); // anonymous local - let @75: (); // anonymous local - let @76: (); // anonymous local - let @77: (); // anonymous local - let @78: (); // anonymous local - let @79: (); // anonymous local - let @80: (); // anonymous local - let @81: (); // anonymous local - let @82: (); // anonymous local - let @83: &'static (test_crate::NoParam::{vtable}); // anonymous local - let @84: &'static (test_crate::NoParam::{vtable}); // anonymous local - let @85: (); // anonymous local - let @86: (); // anonymous local - let @87: (); // anonymous local - let @88: (); // anonymous local - let @89: &'static (test_crate::Both32And64::{vtable}); // anonymous local - let @90: (); // anonymous local - let @91: (); // anonymous local + let @64: usize; // anonymous local + let @65: &'static (test_crate::Modifiable::{vtable}); // anonymous local + let @66: &'static (test_crate::NoParam::{vtable}); // anonymous local + let @67: &'static (test_crate::NoParam::{vtable}); // anonymous local + let @68: &'static (test_crate::Both32And64::{vtable}); // anonymous local storage_live(@21) storage_live(@22) @@ -956,37 +895,17 @@ fn main() storage_live(@60) storage_live(@61) storage_live(@62) - storage_live(@72) - storage_live(@73) - storage_live(@74) - storage_live(@75) - storage_live(@76) - storage_live(@77) - storage_live(@78) - storage_live(@79) - storage_live(@80) - storage_live(@81) - storage_live(@82) - storage_live(@83) - storage_live(@84) - storage_live(@85) - storage_live(@86) - storage_live(@87) - storage_live(@88) - storage_live(@89) - storage_live(@90) - storage_live(@91) + storage_live(@65) + storage_live(@66) + storage_live(@67) + storage_live(@68) storage_live(x@1) storage_live(@2) storage_live(@3) storage_live(@4) @4 := const (42 : i32) - storage_live(@65) - @65 := () - @3 := &(@4, move (@65)) - storage_live(@64) - @64 := () - @2 := &(*(@3), move (@64)) + @3 := &(@4, copy (@Global0)) + @2 := &(*(@3), copy (@Global0)) x@1 := unsize_cast<&'_ (i32), &'_ ((dyn exists<_dyn> [@TraitClause0]: Checkable<_dyn, i32> + _dyn : '_)), {impl Checkable for i32}>(move (@2)) storage_dead(@2) storage_dead(@3) @@ -1011,12 +930,8 @@ fn main() storage_live(@10) storage_live(@11) @11 := const (99 : i32) - storage_live(@68) - @68 := () - @10 := &mut (@11, move (@68)) - storage_live(@67) - @67 := () - @9 := &mut (*(@10), move (@67)) + @10 := &mut (@11, copy (@Global0)) + @9 := &mut (*(@10), copy (@Global0)) y@8 := unsize_cast<&'_ mut (i32), &'_ mut ((dyn exists<_dyn> [@TraitClause0]: Modifiable<_dyn, i32> + _dyn : '_)), {impl Modifiable for i32}[Sized, {impl Clone for i32}]>(move (@9)) storage_dead(@9) storage_dead(@10) @@ -1030,21 +945,15 @@ fn main() storage_live(@19) storage_live(@20) @20 := const ("Hello") - storage_live(@66) - @66 := ptr_metadata(copy (@20)) - @19 := &(*(@20), move (@66)) + storage_live(@64) + @64 := ptr_metadata(copy (@20)) + @19 := &(*(@20), move (@64)) @18 := {impl ToString for T}::to_string<'_, Str>[MetaSized, {impl Display for Str}](move (@19)) storage_dead(@19) - storage_live(@70) - @70 := () - @17 := &(@18, move (@70)) - storage_live(@69) - @69 := () - @16 := &(*(@17), move (@69)) + @17 := &(@18, copy (@Global0)) + @16 := &(*(@17), copy (@Global0)) @15 := modify_trait_object<'_, String>[Sized, {impl Clone for String}](move (@16)) - storage_live(@71) - @71 := () - @14 := &(@15, move (@71)) + @14 := &(@15, copy (@Global0)) storage_dead(@16) @13 := is_empty<'_>(move (@14)) if move (@13) { @@ -1064,31 +973,23 @@ fn main() storage_live(@23) storage_live(@24) storage_live(@25) - storage_live(@74) - @74 := ptr_metadata(copy (y@8)) - @25 := &two-phase-mut (*(y@8), move (@74)) + storage_live(@65) + @65 := ptr_metadata(copy (y@8)) + @25 := &two-phase-mut (*(y@8), move (@65)) storage_live(@26) storage_live(@27) storage_live(@28) @28 := const (100 : i32) - storage_live(@73) - @73 := () - @27 := &mut (@28, move (@73)) - storage_live(@72) - @72 := () - @26 := &(*(@27), move (@72)) + @27 := &mut (@28, copy (@Global0)) + @26 := &(*(@27), copy (@Global0)) @24 := Modifiable<(dyn exists<_dyn> [@TraitClause0]: Modifiable<_dyn, i32> + _dyn : '_), i32>::modify<'_, '_>(move (@25), move (@26)) storage_dead(@26) storage_dead(@25) - storage_live(@76) - @76 := () - @23 := &(@24, move (@76)) + @23 := &(@24, copy (@Global0)) storage_live(@29) storage_live(@30) @30 := const (100 : i32) - storage_live(@75) - @75 := () - @29 := &(@30, move (@75)) + @29 := &(@30, copy (@Global0)) @22 := (move (@23), move (@29)) storage_dead(@29) storage_dead(@23) @@ -1113,20 +1014,12 @@ fn main() @37 := move (kind@36) storage_live(@38) storage_live(@39) - storage_live(@82) - @82 := () - @39 := &(*(left_val@31), move (@82)) - storage_live(@81) - @81 := () - @38 := &(*(@39), move (@81)) + @39 := &(*(left_val@31), copy (@Global0)) + @38 := &(*(@39), copy (@Global0)) storage_live(@40) storage_live(@41) - storage_live(@80) - @80 := () - @41 := &(*(right_val@32), move (@80)) - storage_live(@79) - @79 := () - @40 := &(*(@41), move (@79)) + @41 := &(*(right_val@32), copy (@Global0)) + @40 := &(*(@41), copy (@Global0)) storage_live(@42) @42 := Option::None { } panic(core::panicking::assert_failed) @@ -1149,16 +1042,12 @@ fn main() storage_live(@47) storage_live(@48) @48 := const (42 : i32) - storage_live(@78) - @78 := () - @47 := &(@48, move (@78)) - storage_live(@77) - @77 := () - @46 := &(*(@47), move (@77)) + @47 := &(@48, copy (@Global0)) + @46 := &(*(@47), copy (@Global0)) @45 := to_dyn_obj<'_, i32>[Sized, {impl NoParam for i32}](move (@46)) - storage_live(@84) - @84 := ptr_metadata(copy (@45)) - @44 := &(*(@45), move (@84)) + storage_live(@67) + @67 := ptr_metadata(copy (@45)) + @44 := &(*(@45), move (@67)) z@43 := unsize_cast<&'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)), &'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)), NoParam<(dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)>>(move (@44)) storage_dead(@46) storage_dead(@44) @@ -1167,9 +1056,9 @@ fn main() storage_dead(@45) storage_live(@49) storage_live(@50) - storage_live(@83) - @83 := ptr_metadata(copy (z@43)) - @50 := &(*(z@43), move (@83)) + storage_live(@66) + @66 := ptr_metadata(copy (z@43)) + @50 := &(*(z@43), move (@66)) @49 := NoParam<(dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)>::dummy<'_>(move (@50)) storage_dead(@50) storage_dead(@49) @@ -1178,40 +1067,28 @@ fn main() storage_live(@53) storage_live(@54) @54 := const (42 : i32) - storage_live(@91) - @91 := () - @53 := &(@54, move (@91)) - storage_live(@90) - @90 := () - @52 := &(*(@53), move (@90)) + @53 := &(@54, copy (@Global0)) + @52 := &(*(@53), copy (@Global0)) a@51 := unsize_cast<&'_ (i32), &'_ ((dyn exists<_dyn> [@TraitClause0]: Both32And64<_dyn> + _dyn : '_)), {impl Both32And64 for i32}>(move (@52)) storage_dead(@52) storage_dead(@53) storage_live(@55) storage_live(@56) - storage_live(@89) - @89 := ptr_metadata(copy (a@51)) - @56 := &(*(a@51), move (@89)) + storage_live(@68) + @68 := ptr_metadata(copy (a@51)) + @56 := &(*(a@51), move (@68)) storage_live(@57) storage_live(@58) storage_live(@59) @59 := const (100 : i32) - storage_live(@88) - @88 := () - @58 := &(@59, move (@88)) - storage_live(@87) - @87 := () - @57 := &(*(@58), move (@87)) + @58 := &(@59, copy (@Global0)) + @57 := &(*(@58), copy (@Global0)) storage_live(@60) storage_live(@61) storage_live(@62) @62 := const (200 : i64) - storage_live(@86) - @86 := () - @61 := &(@62, move (@86)) - storage_live(@85) - @85 := () - @60 := &(*(@61), move (@85)) + @61 := &(@62, copy (@Global0)) + @60 := &(*(@61), copy (@Global0)) @55 := Both32And64<(dyn exists<_dyn> [@TraitClause0]: Both32And64<_dyn> + _dyn : '_)>::both_operate<'_, '_, '_>(move (@56), move (@57), move (@60)) storage_dead(@60) storage_dead(@57) From 3f9850e5051af5148703cc54d31726de2c70c22d Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Wed, 17 Sep 2025 16:08:52 +0200 Subject: [PATCH 03/10] Hide unit metadata --- charon/src/ast/expressions_utils.rs | 7 + charon/src/pretty/fmt_with_ctx.rs | 18 +- charon/tests/cargo/build-script.out | 10 + charon/tests/cargo/dependencies.out | 59 ++---- charon/tests/cargo/toml.out | 7 +- charon/tests/cargo/unsafe_.out | 20 +- charon/tests/cargo/workspace.out | 10 + charon/tests/ui/arrays.out | 158 +++++++------- charon/tests/ui/arrays_const_generics.out | 2 +- charon/tests/ui/associated-types.out | 2 +- charon/tests/ui/closure-as-fn.out | 4 +- charon/tests/ui/closures.out | 100 ++++----- charon/tests/ui/closures_with_where.out | 2 +- charon/tests/ui/comments.out | 14 +- charon/tests/ui/constants.out | 2 +- charon/tests/ui/demo.out | 72 +++---- .../ui/dictionary_passing_style_woes.out | 4 +- .../tests/ui/dyn-with-diamond-supertraits.out | 16 +- charon/tests/ui/external.out | 10 +- charon/tests/ui/gosim-demo.out | 20 +- charon/tests/ui/impl-trait.out | 16 +- .../ui/issue-120-bare-discriminant-read.out | 6 +- charon/tests/ui/issue-297-cfg.out | 4 +- charon/tests/ui/issue-320-slice-pattern.out | 30 +-- charon/tests/ui/issue-323-closure-borrow.out | 6 +- charon/tests/ui/issue-378-ctor-as-fn.out | 6 +- .../tests/ui/issue-394-rpit-with-lifetime.out | 2 +- charon/tests/ui/issue-45-misc.out | 20 +- .../issue-70-override-provided-method.2.out | 18 +- .../issue-70-override-provided-method.3.out | 12 +- .../ui/issue-70-override-provided-method.out | 12 +- .../tests/ui/issue-72-hash-missing-impl.out | 6 +- .../issue-97-missing-parent-item-clause.out | 2 +- charon/tests/ui/iterator.out | 36 ++-- charon/tests/ui/loops.out | 38 ++-- .../tests/ui/method-impl-generalization.out | 18 +- charon/tests/ui/ml-name-matcher-tests.out | 6 +- .../ui/monomorphization/bound_lifetime.out | 6 +- .../tests/ui/monomorphization/closure-fn.out | 22 +- charon/tests/ui/monomorphization/closures.out | 14 +- .../ui/monomorphization/fn_ptr_generics.out | 2 +- .../ui/monomorphization/fndefs-casts.out | 26 +-- .../monomorphization/global_with_generics.out | 2 +- .../tests/ui/monomorphization/trait_impls.out | 2 +- .../ui/monomorphization/trait_impls_ullbc.out | 4 +- charon/tests/ui/no_nested_borrows.out | 4 +- charon/tests/ui/opacity.out | 6 +- charon/tests/ui/opaque_attribute.out | 4 +- charon/tests/ui/panics.out | 24 +-- charon/tests/ui/plain-panic-str.out | 4 +- charon/tests/ui/polonius_map.out | 20 +- .../ui/predicates-on-late-bound-vars.out | 6 +- charon/tests/ui/projection-index-from-end.out | 2 +- charon/tests/ui/ptr-offset.out | 4 +- charon/tests/ui/raw-boxes.out | 194 +++++++++--------- ...e-inside-impl-with-bound-with-assoc-ty.out | 4 +- charon/tests/ui/rename_attribute.out | 4 +- charon/tests/ui/result-unwrap.out | 2 +- charon/tests/ui/rvalues.out | 10 +- charon/tests/ui/simple-cmp.out | 6 +- charon/tests/ui/simple/array_index.out | 2 +- .../ui/simple/assoc-type-with-fn-bound.out | 2 +- charon/tests/ui/simple/box-into-inner.out | 2 +- .../simple/call-foreign-defaulted-method.out | 2 +- .../call-method-via-supertrait-bound.out | 2 +- .../ui/simple/closure-capture-ref-by-move.out | 6 +- charon/tests/ui/simple/closure-fn.out | 22 +- charon/tests/ui/simple/closure-fnmut.out | 6 +- .../tests/ui/simple/closure-inside-impl.out | 4 +- .../closure-uses-ambient-self-clause.out | 6 +- charon/tests/ui/simple/closure-with-drops.out | 4 +- charon/tests/ui/simple/const-subslice.out | 2 +- charon/tests/ui/simple/drop-string.out | 2 +- charon/tests/ui/simple/dyn-fn.out | 12 +- .../tests/ui/simple/gat-complex-lifetimes.out | 2 +- charon/tests/ui/simple/gat-implied-clause.out | 4 +- .../tests/ui/simple/generic-cast-to-dyn.out | 2 +- .../tests/ui/simple/lending-iterator-gat.out | 28 +-- .../simple/mem-discriminant-from-derive.out | 12 +- charon/tests/ui/simple/multiple-promoteds.out | 8 +- .../ui/simple/nested-closure-trait-ref.out | 6 +- charon/tests/ui/simple/nested-closure.out | 34 +-- charon/tests/ui/simple/pointee_metadata.out | 4 +- .../ui/simple/promoted-closure-no-warns.out | 12 +- charon/tests/ui/simple/promoted-closure.out | 12 +- .../ui/simple/promoted-in-generic-fn.out | 4 +- .../tests/ui/simple/promoted-inside-impl.out | 4 +- .../promoted-literal-addition-overflow.out | 6 +- .../ui/simple/promoted-literal-addition.out | 6 +- charon/tests/ui/simple/promoted-u32-slice.out | 6 +- charon/tests/ui/simple/ptr_to_promoted.out | 4 +- charon/tests/ui/simple/ref-in-const.out | 8 +- charon/tests/ui/simple/slice_index_range.out | 24 +-- charon/tests/ui/simple/trait-alias.out | 2 +- charon/tests/ui/simple/vec-push.out | 8 +- charon/tests/ui/skip-borrowck.out | 18 +- charon/tests/ui/slice-index-range.out | 6 +- charon/tests/ui/statics.out | 20 +- charon/tests/ui/string-literal.out | 4 +- charon/tests/ui/traits.out | 18 +- .../ui/type_inference_is_order_dependent.out | 12 +- charon/tests/ui/ullbc-control-flow.out | 12 +- charon/tests/ui/unsize.out | 12 +- .../ui/unsupported/issue-79-bound-regions.out | 6 +- charon/tests/ui/vtables.out | 84 ++++---- 105 files changed, 811 insertions(+), 798 deletions(-) diff --git a/charon/src/ast/expressions_utils.rs b/charon/src/ast/expressions_utils.rs index d68969434..d8e6f0af2 100644 --- a/charon/src/ast/expressions_utils.rs +++ b/charon/src/ast/expressions_utils.rs @@ -99,6 +99,13 @@ impl Operand { ty: Ty::mk_unit(), })) } + + pub fn ty(&self) -> &Ty { + match self { + Operand::Copy(place) | Operand::Move(place) => place.ty(), + Operand::Const(constant_expr) => &constant_expr.ty, + } + } } impl Rvalue { diff --git a/charon/src/pretty/fmt_with_ctx.rs b/charon/src/pretty/fmt_with_ctx.rs index 9b377b931..f5de356ee 100644 --- a/charon/src/pretty/fmt_with_ctx.rs +++ b/charon/src/pretty/fmt_with_ctx.rs @@ -1211,12 +1211,18 @@ impl FmtWithCtx for Rvalue { BorrowKind::UniqueImmutable => "&uniq ", BorrowKind::Shallow => "&shallow ", }; - write!( - f, - "{borrow_kind}({}, {})", - place.with_ctx(ctx), - ptr_metadata.with_ctx(ctx) - ) + if ptr_metadata.ty().is_unit() { + // Hide unit metadata + write!(f, "{borrow_kind}{}", place.with_ctx(ctx))?; + } else { + write!( + f, + "{borrow_kind}({}, {})", + place.with_ctx(ctx), + ptr_metadata.with_ctx(ctx) + )?; + } + Ok(()) } Rvalue::RawPtr { place, diff --git a/charon/tests/cargo/build-script.out b/charon/tests/cargo/build-script.out index 2d9cb5979..c851748a7 100644 --- a/charon/tests/cargo/build-script.out +++ b/charon/tests/cargo/build-script.out @@ -1,5 +1,15 @@ # Final LLBC before serialization: +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_cargo_build_script::FOO pub fn FOO() -> u8 { diff --git a/charon/tests/cargo/dependencies.out b/charon/tests/cargo/dependencies.out index d95ca15d9..0c23d238d 100644 --- a/charon/tests/cargo/dependencies.out +++ b/charon/tests/cargo/dependencies.out @@ -68,6 +68,16 @@ where [@TraitClause2]: FnOnce, @TraitClause2::Output = T, +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: test_cargo_dependencies::main::silly_incr::closure struct closure {} @@ -111,13 +121,10 @@ fn silly_incr<'_0>(@1: &'_0 mut (u32)) let @2: (); // anonymous local let @3: &'_ mut (u32); // anonymous local let @4: closure; // anonymous local - let @5: (); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@5) - @5 := () - @3 := &two-phase-mut (*(x@1), move (@5)) + @3 := &two-phase-mut *(x@1) storage_live(@4) @4 := closure { } @2 := take<'_, u32, closure>[Sized, Sized, {impl FnOnce<(u32)> for closure}](move (@3), move (@4)) @@ -154,14 +161,6 @@ fn main() let @19: &'_ (u32); // anonymous local let @20: &'_ (u32); // anonymous local let @21: Option>[Sized>]; // anonymous local - let @22: (); // anonymous local - let @23: (); // anonymous local - let @24: (); // anonymous local - let @25: (); // anonymous local - let @26: (); // anonymous local - let @27: (); // anonymous local - let @28: (); // anonymous local - let @29: (); // anonymous local storage_live(kind@15) storage_live(@16) @@ -170,21 +169,13 @@ fn main() storage_live(@19) storage_live(@20) storage_live(@21) - storage_live(@26) - storage_live(@27) - storage_live(@28) - storage_live(@29) storage_live(x@1) x@1 := const (0 : u32) storage_live(@2) storage_live(@3) storage_live(@4) - storage_live(@23) - @23 := () - @4 := &mut (x@1, move (@23)) - storage_live(@22) - @22 := () - @3 := &two-phase-mut (*(@4), move (@22)) + @4 := &mut x@1 + @3 := &two-phase-mut *(@4) @2 := silly_incr<'_>(move (@3)) storage_dead(@3) storage_dead(@4) @@ -192,15 +183,11 @@ fn main() storage_live(@5) storage_live(@6) storage_live(@7) - storage_live(@25) - @25 := () - @7 := &(x@1, move (@25)) + @7 := &x@1 storage_live(@8) storage_live(@9) @9 := const (1 : u32) - storage_live(@24) - @24 := () - @8 := &(@9, move (@24)) + @8 := &@9 @6 := (move (@7), move (@8)) storage_dead(@8) storage_dead(@7) @@ -225,20 +212,12 @@ fn main() @16 := move (kind@15) storage_live(@17) storage_live(@18) - storage_live(@29) - @29 := () - @18 := &(*(left_val@10), move (@29)) - storage_live(@28) - @28 := () - @17 := &(*(@18), move (@28)) + @18 := &*(left_val@10) + @17 := &*(@18) storage_live(@19) storage_live(@20) - storage_live(@27) - @27 := () - @20 := &(*(right_val@11), move (@27)) - storage_live(@26) - @26 := () - @19 := &(*(@20), move (@26)) + @20 := &*(right_val@11) + @19 := &*(@20) storage_live(@21) @21 := Option::None { } panic(core::panicking::assert_failed) diff --git a/charon/tests/cargo/toml.out b/charon/tests/cargo/toml.out index d232a3ad7..359b0e49a 100644 --- a/charon/tests/cargo/toml.out +++ b/charon/tests/cargo/toml.out @@ -45,7 +45,7 @@ fn UNIT_METADATA() return } -const UNIT_METADATA: () = @Fun2() +const UNIT_METADATA: () = @Fun0() // Full name: test_cargo_toml::main fn main() @@ -54,15 +54,12 @@ fn main() let @1: bool; // anonymous local let @2: &'_ (Option[Sized]); // anonymous local let @3: Option[Sized]; // anonymous local - let @4: (); // anonymous local storage_live(@1) storage_live(@2) storage_live(@3) @3 := Option::Some { 0: const (false) } - storage_live(@4) - @4 := () - @2 := &(@3, move (@4)) + @2 := &@3 @1 := is_some<'_, bool>[Sized](move (@2)) storage_dead(@2) storage_dead(@3) diff --git a/charon/tests/cargo/unsafe_.out b/charon/tests/cargo/unsafe_.out index ca26a937a..e6fc4169b 100644 --- a/charon/tests/cargo/unsafe_.out +++ b/charon/tests/cargo/unsafe_.out @@ -12,6 +12,16 @@ pub fn new_const<'a, const N : usize>(@1: &'a (Array<&'static (Str), const N : u // Full name: std::io::stdio::_print pub fn _print<'_0>(@1: Arguments<'_0>) +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: unsafe::main fn main() { @@ -22,8 +32,6 @@ fn main() let @4: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @5: &'_ (Array<&'_ (Str), 1 : usize>); // anonymous local let @6: Array<&'_ (Str), 1 : usize>; // anonymous local - let @7: (); // anonymous local - let @8: (); // anonymous local storage_live(@1) storage_live(@2) @@ -32,12 +40,8 @@ fn main() storage_live(@5) storage_live(@6) @6 := [const ("Hello, world!\n")] - storage_live(@8) - @8 := () - @5 := &(@6, move (@8)) - storage_live(@7) - @7 := () - @4 := &(*(@5), move (@7)) + @5 := &@6 + @4 := &*(@5) @3 := new_const<'_, 1 : usize>(move (@4)) storage_dead(@4) @2 := _print<'_>(move (@3)) diff --git a/charon/tests/cargo/workspace.out b/charon/tests/cargo/workspace.out index bca0b1347..ecf1e05d9 100644 --- a/charon/tests/cargo/workspace.out +++ b/charon/tests/cargo/workspace.out @@ -9,6 +9,16 @@ pub fn random_number() -> u32 return } +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + // Full name: crate2::extra_random_number pub fn extra_random_number() -> u32 { diff --git a/charon/tests/ui/arrays.out b/charon/tests/ui/arrays.out index 50d1be68d..e40f90202 100644 --- a/charon/tests/ui/arrays.out +++ b/charon/tests/ui/arrays.out @@ -309,7 +309,7 @@ where let @2: &'_ (Array); // anonymous local storage_live(@2) - @2 := &(*(s@1), copy (@Global0)) + @2 := &*(s@1) @0 := @ArrayToSliceShared<'_, T, 32 : usize>(move (@2)) storage_dead(@2) return @@ -328,7 +328,7 @@ where storage_live(@2) storage_live(@3) - @3 := &mut (*(s@1), copy (@Global0)) + @3 := &mut *(s@1) @2 := @ArrayToSliceMut<'_, T, 32 : usize>(move (@3)) storage_dead(@3) storage_live(@4) @@ -350,7 +350,7 @@ where storage_live(@2) storage_live(@3) - @3 := &(s@1, copy (@Global0)) + @3 := &s@1 @2 := @ArrayToSliceShared<'_, T, 32 : usize>(move (@3)) storage_dead(@3) @0 := len<'_, T>[@TraitClause0](move (@2)) @@ -371,7 +371,7 @@ where storage_live(@2) storage_live(@3) - @3 := &(*(s@1), copy (@Global0)) + @3 := &*(s@1) @2 := @ArrayToSliceShared<'_, T, 32 : usize>(move (@3)) storage_dead(@3) @0 := len<'_, T>[@TraitClause0](move (@2)) @@ -415,11 +415,11 @@ where storage_live(@4) @4 := copy (i@2) storage_live(@5) - @5 := &(*(s@1), const (@Global0)) + @5 := &*(s@1) storage_live(@6) @6 := @ArrayIndexShared<'_, T, 32 : usize>(move (@5), copy (@4)) - @3 := &(*(@6), copy (@Global0)) - @0 := &(*(@3), copy (@Global0)) + @3 := &*(@6) + @0 := &*(@3) storage_dead(@4) storage_dead(@3) return @@ -438,7 +438,7 @@ pub fn index_array_u32(@1: Array, @2: usize) -> u32 storage_live(@3) @3 := copy (i@2) storage_live(@4) - @4 := &(s@1, const (@Global0)) + @4 := &s@1 storage_live(@5) @5 := @ArrayIndexShared<'_, u32, 32 : usize>(move (@4), copy (@3)) @0 := copy (*(@5)) @@ -458,7 +458,7 @@ pub fn index_array_copy<'_0>(@1: &'_0 (Array)) -> u32 storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &(*(x@1), const (@Global0)) + @3 := &*(x@1) storage_live(@4) @4 := @ArrayIndexShared<'_, u32, 32 : usize>(move (@3), copy (@2)) @0 := copy (*(@4)) @@ -485,12 +485,12 @@ where storage_live(@5) @5 := copy (i@2) storage_live(@6) - @6 := &mut (*(s@1), const (@Global0)) + @6 := &mut *(s@1) storage_live(@7) @7 := @ArrayIndexMut<'_, T, 32 : usize>(move (@6), copy (@5)) - @4 := &mut (*(@7), copy (@Global0)) - @3 := &mut (*(@4), copy (@Global0)) - @0 := &mut (*(@3), copy (@Global0)) + @4 := &mut *(@7) + @3 := &mut *(@4) + @0 := &mut *(@3) storage_dead(@5) storage_dead(@4) storage_dead(@3) @@ -520,8 +520,8 @@ where @6 := &(*(s@1), move (@5)) storage_live(@7) @7 := @SliceIndexShared<'_, T>(move (@6), copy (@4)) - @3 := &(*(@7), copy (@Global0)) - @0 := &(*(@3), copy (@Global0)) + @3 := &*(@7) + @0 := &*(@3) storage_dead(@4) storage_dead(@3) return @@ -555,9 +555,9 @@ where @8 := &mut (*(s@1), move (@7)) storage_live(@9) @9 := @SliceIndexMut<'_, T>(move (@8), copy (@5)) - @4 := &mut (*(@9), copy (@Global0)) - @3 := &mut (*(@4), copy (@Global0)) - @0 := &mut (*(@3), copy (@Global0)) + @4 := &mut *(@9) + @3 := &mut *(@4) + @0 := &mut *(@3) storage_dead(@5) storage_dead(@4) storage_dead(@3) @@ -669,7 +669,7 @@ pub fn array_to_slice_shared_<'_0>(@1: &'_0 (Array)) -> &'_0 (S let @2: &'_ (Array); // anonymous local storage_live(@2) - @2 := &(*(x@1), copy (@Global0)) + @2 := &*(x@1) @0 := @ArrayToSliceShared<'_, u32, 32 : usize>(move (@2)) storage_dead(@2) return @@ -686,7 +686,7 @@ pub fn array_to_slice_mut_<'_0>(@1: &'_0 mut (Array)) -> &'_0 m storage_live(@2) storage_live(@3) - @3 := &mut (*(x@1), copy (@Global0)) + @3 := &mut *(x@1) @2 := @ArrayToSliceMut<'_, u32, 32 : usize>(move (@3)) storage_dead(@3) storage_live(@4) @@ -715,7 +715,7 @@ pub fn array_subslice_shared_<'_0>(@1: &'_0 (Array), @2: usize, storage_live(@4) storage_live(@5) storage_live(@6) - @6 := &(*(x@1), copy (@Global0)) + @6 := &*(x@1) storage_live(@7) storage_live(@8) @8 := copy (y@2) @@ -760,7 +760,7 @@ pub fn array_subslice_mut_<'_0>(@1: &'_0 mut (Array), @2: usize storage_live(@5) storage_live(@6) storage_live(@7) - @7 := &mut (*(x@1), copy (@Global0)) + @7 := &mut *(x@1) storage_live(@8) storage_live(@9) @9 := copy (y@2) @@ -809,8 +809,8 @@ where @5 := &(*(s@1), move (@4)) storage_live(@6) @6 := @SliceIndexShared<'_, T>(move (@5), copy (@3)) - @2 := &(*(@6), copy (@Global0)) - @0 := &(*(@2), copy (@Global0)) + @2 := &*(@6) + @0 := &*(@2) storage_dead(@3) storage_dead(@2) return @@ -832,11 +832,11 @@ where storage_live(@3) @3 := const (0 : usize) storage_live(@4) - @4 := &(*(s@1), const (@Global0)) + @4 := &*(s@1) storage_live(@5) @5 := @ArrayIndexShared<'_, T, 32 : usize>(move (@4), copy (@3)) - @2 := &(*(@5), copy (@Global0)) - @0 := &(*(@2), copy (@Global0)) + @2 := &*(@5) + @0 := &*(@2) storage_dead(@3) storage_dead(@2) return @@ -861,11 +861,11 @@ pub fn index_index_array(@1: Array, 32 : usize>, @2: usiz storage_live(@5) @5 := copy (j@3) storage_live(@6) - @6 := &(s@1, const (@Global0)) + @6 := &s@1 storage_live(@7) @7 := @ArrayIndexShared<'_, Array, 32 : usize>(move (@6), copy (@4)) storage_live(@8) - @8 := &(*(@7), const (@Global0)) + @8 := &*(@7) storage_live(@9) @9 := @ArrayIndexShared<'_, u32, 32 : usize>(move (@8), copy (@5)) @0 := copy (*(@9)) @@ -893,11 +893,11 @@ pub fn update_update_array(@1: Array, 32 : usize>, @2: us storage_live(@5) @5 := copy (j@3) storage_live(@6) - @6 := &mut (s@1, const (@Global0)) + @6 := &mut s@1 storage_live(@7) @7 := @ArrayIndexMut<'_, Array, 32 : usize>(move (@6), copy (@4)) storage_live(@8) - @8 := &mut (*(@7), const (@Global0)) + @8 := &mut *(@7) storage_live(@9) @9 := @ArrayIndexMut<'_, u32, 32 : usize>(move (@8), copy (@5)) *(@9) := const (0 : u32) @@ -924,12 +924,12 @@ pub fn incr_array_self<'_0>(@1: &'_0 mut (Array)) storage_live(@2) @2 := const (0 : usize) storage_live(@6) - @6 := &(*(s@1), const (@Global0)) + @6 := &*(s@1) storage_live(@7) @7 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@6), copy (@2)) @3 := copy (*(@7)) panic.+ const (1 : u32) storage_live(@4) - @4 := &mut (*(s@1), const (@Global0)) + @4 := &mut *(s@1) storage_live(@5) @5 := @ArrayIndexMut<'_, u32, 2 : usize>(move (@4), copy (@2)) *(@5) := move (@3) @@ -1061,8 +1061,8 @@ pub fn const_slice() storage_live(@3) storage_live(@4) @4 := @ArrayRepeat<'_, u32, 2 : usize>(const (0 : u32)) - @3 := &(@4, copy (@Global0)) - @2 := &(*(@3), copy (@Global0)) + @3 := &@4 + @2 := &*(@3) @1 := @ArrayToSliceShared<'_, u32, 2 : usize>(move (@2)) storage_dead(@2) storage_dead(@3) @@ -1113,8 +1113,8 @@ pub fn take_all() storage_live(@7) storage_live(@8) // x passed by address, there is a reborrow here - @8 := &(x@1, copy (@Global0)) - @7 := &(*(@8), copy (@Global0)) + @8 := &x@1 + @7 := &*(@8) @6 := take_array_borrow<'_>(move (@7)) storage_dead(@7) storage_dead(@8) @@ -1124,8 +1124,8 @@ pub fn take_all() storage_live(@11) storage_live(@12) // automatic cast from array to slice (spanning entire array) - @12 := &(x@1, copy (@Global0)) - @11 := &(*(@12), copy (@Global0)) + @12 := &x@1 + @11 := &*(@12) @10 := @ArrayToSliceShared<'_, u32, 2 : usize>(move (@11)) storage_dead(@11) @9 := take_slice<'_>(move (@10)) @@ -1138,8 +1138,8 @@ pub fn take_all() storage_live(@16) // note that both appear as SliceNew expressions, meaning the SliceNew UnOp is overloaded for // mut and non-mut cases - @16 := &mut (x@1, copy (@Global0)) - @15 := &mut (*(@16), copy (@Global0)) + @16 := &mut x@1 + @15 := &mut *(@16) @14 := @ArrayToSliceMut<'_, u32, 2 : usize>(move (@15)) storage_dead(@15) @13 := take_mut_slice<'_>(move (@14)) @@ -1164,7 +1164,7 @@ pub fn index_array(@1: Array) -> u32 storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &(x@1, const (@Global0)) + @3 := &x@1 storage_live(@4) @4 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@3), copy (@2)) @0 := copy (*(@4)) @@ -1184,7 +1184,7 @@ pub fn index_array_borrow<'_0>(@1: &'_0 (Array)) -> u32 storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &(*(x@1), const (@Global0)) + @3 := &*(x@1) storage_live(@4) @4 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@3), copy (@2)) @0 := copy (*(@4)) @@ -1316,8 +1316,8 @@ pub fn index_all() -> u32 storage_live(@14) storage_live(@15) storage_live(@16) - @16 := &(x@1, copy (@Global0)) - @15 := &(*(@16), copy (@Global0)) + @16 := &x@1 + @15 := &*(@16) @14 := index_array_borrow<'_>(move (@15)) storage_dead(@15) @17 := copy (@8) panic.+ copy (@14) @@ -1328,8 +1328,8 @@ pub fn index_all() -> u32 storage_live(@19) storage_live(@20) storage_live(@21) - @21 := &(x@1, copy (@Global0)) - @20 := &(*(@21), copy (@Global0)) + @21 := &x@1 + @20 := &*(@21) @19 := @ArrayToSliceShared<'_, u32, 2 : usize>(move (@20)) storage_dead(@20) @18 := index_slice_u32_0<'_>(move (@19)) @@ -1342,8 +1342,8 @@ pub fn index_all() -> u32 storage_live(@24) storage_live(@25) storage_live(@26) - @26 := &mut (x@1, copy (@Global0)) - @25 := &mut (*(@26), copy (@Global0)) + @26 := &mut x@1 + @25 := &mut *(@26) @24 := @ArrayToSliceMut<'_, u32, 2 : usize>(move (@25)) storage_dead(@25) @23 := index_mut_slice_u32_0<'_>(move (@24)) @@ -1371,7 +1371,7 @@ pub fn update_array(@1: Array) storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &mut (x@1, const (@Global0)) + @3 := &mut x@1 storage_live(@4) @4 := @ArrayIndexMut<'_, u32, 2 : usize>(move (@3), copy (@2)) *(@4) := const (1 : u32) @@ -1393,7 +1393,7 @@ pub fn update_array_mut_borrow<'_0>(@1: &'_0 mut (Array)) storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &mut (*(x@1), const (@Global0)) + @3 := &mut *(x@1) storage_live(@4) @4 := @ArrayIndexMut<'_, u32, 2 : usize>(move (@3), copy (@2)) *(@4) := const (1 : u32) @@ -1465,8 +1465,8 @@ pub fn update_all() storage_live(@6) storage_live(@7) storage_live(@8) - @8 := &mut (x@1, copy (@Global0)) - @7 := &two-phase-mut (*(@8), copy (@Global0)) + @8 := &mut x@1 + @7 := &two-phase-mut *(@8) @6 := update_array_mut_borrow<'_>(move (@7)) storage_dead(@7) storage_dead(@8) @@ -1475,8 +1475,8 @@ pub fn update_all() storage_live(@10) storage_live(@11) storage_live(@12) - @12 := &mut (x@1, copy (@Global0)) - @11 := &mut (*(@12), copy (@Global0)) + @12 := &mut x@1 + @11 := &mut *(@12) @10 := @ArrayToSliceMut<'_, u32, 2 : usize>(move (@11)) storage_dead(@11) @9 := update_mut_slice<'_>(move (@10)) @@ -1511,7 +1511,7 @@ pub fn range_all() storage_live(@5) storage_live(@6) // CONFIRM: there is no way to shrink [T;N] into [T;M] with M for Array}::index_mut<'_, u32, Range[Sized], Slice, 4 : usize>[Sized, Sized[Sized]>, {impl IndexMut for Slice}[Sized], Slice>[Sized, Sized[Sized]>, {impl SliceIndex, Slice> for Range[Sized]}[Sized]]](move (@6), move (@7)) @@ -1549,7 +1549,7 @@ pub fn deref_array_borrow<'_0>(@1: &'_0 (Array)) -> u32 storage_live(@3) @3 := const (0 : usize) storage_live(@4) - @4 := &(x@2, const (@Global0)) + @4 := &x@2 storage_live(@5) @5 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@4), copy (@3)) @0 := copy (*(@5)) @@ -1573,7 +1573,7 @@ pub fn deref_array_mut_borrow<'_0>(@1: &'_0 mut (Array)) -> u32 storage_live(@3) @3 := const (0 : usize) storage_live(@4) - @4 := &(x@2, const (@Global0)) + @4 := &x@2 storage_live(@5) @5 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@4), copy (@3)) @0 := copy (*(@5)) @@ -1885,8 +1885,8 @@ pub fn f0() storage_live(@3) storage_live(@4) @4 := [const (1 : u32), const (2 : u32)] - @3 := &mut (@4, copy (@Global0)) - @2 := &mut (*(@3), copy (@Global0)) + @3 := &mut @4 + @2 := &mut *(@3) s@1 := @ArrayToSliceMut<'_, u32, 2 : usize>(move (@2)) storage_dead(@2) storage_dead(@3) @@ -1923,7 +1923,7 @@ pub fn f1() storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &mut (s@1, const (@Global0)) + @3 := &mut s@1 storage_live(@4) @4 := @ArrayIndexMut<'_, u32, 2 : usize>(move (@3), copy (@2)) *(@4) := const (1 : u32) @@ -1964,7 +1964,7 @@ pub fn f4<'_0>(@1: &'_0 (Array), @2: usize, @3: usize) -> &'_0 storage_live(@4) storage_live(@5) storage_live(@6) - @6 := &(*(x@1), copy (@Global0)) + @6 := &*(x@1) storage_live(@7) storage_live(@8) @8 := copy (y@2) @@ -2014,7 +2014,7 @@ pub fn f3() -> u32 storage_live(@4) @4 := const (0 : usize) storage_live(@14) - @14 := &(a@1, const (@Global0)) + @14 := &a@1 storage_live(@15) @15 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@14), copy (@4)) @3 := copy (*(@15)) @@ -2027,16 +2027,16 @@ pub fn f3() -> u32 storage_live(@6) storage_live(@7) storage_live(@8) - @8 := &(a@1, copy (@Global0)) - @7 := &(*(@8), copy (@Global0)) + @8 := &a@1 + @7 := &*(@8) @6 := @ArrayToSliceShared<'_, u32, 2 : usize>(move (@7)) storage_dead(@7) storage_live(@9) storage_live(@10) storage_live(@11) storage_live(@12) - @12 := &(b@5, copy (@Global0)) - @11 := &(*(@12), copy (@Global0)) + @12 := &b@5 + @11 := &*(@12) @10 := f4<'_>(move (@11), const (16 : usize), const (18 : usize)) storage_live(@13) @13 := ptr_metadata(copy (@10)) @@ -2077,7 +2077,7 @@ pub fn f5<'_0>(@1: &'_0 (Array)) -> u32 storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &(*(x@1), const (@Global0)) + @3 := &*(x@1) storage_live(@4) @4 := @ArrayIndexShared<'_, u32, 32 : usize>(move (@3), copy (@2)) @0 := copy (*(@4)) @@ -2121,8 +2121,8 @@ pub fn ite() storage_live(@5) storage_live(@6) storage_live(@7) - @7 := &mut (x@1, copy (@Global0)) - @6 := &mut (*(@7), copy (@Global0)) + @7 := &mut x@1 + @6 := &mut *(@7) @5 := @ArrayToSliceMut<'_, u32, 2 : usize>(move (@6)) storage_dead(@6) @4 := index_mut_slice_u32_0<'_>(move (@5)) @@ -2133,8 +2133,8 @@ pub fn ite() storage_live(@9) storage_live(@10) storage_live(@11) - @11 := &mut (y@3, copy (@Global0)) - @10 := &mut (*(@11), copy (@Global0)) + @11 := &mut y@3 + @10 := &mut *(@11) @9 := @ArrayToSliceMut<'_, u32, 2 : usize>(move (@10)) storage_dead(@10) @8 := index_mut_slice_u32_0<'_>(move (@9)) @@ -2388,7 +2388,7 @@ fn slice_pattern_1(@1: Array<(), 1 : usize>) storage_live(_named@2) storage_live(@3) - @3 := &(x@1, const (@Global0)) + @3 := &x@1 storage_live(@4) @4 := @ArrayIndexShared<'_, (), 1 : usize>(move (@3), const (0 : usize)) _named@2 := copy (*(@4)) @@ -2417,19 +2417,19 @@ where storage_live(_a@2) storage_live(@9) - @9 := &mut (x@1, const (@Global0)) + @9 := &mut x@1 storage_live(@10) @10 := @ArrayIndexMut<'_, &'_ mut (T), 3 : usize>(move (@9), const (0 : usize)) _a@2 := move (*(@10)) storage_live(_b@3) storage_live(@7) - @7 := &mut (x@1, const (@Global0)) + @7 := &mut x@1 storage_live(@8) @8 := @ArrayIndexMut<'_, &'_ mut (T), 3 : usize>(move (@7), const (1 : usize)) _b@3 := move (*(@8)) storage_live(_c@4) storage_live(@5) - @5 := &mut (x@1, const (@Global0)) + @5 := &mut x@1 storage_live(@6) @6 := @ArrayIndexMut<'_, &'_ mut (T), 3 : usize>(move (@5), const (2 : usize)) _c@4 := move (*(@6)) @@ -2452,10 +2452,10 @@ fn slice_pattern_3<'_0>(@1: &'_0 (Array<(), 1 : usize>)) storage_live(_named@2) storage_live(@3) - @3 := &(*(x@1), const (@Global0)) + @3 := &*(x@1) storage_live(@4) @4 := @ArrayIndexShared<'_, (), 1 : usize>(move (@3), const (0 : usize)) - _named@2 := &(*(@4), copy (@Global0)) + _named@2 := &*(@4) @0 := () storage_dead(_named@2) @0 := () @@ -2495,7 +2495,7 @@ fn slice_pattern_4<'_0>(@1: &'_0 (Slice<()>)) @7 := &(*(x@1), move (@6)) storage_live(@8) @8 := @SliceIndexShared<'_, ()>(move (@7), const (0 : usize)) - _named@5 := &(*(@8), copy (@Global0)) + _named@5 := &*(@8) @0 := () storage_dead(_named@5) @0 := () diff --git a/charon/tests/ui/arrays_const_generics.out b/charon/tests/ui/arrays_const_generics.out index b216fd091..27555f1ee 100644 --- a/charon/tests/ui/arrays_const_generics.out +++ b/charon/tests/ui/arrays_const_generics.out @@ -23,7 +23,7 @@ pub fn index_array_generic(@1: Array, @2: storage_live(@3) @3 := copy (i@2) storage_live(@4) - @4 := &(s@1, const (@Global0)) + @4 := &s@1 storage_live(@5) @5 := @ArrayIndexShared<'_, u32, const N : usize>(move (@4), copy (@3)) @0 := copy (*(@5)) diff --git a/charon/tests/ui/associated-types.out b/charon/tests/ui/associated-types.out index 3b0a2018a..702f9240d 100644 --- a/charon/tests/ui/associated-types.out +++ b/charon/tests/ui/associated-types.out @@ -285,7 +285,7 @@ where storage_live(@4) @4 := copy (x@1) @3 := @TraitClause1::use_item_provided[@TraitClause2](move (@4)) - @2 := &(@3, copy (@Global0)) + @2 := &@3 storage_dead(@4) @0 := @TraitClause2::parent_clause1::parent_clause1::clone<'_>(move (@2)) storage_dead(@2) diff --git a/charon/tests/ui/closure-as-fn.out b/charon/tests/ui/closure-as-fn.out index 5b5181623..a00118792 100644 --- a/charon/tests/ui/closure-as-fn.out +++ b/charon/tests/ui/closure-as-fn.out @@ -121,7 +121,7 @@ fn {impl FnMut<()> for closure}::call_mut<'_0>(@1: &'_0 mut (closure), @2: ()) let @3: &'_ (closure); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<()> for closure}::call<'_>(move (@3), move (args@2)) @0 := () return @@ -136,7 +136,7 @@ fn {impl FnOnce<()> for closure}::call_once(@1: closure, @2: ()) let @3: &'_ mut (closure); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<()> for closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 @0 := () diff --git a/charon/tests/ui/closures.out b/charon/tests/ui/closures.out index 369302e0f..87f180e36 100644 --- a/charon/tests/ui/closures.out +++ b/charon/tests/ui/closures.out @@ -203,7 +203,7 @@ where x@3 := move ((x@1 as variant Option::Some).0) storage_live(@4) storage_live(@5) - @5 := &(f@2, copy (@Global0)) + @5 := &f@2 storage_live(@6) storage_live(@7) @7 := move (x@3) @@ -248,12 +248,12 @@ where }, Option::Some => { storage_live(x@3) - x@3 := &((*(x@1) as variant Option::Some).0, copy (@Global0)) + x@3 := &(*(x@1) as variant Option::Some).0 storage_live(@4) storage_live(@5) @5 := copy (f@2) storage_live(@6) - @6 := &(*(x@3), copy (@Global0)) + @6 := &*(x@3) @4 := (move @5)(move (@6)) storage_dead(@6) storage_dead(@5) @@ -307,7 +307,7 @@ fn {impl FnMut<(u32), u32> for test_crate::test_closure_u32::closure}::call_mut< let @3: &'_ (test_crate::test_closure_u32::closure); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<(u32), u32> for test_crate::test_closure_u32::closure}::call<'_>(move (@3), move (args@2)) return } @@ -321,7 +321,7 @@ fn {impl FnOnce<(u32), u32> for test_crate::test_closure_u32::closure}::call_onc let @3: &'_ mut (test_crate::test_closure_u32::closure); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(u32), u32> for test_crate::test_closure_u32::closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return @@ -437,7 +437,7 @@ fn {impl FnMut<(u32, u32), u32> for test_crate::test_closure_u32s::closure}::cal let @3: &'_ (test_crate::test_closure_u32s::closure); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<(u32, u32), u32> for test_crate::test_closure_u32s::closure}::call<'_>(move (@3), move (args@2)) return } @@ -451,7 +451,7 @@ fn {impl FnOnce<(u32, u32), u32> for test_crate::test_closure_u32s::closure}::ca let @3: &'_ mut (test_crate::test_closure_u32s::closure); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(u32, u32), u32> for test_crate::test_closure_u32s::closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return @@ -558,7 +558,7 @@ fn {impl FnMut<(&'_ (u32)), &'_ (u32)> for test_crate::test_closure_ref_u32::clo let @3: &'_ (test_crate::test_closure_ref_u32::closure); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<(&'_ (u32)), &'_ (u32)> for test_crate::test_closure_ref_u32::closure}::call<'_0, '_>(move (@3), move (args@2)) return } @@ -572,7 +572,7 @@ fn {impl FnOnce<(&'_ (u32)), &'_ (u32)> for test_crate::test_closure_ref_u32::cl let @3: &'_ mut (test_crate::test_closure_ref_u32::closure); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(&'_ (u32)), &'_ (u32)> for test_crate::test_closure_ref_u32::closure}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop] @1 return @@ -613,9 +613,9 @@ pub fn test_closure_ref_u32<'a>(@1: &'a (u32)) -> &'a (u32) storage_live(@5) @5 := copy (f@2) storage_live(@6) - @6 := &(*(x@1), copy (@Global0)) + @6 := &*(x@1) @4 := (move @5)(move (@6)) - @0 := &(*(@4), copy (@Global0)) + @0 := &*(@4) storage_dead(@6) storage_dead(@5) storage_dead(f@2) @@ -685,7 +685,7 @@ where let @3: &'_ (test_crate::test_closure_ref_param::closure[@TraitClause0]); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<(&'_ (T)), &'_ (T)> for test_crate::test_closure_ref_param::closure[@TraitClause0]}::call<'_0, '_, T>[@TraitClause0](move (@3), move (args@2)) return } @@ -701,7 +701,7 @@ where let @3: &'_ mut (test_crate::test_closure_ref_param::closure[@TraitClause0]); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(&'_ (T)), &'_ (T)> for test_crate::test_closure_ref_param::closure[@TraitClause0]}::call_mut<'_0, '_, T>[@TraitClause0](move (@3), move (@2)) drop[Drop[@TraitClause0]>] @1 return @@ -746,9 +746,9 @@ where storage_live(@5) @5 := copy (f@2) storage_live(@6) - @6 := &(*(x@1), copy (@Global0)) + @6 := &*(x@1) @4 := (move @5)(move (@6)) - @0 := &(*(@4), copy (@Global0)) + @0 := &*(@4) storage_dead(@6) storage_dead(@5) storage_dead(f@2) @@ -837,7 +837,7 @@ where let @3: &'_ (test_crate::test_closure_ref_early_bound::closure<'_, T>[@TraitClause0, @TraitClause1]); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<(&'_ (T)), &'_ (T)> for test_crate::test_closure_ref_early_bound::closure<'_, T>[@TraitClause0, @TraitClause1]}::call<'_, '_1, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) return } @@ -854,7 +854,7 @@ where let @3: &'_ mut (test_crate::test_closure_ref_early_bound::closure<'_, T>[@TraitClause0, @TraitClause1]); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(&'_ (T)), &'_ (T)> for test_crate::test_closure_ref_early_bound::closure<'_, T>[@TraitClause0, @TraitClause1]}::call_mut<'_, '_1, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0, @TraitClause1]>] @1 return @@ -901,9 +901,9 @@ where storage_live(@5) @5 := copy (f@2) storage_live(@6) - @6 := &(*(x@1), copy (@Global0)) + @6 := &*(x@1) @4 := (move @5)(move (@6)) - @0 := &(*(@4), copy (@Global0)) + @0 := &*(@4) storage_dead(@6) storage_dead(@5) storage_dead(f@2) @@ -985,7 +985,7 @@ fn {impl FnMut<(u32), u32> for test_crate::test_map_option2::closure}::call_mut< let @3: &'_ (test_crate::test_map_option2::closure); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<(u32), u32> for test_crate::test_map_option2::closure}::call<'_>(move (@3), move (args@2)) return } @@ -999,7 +999,7 @@ fn {impl FnOnce<(u32), u32> for test_crate::test_map_option2::closure}::call_onc let @3: &'_ mut (test_crate::test_map_option2::closure); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(u32), u32> for test_crate::test_map_option2::closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return @@ -1136,7 +1136,7 @@ where let @2: &'_ (T); // anonymous local storage_live(@2) - @2 := &(x@1, copy (@Global0)) + @2 := &x@1 @0 := @TraitClause1::clone<'_>(move (@2)) storage_dead(@2) drop[Drop] x@1 @@ -1237,7 +1237,7 @@ fn {impl FnMut<(u32), u32> for test_crate::test_map_option3::closure}::call_mut< let @3: &'_ (test_crate::test_map_option3::closure); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<(u32), u32> for test_crate::test_map_option3::closure}::call<'_>(move (@3), move (args@2)) return } @@ -1251,7 +1251,7 @@ fn {impl FnOnce<(u32), u32> for test_crate::test_map_option3::closure}::call_onc let @3: &'_ mut (test_crate::test_map_option3::closure); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(u32), u32> for test_crate::test_map_option3::closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return @@ -1335,12 +1335,12 @@ pub fn test_regions<'a>(@1: &'a (u32)) -> u32 storage_live(f@2) f@2 := test_crate::test_regions::closure { } storage_live(@3) - @3 := &(f@2, copy (@Global0)) + @3 := &f@2 storage_live(@4) storage_live(@5) storage_live(@6) - @6 := &(x@1, copy (@Global0)) - @5 := &(*(@6), copy (@Global0)) + @6 := &x@1 + @5 := &*(@6) @4 := (move (@5)) @0 := {impl Fn<(&'_ (&'_ (u32))), u32> for test_crate::test_regions::closure}::call<'_, '_>(move (@3), move (@4)) storage_dead(@5) @@ -1360,7 +1360,7 @@ fn {impl FnMut<(&'_ (&'_ (u32))), u32> for test_crate::test_regions::closure}::c let @3: &'_ (test_crate::test_regions::closure); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<(&'_ (&'_ (u32))), u32> for test_crate::test_regions::closure}::call<'_0, '_>(move (@3), move (args@2)) return } @@ -1374,7 +1374,7 @@ fn {impl FnOnce<(&'_ (&'_ (u32))), u32> for test_crate::test_regions::closure}:: let @3: &'_ mut (test_crate::test_regions::closure); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(&'_ (&'_ (u32))), u32> for test_crate::test_regions::closure}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop] @1 return @@ -1435,7 +1435,7 @@ fn {impl FnMut<(&'_ (&'_ (u32))), u32> for test_crate::test_regions_casted::clos let @3: &'_ (test_crate::test_regions_casted::closure); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<(&'_ (&'_ (u32))), u32> for test_crate::test_regions_casted::closure}::call<'_0, '_>(move (@3), move (args@2)) return } @@ -1449,7 +1449,7 @@ fn {impl FnOnce<(&'_ (&'_ (u32))), u32> for test_crate::test_regions_casted::clo let @3: &'_ mut (test_crate::test_regions_casted::closure); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(&'_ (&'_ (u32))), u32> for test_crate::test_regions_casted::closure}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop] @1 return @@ -1490,8 +1490,8 @@ pub fn test_regions_casted<'a>(@1: &'a (u32)) -> u32 @4 := copy (f@2) storage_live(@5) storage_live(@6) - @6 := &(x@1, copy (@Global0)) - @5 := &(*(@6), copy (@Global0)) + @6 := &x@1 + @5 := &*(@6) @0 := (move @4)(move (@5)) storage_dead(@5) storage_dead(@4) @@ -1587,15 +1587,15 @@ pub fn test_closure_capture(@1: u32, @2: u32) -> u32 storage_live(f@3) storage_live(@4) storage_live(@5) - @5 := &(x@1, copy (@Global0)) + @5 := &x@1 storage_live(@6) - @6 := &(y@2, copy (@Global0)) + @6 := &y@2 @4 := test_crate::test_closure_capture::closure { 0: move (@5), 1: move (@6) } storage_dead(@6) storage_dead(@5) - f@3 := &(@4, copy (@Global0)) + f@3 := &@4 storage_live(@7) - @7 := &(*(f@3), copy (@Global0)) + @7 := &*(f@3) storage_live(@8) @8 := (const (0 : u32)) @0 := {impl Fn<(u32), u32> for test_crate::test_closure_capture::closure<'_0, '_1>}::call<'_, '_, '_>(move (@7), move (@8)) @@ -1615,7 +1615,7 @@ fn {impl FnMut<(u32), u32> for test_crate::test_closure_capture::closure<'_0, '_ let @3: &'_ (test_crate::test_closure_capture::closure<'_0, '_1>); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<(u32), u32> for test_crate::test_closure_capture::closure<'_0, '_1>}::call<'_0, '_1, '_>(move (@3), move (args@2)) return } @@ -1629,7 +1629,7 @@ fn {impl FnOnce<(u32), u32> for test_crate::test_closure_capture::closure<'_0, ' let @3: &'_ mut (test_crate::test_closure_capture::closure<'_0, '_1>); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(u32), u32> for test_crate::test_closure_capture::closure<'_0, '_1>}::call_mut<'_0, '_1, '_>(move (@3), move (@2)) drop[Drop>] @1 return @@ -1686,7 +1686,7 @@ where storage_live(x@3) x@3 := move ((tupled_args@2).0) storage_live(@4) - @4 := &(x@3, copy (@Global0)) + @4 := &x@3 @0 := @TraitClause1::clone<'_>(move (@4)) storage_dead(@4) drop[Drop] x@3 @@ -1711,8 +1711,8 @@ where f@2 := test_crate::test_closure_clone::closure { } storage_live(@3) storage_live(@4) - @4 := &(f@2, copy (@Global0)) - @3 := &(*(@4), copy (@Global0)) + @4 := &f@2 + @3 := &*(@4) storage_live(@5) storage_live(@6) @6 := move (x@1) @@ -1740,7 +1740,7 @@ where let @3: &'_ (test_crate::test_closure_clone::closure[@TraitClause0, @TraitClause1]); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<(T), T> for test_crate::test_closure_clone::closure[@TraitClause0, @TraitClause1]}::call<'_, T>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) return } @@ -1757,7 +1757,7 @@ where let @3: &'_ mut (test_crate::test_closure_clone::closure[@TraitClause0, @TraitClause1]); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(T), T> for test_crate::test_closure_clone::closure[@TraitClause0, @TraitClause1]}::call_mut<'_, T>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0, @TraitClause1]>] @1 return @@ -1830,7 +1830,7 @@ fn {impl FnOnce<(i32), i32> for test_crate::test_array_map::closure}::call_once( let @3: &'_ mut (test_crate::test_array_map::closure); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(i32), i32> for test_crate::test_array_map::closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return @@ -1919,19 +1919,19 @@ fn test_fnmut_with_ref() sum@1 := const (0 : usize) storage_live(closure@2) storage_live(@3) - @3 := &mut (sum@1, copy (@Global0)) + @3 := &mut sum@1 closure@2 := test_crate::test_fnmut_with_ref::closure { 0: move (@3) } storage_dead(@3) storage_live(@4) storage_live(@5) - @5 := &mut (closure@2, copy (@Global0)) + @5 := &mut closure@2 storage_live(@6) storage_live(@7) storage_live(@8) storage_live(@9) @9 := const (15 : usize) - @8 := &(@9, copy (@Global0)) - @7 := &(*(@8), copy (@Global0)) + @8 := &@9 + @7 := &*(@8) @6 := (move (@7)) @4 := {impl FnMut<(&'_ (usize)), ()> for test_crate::test_fnmut_with_ref::closure<'_0>}::call_mut<'_, '_, '_>(move (@5), move (@6)) storage_dead(@7) @@ -1956,7 +1956,7 @@ fn {impl FnOnce<(&'_ (usize)), ()> for test_crate::test_fnmut_with_ref::closure< let @3: &'_ mut (test_crate::test_fnmut_with_ref::closure<'_0>); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(&'_ (usize)), ()> for test_crate::test_fnmut_with_ref::closure<'_0>}::call_mut<'_0, '_1, '_>(move (@3), move (@2)) drop[Drop>] @1 @0 := () diff --git a/charon/tests/ui/closures_with_where.out b/charon/tests/ui/closures_with_where.out index 7e7aaa28a..c1754e923 100644 --- a/charon/tests/ui/closures_with_where.out +++ b/charon/tests/ui/closures_with_where.out @@ -138,7 +138,7 @@ where let @3: &'_ mut (closure[@TraitClause0, @TraitClause1]); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(usize)> for closure[@TraitClause0, @TraitClause1]}::call_mut<'_, T, const K : usize>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0, @TraitClause1]>] @1 return diff --git a/charon/tests/ui/comments.out b/charon/tests/ui/comments.out index 59169ab0c..525c7c6c9 100644 --- a/charon/tests/ui/comments.out +++ b/charon/tests/ui/comments.out @@ -432,14 +432,14 @@ fn foo() // `assert_eq` @19 := const (9 : usize) storage_live(@34) - @34 := &(a@15, const (@Global0)) + @34 := &a@15 storage_live(@35) @35 := @ArrayIndexShared<'_, u32, 10 : usize>(move (@34), copy (@19)) - @18 := &(*(@35), copy (@Global0)) + @18 := &*(@35) storage_live(@20) storage_live(@21) @21 := const (9 : u32) - @20 := &(@21, copy (@Global0)) + @20 := &@21 @17 := (move (@18), move (@20)) storage_dead(@20) storage_dead(@18) @@ -464,12 +464,12 @@ fn foo() @28 := move (kind@27) storage_live(@29) storage_live(@30) - @30 := &(*(left_val@22), copy (@Global0)) - @29 := &(*(@30), copy (@Global0)) + @30 := &*(left_val@22) + @29 := &*(@30) storage_live(@31) storage_live(@32) - @32 := &(*(right_val@23), copy (@Global0)) - @31 := &(*(@32), copy (@Global0)) + @32 := &*(right_val@23) + @31 := &*(@32) storage_live(@33) @33 := Option::None { } panic(core::panicking::assert_failed) diff --git a/charon/tests/ui/constants.out b/charon/tests/ui/constants.out index e568d3dab..5617d5378 100644 --- a/charon/tests/ui/constants.out +++ b/charon/tests/ui/constants.out @@ -392,7 +392,7 @@ pub fn S2() -> u32 storage_live(@1) storage_live(@2) @3 := () - @4 := &(S1, move (@3)) + @4 := &S1 @2 := move (@4) @1 := copy (*(@2)) @0 := incr(move (@1)) diff --git a/charon/tests/ui/demo.out b/charon/tests/ui/demo.out index 9d0b3f253..5f1df5b22 100644 --- a/charon/tests/ui/demo.out +++ b/charon/tests/ui/demo.out @@ -47,16 +47,16 @@ where @6 := copy (b@1) if move (@6) { storage_live(@7) - @7 := &mut (*(x@2), copy (@Global0)) - @5 := &mut (*(@7), copy (@Global0)) + @7 := &mut *(x@2) + @5 := &mut *(@7) storage_dead(@7) } else { - @5 := &mut (*(y@3), copy (@Global0)) + @5 := &mut *(y@3) } - @4 := &mut (*(@5), copy (@Global0)) + @4 := &mut *(@5) storage_dead(@6) - @0 := &mut (*(@4), copy (@Global0)) + @0 := &mut *(@4) storage_dead(@5) storage_dead(@4) return @@ -150,8 +150,8 @@ pub fn use_incr() storage_live(@2) storage_live(@3) storage_live(@4) - @4 := &mut (x@1, copy (@Global0)) - @3 := &two-phase-mut (*(@4), copy (@Global0)) + @4 := &mut x@1 + @3 := &two-phase-mut *(@4) @2 := test_crate::incr<'_>(move (@3)) storage_dead(@3) storage_dead(@4) @@ -159,8 +159,8 @@ pub fn use_incr() storage_live(@5) storage_live(@6) storage_live(@7) - @7 := &mut (x@1, copy (@Global0)) - @6 := &two-phase-mut (*(@7), copy (@Global0)) + @7 := &mut x@1 + @6 := &two-phase-mut *(@7) @5 := test_crate::incr<'_>(move (@6)) storage_dead(@6) storage_dead(@7) @@ -168,8 +168,8 @@ pub fn use_incr() storage_live(@8) storage_live(@9) storage_live(@10) - @10 := &mut (x@1, copy (@Global0)) - @9 := &two-phase-mut (*(@10), copy (@Global0)) + @10 := &mut x@1 + @9 := &two-phase-mut *(@10) @8 := test_crate::incr<'_>(move (@9)) storage_dead(@9) storage_dead(@10) @@ -220,22 +220,22 @@ where }, } storage_live(x@3) - x@3 := &((*(l@1) as variant CList::CCons).0, copy (@Global0)) + x@3 := &(*(l@1) as variant CList::CCons).0 storage_live(tl@4) - tl@4 := &((*(l@1) as variant CList::CCons).1, copy (@Global0)) + tl@4 := &(*(l@1) as variant CList::CCons).1 storage_live(@5) storage_live(@6) @6 := copy (i@2) @5 := move (@6) == const (0 : u32) if move (@5) { storage_dead(@6) - @0 := &(*(x@3), copy (@Global0)) + @0 := &*(x@3) } else { storage_dead(@6) storage_live(@7) storage_live(@8) - @8 := &(*(*(tl@4)), copy (@Global0)) + @8 := &*(*(tl@4)) storage_live(@9) storage_live(@10) @10 := copy (i@2) @@ -243,7 +243,7 @@ where @9 := move (@11) storage_dead(@10) @7 := list_nth<'_, T>[@TraitClause0](move (@8), move (@9)) - @0 := &(*(@7), copy (@Global0)) + @0 := &*(@7) storage_dead(@9) storage_dead(@8) storage_dead(@7) @@ -293,9 +293,9 @@ where }, } storage_live(x@5) - x@5 := &mut ((*(l@1) as variant CList::CCons).0, copy (@Global0)) + x@5 := &mut (*(l@1) as variant CList::CCons).0 storage_live(tl@6) - tl@6 := &mut ((*(l@1) as variant CList::CCons).1, copy (@Global0)) + tl@6 := &mut (*(l@1) as variant CList::CCons).1 storage_live(@7) storage_live(@8) storage_live(@9) @@ -305,15 +305,15 @@ where if move (@9) { storage_dead(@10) storage_live(@11) - @11 := &mut (*(x@5), copy (@Global0)) - @8 := &mut (*(@11), copy (@Global0)) + @11 := &mut *(x@5) + @8 := &mut *(@11) storage_dead(@11) } else { storage_dead(@10) storage_live(@12) storage_live(@13) - @13 := &two-phase-mut (*(*(tl@6)), copy (@Global0)) + @13 := &two-phase-mut *(*(tl@6)) storage_live(@14) storage_live(@15) @15 := copy (i@2) @@ -321,20 +321,20 @@ where @14 := move (@16) storage_dead(@15) @12 := list_nth_mut<'_, T>[@TraitClause0](move (@13), move (@14)) - @8 := &mut (*(@12), copy (@Global0)) + @8 := &mut *(@12) storage_dead(@14) storage_dead(@13) storage_dead(@12) } - @7 := &mut (*(@8), copy (@Global0)) + @7 := &mut *(@8) storage_dead(@9) - @4 := &mut (*(@7), copy (@Global0)) + @4 := &mut *(@7) storage_dead(@8) storage_dead(@7) storage_dead(tl@6) storage_dead(x@5) - @3 := &mut (*(@4), copy (@Global0)) - @0 := &mut (*(@3), copy (@Global0)) + @3 := &mut *(@4) + @0 := &mut *(@3) storage_dead(@4) storage_dead(@3) return @@ -371,9 +371,9 @@ where match *(l@1) { CList::CCons => { storage_live(x@4) - x@4 := &mut ((*(l@1) as variant CList::CCons).0, copy (@Global0)) + x@4 := &mut (*(l@1) as variant CList::CCons).0 storage_live(tl@5) - tl@5 := &mut ((*(l@1) as variant CList::CCons).1, copy (@Global0)) + tl@5 := &mut (*(l@1) as variant CList::CCons).1 storage_live(@6) storage_live(@7) storage_live(@8) @@ -388,7 +388,7 @@ where @9 := copy (i@2) panic.- const (1 : u32) i@2 := move (@9) storage_live(@10) - @10 := &mut (*(*(tl@5)), copy (@Global0)) + @10 := &mut *(*(tl@5)) l@1 := move (@10) storage_dead(@10) storage_dead(tl@5) @@ -396,7 +396,7 @@ where continue 0 } storage_dead(@8) - @0 := &mut (*(x@4), copy (@Global0)) + @0 := &mut *(x@4) storage_dead(@7) storage_dead(@6) storage_dead(tl@5) @@ -480,12 +480,12 @@ where match *(l@1) { CList::CCons => { storage_live(tl@4) - tl@4 := &mut ((*(l@1) as variant CList::CCons).1, copy (@Global0)) + tl@4 := &mut (*(l@1) as variant CList::CCons).1 storage_live(@5) storage_live(@6) - @6 := &two-phase-mut (*(*(tl@4)), copy (@Global0)) + @6 := &two-phase-mut *(*(tl@4)) @5 := list_tail<'_, T>[@TraitClause0](move (@6)) - @3 := &mut (*(@5), copy (@Global0)) + @3 := &mut *(@5) storage_dead(@6) storage_dead(@5) storage_dead(tl@4) @@ -494,8 +494,8 @@ where @3 := move (l@1) }, } - @2 := &mut (*(@3), copy (@Global0)) - @0 := &mut (*(@2), copy (@Global0)) + @2 := &mut *(@3) + @0 := &mut *(@2) storage_dead(@3) storage_dead(@2) return @@ -549,7 +549,7 @@ where let @2: &'_ mut (T); // anonymous local storage_live(@2) - @2 := &two-phase-mut (*(cnt@1), copy (@Global0)) + @2 := &two-phase-mut *(cnt@1) @0 := @TraitClause1::incr<'_>(move (@2)) storage_dead(@2) return diff --git a/charon/tests/ui/dictionary_passing_style_woes.out b/charon/tests/ui/dictionary_passing_style_woes.out index 34c3729a5..3666c56a0 100644 --- a/charon/tests/ui/dictionary_passing_style_woes.out +++ b/charon/tests/ui/dictionary_passing_style_woes.out @@ -173,7 +173,7 @@ where let @2: &'_ (T); // anonymous local storage_live(@2) - @2 := &(x@1, copy (@Global0)) + @2 := &x@1 @0 := @TraitClause1::parent_clause1::method<'_>(move (@2)) storage_dead(@2) drop[Drop] x@1 @@ -191,7 +191,7 @@ where let @2: &'_ (T); // anonymous local storage_live(@2) - @2 := &(x@1, copy (@Global0)) + @2 := &x@1 @0 := @TraitClause1::parent_clause1::method<'_>(move (@2)) storage_dead(@2) drop[Drop] x@1 diff --git a/charon/tests/ui/dyn-with-diamond-supertraits.out b/charon/tests/ui/dyn-with-diamond-supertraits.out index aa4e4fdfd..4437390be 100644 --- a/charon/tests/ui/dyn-with-diamond-supertraits.out +++ b/charon/tests/ui/dyn-with-diamond-supertraits.out @@ -244,7 +244,7 @@ fn {impl Right for i32}::right_method<'_0>(@1: &'_0 (i32)) -> i32 storage_dead(@4) storage_live(@6) storage_live(@7) - @7 := &(*(self@1), copy (@Global0)) + @7 := &*(self@1) @6 := {impl Internal for i32}::internal_method<'_>(move (@7)) storage_dead(@7) @8 := copy (@3) panic.+ copy (@6) @@ -253,7 +253,7 @@ fn {impl Right for i32}::right_method<'_0>(@1: &'_0 (i32)) -> i32 storage_dead(@3) storage_live(@9) storage_live(@10) - @10 := &(*(self@1), copy (@Global0)) + @10 := &*(self@1) @9 := {impl Super for i32}::super_method<'_>(move (@10), const (10 : i32)) storage_dead(@10) @11 := copy (@2) panic.+ copy (@9) @@ -287,12 +287,12 @@ fn {impl Join for i32}::join_method<'_0>(@1: &'_0 (i32)) -> (i32, i32) storage_live(@2) storage_live(@3) - @3 := &(*(self@1), copy (@Global0)) + @3 := &*(self@1) @2 := {impl Left for i32}::left_method<'_>(move (@3)) storage_dead(@3) storage_live(@4) storage_live(@5) - @5 := &(*(self@1), copy (@Global0)) + @5 := &*(self@1) @4 := {impl Right for i32}::right_method<'_>(move (@5)) storage_dead(@5) @0 := (move (@2), move (@4)) @@ -315,9 +315,9 @@ fn {impl Join for i32}::{vtable}() -> test_crate::Join::{vtable} for i32}::{vtable}, move (@3)) + @4 := &{impl Right for i32}::{vtable} ret@0 := test_crate::Join::{vtable} { size: const (Opaque(unknown size)), align: const (Opaque(unknown align)), drop: const (Opaque(unknown drop)), method_join_method: const ({impl Join for i32}::join_method), super_trait_0: const (Opaque(missing supertrait vtable)), super_trait_1: move (@2), super_trait_2: move (@4) } return } @@ -352,8 +352,8 @@ fn main() storage_live(@3) storage_live(@4) @4 := const (97 : i32) - @3 := &(@4, copy (@Global0)) - @2 := &(*(@3), copy (@Global0)) + @3 := &@4 + @2 := &*(@3) v@1 := unsize_cast<&'_ (i32), &'_ ((dyn exists<_dyn> [@TraitClause0]: Join<_dyn, i32> + _dyn : '_ + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause2::Right = i32 + @TraitClause1_0::parent_clause1::Left = i32)), {impl Join for i32}>(move (@2)) storage_dead(@2) storage_dead(@3) diff --git a/charon/tests/ui/external.out b/charon/tests/ui/external.out index 050e66bc1..27ac7cebc 100644 --- a/charon/tests/ui/external.out +++ b/charon/tests/ui/external.out @@ -239,9 +239,9 @@ where let @4: &'_ mut (T); // anonymous local storage_live(@3) - @3 := &two-phase-mut (*(x@1), copy (@Global0)) + @3 := &two-phase-mut *(x@1) storage_live(@4) - @4 := &two-phase-mut (*(y@2), copy (@Global0)) + @4 := &two-phase-mut *(y@2) @0 := core::mem::swap<'_, '_, T>[@TraitClause0](move (@3), move (@4)) storage_dead(@4) storage_dead(@3) @@ -279,7 +279,7 @@ pub fn test_vec_push() v@1 := alloc::vec::{Vec[@TraitClause0, Sized]}::new[Sized]() storage_live(@2) storage_live(@3) - @3 := &two-phase-mut (v@1, copy (@Global0)) + @3 := &two-phase-mut v@1 @2 := push<'_, u32, Global>[Sized, Sized](move (@3), const (0 : u32)) storage_dead(@3) storage_dead(@2) @@ -298,7 +298,7 @@ pub fn use_get<'_0>(@1: &'_0 (Cell[MetaSized])) -> u32 let @2: &'_ (Cell[MetaSized]); // anonymous local storage_live(@2) - @2 := &(*(rc@1), copy (@Global0)) + @2 := &*(rc@1) @0 := get<'_, u32>[Sized, {impl Copy for u32}](move (@2)) storage_dead(@2) return @@ -316,7 +316,7 @@ pub fn incr<'_0>(@1: &'_0 mut (Cell[MetaSized])) storage_live(@4) storage_live(@2) storage_live(@3) - @3 := &two-phase-mut (*(rc@1), copy (@Global0)) + @3 := &two-phase-mut *(rc@1) @2 := get_mut<'_, u32>[MetaSized](move (@3)) storage_dead(@3) @4 := copy (*(@2)) panic.+ const (1 : u32) diff --git a/charon/tests/ui/gosim-demo.out b/charon/tests/ui/gosim-demo.out index b53e32752..979d3971d 100644 --- a/charon/tests/ui/gosim-demo.out +++ b/charon/tests/ui/gosim-demo.out @@ -555,8 +555,8 @@ where storage_live(@6) storage_live(@7) storage_live(@8) - @8 := &mut (iter@4, copy (@Global0)) - @7 := &two-phase-mut (*(@8), copy (@Global0)) + @8 := &mut iter@4 + @7 := &two-phase-mut *(@8) @6 := {impl Iterator for Iter<'a, T>[@TraitClause0]}::next<'_, '_, T>[@TraitClause0](move (@7)) storage_dead(@7) match @6 { @@ -573,8 +573,8 @@ where storage_live(@14) storage_live(@15) storage_live(@16) - @16 := &(x@9, copy (@Global0)) - @15 := &(*(@16), copy (@Global0)) + @16 := &x@9 + @15 := &*(@16) @14 := new_debug<'_, '_, &'_ (T)>[Sized<&'_ (T)>, {impl Debug for &'_0 (T)}<'_, T>[@TraitClause1]](move (@15)) storage_dead(@15) args@13 := [move (@14)] @@ -583,12 +583,12 @@ where storage_live(@18) storage_live(@19) @19 := [const ("- "), const ("\n")] - @18 := &(@19, copy (@Global0)) - @17 := &(*(@18), copy (@Global0)) + @18 := &@19 + @17 := &*(@18) storage_live(@20) storage_live(@21) - @21 := &(args@13, copy (@Global0)) - @20 := &(*(@21), copy (@Global0)) + @21 := &args@13 + @20 := &*(@21) @12 := new_v1<'_, 2 : usize, 1 : usize>(move (@17), move (@20)) storage_dead(@21) storage_dead(@20) @@ -635,8 +635,8 @@ fn main() storage_live(@4) storage_live(@5) @5 := [const (0 : i32), const (1 : i32), const (2 : i32)] - @4 := &(@5, copy (@Global0)) - @3 := &(*(@4), copy (@Global0)) + @4 := &@5 + @3 := &*(@4) @2 := @ArrayToSliceShared<'_, i32, 3 : usize>(move (@3)) storage_dead(@3) @1 := debug_slice<'_, i32>[Sized, {impl Debug for i32}](move (@2)) diff --git a/charon/tests/ui/impl-trait.out b/charon/tests/ui/impl-trait.out index 436c3aa89..837aa4689 100644 --- a/charon/tests/ui/impl-trait.out +++ b/charon/tests/ui/impl-trait.out @@ -130,8 +130,8 @@ pub fn {impl Foo for ()}::get_ty<'_0>(@1: &'_0 (())) -> &'_0 (u32) storage_live(@2) storage_live(@3) @3 := const (42 : u32) - @2 := &(@3, copy (@Global0)) - @0 := &(*(@2), copy (@Global0)) + @2 := &@3 + @0 := &*(@2) storage_dead(@3) storage_dead(@2) return @@ -173,9 +173,9 @@ fn use_foo() storage_live(@3) storage_live(@4) storage_live(@5) - @5 := &(foo@1, copy (@Global0)) + @5 := &foo@1 @4 := {impl Foo for ()}::get_ty<'_>(move (@5)) - @3 := &(*(@4), copy (@Global0)) + @3 := &*(@4) storage_dead(@5) @2 := {impl Clone for u32}::clone<'_>(move (@3)) storage_dead(@3) @@ -251,7 +251,7 @@ where storage_live(@3) storage_live(@4) storage_live(@5) - @5 := &(foo@1, copy (@Global0)) + @5 := &foo@1 @4 := @TraitClause1::parent_clause2::get_ty<'_>(move (@5)) storage_live(@6) @6 := ptr_metadata(copy (@4)) @@ -309,7 +309,7 @@ where storage_live(x@3) x@3 := move ((tupled_args@2).0) storage_live(@4) - @4 := &(*(x@3), copy (@Global0)) + @4 := &*(x@3) @0 := WrapClone { 0: move (@4) } storage_dead(@4) return @@ -351,8 +351,8 @@ pub fn use_wrap() storage_live(@6) storage_live(@7) @7 := const (42 : u32) - @6 := &(@7, copy (@Global0)) - @5 := &(*(@6), copy (@Global0)) + @6 := &@7 + @5 := &*(@6) @4 := (move (@5)) @2 := {impl FnOnce<(&'_ (U))> for closure[@TraitClause0]}::call_once<'_, u32>[Sized](move (@3), move (@4)) storage_dead(@5) diff --git a/charon/tests/ui/issue-120-bare-discriminant-read.out b/charon/tests/ui/issue-120-bare-discriminant-read.out index 87e799d09..821d7ed68 100644 --- a/charon/tests/ui/issue-120-bare-discriminant-read.out +++ b/charon/tests/ui/issue-120-bare-discriminant-read.out @@ -70,7 +70,7 @@ where let @2: &'_ (Option[@TraitClause0]); // anonymous local storage_live(@2) - @2 := &(*(opt@1), copy (@Global0)) + @2 := &*(opt@1) @0 := @discriminant(*(@2)) storage_dead(@2) return @@ -90,8 +90,8 @@ where storage_live(@2) storage_live(@3) storage_live(@4) - @4 := &(opt@1, copy (@Global0)) - @3 := &(*(@4), copy (@Global0)) + @4 := &opt@1 + @3 := &*(@4) @2 := discriminant_value<'_, T>[@TraitClause0](move (@3)) storage_dead(@3) @0 := move (@2) != const (0 : isize) diff --git a/charon/tests/ui/issue-297-cfg.out b/charon/tests/ui/issue-297-cfg.out index b9edba5b8..713bf8549 100644 --- a/charon/tests/ui/issue-297-cfg.out +++ b/charon/tests/ui/issue-297-cfg.out @@ -674,8 +674,8 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@10) storage_live(@11) storage_live(@12) - @12 := &mut (iter@8, copy (@Global0)) - @11 := &two-phase-mut (*(@12), copy (@Global0)) + @12 := &mut iter@8 + @11 := &two-phase-mut *(@12) @10 := {impl Iterator for Chunks<'a, T>[@TraitClause0]}::next<'_, '_, u8>[Sized](move (@11)) storage_dead(@11) match @10 { diff --git a/charon/tests/ui/issue-320-slice-pattern.out b/charon/tests/ui/issue-320-slice-pattern.out index 53894fb44..02330e437 100644 --- a/charon/tests/ui/issue-320-slice-pattern.out +++ b/charon/tests/ui/issue-320-slice-pattern.out @@ -29,19 +29,19 @@ fn slice_pat1() array@1 := @ArrayRepeat<'_, i32, 4 : usize>(const (0 : i32)) storage_live(_a@2) storage_live(@9) - @9 := &(array@1, const (@Global0)) + @9 := &array@1 storage_live(@10) @10 := @ArrayIndexShared<'_, i32, 4 : usize>(move (@9), const (0 : usize)) _a@2 := copy (*(@10)) storage_live(_b@3) storage_live(@7) - @7 := &(array@1, const (@Global0)) + @7 := &array@1 storage_live(@8) @8 := @ArraySubSliceShared<'_, i32, 4 : usize>(move (@7), const (1 : usize), const (3 : usize)) _b@3 := copy (*(@8)) storage_live(_c@4) storage_live(@5) - @5 := &(array@1, const (@Global0)) + @5 := &array@1 storage_live(@6) @6 := @ArrayIndexShared<'_, i32, 4 : usize>(move (@5), const (3 : usize)) _c@4 := copy (*(@6)) @@ -75,27 +75,27 @@ fn slice_pat2() storage_live(@2) storage_live(@3) @3 := @ArrayRepeat<'_, i32, 4 : usize>(const (0 : i32)) - @2 := &(@3, copy (@Global0)) - array_ref@1 := &(*(@2), copy (@Global0)) + @2 := &@3 + array_ref@1 := &*(@2) storage_dead(@2) storage_live(_a@4) storage_live(@11) - @11 := &(*(array_ref@1), const (@Global0)) + @11 := &*(array_ref@1) storage_live(@12) @12 := @ArrayIndexShared<'_, i32, 4 : usize>(move (@11), const (0 : usize)) - _a@4 := &(*(@12), copy (@Global0)) + _a@4 := &*(@12) storage_live(_b@5) storage_live(@9) - @9 := &(*(array_ref@1), const (@Global0)) + @9 := &*(array_ref@1) storage_live(@10) @10 := @ArraySubSliceShared<'_, i32, 4 : usize>(move (@9), const (1 : usize), const (3 : usize)) - _b@5 := &(*(@10), copy (@Global0)) + _b@5 := &*(@10) storage_live(_c@6) storage_live(@7) - @7 := &(*(array_ref@1), const (@Global0)) + @7 := &*(array_ref@1) storage_live(@8) @8 := @ArrayIndexShared<'_, i32, 4 : usize>(move (@7), const (3 : usize)) - _c@6 := &(*(@8), copy (@Global0)) + _c@6 := &*(@8) @0 := () storage_dead(_c@6) storage_dead(_b@5) @@ -146,8 +146,8 @@ fn slice_pat3() storage_live(@3) storage_live(@4) @4 := @ArrayRepeat<'_, i32, 4 : usize>(const (0 : i32)) - @3 := &(@4, copy (@Global0)) - @2 := &(*(@3), copy (@Global0)) + @3 := &@4 + @2 := &*(@3) slice@1 := @ArrayToSliceShared<'_, i32, 4 : usize>(move (@2)) storage_dead(@2) storage_dead(@3) @@ -171,7 +171,7 @@ fn slice_pat3() @26 := &(*(slice@1), move (@25)) storage_live(@27) @27 := @SliceIndexShared<'_, i32>(move (@26), const (0 : usize)) - _a@5 := &(*(@27), copy (@Global0)) + _a@5 := &*(@27) storage_live(@11) @11 := len(*(slice@1)) storage_live(@12) @@ -204,7 +204,7 @@ fn slice_pat3() storage_dead(@17) storage_live(@19) @19 := @SliceIndexShared<'_, i32>(move (@16), copy (@18)) - _c@7 := &(*(@19), copy (@Global0)) + _c@7 := &*(@19) @0 := () storage_dead(_c@7) storage_dead(_b@6) diff --git a/charon/tests/ui/issue-323-closure-borrow.out b/charon/tests/ui/issue-323-closure-borrow.out index edde2dc62..67a985fed 100644 --- a/charon/tests/ui/issue-323-closure-borrow.out +++ b/charon/tests/ui/issue-323-closure-borrow.out @@ -106,7 +106,7 @@ fn new<'_0>(@1: &'_0 mut (Rng)) storage_live(@2) storage_live(@3) - @3 := &uniq (*(rng@1), copy (@Global0)) + @3 := &uniq *(rng@1) @2 := closure { 0: move (@3) } storage_dead(@3) storage_dead(@2) @@ -126,7 +126,7 @@ fn {impl FnMut<()> for closure<'_0>}::call_mut<'_0, '_1>(@1: &'_1 mut (closure<' storage_live(@3) storage_live(@4) - @4 := &two-phase-mut (*((*(@1)).0), copy (@Global0)) + @4 := &two-phase-mut *((*(@1)).0) @3 := next_u64<'_>(move (@4)) storage_dead(@4) storage_dead(@3) @@ -144,7 +144,7 @@ fn {impl FnOnce<()> for closure<'_0>}::call_once<'_0>(@1: closure<'_0>, @2: ()) let @3: &'_ mut (closure<'_0>); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<()> for closure<'_0>}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop>] @1 @0 := () diff --git a/charon/tests/ui/issue-378-ctor-as-fn.out b/charon/tests/ui/issue-378-ctor-as-fn.out index c984560f0..4909b5ac3 100644 --- a/charon/tests/ui/issue-378-ctor-as-fn.out +++ b/charon/tests/ui/issue-378-ctor-as-fn.out @@ -94,7 +94,7 @@ fn {impl Drop for Foo}::drop<'_0>(@1: &'_0 mut (Foo)) let @2: &'_ mut (Foo); // anonymous local storage_live(@2) - @2 := &mut (*(@1), copy (@Global0)) + @2 := &mut *(@1) drop[{impl Drop for String}] (*(@2)).1 @0 := () return @@ -202,8 +202,8 @@ fn main() storage_live(@16) storage_live(@17) @17 := const (42 : i32) - @16 := &(@17, copy (@Global0)) - @15 := &(*(@16), copy (@Global0)) + @16 := &@17 + @15 := &*(@16) @13 := Variant<'_, i32>[Sized](move (@15)) storage_dead(@15) storage_dead(@14) diff --git a/charon/tests/ui/issue-394-rpit-with-lifetime.out b/charon/tests/ui/issue-394-rpit-with-lifetime.out index 4c7358a77..ea15b7783 100644 --- a/charon/tests/ui/issue-394-rpit-with-lifetime.out +++ b/charon/tests/ui/issue-394-rpit-with-lifetime.out @@ -123,7 +123,7 @@ fn {impl FnOnce<()> for closure<'_>}::call_once<'a>(@1: closure<'_>, @2: ()) -> let @3: &'_ mut (closure<'_>); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<()> for closure<'_>}::call_mut<'_, '_>(move (@3), move (@2)) drop[Drop>] @1 return diff --git a/charon/tests/ui/issue-45-misc.out b/charon/tests/ui/issue-45-misc.out index 961c9ef6a..db53034d9 100644 --- a/charon/tests/ui/issue-45-misc.out +++ b/charon/tests/ui/issue-45-misc.out @@ -572,7 +572,7 @@ fn {impl FnOnce<(i32)> for closure}::call_once(@1: closure, @2: (i32)) -> i32 let @3: &'_ mut (closure); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(i32)> for closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return @@ -661,8 +661,8 @@ fn cbd(@1: Array) storage_live(@6) storage_live(@7) storage_live(@8) - @8 := &mut (iter@4, copy (@Global0)) - @7 := &two-phase-mut (*(@8), copy (@Global0)) + @8 := &mut iter@4 + @7 := &two-phase-mut *(@8) @6 := {impl Iterator for Range[@TraitClause0]}::next<'_, u8>[Sized, {impl Step for u8}](move (@7)) storage_dead(@7) match @6 { @@ -677,7 +677,7 @@ fn cbd(@1: Array) storage_live(@11) @11 := const (0 : usize) storage_live(@12) - @12 := &mut (prf_input@1, const (@Global0)) + @12 := &mut prf_input@1 storage_live(@13) @13 := @ArrayIndexMut<'_, u8, 33 : usize>(move (@12), copy (@11)) *(@13) := move (@10) @@ -768,7 +768,7 @@ fn select<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) @9 := &(*(lhs@1), move (@25)) @8 := core::slice::{Slice}::len<'_, u8>[Sized](move (@9)) storage_dead(@9) - @7 := &(@8, copy (@Global0)) + @7 := &@8 storage_live(@10) storage_live(@11) storage_live(@12) @@ -777,7 +777,7 @@ fn select<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) @12 := &(*(rhs@2), move (@26)) @11 := core::slice::{Slice}::len<'_, u8>[Sized](move (@12)) storage_dead(@12) - @10 := &(@11, copy (@Global0)) + @10 := &@11 @6 := (move (@7), move (@10)) storage_dead(@10) storage_dead(@7) @@ -802,12 +802,12 @@ fn select<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) @19 := move (kind@18) storage_live(@20) storage_live(@21) - @21 := &(*(left_val@13), copy (@Global0)) - @20 := &(*(@21), copy (@Global0)) + @21 := &*(left_val@13) + @20 := &*(@21) storage_live(@22) storage_live(@23) - @23 := &(*(right_val@14), copy (@Global0)) - @22 := &(*(@23), copy (@Global0)) + @23 := &*(right_val@14) + @22 := &*(@23) storage_live(@24) @24 := Option::None { } panic(core::panicking::assert_failed) diff --git a/charon/tests/ui/issue-70-override-provided-method.2.out b/charon/tests/ui/issue-70-override-provided-method.2.out index afeec4a35..01ec79087 100644 --- a/charon/tests/ui/issue-70-override-provided-method.2.out +++ b/charon/tests/ui/issue-70-override-provided-method.2.out @@ -110,7 +110,7 @@ fn {impl Trait for Foo}::required<'_0>(@1: &'_0 (Foo)) storage_live(@2) storage_live(@3) - @3 := &(*(self@1), copy (@Global0)) + @3 := &*(self@1) @2 := test_crate::{impl Trait for Foo}::provided1<'_>(move (@3)) storage_dead(@3) storage_dead(@2) @@ -130,13 +130,13 @@ fn test_crate::{impl Trait for Foo}::provided1<'_0>(@1: &'_0 (Foo)) storage_live(@2) storage_live(@3) - @3 := &(*(self@1), copy (@Global0)) + @3 := &*(self@1) @2 := {impl Trait for Foo}::required<'_>(move (@3)) storage_dead(@3) storage_dead(@2) storage_live(@4) storage_live(@5) - @5 := &(*(self@1), copy (@Global0)) + @5 := &*(self@1) @4 := test_crate::{impl Trait for Foo}::provided2<'_>(move (@5)) storage_dead(@5) storage_dead(@4) @@ -156,13 +156,13 @@ fn test_crate::{impl Trait for Foo}::provided2<'_0>(@1: &'_0 (Foo)) storage_live(@2) storage_live(@3) - @3 := &(*(self@1), copy (@Global0)) + @3 := &*(self@1) @2 := {impl Trait for Foo}::required<'_>(move (@3)) storage_dead(@3) storage_dead(@2) storage_live(@4) storage_live(@5) - @5 := &(*(self@1), copy (@Global0)) + @5 := &*(self@1) @4 := test_crate::{impl Trait for Foo}::provided1<'_>(move (@5)) storage_dead(@5) storage_dead(@4) @@ -193,7 +193,7 @@ fn {impl Trait for Bar}::required<'_0>(@1: &'_0 (Bar)) storage_live(@2) storage_live(@3) - @3 := &(*(self@1), copy (@Global0)) + @3 := &*(self@1) @2 := test_crate::{impl Trait for Bar}::provided2<'_>(move (@3)) storage_dead(@3) storage_dead(@2) @@ -212,7 +212,7 @@ fn {impl Trait for Bar}::provided1<'_0>(@1: &'_0 (Bar)) storage_live(@2) storage_live(@3) - @3 := &(*(self@1), copy (@Global0)) + @3 := &*(self@1) @2 := test_crate::{impl Trait for Bar}::provided2<'_>(move (@3)) storage_dead(@3) storage_dead(@2) @@ -232,13 +232,13 @@ fn test_crate::{impl Trait for Bar}::provided2<'_0>(@1: &'_0 (Bar)) storage_live(@2) storage_live(@3) - @3 := &(*(self@1), copy (@Global0)) + @3 := &*(self@1) @2 := {impl Trait for Bar}::required<'_>(move (@3)) storage_dead(@3) storage_dead(@2) storage_live(@4) storage_live(@5) - @5 := &(*(self@1), copy (@Global0)) + @5 := &*(self@1) @4 := {impl Trait for Bar}::provided1<'_>(move (@5)) storage_dead(@5) storage_dead(@4) diff --git a/charon/tests/ui/issue-70-override-provided-method.3.out b/charon/tests/ui/issue-70-override-provided-method.3.out index 4c12cbcbf..a4912c67e 100644 --- a/charon/tests/ui/issue-70-override-provided-method.3.out +++ b/charon/tests/ui/issue-70-override-provided-method.3.out @@ -138,9 +138,9 @@ where storage_live(@3) storage_live(@4) - @4 := &(y@2, copy (@Global0)) + @4 := &y@2 storage_live(@5) - @5 := &(x@1, copy (@Global0)) + @5 := &x@1 @3 := @TraitClause2::eq<'_, '_>(move (@4), move (@5)) if move (@3) { storage_dead(@5) @@ -197,9 +197,9 @@ where storage_live(@3) storage_live(@4) - @4 := &(y@2, copy (@Global0)) + @4 := &y@2 storage_live(@5) - @5 := &(x@1, copy (@Global0)) + @5 := &x@1 @3 := @TraitClause3::eq<'_, '_>(move (@4), move (@5)) if move (@3) { storage_dead(@5) @@ -268,9 +268,9 @@ where storage_live(@3) storage_live(@4) - @4 := &(y@2, copy (@Global0)) + @4 := &y@2 storage_live(@5) - @5 := &(x@1, copy (@Global0)) + @5 := &x@1 @3 := @TraitClause3::eq<'_, '_>(move (@4), move (@5)) if move (@3) { storage_dead(@5) diff --git a/charon/tests/ui/issue-70-override-provided-method.out b/charon/tests/ui/issue-70-override-provided-method.out index d3bec1e07..519c34623 100644 --- a/charon/tests/ui/issue-70-override-provided-method.out +++ b/charon/tests/ui/issue-70-override-provided-method.out @@ -133,11 +133,11 @@ fn main() storage_live(@2) storage_live(@3) @3 := Option::Some { 0: const (1 : i32) } - @2 := &(@3, copy (@Global0)) + @2 := &@3 storage_live(@4) storage_live(@5) @5 := Option::Some { 0: const (1 : i32) } - @4 := &(@5, copy (@Global0)) + @4 := &@5 @1 := {impl PartialEq[@TraitClause0]> for Option[@TraitClause0]}::eq<'_, '_, i32>[Sized, {impl PartialEq for i32}](move (@2), move (@4)) storage_dead(@4) storage_dead(@2) @@ -198,12 +198,12 @@ pub fn {impl PartialOrd for Foo}::partial_cmp<'_0, '_1>(@1: &'_0 (Foo), @2: storage_live(@3) storage_live(@4) - @4 := &((*(self@1)).0, copy (@Global0)) - @3 := &(*(@4), copy (@Global0)) + @4 := &(*(self@1)).0 + @3 := &*(@4) storage_live(@5) storage_live(@6) - @6 := &((*(other@2)).0, copy (@Global0)) - @5 := &(*(@6), copy (@Global0)) + @6 := &(*(other@2)).0 + @5 := &*(@6) @0 := {impl PartialOrd for u32}::partial_cmp<'_, '_>(move (@3), move (@5)) storage_dead(@6) storage_dead(@5) diff --git a/charon/tests/ui/issue-72-hash-missing-impl.out b/charon/tests/ui/issue-72-hash-missing-impl.out index e4eddaafd..6e6f5c388 100644 --- a/charon/tests/ui/issue-72-hash-missing-impl.out +++ b/charon/tests/ui/issue-72-hash-missing-impl.out @@ -91,11 +91,11 @@ fn main() storage_live(@3) storage_live(@4) @4 := const (0 : u32) - @3 := &(@4, copy (@Global0)) + @3 := &@4 storage_live(@5) storage_live(@6) - @6 := &mut (hasher@1, copy (@Global0)) - @5 := &two-phase-mut (*(@6), copy (@Global0)) + @6 := &mut hasher@1 + @5 := &two-phase-mut *(@6) @2 := {impl Hash for u32}::hash<'_, '_, DefaultHasher>[Sized, {impl Hasher for DefaultHasher}](move (@3), move (@5)) storage_dead(@5) storage_dead(@3) diff --git a/charon/tests/ui/issue-97-missing-parent-item-clause.out b/charon/tests/ui/issue-97-missing-parent-item-clause.out index 1c20457ed..95336be25 100644 --- a/charon/tests/ui/issue-97-missing-parent-item-clause.out +++ b/charon/tests/ui/issue-97-missing-parent-item-clause.out @@ -65,7 +65,7 @@ pub fn test(@1: AVLTree[Sized]) storage_live(@2) storage_live(@3) - @3 := &two-phase-mut (tree@1, copy (@Global0)) + @3 := &two-phase-mut tree@1 @2 := insert<'_, u32>[Sized, {impl Ord for u32}](move (@3)) storage_dead(@3) storage_dead(@2) diff --git a/charon/tests/ui/iterator.out b/charon/tests/ui/iterator.out index 296f35b61..1db7f802a 100644 --- a/charon/tests/ui/iterator.out +++ b/charon/tests/ui/iterator.out @@ -4621,8 +4621,8 @@ fn main() storage_live(@9) storage_live(@10) storage_live(@11) - @11 := &mut (iter@7, copy (@Global0)) - @10 := &two-phase-mut (*(@11), copy (@Global0)) + @11 := &mut iter@7 + @10 := &two-phase-mut *(@11) @9 := {impl Iterator for IntoIter[@TraitClause0]}::next<'_, i32, 7 : usize>[Sized](move (@10)) storage_dead(@10) match @9 { @@ -4658,7 +4658,7 @@ fn main() storage_live(@17) storage_live(@18) storage_live(@19) - @19 := &(a@1, copy (@Global0)) + @19 := &a@1 @18 := @ArrayToSliceShared<'_, i32, 7 : usize>(move (@19)) storage_dead(@19) @17 := iter<'_, i32>[Sized](move (@18)) @@ -4672,8 +4672,8 @@ fn main() storage_live(@22) storage_live(@23) storage_live(@24) - @24 := &mut (iter@20, copy (@Global0)) - @23 := &two-phase-mut (*(@24), copy (@Global0)) + @24 := &mut iter@20 + @23 := &two-phase-mut *(@24) @22 := {impl Iterator for Iter<'a, T>[@TraitClause0]}::next<'_, '_, i32>[Sized](move (@23)) storage_dead(@23) match @22 { @@ -4685,7 +4685,7 @@ fn main() v@25 := copy ((@22 as variant Option::Some).0) storage_live(@26) storage_live(@27) - @27 := &two-phase-mut (i@2, copy (@Global0)) + @27 := &two-phase-mut i@2 storage_live(@28) @28 := copy (v@25) @26 := {impl AddAssign<&'_0 (i32)> for i32}::add_assign<'_, '_>(move (@27), move (@28)) @@ -4711,7 +4711,7 @@ fn main() storage_live(@31) storage_live(@32) storage_live(@33) - @33 := &(a@1, copy (@Global0)) + @33 := &a@1 @32 := @ArrayToSliceShared<'_, i32, 7 : usize>(move (@33)) storage_dead(@33) @31 := chunks<'_, i32>[Sized](move (@32), const (2 : usize)) @@ -4725,8 +4725,8 @@ fn main() storage_live(@36) storage_live(@37) storage_live(@38) - @38 := &mut (iter@34, copy (@Global0)) - @37 := &two-phase-mut (*(@38), copy (@Global0)) + @38 := &mut iter@34 + @37 := &two-phase-mut *(@38) @36 := {impl Iterator for Chunks<'a, T>[@TraitClause0]}::next<'_, '_, i32>[Sized](move (@37)) storage_dead(@37) match @36 { @@ -4754,7 +4754,7 @@ fn main() storage_live(@42) storage_live(@43) storage_live(@44) - @44 := &(a@1, copy (@Global0)) + @44 := &a@1 @43 := @ArrayToSliceShared<'_, i32, 7 : usize>(move (@44)) storage_dead(@44) @42 := chunks_exact<'_, i32>[Sized](move (@43), const (2 : usize)) @@ -4768,8 +4768,8 @@ fn main() storage_live(@47) storage_live(@48) storage_live(@49) - @49 := &mut (iter@45, copy (@Global0)) - @48 := &two-phase-mut (*(@49), copy (@Global0)) + @49 := &mut iter@45 + @48 := &two-phase-mut *(@49) @47 := {impl Iterator for ChunksExact<'a, T>[@TraitClause0]}::next<'_, '_, i32>[Sized](move (@48)) storage_dead(@48) match @47 { @@ -4797,9 +4797,9 @@ fn main() storage_live(@52) storage_live(@53) storage_live(@54) - @54 := &(i@2, copy (@Global0)) + @54 := &i@2 storage_live(@55) - @55 := &(expected@51, copy (@Global0)) + @55 := &expected@51 @53 := (move (@54), move (@55)) storage_dead(@55) storage_dead(@54) @@ -4824,12 +4824,12 @@ fn main() @62 := move (kind@61) storage_live(@63) storage_live(@64) - @64 := &(*(left_val@56), copy (@Global0)) - @63 := &(*(@64), copy (@Global0)) + @64 := &*(left_val@56) + @63 := &*(@64) storage_live(@65) storage_live(@66) - @66 := &(*(right_val@57), copy (@Global0)) - @65 := &(*(@66), copy (@Global0)) + @66 := &*(right_val@57) + @65 := &*(@66) storage_live(@67) @67 := Option::None { } panic(core::panicking::assert_failed) diff --git a/charon/tests/ui/loops.out b/charon/tests/ui/loops.out index f72f81274..45d454f39 100644 --- a/charon/tests/ui/loops.out +++ b/charon/tests/ui/loops.out @@ -1763,8 +1763,8 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize storage_live(@9) storage_live(@10) storage_live(@11) - @11 := &mut (iter@7, copy (@Global0)) - @10 := &two-phase-mut (*(@11), copy (@Global0)) + @11 := &mut iter@7 + @10 := &two-phase-mut *(@11) @9 := {impl Iterator for Range[@TraitClause0]}::next<'_, i32>[Sized, {impl Step for i32}](move (@10)) storage_dead(@10) match @9 { @@ -1803,8 +1803,8 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize storage_live(@19) storage_live(@20) storage_live(@21) - @21 := &mut (iter@17, copy (@Global0)) - @20 := &two-phase-mut (*(@21), copy (@Global0)) + @21 := &mut iter@17 + @20 := &two-phase-mut *(@21) @19 := {impl Iterator for Range[@TraitClause0]}::next<'_, usize>[Sized, {impl Step for usize}](move (@20)) storage_dead(@20) match @19 { @@ -1827,8 +1827,8 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize storage_live(@27) storage_live(@28) storage_live(@29) - @29 := &mut (iter@25, copy (@Global0)) - @28 := &two-phase-mut (*(@29), copy (@Global0)) + @29 := &mut iter@25 + @28 := &two-phase-mut *(@29) @27 := {impl Iterator for Range[@TraitClause0]}::next<'_, usize>[Sized, {impl Step for usize}](move (@28)) storage_dead(@28) match @27 { @@ -1923,8 +1923,8 @@ pub fn loop_inside_if(@1: bool, @2: u32) -> u32 storage_live(@11) storage_live(@12) storage_live(@13) - @13 := &mut (iter@9, copy (@Global0)) - @12 := &two-phase-mut (*(@13), copy (@Global0)) + @13 := &mut iter@9 + @12 := &two-phase-mut *(@13) @11 := {impl Iterator for Range[@TraitClause0]}::next<'_, u32>[Sized, {impl Step for u32}](move (@12)) storage_dead(@12) match @11 { @@ -2066,7 +2066,7 @@ pub fn sum_array(@1: Array) -> u32 storage_live(@8) @8 := copy (i@2) storage_live(@12) - @12 := &(a@1, const (@Global0)) + @12 := &a@1 storage_live(@13) @13 := @ArrayIndexShared<'_, u32, const N : usize>(move (@12), copy (@8)) @7 := copy (*(@13)) @@ -2123,7 +2123,7 @@ pub fn clear<'_0>(@1: &'_0 mut (Vec[Sized, Sized])) @4 := copy (i@2) storage_live(@5) storage_live(@6) - @6 := &(*(v@1), copy (@Global0)) + @6 := &*(v@1) @5 := alloc::vec::{Vec[@TraitClause0, @TraitClause1]}::len<'_, u32, Global>[Sized, Sized](move (@6)) storage_dead(@6) @3 := move (@4) < move (@5) @@ -2136,7 +2136,7 @@ pub fn clear<'_0>(@1: &'_0 mut (Vec[Sized, Sized])) storage_dead(@4) storage_live(@7) storage_live(@8) - @8 := &mut (*(v@1), copy (@Global0)) + @8 := &mut *(v@1) storage_live(@9) @9 := copy (i@2) @7 := {impl IndexMut for Vec[@TraitClause0, @TraitClause2]}::index_mut<'_, u32, usize, Global>[Sized, Sized, Sized, {impl SliceIndex> for usize}[Sized]](move (@8), move (@9)) @@ -2192,9 +2192,9 @@ pub fn get_elem_mut<'_0>(@1: &'_0 mut (List[Sized]), @2: usize) -> match *(ls@1) { List::Cons => { storage_live(y@3) - y@3 := &mut ((*(ls@1) as variant List::Cons).0, copy (@Global0)) + y@3 := &mut (*(ls@1) as variant List::Cons).0 storage_live(tl@4) - tl@4 := &mut ((*(ls@1) as variant List::Cons).1, copy (@Global0)) + tl@4 := &mut (*(ls@1) as variant List::Cons).1 storage_live(@5) storage_live(@6) @6 := copy (*(y@3)) @@ -2207,7 +2207,7 @@ pub fn get_elem_mut<'_0>(@1: &'_0 mut (List[Sized]), @2: usize) -> storage_dead(@7) storage_dead(@6) storage_live(@8) - @8 := &mut (*(*(tl@4)), copy (@Global0)) + @8 := &mut *(*(tl@4)) ls@1 := move (@8) storage_dead(@8) storage_dead(@5) @@ -2217,7 +2217,7 @@ pub fn get_elem_mut<'_0>(@1: &'_0 mut (List[Sized]), @2: usize) -> } storage_dead(@7) storage_dead(@6) - @0 := &mut (*(y@3), copy (@Global0)) + @0 := &mut *(y@3) storage_dead(@5) storage_dead(tl@4) storage_dead(y@3) @@ -2259,9 +2259,9 @@ where match *(ls@1) { List::Cons => { storage_live(x@4) - x@4 := &mut ((*(ls@1) as variant List::Cons).0, copy (@Global0)) + x@4 := &mut (*(ls@1) as variant List::Cons).0 storage_live(tl@5) - tl@5 := &mut ((*(ls@1) as variant List::Cons).1, copy (@Global0)) + tl@5 := &mut (*(ls@1) as variant List::Cons).1 storage_live(@6) storage_live(@7) @7 := copy (i@2) @@ -2271,7 +2271,7 @@ where else { storage_dead(@7) storage_live(@8) - @8 := &mut (*(*(tl@5)), copy (@Global0)) + @8 := &mut *(*(tl@5)) ls@1 := move (@8) storage_dead(@8) @9 := copy (i@2) panic.- const (1 : u32) @@ -2282,7 +2282,7 @@ where continue 0 } storage_dead(@7) - @0 := &mut (*(x@4), copy (@Global0)) + @0 := &mut *(x@4) storage_dead(@6) storage_dead(tl@5) storage_dead(x@4) diff --git a/charon/tests/ui/method-impl-generalization.out b/charon/tests/ui/method-impl-generalization.out index e3a1aa6cf..15686875e 100644 --- a/charon/tests/ui/method-impl-generalization.out +++ b/charon/tests/ui/method-impl-generalization.out @@ -176,8 +176,8 @@ fn main() storage_live(@4) storage_live(@5) @5 := const (1 : u32) - @4 := &(@5, copy (@Global0)) - @3 := &(*(@4), copy (@Global0)) + @4 := &@5 + @3 := &*(@4) @1 := {impl Trait for ()}::method1(move (@2), move (@3)) storage_dead(@3) storage_dead(@2) @@ -192,13 +192,13 @@ fn main() // Not allowed to use the more precise signature. // let _ = ().method2(String::new()); @8 := () - @7 := &(@8, copy (@Global0)) + @7 := &@8 storage_live(@9) storage_live(@10) storage_live(@11) @11 := () - @10 := &(@11, copy (@Global0)) - @9 := &(*(@10), copy (@Global0)) + @10 := &@11 + @9 := &*(@10) @6 := {impl MyCompare<&'a (())> for &'a (())}::compare<'_>(move (@7), move (@9)) storage_dead(@9) storage_dead(@7) @@ -255,15 +255,15 @@ fn call_foo<'e>(@1: &'e (())) -> &'e (()) storage_live(@2) storage_live(@3) // Calls have erased lifetimes so we can't notice the discrepancy if there is one. - @3 := &(*(x@1), copy (@Global0)) + @3 := &*(x@1) storage_live(@4) storage_live(@5) storage_live(@6) @6 := () - @5 := &(@6, copy (@Global0)) - @4 := &(*(@5), copy (@Global0)) + @5 := &@6 + @4 := &*(@5) @2 := {impl Foo for ()}::foo<'_, '_>(move (@3), move (@4)) - @0 := &(*(@2), copy (@Global0)) + @0 := &*(@2) storage_dead(@4) storage_dead(@3) storage_dead(@6) diff --git a/charon/tests/ui/ml-name-matcher-tests.out b/charon/tests/ui/ml-name-matcher-tests.out index 45b4f476d..0607ea1e9 100644 --- a/charon/tests/ui/ml-name-matcher-tests.out +++ b/charon/tests/ui/ml-name-matcher-tests.out @@ -288,7 +288,7 @@ fn foo() storage_live(@2) storage_live(@3) @3 := Option::Some { 0: const (0 : i32) } - @2 := &(@3, copy (@Global0)) + @2 := &@3 @1 := is_some<'_, i32>[Sized](move (@2)) storage_dead(@2) storage_dead(@3) @@ -298,8 +298,8 @@ fn foo() storage_live(@6) storage_live(@7) @7 := [const (false)] - @6 := &(@7, copy (@Global0)) - @5 := &(*(@6), copy (@Global0)) + @6 := &@7 + @5 := &*(@6) slice@4 := @ArrayToSliceShared<'_, bool, 1 : usize>(move (@5)) storage_dead(@5) storage_dead(@6) diff --git a/charon/tests/ui/monomorphization/bound_lifetime.out b/charon/tests/ui/monomorphization/bound_lifetime.out index 870d2cb64..2ce361974 100644 --- a/charon/tests/ui/monomorphization/bound_lifetime.out +++ b/charon/tests/ui/monomorphization/bound_lifetime.out @@ -37,7 +37,7 @@ fn foo<'_0>(@1: &'_0 (u32)) -> Option::<&'_ (u32)> let @2: &'_ (u32); // anonymous local storage_live(@2) - @2 := &(*(x@1), copy (@Global0)) + @2 := &*(x@1) @0 := Option::<&'_ (u32)>::Some { 0: move (@2) } storage_dead(@2) return @@ -57,8 +57,8 @@ fn main() storage_live(@3) storage_live(@4) @4 := const (42 : u32) - @3 := &(@4, copy (@Global0)) - @2 := &(*(@3), copy (@Global0)) + @3 := &@4 + @2 := &*(@3) @1 := foo<'_>(move (@2)) storage_dead(@2) storage_dead(@4) diff --git a/charon/tests/ui/monomorphization/closure-fn.out b/charon/tests/ui/monomorphization/closure-fn.out index b97d97da2..f02143ea3 100644 --- a/charon/tests/ui/monomorphization/closure-fn.out +++ b/charon/tests/ui/monomorphization/closure-fn.out @@ -166,7 +166,7 @@ fn apply_to::><'_0>(@1: &'_0 (closure<'_, '_>)) -> u8 let @3: (u8, u8); // anonymous local storage_live(@2) - @2 := &(*(f@1), copy (@Global0)) + @2 := &*(f@1) storage_live(@3) @3 := (const (10 : u8), const (20 : u8)) @0 := {impl Fn::, (u8, u8)>}::call<'_, '_, '_>(move (@2), move (@3)) @@ -184,7 +184,7 @@ fn {impl FnMut::, (u8, u8)>}::call_mut<'_0, '_1, '_2>(@1: &'_2 m let @3: &'_ (closure<'_0, '_1>); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn::, (u8, u8)>}::call<'_0, '_1, '_>(move (@3), move (args@2)) return } @@ -198,7 +198,7 @@ fn apply_to_mut::><'_0>(@1: &'_0 mut (closure<'_, '_>)) -> u8 let @3: (u8, u8); // anonymous local storage_live(@2) - @2 := &mut (*(f@1), copy (@Global0)) + @2 := &mut *(f@1) storage_live(@3) @3 := (const (10 : u8), const (20 : u8)) @0 := {impl FnMut::, (u8, u8)>}::call_mut<'_, '_, '_>(move (@2), move (@3)) @@ -216,7 +216,7 @@ fn {impl FnOnce::, (u8, u8)>}::call_once<'_0, '_1>(@1: closure<' let @3: &'_ mut (closure<'_0, '_1>); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut::, (u8, u8)>}::call_mut<'_0, '_1, '_>(move (@3), move (@2)) drop[Drop::>] @1 return @@ -268,15 +268,15 @@ fn main() z@2 := const (1 : u8) storage_live(f@3) storage_live(@4) - @4 := &(v@1, copy (@Global0)) + @4 := &v@1 storage_live(@5) - @5 := &(z@2, copy (@Global0)) + @5 := &z@2 f@3 := closure { 0: move (@4), 1: move (@5) } storage_dead(@5) storage_dead(@4) storage_live(@6) storage_live(@7) - @7 := &(f@3, copy (@Global0)) + @7 := &f@3 storage_live(@8) @8 := (const (10 : u8), const (20 : u8)) @6 := {impl Fn::, (u8, u8)>}::call<'_, '_, '_>(move (@7), move (@8)) @@ -286,8 +286,8 @@ fn main() storage_live(@9) storage_live(@10) storage_live(@11) - @11 := &(f@3, copy (@Global0)) - @10 := &(*(@11), copy (@Global0)) + @11 := &f@3 + @10 := &*(@11) @9 := apply_to::><'_>(move (@10)) storage_dead(@10) storage_dead(@11) @@ -295,8 +295,8 @@ fn main() storage_live(@12) storage_live(@13) storage_live(@14) - @14 := &mut (f@3, copy (@Global0)) - @13 := &two-phase-mut (*(@14), copy (@Global0)) + @14 := &mut f@3 + @13 := &two-phase-mut *(@14) @12 := apply_to_mut::><'_>(move (@13)) storage_dead(@13) storage_dead(@14) diff --git a/charon/tests/ui/monomorphization/closures.out b/charon/tests/ui/monomorphization/closures.out index e39e397f0..069037d7a 100644 --- a/charon/tests/ui/monomorphization/closures.out +++ b/charon/tests/ui/monomorphization/closures.out @@ -252,7 +252,7 @@ fn apply_to_zero::>(@1: test_crate::main::closure< let @3: (u8); // anonymous local storage_live(@2) - @2 := &(f@1, copy (@Global0)) + @2 := &f@1 storage_live(@3) @3 := (const (0 : u8)) @0 := {impl Fn::, (u8)>}::call<'_, '_>(move (@2), move (@3)) @@ -300,7 +300,7 @@ fn apply_to_zero_mut::>(@1: test_crate::main::cl let @3: (u8); // anonymous local storage_live(@2) - @2 := &mut (f@1, copy (@Global0)) + @2 := &mut f@1 storage_live(@3) @3 := (const (0 : u8)) @0 := {impl FnMut::, (u8)>}::call_mut<'_, '_>(move (@2), move (@3)) @@ -379,7 +379,7 @@ fn main() storage_live(@2) storage_live(@3) storage_live(@4) - @4 := &(z@1, copy (@Global0)) + @4 := &z@1 @3 := test_crate::main::closure { 0: move (@4) } storage_dead(@4) @2 := apply_to_zero::>(move (@3)) @@ -390,7 +390,7 @@ fn main() storage_live(@6) storage_live(@7) storage_live(@8) - @8 := &mut (z@5, copy (@Global0)) + @8 := &mut z@5 @7 := test_crate::main::closure#1 { 0: move (@8) } storage_dead(@8) @6 := apply_to_zero_mut::>(move (@7)) @@ -421,7 +421,7 @@ fn {impl FnMut::, (u8)>}::call_mut<'_0, '_1>(@1: & let @3: &'_ (test_crate::main::closure<'_0>); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn::, (u8)>}::call<'_0, '_>(move (@3), move (args@2)) return } @@ -435,7 +435,7 @@ fn {impl FnOnce::, (u8)>}::call_once<'_0>(@1: test let @3: &'_ mut (test_crate::main::closure<'_0>); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut::, (u8)>}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop::>] @1 return @@ -479,7 +479,7 @@ fn {impl FnOnce::, (u8)>}::call_once<'_0>(@1: te let @3: &'_ mut (test_crate::main::closure#1<'_0>); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut::, (u8)>}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop::>] @1 return diff --git a/charon/tests/ui/monomorphization/fn_ptr_generics.out b/charon/tests/ui/monomorphization/fn_ptr_generics.out index a48f4bf24..d70f08712 100644 --- a/charon/tests/ui/monomorphization/fn_ptr_generics.out +++ b/charon/tests/ui/monomorphization/fn_ptr_generics.out @@ -49,7 +49,7 @@ fn init_option() storage_live(@4) @4 := const (0 : usize) storage_live(@5) - @5 := &(a@1, const (@Global0)) + @5 := &a@1 storage_live(@6) @6 := @ArrayIndexShared<'_, Option::, 6 : usize>(move (@5), copy (@4)) b@3 := copy (*(@6)) diff --git a/charon/tests/ui/monomorphization/fndefs-casts.out b/charon/tests/ui/monomorphization/fndefs-casts.out index f776d2301..8d7402a79 100644 --- a/charon/tests/ui/monomorphization/fndefs-casts.out +++ b/charon/tests/ui/monomorphization/fndefs-casts.out @@ -194,14 +194,14 @@ fn takes_closure:: foo::<'_0>>(@1: for<'_0> foo::<'_0_0>) let @6: u32; // anonymous local storage_live(@2) - @2 := &(c@1, copy (@Global0)) + @2 := &c@1 storage_live(@3) storage_live(@4) storage_live(@5) storage_live(@6) @6 := const (13 : u32) - @5 := &(@6, copy (@Global0)) - @4 := &(*(@5), copy (@Global0)) + @5 := &@6 + @4 := &*(@5) @3 := (move (@4)) @0 := Fn:: foo::<'_0_0>, (&'_ (u32))>::call<'_>(move (@2), move (@3)) storage_dead(@4) @@ -259,8 +259,8 @@ fn main() @6 := copy (fooint1@1) storage_live(@7) storage_live(@8) - @8 := &(a@4, copy (@Global0)) - @7 := &(*(@8), copy (@Global0)) + @8 := &a@4 + @7 := &*(@8) @5 := (move @6)(move (@7)) storage_dead(@7) storage_dead(@6) @@ -273,8 +273,8 @@ fn main() @11 := copy (fooint1@1) storage_live(@12) storage_live(@13) - @13 := &(a@4, copy (@Global0)) - @12 := &(*(@13), copy (@Global0)) + @13 := &a@4 + @12 := &*(@13) @10 := (move @11)(move (@12)) storage_dead(@12) storage_dead(@11) @@ -285,8 +285,8 @@ fn main() @15 := copy (fooint1@1) storage_live(@16) storage_live(@17) - @17 := &(b@9, copy (@Global0)) - @16 := &(*(@17), copy (@Global0)) + @17 := &b@9 + @16 := &*(@17) @14 := (move @15)(move (@16)) storage_dead(@16) storage_dead(@15) @@ -297,8 +297,8 @@ fn main() @19 := copy (fooint2@2) storage_live(@20) storage_live(@21) - @21 := &(b@9, copy (@Global0)) - @20 := &(*(@21), copy (@Global0)) + @21 := &b@9 + @20 := &*(@21) @18 := (move @19)(move (@20)) storage_dead(@20) storage_dead(@19) @@ -311,8 +311,8 @@ fn main() storage_live(@25) storage_live(@26) @26 := const (x) - @25 := &(@26, copy (@Global0)) - @24 := &(*(@25), copy (@Global0)) + @25 := &@26 + @24 := &*(@25) @22 := (move @23)(move (@24)) storage_dead(@24) storage_dead(@23) diff --git a/charon/tests/ui/monomorphization/global_with_generics.out b/charon/tests/ui/monomorphization/global_with_generics.out index 52c94db5f..0207e8105 100644 --- a/charon/tests/ui/monomorphization/global_with_generics.out +++ b/charon/tests/ui/monomorphization/global_with_generics.out @@ -82,7 +82,7 @@ fn main() storage_live(_b@1) storage_live(@2) @3 := () - @4 := &(FooBool, move (@3)) + @4 := &FooBool @2 := move (@4) _b@1 := copy ((*(@2)).value) storage_dead(@2) diff --git a/charon/tests/ui/monomorphization/trait_impls.out b/charon/tests/ui/monomorphization/trait_impls.out index a15ebb94d..b060c4ff9 100644 --- a/charon/tests/ui/monomorphization/trait_impls.out +++ b/charon/tests/ui/monomorphization/trait_impls.out @@ -72,7 +72,7 @@ fn do_test::(@1: bool) let @2: &'_ (bool); // anonymous local storage_live(@2) - @2 := &(x@1, copy (@Global0)) + @2 := &x@1 @0 := {impl Trait::}::method<'_>(move (@2)) storage_dead(@2) drop[Drop::] x@1 diff --git a/charon/tests/ui/monomorphization/trait_impls_ullbc.out b/charon/tests/ui/monomorphization/trait_impls_ullbc.out index aa2bb9568..8b4c21971 100644 --- a/charon/tests/ui/monomorphization/trait_impls_ullbc.out +++ b/charon/tests/ui/monomorphization/trait_impls_ullbc.out @@ -88,9 +88,9 @@ fn do_test::(@1: bool, @2: bool) storage_live(@3); storage_live(@4); storage_live(@5); - @5 := &(expected@2, copy (@Global0)); + @5 := &expected@2; storage_live(@6); - @6 := &(init@1, copy (@Global0)); + @6 := &init@1; @4 := {impl PartialEq::}::eq<'_, '_>(move (@5), move (@6)) -> bb1 (unwind: bb2); } diff --git a/charon/tests/ui/no_nested_borrows.out b/charon/tests/ui/no_nested_borrows.out index a688ecc42..0d111988e 100644 --- a/charon/tests/ui/no_nested_borrows.out +++ b/charon/tests/ui/no_nested_borrows.out @@ -474,13 +474,13 @@ pub fn test_box1() b@1 := @BoxNew[Sized](const (0 : i32)) storage_live(x@2) storage_live(@3) - @3 := &two-phase-mut (b@1, copy (@Global0)) + @3 := &two-phase-mut b@1 x@2 := {impl DerefMut for alloc::boxed::Box[@TraitClause0, @TraitClause1]}::deref_mut<'_, i32, Global>[MetaSized, Sized](move (@3)) storage_dead(@3) *(x@2) := const (1 : i32) storage_live(x@4) storage_live(@5) - @5 := &(b@1, copy (@Global0)) + @5 := &b@1 x@4 := {impl Deref for alloc::boxed::Box[@TraitClause0, @TraitClause1]}::deref<'_, i32, Global>[MetaSized, Sized](move (@5)) storage_dead(@5) storage_live(@6) diff --git a/charon/tests/ui/opacity.out b/charon/tests/ui/opacity.out index 83ab7373d..ccdee1c54 100644 --- a/charon/tests/ui/opacity.out +++ b/charon/tests/ui/opacity.out @@ -138,7 +138,7 @@ fn foo() storage_live(@2) storage_live(@3) @3 := Option::Some { 0: const (0 : i32) } - @2 := &(@3, copy (@Global0)) + @2 := &@3 @1 := is_some<'_, i32>[Sized](move (@2)) storage_dead(@2) storage_dead(@3) @@ -151,8 +151,8 @@ fn foo() storage_live(@7) storage_live(@8) @8 := const (0 : i32) - @7 := &(@8, copy (@Global0)) - @6 := &(*(@7), copy (@Global0)) + @7 := &@8 + @6 := &*(@7) @5 := from_ref<'_, i32>[Sized](move (@6)) storage_dead(@6) storage_dead(@8) diff --git a/charon/tests/ui/opaque_attribute.out b/charon/tests/ui/opaque_attribute.out index 38a35d66a..434a6541b 100644 --- a/charon/tests/ui/opaque_attribute.out +++ b/charon/tests/ui/opaque_attribute.out @@ -79,9 +79,9 @@ where }, Option::Some => { storage_live(x@2) - x@2 := &((*(self@1) as variant Option::Some).0, copy (@Global0)) + x@2 := &(*(self@1) as variant Option::Some).0 storage_live(@3) - @3 := &(*(x@2), copy (@Global0)) + @3 := &*(x@2) @0 := @TraitClause1::get_bool<'_>(move (@3)) storage_dead(@3) storage_dead(x@2) diff --git a/charon/tests/ui/panics.out b/charon/tests/ui/panics.out index ad144173f..6bf639270 100644 --- a/charon/tests/ui/panics.out +++ b/charon/tests/ui/panics.out @@ -48,8 +48,8 @@ fn panic2() storage_live(@3) storage_live(@4) @4 := [const ("O no!")] - @3 := &(@4, copy (@Global0)) - @2 := &(*(@3), copy (@Global0)) + @3 := &@4 + @2 := &*(@3) @1 := new_const<'_, 1 : usize>(move (@2)) storage_dead(@2) panic(core::panicking::panic_fmt) @@ -72,14 +72,14 @@ fn panic3() storage_live(@3) storage_live(@4) @4 := [const ("O no!")] - @3 := &(@4, copy (@Global0)) - @2 := &(*(@3), copy (@Global0)) + @3 := &@4 + @2 := &*(@3) storage_live(@5) storage_live(@6) storage_live(@7) @7 := [] - @6 := &(@7, copy (@Global0)) - @5 := &(*(@6), copy (@Global0)) + @6 := &@7 + @5 := &*(@6) @1 := new_v1<'_, 1 : usize, 0 : usize>(move (@2), move (@5)) storage_dead(@5) storage_dead(@2) @@ -130,8 +130,8 @@ fn panic5() storage_live(@5) storage_live(@6) @6 := [const ("assert failed")] - @5 := &(@6, copy (@Global0)) - @4 := &(*(@5), copy (@Global0)) + @5 := &@6 + @4 := &*(@5) @3 := new_const<'_, 1 : usize>(move (@4)) storage_dead(@4) panic(core::panicking::panic_fmt) @@ -168,14 +168,14 @@ fn panic7() storage_live(@3) storage_live(@4) @4 := [const ("internal error: entered unreachable code: can't reach this")] - @3 := &(@4, copy (@Global0)) - @2 := &(*(@3), copy (@Global0)) + @3 := &@4 + @2 := &*(@3) storage_live(@5) storage_live(@6) storage_live(@7) @7 := [] - @6 := &(@7, copy (@Global0)) - @5 := &(*(@6), copy (@Global0)) + @6 := &@7 + @5 := &*(@6) @1 := new_v1<'_, 1 : usize, 0 : usize>(move (@2), move (@5)) storage_dead(@5) storage_dead(@2) diff --git a/charon/tests/ui/plain-panic-str.out b/charon/tests/ui/plain-panic-str.out index 7e37e2526..335bc0207 100644 --- a/charon/tests/ui/plain-panic-str.out +++ b/charon/tests/ui/plain-panic-str.out @@ -33,8 +33,8 @@ fn main() storage_live(@3) storage_live(@4) @4 := [const ("O no")] - @3 := &(@4, copy (@Global0)) - @2 := &(*(@3), copy (@Global0)) + @3 := &@4 + @2 := &*(@3) @1 := new_const<'_, 1 : usize>(move (@2)) storage_dead(@2) panic(core::panicking::panic_fmt) diff --git a/charon/tests/ui/polonius_map.out b/charon/tests/ui/polonius_map.out index 5ae87b244..11547b4dc 100644 --- a/charon/tests/ui/polonius_map.out +++ b/charon/tests/ui/polonius_map.out @@ -306,13 +306,13 @@ pub fn get_or_insert<'_0>(@1: &'_0 mut (HashMap[Sized[Sized, Sized, Sized, {impl Eq for u32}, {impl Hash for u32}, {impl BuildHasher for RandomState}, MetaSized, {impl Borrow for T}[MetaSized], {impl Hash for u32}, {impl Eq for u32}](move (@3), move (@4)) storage_dead(@4) storage_dead(@3) @@ -320,25 +320,25 @@ pub fn get_or_insert<'_0>(@1: &'_0 mut (HashMap[Sized { storage_live(@8) storage_live(@9) - @9 := &two-phase-mut (*(map@1), copy (@Global0)) + @9 := &two-phase-mut *(map@1) @8 := insert<'_, u32, u32, RandomState>[Sized, Sized, Sized, {impl Eq for u32}, {impl Hash for u32}, {impl BuildHasher for RandomState}](move (@9), const (22 : u32), const (33 : u32)) storage_dead(@9) storage_dead(@8) storage_live(@10) storage_live(@11) storage_live(@12) - @12 := &(*(map@1), copy (@Global0)) + @12 := &*(map@1) storage_live(@13) storage_live(@14) storage_live(@15) @15 := const (22 : u32) - @14 := &(@15, copy (@Global0)) - @13 := &(*(@14), copy (@Global0)) + @14 := &@15 + @13 := &*(@14) @11 := {impl Index<&'_0 (Q)> for HashMap[@TraitClause0, @TraitClause2, @TraitClause3]}::index<'_, '_, u32, u32, u32, RandomState>[Sized, MetaSized, Sized, Sized, {impl Eq for u32}, {impl Hash for u32}, {impl Borrow for T}[MetaSized], {impl Eq for u32}, {impl Hash for u32}, {impl BuildHasher for RandomState}](move (@12), move (@13)) storage_dead(@13) storage_dead(@12) - @10 := &(*(@11), copy (@Global0)) - @0 := &(*(@10), copy (@Global0)) + @10 := &*(@11) + @0 := &*(@10) storage_dead(@15) storage_dead(@14) storage_dead(@11) @@ -347,7 +347,7 @@ pub fn get_or_insert<'_0>(@1: &'_0 mut (HashMap[Sized { storage_live(v@7) v@7 := copy ((@2 as variant Option::Some).0) - @0 := &(*(v@7), copy (@Global0)) + @0 := &*(v@7) storage_dead(v@7) }, } diff --git a/charon/tests/ui/predicates-on-late-bound-vars.out b/charon/tests/ui/predicates-on-late-bound-vars.out index 3e1ac47ad..bbff78b6b 100644 --- a/charon/tests/ui/predicates-on-late-bound-vars.out +++ b/charon/tests/ui/predicates-on-late-bound-vars.out @@ -130,7 +130,7 @@ fn wrap<'a>(@1: &'a (u32)) -> Option<&'a (u32)>[Sized<&'a (u32)>] let @2: &'_ (u32); // anonymous local storage_live(@2) - @2 := &(*(x@1), copy (@Global0)) + @2 := &*(x@1) @0 := Option::Some { 0: move (@2) } storage_dead(@2) return @@ -146,7 +146,7 @@ where let @2: &'_ (u32); // anonymous local storage_live(@2) - @2 := &(*(x@1), copy (@Global0)) + @2 := &*(x@1) @0 := Option::Some { 0: move (@2) } storage_dead(@2) return @@ -165,7 +165,7 @@ fn foo() storage_live(@2) storage_live(@3) // `try_borrow` has a type that includes predicates on late bound regions. - @3 := &(ref_b@1, copy (@Global0)) + @3 := &ref_b@1 @2 := try_borrow<'_, bool>[MetaSized](move (@3)) storage_dead(@3) drop[{impl Drop for Result[@TraitClause0, @TraitClause1]}[MetaSized], BorrowError>[Sized[MetaSized]>, Sized]] @2 diff --git a/charon/tests/ui/projection-index-from-end.out b/charon/tests/ui/projection-index-from-end.out index 5e1de61bb..d5151cc63 100644 --- a/charon/tests/ui/projection-index-from-end.out +++ b/charon/tests/ui/projection-index-from-end.out @@ -50,7 +50,7 @@ fn slice_pattern_end<'_0>(@1: &'_0 (Slice<()>)) storage_dead(@8) storage_live(@10) @10 := @SliceIndexShared<'_, ()>(move (@7), copy (@9)) - _named@5 := &(*(@10), copy (@Global0)) + _named@5 := &*(@10) @0 := () storage_dead(_named@5) @0 := () diff --git a/charon/tests/ui/ptr-offset.out b/charon/tests/ui/ptr-offset.out index 8030583b8..b20ccafda 100644 --- a/charon/tests/ui/ptr-offset.out +++ b/charon/tests/ui/ptr-offset.out @@ -172,7 +172,7 @@ fn precondition_check(@1: *const (), @2: isize, @3: usize) storage_live(@6) storage_live(@8) @8 := [const ("unsafe precondition(s) violated: ptr::offset requires the address calculation to not overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@7 := &(@8, copy (@Global0)) + pieces@7 := &@8 storage_live(@25) @25 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@7)) storage_live(@26) @@ -241,7 +241,7 @@ fn main() storage_live(ptr@2) storage_live(@3) storage_live(@4) - @4 := &(s@1, copy (@Global0)) + @4 := &s@1 @3 := @ArrayToSliceShared<'_, i32, 2 : usize>(move (@4)) storage_dead(@4) ptr@2 := as_ptr<'_, i32>[Sized](move (@3)) diff --git a/charon/tests/ui/raw-boxes.out b/charon/tests/ui/raw-boxes.out index 5e9ad60bf..40f616f40 100644 --- a/charon/tests/ui/raw-boxes.out +++ b/charon/tests/ui/raw-boxes.out @@ -329,12 +329,12 @@ fn core::ptr::alignment::{Alignment}::new_unchecked::precondition_check(@1: usiz }, _ => { @10 := [] - @9 := &(@10, copy (@Global0)) + @9 := &@10 storage_dead(@6) storage_live(@3) storage_live(@5) @5 := [const ("unsafe precondition(s) violated: Alignment::new_unchecked requires a power of two\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@4 := &(@5, copy (@Global0)) + pieces@4 := &@5 storage_live(@7) @7 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@4)) storage_live(@8) @@ -578,9 +578,9 @@ fn core::ptr::write_bytes::precondition_check(@1: *const (), @2: usize, @3: bool }, _ => { @20 := [const ("is_aligned_to: align is not a power-of-two")] - @19 := &(@20, copy (@Global0)) + @19 := &@20 @22 := [] - @21 := &(@22, copy (@Global0)) + @21 := &@22 storage_dead(@14) storage_live(@10) storage_live(@15) @@ -631,11 +631,11 @@ fn core::ptr::write_bytes::precondition_check(@1: *const (), @2: usize, @3: bool }, } @24 := [] - @23 := &(@24, copy (@Global0)) + @23 := &@24 storage_live(@6) storage_live(@8) @8 := [const ("unsafe precondition(s) violated: ptr::write_bytes requires that the destination pointer is aligned and non-null\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@7 := &(@8, copy (@Global0)) + pieces@7 := &@8 storage_live(@17) @17 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@7)) storage_live(@18) @@ -779,7 +779,7 @@ pub fn new_const<'a, const N : usize>(@1: &'a (Array<&'static (Str), const N : u storage_live(@5) storage_live(@6) @5 := [] - @4 := &(@5, copy (@Global0)) + @4 := &@5 storage_live(@2) @2 := @ArrayToSliceShared<'_, &'_ (Str), const N : usize>(copy (pieces@1)) storage_live(@3) @@ -813,8 +813,8 @@ pub fn panic_nounwind(@1: &'static (Str)) -> ! @7 := copy (expr@1) @6 := [move (@7)] storage_dead(@7) - @5 := &(@6, copy (@Global0)) - @4 := &(*(@5), copy (@Global0)) + @5 := &@6 + @4 := &*(@5) @3 := new_const<'_, 1 : usize>(move (@4)) storage_dead(@4) @2 := panic_nounwind_fmt<'_>(move (@3), const (false)) @@ -1016,9 +1016,9 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () }, _ => { @36 := [const ("is_aligned_to: align is not a power-of-two")] - @35 := &(@36, copy (@Global0)) + @35 := &@36 @38 := [] - @37 := &(@38, copy (@Global0)) + @37 := &@38 storage_dead(@23) storage_live(@19) storage_live(@24) @@ -1056,9 +1056,9 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () }, _ => { @42 := [const ("is_aligned_to: align is not a power-of-two")] - @41 := &(@42, copy (@Global0)) + @41 := &@42 @44 := [] - @43 := &(@44, copy (@Global0)) + @43 := &@44 storage_dead(@30) storage_live(@27) storage_live(@31) @@ -1093,11 +1093,11 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () } else { @40 := [] - @39 := &(@40, copy (@Global0)) + @39 := &@40 storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@16 := &(@17, copy (@Global0)) + pieces@16 := &@17 storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) @@ -1128,11 +1128,11 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () } else { @40 := [] - @39 := &(@40, copy (@Global0)) + @39 := &@40 storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@16 := &(@17, copy (@Global0)) + pieces@16 := &@17 storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) @@ -1150,11 +1150,11 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_dead(@8) storage_dead(zero_size@7) @40 := [] - @39 := &(@40, copy (@Global0)) + @39 := &@40 storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@16 := &(@17, copy (@Global0)) + pieces@16 := &@17 storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) @@ -1175,11 +1175,11 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_dead(@8) storage_dead(zero_size@7) @40 := [] - @39 := &(@40, copy (@Global0)) + @39 := &@40 storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@16 := &(@17, copy (@Global0)) + pieces@16 := &@17 storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) @@ -1213,9 +1213,9 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () }, _ => { @42 := [const ("is_aligned_to: align is not a power-of-two")] - @41 := &(@42, copy (@Global0)) + @41 := &@42 @44 := [] - @43 := &(@44, copy (@Global0)) + @43 := &@44 storage_dead(@30) storage_live(@27) storage_live(@31) @@ -1250,11 +1250,11 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () } else { @40 := [] - @39 := &(@40, copy (@Global0)) + @39 := &@40 storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@16 := &(@17, copy (@Global0)) + pieces@16 := &@17 storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) @@ -1285,11 +1285,11 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () } else { @40 := [] - @39 := &(@40, copy (@Global0)) + @39 := &@40 storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@16 := &(@17, copy (@Global0)) + pieces@16 := &@17 storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) @@ -1307,11 +1307,11 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_dead(@8) storage_dead(zero_size@7) @40 := [] - @39 := &(@40, copy (@Global0)) + @39 := &@40 storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@16 := &(@17, copy (@Global0)) + pieces@16 := &@17 storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) @@ -1332,11 +1332,11 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_dead(@8) storage_dead(zero_size@7) @40 := [] - @39 := &(@40, copy (@Global0)) + @39 := &@40 storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@16 := &(@17, copy (@Global0)) + pieces@16 := &@17 storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) @@ -1356,11 +1356,11 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_dead(@8) storage_dead(zero_size@7) @40 := [] - @39 := &(@40, copy (@Global0)) + @39 := &@40 storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@16 := &(@17, copy (@Global0)) + pieces@16 := &@17 storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) @@ -1382,11 +1382,11 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () storage_dead(@8) storage_dead(zero_size@7) @40 := [] - @39 := &(@40, copy (@Global0)) + @39 := &@40 storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@16 := &(@17, copy (@Global0)) + pieces@16 := &@17 storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) @@ -1414,9 +1414,9 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () }, _ => { @36 := [const ("is_aligned_to: align is not a power-of-two")] - @35 := &(@36, copy (@Global0)) + @35 := &@36 @38 := [] - @37 := &(@38, copy (@Global0)) + @37 := &@38 storage_dead(@23) storage_live(@19) storage_live(@24) @@ -1453,9 +1453,9 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () }, _ => { @42 := [const ("is_aligned_to: align is not a power-of-two")] - @41 := &(@42, copy (@Global0)) + @41 := &@42 @44 := [] - @43 := &(@44, copy (@Global0)) + @43 := &@44 storage_dead(@30) storage_live(@27) storage_live(@31) @@ -1540,11 +1540,11 @@ fn core::ptr::copy_nonoverlapping::precondition_check(@1: *const (), @2: *mut () }, } @40 := [] - @39 := &(@40, copy (@Global0)) + @39 := &@40 storage_live(@15) storage_live(@17) @17 := [const ("unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@16 := &(@17, copy (@Global0)) + pieces@16 := &@17 storage_live(@33) @33 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@16)) storage_live(@34) @@ -1624,7 +1624,7 @@ where dst@9 := cast<*mut Slice, *mut u8>(copy (@15)) storage_live(count@10) storage_live(self@11) - self@11 := &(old_layout@3, copy (@Global0)) + self@11 := &old_layout@3 count@10 := copy ((old_layout@3).size) storage_dead(self@11) storage_live(@19) @@ -1718,7 +1718,7 @@ where dst@9 := cast<*mut Slice, *mut u8>(copy (@15)) storage_live(count@10) storage_live(self@11) - self@11 := &(old_layout@3, copy (@Global0)) + self@11 := &old_layout@3 count@10 := copy ((old_layout@3).size) storage_dead(self@11) storage_live(@19) @@ -1812,7 +1812,7 @@ where dst@9 := cast<*mut Slice, *mut u8>(copy (@15)) storage_live(count@10) storage_live(self@11) - self@11 := &(new_layout@4, copy (@Global0)) + self@11 := &new_layout@4 count@10 := copy ((new_layout@4).size) storage_dead(self@11) storage_live(@19) @@ -2044,12 +2044,12 @@ fn core::ptr::non_null::{NonNull}::new_unchecked::precondition_check(@1: *mut }, } @10 := [] - @9 := &(@10, copy (@Global0)) + @9 := &@10 storage_dead(@6) storage_live(@3) storage_live(@5) @5 := [const ("unsafe precondition(s) violated: NonNull::new_unchecked requires that the pointer is non-null\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@4 := &(@5, copy (@Global0)) + pieces@4 := &@5 storage_live(@7) @7 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@4)) storage_live(@8) @@ -2088,11 +2088,11 @@ fn core::hint::assert_unchecked::precondition_check(@1: bool) } else { @9 := [] - @8 := &(@9, copy (@Global0)) + @8 := &@9 storage_live(@3) storage_live(@5) @5 := [const ("unsafe precondition(s) violated: hint::assert_unchecked must never be called when the condition is false\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@4 := &(@5, copy (@Global0)) + pieces@4 := &@5 storage_live(@6) @6 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@4)) storage_live(@7) @@ -2138,11 +2138,11 @@ fn core::alloc::layout::{Layout}::from_size_align_unchecked::precondition_check( } else { @11 := [] - @10 := &(@11, copy (@Global0)) + @10 := &@11 storage_live(@5) storage_live(@7) @7 := [const ("unsafe precondition(s) violated: Layout::from_size_align_unchecked requires that align is a power of 2 and the rounded-up allocation size does not exceed isize::MAX\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@6 := &(@7, copy (@Global0)) + pieces@6 := &@7 storage_live(@8) @8 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@6)) storage_live(@9) @@ -2300,7 +2300,7 @@ fn alloc_impl<'_0>(@1: &'_0 (Global), @2: Layout, @3: bool) -> Result(@1: &'_0 (Global), @2: Layout, @3: bool) -> Result(@1: &'_0 (Global), @2: Layout, @3: bool) -> Result(@1: &'_0 (Global), @2: Layout, @3: bool) -> Result[Sized, {impl ZeroablePrimitive for usize}]>(copy (@19)) @@ -2687,7 +2687,7 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_live(@90) storage_live(@91) storage_live(self@7) - self@7 := &(old_layout@3, copy (@Global0)) + self@7 := &old_layout@3 old_size@6 := copy ((old_layout@3).size) storage_dead(self@7) switch copy (old_size@6) { @@ -2695,10 +2695,10 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay }, _ => { storage_live(old_size@8) - old_size@8 := &(old_size@6, copy (@Global0)) + old_size@8 := &old_size@6 storage_live(@9) storage_live(self@11) - self@11 := &(old_layout@3, copy (@Global0)) + self@11 := &old_layout@3 @41 := copy ((old_layout@3).align) @42 := copy ((@41).0) @43 := @discriminant(@42) @@ -2710,7 +2710,7 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_dead(self@11) storage_live(@12) storage_live(self@13) - self@13 := &(new_layout@4, copy (@Global0)) + self@13 := &new_layout@4 storage_live(@47) @47 := copy ((new_layout@4).align) storage_live(@49) @@ -2791,7 +2791,7 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_live(layout@40) layout@40 := copy (old_layout@3) storage_live(self@81) - self@81 := &(layout@40, copy (@Global0)) + self@81 := &layout@40 storage_dead(self@81) switch copy (old_size@6) { 0 : usize => { @@ -2800,10 +2800,10 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_live(layout@82) layout@82 := copy (old_layout@3) storage_live(self@83) - self@83 := &(layout@82, copy (@Global0)) + self@83 := &layout@82 storage_dead(self@83) storage_live(self@84) - self@84 := &(layout@82, copy (@Global0)) + self@84 := &layout@82 assert(copy (@46) == true) storage_dead(self@84) @39 := __rust_dealloc(move (ptr@37), copy (old_size@6), move (@10)) @@ -2817,12 +2817,12 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_dead(@12) storage_dead(@9) storage_live(self@15) - self@15 := &(new_layout@4, copy (@Global0)) + self@15 := &new_layout@4 new_size@14 := copy ((new_layout@4).size) storage_dead(self@15) storage_live(cond@16) storage_live(self@17) - self@17 := &(old_layout@3, copy (@Global0)) + self@17 := &old_layout@3 storage_dead(self@17) cond@16 := copy (new_size@14) >= copy (old_size@6) @54 := ub_checks @@ -2840,10 +2840,10 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_live(new_size@22) new_size@22 := copy (new_size@14) storage_live(self@55) - self@55 := &(layout@21, copy (@Global0)) + self@55 := &layout@21 storage_dead(self@55) storage_live(self@56) - self@56 := &(layout@21, copy (@Global0)) + self@56 := &layout@21 assert(copy (@46) == true) storage_dead(self@56) raw_ptr@18 := __rust_realloc(move (ptr@19), copy (old_size@6), move (@10), copy (new_size@14)) @@ -2890,10 +2890,10 @@ unsafe fn grow_impl<'_0>(@1: &'_0 (Global), @2: NonNull, @3: Layout, @4: Lay storage_live(new_size@22) new_size@22 := copy (new_size@14) storage_live(self@55) - self@55 := &(layout@21, copy (@Global0)) + self@55 := &layout@21 storage_dead(self@55) storage_live(self@56) - self@56 := &(layout@21, copy (@Global0)) + self@56 := &layout@21 assert(copy (@46) == true) storage_dead(self@56) raw_ptr@18 := __rust_realloc(move (ptr@19), copy (old_size@6), move (@10), copy (new_size@14)) @@ -3082,7 +3082,7 @@ pub unsafe fn {impl Allocator for Global}::deallocate<'_0>(@1: &'_0 (Global), @2 storage_live(@15) storage_live(@16) storage_live(self@5) - self@5 := &(layout@3, copy (@Global0)) + self@5 := &layout@3 @4 := copy ((layout@3).size) storage_dead(self@5) switch move (@4) { @@ -3094,11 +3094,11 @@ pub unsafe fn {impl Allocator for Global}::deallocate<'_0>(@1: &'_0 (Global), @2 storage_live(layout@7) layout@7 := copy (layout@3) storage_live(self@8) - self@8 := &(layout@7, copy (@Global0)) + self@8 := &layout@7 storage_dead(self@8) storage_live(@9) storage_live(self@10) - self@10 := &(layout@7, copy (@Global0)) + self@10 := &layout@7 storage_live(@11) @11 := copy ((layout@3).align) storage_live(@13) @@ -3379,7 +3379,7 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(@115) storage_live(@116) storage_live(self@6) - self@6 := &(new_layout@4, copy (@Global0)) + self@6 := &new_layout@4 new_size@5 := copy ((new_layout@4).size) storage_dead(self@6) switch copy (new_size@5) { @@ -3387,10 +3387,10 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No }, _ => { storage_live(new_size@12) - new_size@12 := &(new_size@5, copy (@Global0)) + new_size@12 := &new_size@5 storage_live(@13) storage_live(self@15) - self@15 := &(old_layout@3, copy (@Global0)) + self@15 := &old_layout@3 @40 := copy ((old_layout@3).align) @41 := copy ((@40).0) @42 := @discriminant(@41) @@ -3402,7 +3402,7 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_dead(self@15) storage_live(@16) storage_live(self@17) - self@17 := &(new_layout@4, copy (@Global0)) + self@17 := &new_layout@4 storage_live(@68) @68 := copy ((new_layout@4).align) storage_live(@70) @@ -3430,7 +3430,7 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_dead(@13) storage_live(cond@18) storage_live(self@20) - self@20 := &(old_layout@3, copy (@Global0)) + self@20 := &old_layout@3 @19 := copy ((old_layout@3).size) storage_dead(self@20) cond@18 := copy (new_size@5) <= copy (@19) @@ -3449,10 +3449,10 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(new_size@25) new_size@25 := copy (new_size@5) storage_live(self@76) - self@76 := &(layout@24, copy (@Global0)) + self@76 := &layout@24 storage_dead(self@76) storage_live(self@77) - self@77 := &(layout@24, copy (@Global0)) + self@77 := &layout@24 assert(copy (@45) == true) storage_dead(self@77) raw_ptr@21 := __rust_realloc(move (ptr@22), move (@19), move (@14), copy (new_size@5)) @@ -3499,10 +3499,10 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(new_size@25) new_size@25 := copy (new_size@5) storage_live(self@76) - self@76 := &(layout@24, copy (@Global0)) + self@76 := &layout@24 storage_dead(self@76) storage_live(self@77) - self@77 := &(layout@24, copy (@Global0)) + self@77 := &layout@24 assert(copy (@45) == true) storage_dead(self@77) raw_ptr@21 := __rust_realloc(move (ptr@22), move (@19), move (@14), copy (new_size@5)) @@ -3796,7 +3796,7 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No layout@39 := copy (old_layout@3) storage_live(@99) storage_live(self@100) - self@100 := &(layout@39, copy (@Global0)) + self@100 := &layout@39 @99 := copy ((old_layout@3).size) storage_dead(self@100) switch move (@99) { @@ -3806,10 +3806,10 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(layout@101) layout@101 := copy (old_layout@3) storage_live(self@102) - self@102 := &(layout@101, copy (@Global0)) + self@102 := &layout@101 storage_dead(self@102) storage_live(self@103) - self@103 := &(layout@101, copy (@Global0)) + self@103 := &layout@101 assert(copy (@45) == true) storage_dead(self@103) @38 := __rust_dealloc(move (ptr@36), move (@99), move (@14)) @@ -3869,7 +3869,7 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No layout@39 := copy (old_layout@3) storage_live(@99) storage_live(self@100) - self@100 := &(layout@39, copy (@Global0)) + self@100 := &layout@39 @99 := copy ((old_layout@3).size) storage_dead(self@100) switch move (@99) { @@ -3879,10 +3879,10 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(layout@101) layout@101 := copy (old_layout@3) storage_live(self@102) - self@102 := &(layout@101, copy (@Global0)) + self@102 := &layout@101 storage_dead(self@102) storage_live(self@103) - self@103 := &(layout@101, copy (@Global0)) + self@103 := &layout@101 assert(copy (@45) == true) storage_dead(self@103) @38 := __rust_dealloc(move (ptr@36), move (@99), move (@14)) @@ -3912,7 +3912,7 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No layout@8 := copy (old_layout@3) storage_live(@46) storage_live(self@47) - self@47 := &(layout@8, copy (@Global0)) + self@47 := &layout@8 @46 := copy ((old_layout@3).size) storage_dead(self@47) switch move (@46) { @@ -3924,11 +3924,11 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(layout@49) layout@49 := copy (old_layout@3) storage_live(self@50) - self@50 := &(layout@49, copy (@Global0)) + self@50 := &layout@49 storage_dead(self@50) storage_live(@51) storage_live(self@52) - self@52 := &(layout@49, copy (@Global0)) + self@52 := &layout@49 storage_live(@53) @53 := copy ((old_layout@3).align) storage_live(@55) @@ -3961,7 +3961,7 @@ pub unsafe fn {impl Allocator for Global}::shrink<'_0>(@1: &'_0 (Global), @2: No storage_live(@9) storage_live(data@10) storage_live(self@11) - self@11 := &(new_layout@4, copy (@Global0)) + self@11 := &new_layout@4 storage_live(@60) @60 := copy ((new_layout@4).align) @59 := transmute[Sized, {impl ZeroablePrimitive for usize}]>(copy (@60)) @@ -4038,13 +4038,13 @@ fn ct_error(@1: Layout) -> ! storage_live(@6) storage_live(@7) @7 := [const ("allocation failed")] - @6 := &(@7, copy (@Global0)) + @6 := &@7 storage_live(@2) storage_live(@3) storage_live(@4) @5 := move (@6) - @4 := &(*(@5), copy (@Global0)) - @3 := &(*(@4), copy (@Global0)) + @4 := &*(@5) + @3 := &*(@4) @2 := new_const<'_, 1 : usize>(move (@3)) storage_dead(@3) panic(core::panicking::panic_fmt) @@ -4098,7 +4098,7 @@ unsafe fn exchange_malloc(@1: usize, @2: usize) -> *mut u8 else { } @12 := Global { } - @11 := &(@12, copy (@Global0)) + @11 := &@12 storage_dead(@7) storage_live(@9) @9 := transmute(copy (align@2)) @@ -4320,14 +4320,14 @@ where storage_dead(align@9) storage_dead(t@3) storage_live(self@5) - self@5 := &(layout@2, copy (@Global0)) + self@5 := &layout@2 storage_dead(self@5) switch move (size@8) { 0 : usize => { }, _ => { storage_live(@7) - @7 := &((*(self@1)).1, copy (@Global0)) + @7 := &(*(self@1)).1 storage_live(@14) @14 := cast<*mut T, *const u8>(copy (@4)) unique@13 := NonNull { pointer: move (@14) } diff --git a/charon/tests/ui/regressions/closure-inside-impl-with-bound-with-assoc-ty.out b/charon/tests/ui/regressions/closure-inside-impl-with-bound-with-assoc-ty.out index b9c54301c..a8de64322 100644 --- a/charon/tests/ui/regressions/closure-inside-impl-with-bound-with-assoc-ty.out +++ b/charon/tests/ui/regressions/closure-inside-impl-with-bound-with-assoc-ty.out @@ -162,7 +162,7 @@ where let @3: &'_ (closure[@TraitClause0, @TraitClause1]); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<(()), ()> for closure[@TraitClause0, @TraitClause1]}::call<'_, F, Clause1_Repr>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) @0 := () return @@ -180,7 +180,7 @@ where let @3: &'_ mut (closure[@TraitClause0, @TraitClause1]); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(()), ()> for closure[@TraitClause0, @TraitClause1]}::call_mut<'_, F, Clause1_Repr>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0, @TraitClause1]>] @1 @0 := () diff --git a/charon/tests/ui/rename_attribute.out b/charon/tests/ui/rename_attribute.out index 576c15918..2968e4d80 100644 --- a/charon/tests/ui/rename_attribute.out +++ b/charon/tests/ui/rename_attribute.out @@ -88,12 +88,12 @@ where storage_live(@4) storage_live(@2) storage_live(@3) - @3 := &(x@1, copy (@Global0)) + @3 := &x@1 @2 := {impl BoolTrait for bool}::get_bool<'_>(move (@3)) if move (@2) { storage_dead(@3) storage_live(@4) - @4 := &(x@1, copy (@Global0)) + @4 := &x@1 @0 := test_crate::{impl BoolTrait for bool}::ret_true<'_>(move (@4)) storage_dead(@4) } diff --git a/charon/tests/ui/result-unwrap.out b/charon/tests/ui/result-unwrap.out index 891b10dc1..8dc27d044 100644 --- a/charon/tests/ui/result-unwrap.out +++ b/charon/tests/ui/result-unwrap.out @@ -238,7 +238,7 @@ where storage_live(e@2) e@2 := move ((self@1 as variant Result::Err).0) storage_live(@4) - @5 := &(e@2, copy (@Global0)) + @5 := &e@2 @4 := unsize_cast<&'_ (E), &'_ ((dyn exists<_dyn> [@TraitClause0]: Debug<_dyn> + _dyn : '_)), @TraitClause2>(copy (@5)) @3 := unwrap_failed<'_, '_>(const ("called `Result::unwrap()` on an `Err` value"), move (@4)) }, diff --git a/charon/tests/ui/rvalues.out b/charon/tests/ui/rvalues.out index 26ae8bda5..fbf46ee50 100644 --- a/charon/tests/ui/rvalues.out +++ b/charon/tests/ui/rvalues.out @@ -155,7 +155,7 @@ fn addr_of() x@1 := const (0 : u32) storage_live(@2) storage_live(@3) - @3 := &(x@1, copy (@Global0)) + @3 := &x@1 @2 := &raw const (*(@3), copy (@Global0)) storage_dead(@3) storage_dead(@2) @@ -236,7 +236,7 @@ fn ptr_casts() storage_live(@2) storage_live(@3) @3 := @ArrayRepeat<'_, u32, 64 : usize>(const (0 : u32)) - @2 := &(@3, copy (@Global0)) + @2 := &@3 array_ptr@1 := &raw const (*(@2), copy (@Global0)) storage_dead(@2) storage_live(@4) @@ -249,7 +249,7 @@ fn ptr_casts() x@6 := const (0 : u8) storage_live(x@7) storage_live(@8) - @8 := &(x@6, copy (@Global0)) + @8 := &x@6 x@7 := &raw const (*(@8), copy (@Global0)) storage_dead(@8) storage_live(@9) @@ -334,7 +334,7 @@ fn {impl FnMut<(u8)> for closure}::call_mut<'_0>(@1: &'_0 mut (closure), @2: (u8 let @3: &'_ (closure); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<(u8)> for closure}::call<'_>(move (@3), move (args@2)) @0 := () return @@ -349,7 +349,7 @@ fn {impl FnOnce<(u8)> for closure}::call_once(@1: closure, @2: (u8)) let @3: &'_ mut (closure); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(u8)> for closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 @0 := () diff --git a/charon/tests/ui/simple-cmp.out b/charon/tests/ui/simple-cmp.out index faa04bf42..36087fe85 100644 --- a/charon/tests/ui/simple-cmp.out +++ b/charon/tests/ui/simple-cmp.out @@ -163,11 +163,11 @@ fn main() y@2 := const (22 : i32) storage_live(@3) storage_live(@4) - @4 := &(x@1, copy (@Global0)) + @4 := &x@1 storage_live(@5) storage_live(@6) - @6 := &(y@2, copy (@Global0)) - @5 := &(*(@6), copy (@Global0)) + @6 := &y@2 + @5 := &*(@6) @3 := {impl Ord for i32}::cmp<'_, '_>(move (@4), move (@5)) storage_dead(@5) storage_dead(@4) diff --git a/charon/tests/ui/simple/array_index.out b/charon/tests/ui/simple/array_index.out index 1c16bbc87..38eb01dc2 100644 --- a/charon/tests/ui/simple/array_index.out +++ b/charon/tests/ui/simple/array_index.out @@ -22,7 +22,7 @@ pub fn first(@1: Array) -> u32 storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &(s@1, const (@Global0)) + @3 := &s@1 storage_live(@4) @4 := @ArrayIndexShared<'_, u32, 0 : usize>(move (@3), copy (@2)) @0 := copy (*(@4)) diff --git a/charon/tests/ui/simple/assoc-type-with-fn-bound.out b/charon/tests/ui/simple/assoc-type-with-fn-bound.out index 9d9f60c58..0ed58f343 100644 --- a/charon/tests/ui/simple/assoc-type-with-fn-bound.out +++ b/charon/tests/ui/simple/assoc-type-with-fn-bound.out @@ -106,7 +106,7 @@ where let @3: (); // anonymous local storage_live(@2) - @2 := &(*(self@1), copy (@Global0)) + @2 := &*(self@1) storage_live(@3) @3 := () @0 := @TraitClause0::call<'_>(move (@2), move (@3)) diff --git a/charon/tests/ui/simple/box-into-inner.out b/charon/tests/ui/simple/box-into-inner.out index f6512b31a..f76f57742 100644 --- a/charon/tests/ui/simple/box-into-inner.out +++ b/charon/tests/ui/simple/box-into-inner.out @@ -122,7 +122,7 @@ fn into_inner(@1: alloc::boxed::Box[MetaSized, Sized]) drop[{impl Drop for String}] _x@2 storage_dead(_x@2) @5 := transmute, *const String>(copy ((*(b@1)).0)) - @3 := &mut (b@1, copy (@Global0)) + @3 := &mut b@1 @4 := {impl Drop for alloc::boxed::Box[@TraitClause0, @TraitClause1]}::drop<'_, String, Global>[MetaSized, Sized](move (@3)) @0 := () return diff --git a/charon/tests/ui/simple/call-foreign-defaulted-method.out b/charon/tests/ui/simple/call-foreign-defaulted-method.out index cd39c6a63..c98225844 100644 --- a/charon/tests/ui/simple/call-foreign-defaulted-method.out +++ b/charon/tests/ui/simple/call-foreign-defaulted-method.out @@ -36,7 +36,7 @@ fn main() storage_live(@2) storage_live(@3) @3 := () - @2 := &(@3, copy (@Global0)) + @2 := &@3 @1 := test_crate::foo::{impl Trait for ()}::defaulted<'_>(move (@2)) storage_dead(@2) storage_dead(@3) diff --git a/charon/tests/ui/simple/call-method-via-supertrait-bound.out b/charon/tests/ui/simple/call-method-via-supertrait-bound.out index 77b1b0a89..55723d2e4 100644 --- a/charon/tests/ui/simple/call-method-via-supertrait-bound.out +++ b/charon/tests/ui/simple/call-method-via-supertrait-bound.out @@ -101,7 +101,7 @@ where storage_live(@2) storage_live(@3) - @3 := &(x@1, copy (@Global0)) + @3 := &x@1 @2 := {impl HasMethod for T}::method<'_, T>[@TraitClause0, @TraitClause1::parent_clause1](move (@3)) storage_dead(@3) storage_dead(@2) diff --git a/charon/tests/ui/simple/closure-capture-ref-by-move.out b/charon/tests/ui/simple/closure-capture-ref-by-move.out index ff75434b5..805387176 100644 --- a/charon/tests/ui/simple/closure-capture-ref-by-move.out +++ b/charon/tests/ui/simple/closure-capture-ref-by-move.out @@ -112,12 +112,12 @@ fn foo() storage_live(x@1) x@1 := const (0 : i32) storage_live(rx@2) - rx@2 := &mut (x@1, copy (@Global0)) + rx@2 := &mut x@1 storage_live(closure@3) closure@3 := closure { 0: move (rx@2) } storage_live(@4) storage_live(@5) - @5 := &mut (closure@3, copy (@Global0)) + @5 := &mut closure@3 storage_live(@6) @6 := () @4 := {impl FnMut<()> for closure<'_0>}::call_mut<'_, '_>(move (@5), move (@6)) @@ -141,7 +141,7 @@ fn {impl FnOnce<()> for closure<'_0>}::call_once<'_0>(@1: closure<'_0>, @2: ()) let @3: &'_ mut (closure<'_0>); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<()> for closure<'_0>}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop>] @1 @0 := () diff --git a/charon/tests/ui/simple/closure-fn.out b/charon/tests/ui/simple/closure-fn.out index e68da5df5..4de7f9396 100644 --- a/charon/tests/ui/simple/closure-fn.out +++ b/charon/tests/ui/simple/closure-fn.out @@ -106,7 +106,7 @@ where let @3: (u8, u8); // anonymous local storage_live(@2) - @2 := &(*(f@1), copy (@Global0)) + @2 := &*(f@1) storage_live(@3) @3 := (const (10 : u8), const (20 : u8)) @0 := @TraitClause1::call<'_>(move (@2), move (@3)) @@ -128,7 +128,7 @@ where let @3: (u8, u8); // anonymous local storage_live(@2) - @2 := &mut (*(f@1), copy (@Global0)) + @2 := &mut *(f@1) storage_live(@3) @3 := (const (10 : u8), const (20 : u8)) @0 := @TraitClause1::call_mut<'_>(move (@2), move (@3)) @@ -225,7 +225,7 @@ fn {impl FnMut<(u8, u8)> for closure<'_0, '_1>}::call_mut<'_0, '_1, '_2>(@1: &'_ let @3: &'_ (closure<'_0, '_1>); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<(u8, u8)> for closure<'_0, '_1>}::call<'_0, '_1, '_>(move (@3), move (args@2)) return } @@ -239,7 +239,7 @@ fn {impl FnOnce<(u8, u8)> for closure<'_0, '_1>}::call_once<'_0, '_1>(@1: closur let @3: &'_ mut (closure<'_0, '_1>); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(u8, u8)> for closure<'_0, '_1>}::call_mut<'_0, '_1, '_>(move (@3), move (@2)) drop[Drop>] @1 return @@ -303,15 +303,15 @@ fn main() z@2 := const (1 : u8) storage_live(f@3) storage_live(@4) - @4 := &(v@1, copy (@Global0)) + @4 := &v@1 storage_live(@5) - @5 := &(z@2, copy (@Global0)) + @5 := &z@2 f@3 := closure { 0: move (@4), 1: move (@5) } storage_dead(@5) storage_dead(@4) storage_live(@6) storage_live(@7) - @7 := &(f@3, copy (@Global0)) + @7 := &f@3 storage_live(@8) @8 := (const (10 : u8), const (20 : u8)) @6 := {impl Fn<(u8, u8)> for closure<'_0, '_1>}::call<'_, '_, '_>(move (@7), move (@8)) @@ -321,8 +321,8 @@ fn main() storage_live(@9) storage_live(@10) storage_live(@11) - @11 := &(f@3, copy (@Global0)) - @10 := &(*(@11), copy (@Global0)) + @11 := &f@3 + @10 := &*(@11) @9 := apply_to<'_, closure<'_, '_>>[Sized>, {impl Fn<(u8, u8)> for closure<'_0, '_1>}<'_, '_>](move (@10)) storage_dead(@10) storage_dead(@11) @@ -330,8 +330,8 @@ fn main() storage_live(@12) storage_live(@13) storage_live(@14) - @14 := &mut (f@3, copy (@Global0)) - @13 := &two-phase-mut (*(@14), copy (@Global0)) + @14 := &mut f@3 + @13 := &two-phase-mut *(@14) @12 := apply_to_mut<'_, closure<'_, '_>>[Sized>, {impl FnMut<(u8, u8)> for closure<'_0, '_1>}<'_, '_>](move (@13)) storage_dead(@13) storage_dead(@14) diff --git a/charon/tests/ui/simple/closure-fnmut.out b/charon/tests/ui/simple/closure-fnmut.out index fa4bca1dc..4d354b214 100644 --- a/charon/tests/ui/simple/closure-fnmut.out +++ b/charon/tests/ui/simple/closure-fnmut.out @@ -90,7 +90,7 @@ where let @3: (u8); // anonymous local storage_live(@2) - @2 := &mut (f@1, copy (@Global0)) + @2 := &mut f@1 storage_live(@3) @3 := (const (0 : u8)) @0 := @TraitClause1::call_mut<'_>(move (@2), move (@3)) @@ -143,7 +143,7 @@ fn {impl FnOnce<(u8)> for closure<'_0>}::call_once<'_0>(@1: closure<'_0>, @2: (u let @3: &'_ mut (closure<'_0>); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(u8)> for closure<'_0>}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop>] @1 return @@ -184,7 +184,7 @@ fn main() storage_live(@2) storage_live(@3) storage_live(@4) - @4 := &mut (z@1, copy (@Global0)) + @4 := &mut z@1 @3 := closure { 0: move (@4) } storage_dead(@4) @2 := apply_to_zero_mut>[Sized>, {impl FnMut<(u8)> for closure<'_0>}<'_>](move (@3)) diff --git a/charon/tests/ui/simple/closure-inside-impl.out b/charon/tests/ui/simple/closure-inside-impl.out index 7fdf14f5a..0c4fc452b 100644 --- a/charon/tests/ui/simple/closure-inside-impl.out +++ b/charon/tests/ui/simple/closure-inside-impl.out @@ -155,7 +155,7 @@ where let @3: &'_ (closure[@TraitClause0, @TraitClause1]); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<(())> for closure[@TraitClause0, @TraitClause1]}::call<'_, F, T>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) @0 := () return @@ -173,7 +173,7 @@ where let @3: &'_ mut (closure[@TraitClause0, @TraitClause1]); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(())> for closure[@TraitClause0, @TraitClause1]}::call_mut<'_, F, T>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0, @TraitClause1]>] @1 @0 := () diff --git a/charon/tests/ui/simple/closure-uses-ambient-self-clause.out b/charon/tests/ui/simple/closure-uses-ambient-self-clause.out index 810f1bb9f..71148d3a2 100644 --- a/charon/tests/ui/simple/closure-uses-ambient-self-clause.out +++ b/charon/tests/ui/simple/closure-uses-ambient-self-clause.out @@ -142,7 +142,7 @@ where storage_live(@2) storage_live(@3) @3 := closure { } - @2 := &(@3, copy (@Global0)) + @2 := &@3 storage_live(@4) storage_live(@5) @5 := move (i@1) @@ -169,7 +169,7 @@ where let @3: &'_ (closure[@TraitClause0]); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<(@TraitClause0::Item)> for closure[@TraitClause0]}::call<'_, Self>[@TraitClause0](move (@3), move (args@2)) @0 := () return @@ -186,7 +186,7 @@ where let @3: &'_ mut (closure[@TraitClause0]); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(@TraitClause0::Item)> for closure[@TraitClause0]}::call_mut<'_, Self>[@TraitClause0](move (@3), move (@2)) drop[Drop[@TraitClause0]>] @1 @0 := () diff --git a/charon/tests/ui/simple/closure-with-drops.out b/charon/tests/ui/simple/closure-with-drops.out index 80dd1876e..5323c7c9b 100644 --- a/charon/tests/ui/simple/closure-with-drops.out +++ b/charon/tests/ui/simple/closure-with-drops.out @@ -208,7 +208,7 @@ fn {impl FnMut<()> for test_crate::bar::closure}::call_mut<'_0>(@1: &'_0 mut (te let @3: &'_ (test_crate::bar::closure); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<()> for test_crate::bar::closure}::call<'_>(move (@3), move (args@2)) @0 := () return @@ -223,7 +223,7 @@ fn {impl FnOnce<()> for test_crate::bar::closure}::call_once(@1: test_crate::bar let @3: &'_ mut (test_crate::bar::closure); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<()> for test_crate::bar::closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 @0 := () diff --git a/charon/tests/ui/simple/const-subslice.out b/charon/tests/ui/simple/const-subslice.out index 62c3a8501..369e6b964 100644 --- a/charon/tests/ui/simple/const-subslice.out +++ b/charon/tests/ui/simple/const-subslice.out @@ -30,7 +30,7 @@ fn main() storage_live(y@1) @7 := [const (0 : u8), const (1 : u8), const (2 : u8)] @8 := () - @9 := &(@7, move (@8)) + @9 := &@7 y@1 := move (@9) storage_live(z@2) storage_live(@3) diff --git a/charon/tests/ui/simple/drop-string.out b/charon/tests/ui/simple/drop-string.out index 33ea71bf4..203a82034 100644 --- a/charon/tests/ui/simple/drop-string.out +++ b/charon/tests/ui/simple/drop-string.out @@ -93,7 +93,7 @@ fn {impl Drop for String}::drop<'_0>(@1: &'_0 mut (String)) let @2: &'_ mut (String); // anonymous local storage_live(@2) - @2 := &mut (*(@1), copy (@Global0)) + @2 := &mut *(@1) drop[{impl Drop for Vec[@TraitClause0, @TraitClause1, @TraitClause3, @TraitClause4]}[Sized, Sized, Drop, {impl Drop for Global}]] (*(@2)).vec @0 := () return diff --git a/charon/tests/ui/simple/dyn-fn.out b/charon/tests/ui/simple/dyn-fn.out index 49361d107..d174c054a 100644 --- a/charon/tests/ui/simple/dyn-fn.out +++ b/charon/tests/ui/simple/dyn-fn.out @@ -125,8 +125,8 @@ fn takes_fn<'_0>(@1: &'_0 ((dyn exists<_dyn> [@TraitClause0]: for<'a> Fn<_dyn, ( storage_live(@5) storage_live(@6) storage_live(@7) - @7 := &mut (counter@2, copy (@Global0)) - @6 := &two-phase-mut (*(@7), copy (@Global0)) + @7 := &mut counter@2 + @6 := &two-phase-mut *(@7) @5 := (move (@6)) @3 := Fn<(dyn exists<_dyn> [@TraitClause0]: for<'a> Fn<_dyn, (&'a mut (u32))> + _dyn : '_ + for<'a> @TraitClause1_0::parent_clause1::parent_clause1::Output = bool), (&'_ mut (u32))>::call<'_>(move (@4), move (@5)) if move (@3) { @@ -179,7 +179,7 @@ fn {impl FnMut<(&'_ mut (u32))> for closure}::call_mut<'_0, '_1>(@1: &'_1 mut (c let @3: &'_ (closure); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<(&'_ mut (u32))> for closure}::call<'_0, '_>(move (@3), move (args@2)) return } @@ -193,7 +193,7 @@ fn {impl FnOnce<(&'_ mut (u32))> for closure}::call_once<'_0>(@1: closure, @2: ( let @3: &'_ mut (closure); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(&'_ mut (u32))> for closure}::call_mut<'_0, '_>(move (@3), move (@2)) drop[Drop] @1 return @@ -244,8 +244,8 @@ fn gives_fn() storage_live(@3) storage_live(@4) @4 := closure { } - @3 := &(@4, copy (@Global0)) - @2 := &(*(@3), copy (@Global0)) + @3 := &@4 + @2 := &*(@3) @1 := unsize_cast<&'_ (closure), &'_ ((dyn exists<_dyn> [@TraitClause0]: for<'a> Fn<_dyn, (&'a mut (u32))> + _dyn : '_ + for<'a> @TraitClause1_0::parent_clause1::parent_clause1::Output = bool)), {impl Fn<(&'_ mut (u32))> for closure}<'_>>(move (@2)) storage_dead(@2) @0 := takes_fn<'_>(move (@1)) diff --git a/charon/tests/ui/simple/gat-complex-lifetimes.out b/charon/tests/ui/simple/gat-complex-lifetimes.out index 3c3d3c87a..33dc7103b 100644 --- a/charon/tests/ui/simple/gat-complex-lifetimes.out +++ b/charon/tests/ui/simple/gat-complex-lifetimes.out @@ -77,7 +77,7 @@ where storage_live(@3) @3 := move (x@1) @2 := (@TraitClause1::Type::[@TraitClause1])::foo(move (@3)) - @0 := &(*(@2), copy (@Global0)) + @0 := &*(@2) storage_dead(@3) storage_dead(@2) drop[Drop<@TraitClause1::Type>] x@1 diff --git a/charon/tests/ui/simple/gat-implied-clause.out b/charon/tests/ui/simple/gat-implied-clause.out index 3c0b4cecf..c3b327003 100644 --- a/charon/tests/ui/simple/gat-implied-clause.out +++ b/charon/tests/ui/simple/gat-implied-clause.out @@ -89,7 +89,7 @@ where storage_live(@2) storage_live(@3) - @3 := &(x@1, copy (@Global0)) + @3 := &x@1 @2 := (@TraitClause1::LifetimeGat::[@TraitClause1])::clone<'_>(move (@3)) storage_dead(@3) drop[Drop<@TraitClause1::LifetimeGat>] @2 @@ -113,7 +113,7 @@ where storage_live(@2) storage_live(@3) - @3 := &(x@1, copy (@Global0)) + @3 := &x@1 @2 := (@TraitClause1::NonLifetimeGat::[@TraitClause1])::clone<'_>(move (@3)) storage_dead(@3) drop[Drop<@TraitClause1::NonLifetimeGat>] @2 diff --git a/charon/tests/ui/simple/generic-cast-to-dyn.out b/charon/tests/ui/simple/generic-cast-to-dyn.out index 24d10e6ea..69768a90f 100644 --- a/charon/tests/ui/simple/generic-cast-to-dyn.out +++ b/charon/tests/ui/simple/generic-cast-to-dyn.out @@ -66,7 +66,7 @@ where storage_live(@2) storage_live(@3) storage_live(@4) - @4 := &(*(x@1), copy (@Global0)) + @4 := &*(x@1) @3 := unsize_cast<&'_ (T), &'_ ((dyn exists<_dyn> [@TraitClause0]: Any<_dyn> + _dyn : '_)), @TraitClause1>(move (@4)) storage_dead(@4) storage_live(@5) diff --git a/charon/tests/ui/simple/lending-iterator-gat.out b/charon/tests/ui/simple/lending-iterator-gat.out index 98d31fe8b..00545c5a8 100644 --- a/charon/tests/ui/simple/lending-iterator-gat.out +++ b/charon/tests/ui/simple/lending-iterator-gat.out @@ -151,15 +151,15 @@ where }, } storage_live(item@2) - item@2 := &mut ((*(self@1) as variant Option::Some).0, copy (@Global0)) + item@2 := &mut (*(self@1) as variant Option::Some).0 storage_live(item@3) - item@3 := &(*(*(item@2)), copy (@Global0)) + item@3 := &*(*(item@2)) storage_live(@4) @4 := Option::None { } *(self@1) := move (@4) storage_dead(@4) storage_live(@5) - @5 := &(*(item@3), copy (@Global0)) + @5 := &*(item@3) @0 := Option::Some { 0: move (@5) } storage_dead(@5) storage_dead(item@3) @@ -208,7 +208,7 @@ where loop { storage_live(@4) storage_live(@5) - @5 := &two-phase-mut (iter@1, copy (@Global0)) + @5 := &two-phase-mut iter@1 @4 := @TraitClause2::next<'_>(move (@5)) storage_dead(@5) match @4 { @@ -221,7 +221,7 @@ where storage_live(item@6) item@6 := move ((@4 as variant Option::Some).0) storage_live(@7) - @7 := &mut (f@2, copy (@Global0)) + @7 := &mut f@2 storage_live(@8) storage_live(@9) @9 := move (item@6) @@ -285,7 +285,7 @@ fn {impl FnOnce<(&'_ (i32))> for closure<'_0>}::call_once<'_0, '_1>(@1: closure< let @3: &'_ mut (closure<'_0>); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(&'_ (i32))> for closure<'_0>}::call_mut<'_0, '_1, '_>(move (@3), move (@2)) drop[Drop>] @1 @0 := () @@ -357,7 +357,7 @@ pub fn main() storage_live(@3) storage_live(@4) @4 := const (42 : i32) - @3 := &(@4, copy (@Global0)) + @3 := &@4 iter@2 := Option::Some { 0: move (@3) } storage_dead(@3) storage_live(sum@5) @@ -367,7 +367,7 @@ pub fn main() @7 := copy (iter@2) storage_live(@8) storage_live(@9) - @9 := &mut (sum@5, copy (@Global0)) + @9 := &mut sum@5 @8 := closure { 0: move (@9) } storage_dead(@9) @6 := for_each[Sized<&'_ (i32)>], closure<'_>>[Sized[Sized<&'_ (i32)>]>, Sized>, {impl LendingIterator for Option<&'a (T)>[Sized<&'_ (T)>]}<'_, i32>[Sized], {impl FnMut<(&'_ (i32))> for closure<'_0>}<'_, '_>](move (@7), move (@8)) @@ -377,11 +377,11 @@ pub fn main() storage_live(@10) storage_live(@11) storage_live(@12) - @12 := &(sum@5, copy (@Global0)) + @12 := &sum@5 storage_live(@13) storage_live(@14) @14 := const (42 : i32) - @13 := &(@14, copy (@Global0)) + @13 := &@14 @11 := (move (@12), move (@13)) storage_dead(@13) storage_dead(@12) @@ -406,12 +406,12 @@ pub fn main() @21 := move (kind@20) storage_live(@22) storage_live(@23) - @23 := &(*(left_val@15), copy (@Global0)) - @22 := &(*(@23), copy (@Global0)) + @23 := &*(left_val@15) + @22 := &*(@23) storage_live(@24) storage_live(@25) - @25 := &(*(right_val@16), copy (@Global0)) - @24 := &(*(@25), copy (@Global0)) + @25 := &*(right_val@16) + @24 := &*(@25) storage_live(@26) @26 := Option::None { } panic(core::panicking::assert_failed) diff --git a/charon/tests/ui/simple/mem-discriminant-from-derive.out b/charon/tests/ui/simple/mem-discriminant-from-derive.out index 83d9162ef..dcb7dda8c 100644 --- a/charon/tests/ui/simple/mem-discriminant-from-derive.out +++ b/charon/tests/ui/simple/mem-discriminant-from-derive.out @@ -245,12 +245,12 @@ pub fn {impl PartialEq for Enum}::eq<'_0, '_1>(@1: &'_0 (Enum), @2: &'_1 ( storage_live(@16) storage_live(__self_discr@3) storage_live(@4) - @4 := &(*(self@1), copy (@Global0)) + @4 := &*(self@1) __self_discr@3 := @discriminant(*(@4)) storage_dead(@4) storage_live(__arg1_discr@5) storage_live(@6) - @6 := &(*(other@2), copy (@Global0)) + @6 := &*(other@2) __arg1_discr@5 := @discriminant(*(@6)) storage_dead(@6) storage_live(@7) @@ -275,13 +275,13 @@ pub fn {impl PartialEq for Enum}::eq<'_0, '_1>(@1: &'_0 (Enum), @2: &'_1 ( match *((@10).1) { Enum::Some => { storage_live(__self_0@13) - __self_0@13 := &((*((@10).0) as variant Enum::Some).0, copy (@Global0)) + __self_0@13 := &(*((@10).0) as variant Enum::Some).0 storage_live(__arg1_0@14) - __arg1_0@14 := &((*((@10).1) as variant Enum::Some).0, copy (@Global0)) + __arg1_0@14 := &(*((@10).1) as variant Enum::Some).0 storage_live(@15) - @15 := &(__self_0@13, copy (@Global0)) + @15 := &__self_0@13 storage_live(@16) - @16 := &(__arg1_0@14, copy (@Global0)) + @16 := &__arg1_0@14 @0 := {impl PartialEq<&'_0 (B)> for &'_1 (A)}::eq<'_, '_, '_, '_, u8, u8>[{impl PartialEq for u8}](move (@15), move (@16)) storage_dead(@16) storage_dead(@15) diff --git a/charon/tests/ui/simple/multiple-promoteds.out b/charon/tests/ui/simple/multiple-promoteds.out index 0aa14cb3b..f39246ec0 100644 --- a/charon/tests/ui/simple/multiple-promoteds.out +++ b/charon/tests/ui/simple/multiple-promoteds.out @@ -85,16 +85,16 @@ fn six() -> u32 @2 := const (0 : u32) panic.+ const (1 : u32) @11 := const (0 : u32) wrap.+ const (1 : u32) @10 := move (@11) - @9 := &(@10, copy (@Global0)) + @9 := &@10 @8 := move (@9) - x@1 := &(*(@8), copy (@Global0)) + x@1 := &*(@8) storage_live(y@3) @4 := const (2 : u32) panic.+ const (3 : u32) @14 := const (2 : u32) wrap.+ const (3 : u32) @13 := move (@14) - @12 := &(@13, copy (@Global0)) + @12 := &@13 @7 := move (@12) - y@3 := &(*(@7), copy (@Global0)) + y@3 := &*(@7) storage_live(@5) @5 := copy (x@1) storage_live(@6) diff --git a/charon/tests/ui/simple/nested-closure-trait-ref.out b/charon/tests/ui/simple/nested-closure-trait-ref.out index 15de9f426..e3f0b252e 100644 --- a/charon/tests/ui/simple/nested-closure-trait-ref.out +++ b/charon/tests/ui/simple/nested-closure-trait-ref.out @@ -198,7 +198,7 @@ where let @3: &'_ (T); // anonymous local storage_live(@3) - @3 := &((*(@1)).0, copy (@Global0)) + @3 := &(*(@1)).0 @0 := @TraitClause1::clone<'_>(move (@3)) storage_dead(@3) return @@ -216,7 +216,7 @@ where let @3: &'_ (test_crate::foo::closure::closure[@TraitClause0, @TraitClause1]); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<()> for test_crate::foo::closure::closure[@TraitClause0, @TraitClause1]}::call<'_, T>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) return } @@ -233,7 +233,7 @@ where let @3: &'_ mut (test_crate::foo::closure::closure[@TraitClause0, @TraitClause1]); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<()> for test_crate::foo::closure::closure[@TraitClause0, @TraitClause1]}::call_mut<'_, T>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0, @TraitClause1]>] @1 return diff --git a/charon/tests/ui/simple/nested-closure.out b/charon/tests/ui/simple/nested-closure.out index cf4a353d9..64a00a8b0 100644 --- a/charon/tests/ui/simple/nested-closure.out +++ b/charon/tests/ui/simple/nested-closure.out @@ -161,7 +161,7 @@ where let @3: &'_ (T); // anonymous local storage_live(@3) - @3 := &(*((*(@1)).0), copy (@Global0)) + @3 := &*((*(@1)).0) @0 := test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure { 0: move (@3) } storage_dead(@3) return @@ -182,7 +182,7 @@ where storage_live(_y@3) _y@3 := move ((tupled_args@2).0) storage_live(@4) - @4 := &(*((*(@1)).0), copy (@Global0)) + @4 := &*((*(@1)).0) @0 := test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure::closure { 0: move (@4) } storage_dead(@4) return @@ -203,7 +203,7 @@ where storage_live(_z@3) _z@3 := move ((tupled_args@2).0) storage_live(@4) - @4 := &(*((*(@1)).0), copy (@Global0)) + @4 := &*((*(@1)).0) @0 := @TraitClause1::clone<'_>(move (@4)) storage_dead(@4) return @@ -236,7 +236,7 @@ where storage_live(clo@2) storage_live(@3) - @3 := &(*(*(x@1)), copy (@Global0)) + @3 := &*(*(x@1)) clo@2 := test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure { 0: move (@3) } storage_dead(@3) storage_live(@4) @@ -244,11 +244,11 @@ where storage_live(@6) storage_live(@7) storage_live(@8) - @8 := &(clo@2, copy (@Global0)) + @8 := &clo@2 storage_live(@9) @9 := () @7 := {impl Fn<()> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call<'_, '_, '_, T>[@TraitClause0, @TraitClause1](move (@8), move (@9)) - @6 := &(@7, copy (@Global0)) + @6 := &@7 storage_dead(@9) storage_dead(@8) storage_live(@10) @@ -256,11 +256,11 @@ where storage_live(@12) storage_live(@13) @13 := const (0 : u32) - @12 := &(@13, copy (@Global0)) - @11 := &(*(@12), copy (@Global0)) + @12 := &@13 + @11 := &*(@12) @10 := (move (@11)) @5 := {impl Fn<(&'_ (u32))> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call<'_, '_, '_, '_, T>[@TraitClause0, @TraitClause1](move (@6), move (@10)) - @4 := &(@5, copy (@Global0)) + @4 := &@5 storage_dead(@11) storage_dead(@10) storage_dead(@6) @@ -269,8 +269,8 @@ where storage_live(@16) storage_live(@17) @17 := const (1 : u32) - @16 := &(@17, copy (@Global0)) - @15 := &(*(@16), copy (@Global0)) + @16 := &@17 + @15 := &*(@16) @14 := (move (@15)) @0 := {impl Fn<(&'_ (u32))> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call<'_, '_, '_, '_, T>[@TraitClause0, @TraitClause1](move (@4), move (@14)) storage_dead(@15) @@ -298,7 +298,7 @@ where let @3: &'_ (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<()> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call<'_, '_1, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) return } @@ -315,7 +315,7 @@ where let @3: &'_ mut (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<()> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call_mut<'_, '_1, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0]}::test_nested_closures::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]>] @1 return @@ -376,7 +376,7 @@ where let @3: &'_ (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<(&'_ (u32))> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call<'_, '_1, '_2, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) return } @@ -393,7 +393,7 @@ where let @3: &'_ mut (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(&'_ (u32))> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call_mut<'_, '_1, '_2, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0]}::test_nested_closures::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]>] @1 return @@ -454,7 +454,7 @@ where let @3: &'_ (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<(&'_ (u32))> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call<'_, '_1, '_2, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (args@2)) return } @@ -471,7 +471,7 @@ where let @3: &'_ mut (test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(&'_ (u32))> for test_crate::{Foo<'a, T>[@TraitClause0]}::test_nested_closures::closure::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]}::call_mut<'_, '_1, '_2, '_, T>[@TraitClause0, @TraitClause1](move (@3), move (@2)) drop[Drop[@TraitClause0]}::test_nested_closures::closure::closure::closure<'_, '_1, T>[@TraitClause0, @TraitClause1]>] @1 return diff --git a/charon/tests/ui/simple/pointee_metadata.out b/charon/tests/ui/simple/pointee_metadata.out index 4c075b3c7..f7b2a1956 100644 --- a/charon/tests/ui/simple/pointee_metadata.out +++ b/charon/tests/ui/simple/pointee_metadata.out @@ -236,7 +236,7 @@ fn empty_metadata() storage_live(@3) storage_live(@4) @4 := const (0 : u32) - @3 := &(@4, copy (@Global0)) + @3 := &@4 @2 := &raw const (*(@3), copy (@Global0)) @1 := to_raw_parts(move (@2)) storage_dead(@2) @@ -264,7 +264,7 @@ fn slice_metadata() storage_live(@4) storage_live(@5) @5 := [const (0 : u32), const (1 : u32)] - @4 := &(@5, copy (@Global0)) + @4 := &@5 @3 := &raw const (*(@4), copy (@Global0)) @2 := unsize_cast<*const Array, *const Slice, 2 : usize>(move (@3)) storage_dead(@3) diff --git a/charon/tests/ui/simple/promoted-closure-no-warns.out b/charon/tests/ui/simple/promoted-closure-no-warns.out index 6c1d77b2d..9c4c5b5a9 100644 --- a/charon/tests/ui/simple/promoted-closure-no-warns.out +++ b/charon/tests/ui/simple/promoted-closure-no-warns.out @@ -110,13 +110,13 @@ pub fn foo() -> &'static (closure) storage_live(@4) storage_live(@5) @5 := closure { } - @4 := &(@5, copy (@Global0)) + @4 := &@5 storage_live(@1) storage_live(@2) @3 := move (@4) - @2 := &(*(@3), copy (@Global0)) - @1 := &(*(@2), copy (@Global0)) - @0 := &(*(@1), copy (@Global0)) + @2 := &*(@3) + @1 := &*(@2) + @0 := &*(@1) storage_dead(@2) storage_dead(@1) return @@ -145,7 +145,7 @@ fn {impl FnMut<(u32)> for closure}::call_mut<'_0>(@1: &'_0 mut (closure), @2: (u let @3: &'_ (closure); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<(u32)> for closure}::call<'_>(move (@3), move (args@2)) return } @@ -159,7 +159,7 @@ fn {impl FnOnce<(u32)> for closure}::call_once(@1: closure, @2: (u32)) -> u32 let @3: &'_ mut (closure); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(u32)> for closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return diff --git a/charon/tests/ui/simple/promoted-closure.out b/charon/tests/ui/simple/promoted-closure.out index 6c1d77b2d..9c4c5b5a9 100644 --- a/charon/tests/ui/simple/promoted-closure.out +++ b/charon/tests/ui/simple/promoted-closure.out @@ -110,13 +110,13 @@ pub fn foo() -> &'static (closure) storage_live(@4) storage_live(@5) @5 := closure { } - @4 := &(@5, copy (@Global0)) + @4 := &@5 storage_live(@1) storage_live(@2) @3 := move (@4) - @2 := &(*(@3), copy (@Global0)) - @1 := &(*(@2), copy (@Global0)) - @0 := &(*(@1), copy (@Global0)) + @2 := &*(@3) + @1 := &*(@2) + @0 := &*(@1) storage_dead(@2) storage_dead(@1) return @@ -145,7 +145,7 @@ fn {impl FnMut<(u32)> for closure}::call_mut<'_0>(@1: &'_0 mut (closure), @2: (u let @3: &'_ (closure); // anonymous local storage_live(@3) - @3 := &(*(state@1), copy (@Global0)) + @3 := &*(state@1) @0 := {impl Fn<(u32)> for closure}::call<'_>(move (@3), move (args@2)) return } @@ -159,7 +159,7 @@ fn {impl FnOnce<(u32)> for closure}::call_once(@1: closure, @2: (u32)) -> u32 let @3: &'_ mut (closure); // anonymous local storage_live(@3) - @3 := &mut (@1, copy (@Global0)) + @3 := &mut @1 @0 := {impl FnMut<(u32)> for closure}::call_mut<'_>(move (@3), move (@2)) drop[Drop] @1 return diff --git a/charon/tests/ui/simple/promoted-in-generic-fn.out b/charon/tests/ui/simple/promoted-in-generic-fn.out index c5c74d64f..d75385821 100644 --- a/charon/tests/ui/simple/promoted-in-generic-fn.out +++ b/charon/tests/ui/simple/promoted-in-generic-fn.out @@ -44,10 +44,10 @@ where storage_live(@4) // This can't be evaluated generically. @4 := size_of[@TraitClause0]() - @3 := &(@4, copy (@Global0)) + @3 := &@4 storage_live(@1) @2 := move (@3) - @1 := &(*(@2), copy (@Global0)) + @1 := &*(@2) storage_dead(@1) @0 := () @0 := () diff --git a/charon/tests/ui/simple/promoted-inside-impl.out b/charon/tests/ui/simple/promoted-inside-impl.out index b119cf3b4..3f3f9c11b 100644 --- a/charon/tests/ui/simple/promoted-inside-impl.out +++ b/charon/tests/ui/simple/promoted-inside-impl.out @@ -46,10 +46,10 @@ where storage_live(@3) storage_live(@4) @4 := const (0 : i32) - @3 := &(@4, copy (@Global0)) + @3 := &@4 storage_live(_promoted@1) @2 := move (@3) - _promoted@1 := &(*(@2), copy (@Global0)) + _promoted@1 := &*(@2) @0 := () storage_dead(_promoted@1) @0 := () diff --git a/charon/tests/ui/simple/promoted-literal-addition-overflow.out b/charon/tests/ui/simple/promoted-literal-addition-overflow.out index 03ee20e76..27137fbc9 100644 --- a/charon/tests/ui/simple/promoted-literal-addition-overflow.out +++ b/charon/tests/ui/simple/promoted-literal-addition-overflow.out @@ -36,10 +36,10 @@ fn overflow() -> &'static (u32) @2 := copy (MAX) panic.+ const (1 : u32) @6 := copy (MAX) wrap.+ const (1 : u32) @5 := move (@6) - @4 := &(@5, copy (@Global0)) + @4 := &@5 @3 := move (@4) - @1 := &(*(@3), copy (@Global0)) - @0 := &(*(@1), copy (@Global0)) + @1 := &*(@3) + @0 := &*(@1) storage_dead(@1) return } diff --git a/charon/tests/ui/simple/promoted-literal-addition.out b/charon/tests/ui/simple/promoted-literal-addition.out index 82d77f2c2..b4548277f 100644 --- a/charon/tests/ui/simple/promoted-literal-addition.out +++ b/charon/tests/ui/simple/promoted-literal-addition.out @@ -30,10 +30,10 @@ fn two() -> &'static (u32) @2 := const (1 : u32) panic.+ const (1 : u32) @6 := const (1 : u32) wrap.+ const (1 : u32) @5 := move (@6) - @4 := &(@5, copy (@Global0)) + @4 := &@5 @3 := move (@4) - @1 := &(*(@3), copy (@Global0)) - @0 := &(*(@1), copy (@Global0)) + @1 := &*(@3) + @0 := &*(@1) storage_dead(@1) return } diff --git a/charon/tests/ui/simple/promoted-u32-slice.out b/charon/tests/ui/simple/promoted-u32-slice.out index 790ce69e4..701a91e9f 100644 --- a/charon/tests/ui/simple/promoted-u32-slice.out +++ b/charon/tests/ui/simple/promoted-u32-slice.out @@ -24,12 +24,12 @@ pub fn foo() -> &'static (Slice) storage_live(@4) storage_live(@5) @5 := [const (0 : u32), const (1 : u32), const (2 : u32), const (3 : u32)] - @4 := &(@5, copy (@Global0)) + @4 := &@5 storage_live(@1) storage_live(@2) @3 := move (@4) - @2 := &(*(@3), copy (@Global0)) - @1 := &(*(@2), copy (@Global0)) + @2 := &*(@3) + @1 := &*(@2) @0 := @ArrayToSliceShared<'_, u32, 4 : usize>(move (@1)) storage_dead(@1) storage_dead(@2) diff --git a/charon/tests/ui/simple/ptr_to_promoted.out b/charon/tests/ui/simple/ptr_to_promoted.out index 33fa39be4..1ebf1d003 100644 --- a/charon/tests/ui/simple/ptr_to_promoted.out +++ b/charon/tests/ui/simple/ptr_to_promoted.out @@ -26,11 +26,11 @@ fn main() storage_live(@6) storage_live(@7) @7 := const (0 : u8) - @6 := &(@7, copy (@Global0)) + @6 := &@7 storage_live(x@1) storage_live(@2) @5 := move (@6) - @2 := &(*(@5), copy (@Global0)) + @2 := &*(@5) x@1 := &raw const (*(@2), copy (@Global0)) storage_dead(@2) storage_live(@3) diff --git a/charon/tests/ui/simple/ref-in-const.out b/charon/tests/ui/simple/ref-in-const.out index 49cf21817..0961d62e8 100644 --- a/charon/tests/ui/simple/ref-in-const.out +++ b/charon/tests/ui/simple/ref-in-const.out @@ -25,12 +25,12 @@ fn SOME_INT() -> &'static (&'static (i32)) storage_live(@4) storage_live(@5) @5 := const (0 : i32) - @4 := &(@5, copy (@Global0)) - @3 := &(@4, copy (@Global0)) + @4 := &@5 + @3 := &@4 storage_live(@1) @2 := move (@3) - @1 := &(*(@2), copy (@Global0)) - @0 := &(*(@1), copy (@Global0)) + @1 := &*(@2) + @0 := &*(@1) storage_dead(@1) return } diff --git a/charon/tests/ui/simple/slice_index_range.out b/charon/tests/ui/simple/slice_index_range.out index 17d884b57..19fb536d5 100644 --- a/charon/tests/ui/simple/slice_index_range.out +++ b/charon/tests/ui/simple/slice_index_range.out @@ -111,7 +111,7 @@ pub fn new_const<'a, const N : usize>(@1: &'a (Array<&'static (Str), const N : u storage_live(@5) storage_live(@6) @5 := [] - @4 := &(@5, copy (@Global0)) + @4 := &@5 storage_live(@2) @2 := @ArrayToSliceShared<'_, &'_ (Str), const N : usize>(copy (pieces@1)) storage_live(@3) @@ -345,13 +345,13 @@ fn slice_end_index_overflow_fail() -> ! storage_live(@5) storage_live(@6) @6 := [const ("attempted to index slice up to maximum usize")] - @5 := &(@6, copy (@Global0)) + @5 := &@6 storage_live(@1) storage_live(@2) storage_live(@3) @4 := move (@5) - @3 := &(*(@4), copy (@Global0)) - @2 := &(*(@3), copy (@Global0)) + @3 := &*(@4) + @2 := &*(@3) @1 := new_const<'_, 1 : usize>(move (@2)) storage_dead(@2) panic(core::panicking::panic_fmt) @@ -617,11 +617,11 @@ fn {impl SliceIndex> for Range[Sized]}::get_unchecked::pr else { } @13 := [] - @12 := &(@13, copy (@Global0)) + @12 := &@13 storage_live(@7) storage_live(@9) @9 := [const ("unsafe precondition(s) violated: slice::get_unchecked requires that the range is within the slice\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@8 := &(@9, copy (@Global0)) + pieces@8 := &@9 storage_live(@10) @10 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@8)) storage_live(@11) @@ -732,11 +732,11 @@ fn {impl SliceIndex> for Range[Sized]}::get_unchecked_mut else { } @13 := [] - @12 := &(@13, copy (@Global0)) + @12 := &@13 storage_live(@7) storage_live(@9) @9 := [const ("unsafe precondition(s) violated: slice::get_unchecked_mut requires that the range is within the slice\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@8 := &(@9, copy (@Global0)) + pieces@8 := &@9 storage_live(@10) @10 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@8)) storage_live(@11) @@ -1049,7 +1049,7 @@ where storage_live(@23) storage_live(@3) storage_live(self@5) - self@5 := &(self@1, copy (@Global0)) + self@5 := &self@1 storage_dead(self@5) self@4 := copy ((self@1).end) @3 := copy (self@4) == copy (MAX) @@ -1174,7 +1174,7 @@ where storage_live(@23) storage_live(@3) storage_live(self@5) - self@5 := &(self@1, copy (@Global0)) + self@5 := &self@1 storage_dead(self@5) self@4 := copy ((self@1).end) @3 := copy (self@4) == copy (MAX) @@ -1409,7 +1409,7 @@ where storage_live(self@12) storage_live(@3) storage_live(self@5) - self@5 := &(self@1, copy (@Global0)) + self@5 := &self@1 storage_dead(self@5) self@4 := copy ((self@1).end) @3 := copy (self@4) == copy (MAX) @@ -1473,7 +1473,7 @@ where storage_live(self@12) storage_live(@3) storage_live(self@5) - self@5 := &(self@1, copy (@Global0)) + self@5 := &self@1 storage_dead(self@5) self@4 := copy ((self@1).end) @3 := copy (self@4) == copy (MAX) diff --git a/charon/tests/ui/simple/trait-alias.out b/charon/tests/ui/simple/trait-alias.out index d0f892a61..4be456077 100644 --- a/charon/tests/ui/simple/trait-alias.out +++ b/charon/tests/ui/simple/trait-alias.out @@ -146,7 +146,7 @@ where storage_live(@2) storage_live(@3) - @3 := &(x@1, copy (@Global0)) + @3 := &x@1 @2 := @TraitClause1::parent_clause2::clone<'_>(move (@3)) storage_dead(@3) drop[Drop] @2 diff --git a/charon/tests/ui/simple/vec-push.out b/charon/tests/ui/simple/vec-push.out index 2c4b67660..70392bb44 100644 --- a/charon/tests/ui/simple/vec-push.out +++ b/charon/tests/ui/simple/vec-push.out @@ -111,9 +111,9 @@ where storage_live(@4) storage_live(@5) storage_live(self@6) - self@6 := &((*(self@1)).buf, copy (@Global0)) + self@6 := &(*(self@1)).buf storage_live(self@12) - self@12 := &(((*(self@1)).buf).0, copy (@Global0)) + self@12 := &((*(self@1)).buf).0 storage_live(elem_size@13) elem_size@13 := size_of switch move (elem_size@13) { @@ -134,7 +134,7 @@ where if move (@4) { storage_dead(@5) storage_live(@8) - @8 := &two-phase-mut ((*(self@1)).buf, copy (@Global0)) + @8 := &two-phase-mut (*(self@1)).buf @7 := grow_one<'_, T, A>[@TraitClause0, @TraitClause1](move (@8)) storage_dead(@8) } @@ -166,7 +166,7 @@ fn vec<'_0>(@1: &'_0 mut (Vec[Sized, Sized])) let @2: &'_ mut (Vec[Sized, Sized]); // anonymous local storage_live(@2) - @2 := &two-phase-mut (*(x@1), copy (@Global0)) + @2 := &two-phase-mut *(x@1) @0 := push<'_, u32, Global>[Sized, Sized](move (@2), const (42 : u32)) storage_dead(@2) @0 := () diff --git a/charon/tests/ui/skip-borrowck.out b/charon/tests/ui/skip-borrowck.out index 7718a2647..c44619120 100644 --- a/charon/tests/ui/skip-borrowck.out +++ b/charon/tests/ui/skip-borrowck.out @@ -43,16 +43,16 @@ where @6 := copy (b@1) if move (@6) { storage_live(@7) - @7 := &mut (*(x@2), copy (@Global0)) - @5 := &mut (*(@7), copy (@Global0)) + @7 := &mut *(x@2) + @5 := &mut *(@7) storage_dead(@7) } else { - @5 := &mut (*(y@3), copy (@Global0)) + @5 := &mut *(y@3) } - @4 := &mut (*(@5), copy (@Global0)) + @4 := &mut *(@5) storage_dead(@6) - @0 := &mut (*(@4), copy (@Global0)) + @0 := &mut *(@4) storage_dead(@5) storage_dead(@4) return @@ -91,12 +91,12 @@ pub fn choose_test() storage_live(z@3) storage_live(@4) storage_live(@5) - @5 := &mut (x@1, copy (@Global0)) - @4 := &two-phase-mut (*(@5), copy (@Global0)) + @5 := &mut x@1 + @4 := &two-phase-mut *(@5) storage_live(@6) storage_live(@7) - @7 := &mut (y@2, copy (@Global0)) - @6 := &two-phase-mut (*(@7), copy (@Global0)) + @7 := &mut y@2 + @6 := &two-phase-mut *(@7) z@3 := choose<'_, i32>[Sized](const (true), move (@4), move (@6)) storage_dead(@6) storage_dead(@4) diff --git a/charon/tests/ui/slice-index-range.out b/charon/tests/ui/slice-index-range.out index 894c4a701..748e224db 100644 --- a/charon/tests/ui/slice-index-range.out +++ b/charon/tests/ui/slice-index-range.out @@ -475,7 +475,7 @@ fn {impl SliceIndex> for Range[Sized]}::get_unchecked::pr storage_live(@7) storage_live(@9) @9 := [const ("unsafe precondition(s) violated: slice::get_unchecked requires that the range is within the slice\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@8 := &(@9, copy (@Global0)) + pieces@8 := &@9 storage_live(@10) @10 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@8)) storage_live(@11) @@ -584,7 +584,7 @@ fn {impl SliceIndex> for Range[Sized]}::get_unchecked_mut storage_live(@7) storage_live(@9) @9 := [const ("unsafe precondition(s) violated: slice::get_unchecked_mut requires that the range is within the slice\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.")] - pieces@8 := &(@9, copy (@Global0)) + pieces@8 := &@9 storage_live(@10) @10 := @ArrayToSliceShared<'_, &'_ (Str), 1 : usize>(copy (pieces@8)) storage_live(@11) @@ -869,7 +869,7 @@ fn main() storage_live(slice@2) storage_live(@3) storage_live(@4) - @4 := &(array@1, copy (@Global0)) + @4 := &array@1 storage_live(@5) @5 := Range { start: const (2 : usize), end: const (5 : usize) } @3 := {impl Index for Array}::index<'_, i32, Range[Sized], 6 : usize>[Sized, Sized[Sized]>, {impl Index for Slice}[Sized]>[Sized, Sized[Sized]>, {impl SliceIndex> for Range[Sized]}[Sized]]](move (@4), move (@5)) diff --git a/charon/tests/ui/statics.out b/charon/tests/ui/statics.out index 5c4a6b8ac..f71b68e39 100644 --- a/charon/tests/ui/statics.out +++ b/charon/tests/ui/statics.out @@ -37,11 +37,11 @@ fn constant() storage_live(_ref@2) storage_live(@3) @3 := copy (CONST) - _ref@2 := &(@3, copy (@Global0)) + _ref@2 := &@3 storage_live(_ref_mut@4) storage_live(@5) @5 := copy (CONST) - _ref_mut@4 := &mut (@5, copy (@Global0)) + _ref_mut@4 := &mut @5 @0 := () storage_dead(@5) storage_dead(_ref_mut@4) @@ -90,20 +90,20 @@ fn shared_static() storage_live(_val@1) storage_live(@2) @7 := () - @8 := &(SHARED_STATIC, move (@7)) + @8 := &SHARED_STATIC @2 := move (@8) _val@1 := copy (*(@2)) storage_dead(@2) storage_live(_ref@3) storage_live(@4) @9 := () - @10 := &(SHARED_STATIC, move (@9)) + @10 := &SHARED_STATIC @4 := move (@10) - _ref@3 := &(*(@4), copy (@Global0)) + _ref@3 := &*(@4) storage_live(_ptr@5) storage_live(@6) @11 := () - @12 := &(SHARED_STATIC, move (@11)) + @12 := &SHARED_STATIC @6 := move (@12) _ptr@5 := &raw const (*(@6), copy (@Global0)) @0 := () @@ -175,13 +175,13 @@ fn mut_static() @13 := () @14 := &raw mut (MUT_STATIC, move (@13)) @4 := move (@14) - _ref@3 := &(*(@4), copy (@Global0)) + _ref@3 := &*(@4) storage_live(_ref_mut@5) storage_live(@6) @15 := () @16 := &raw mut (MUT_STATIC, move (@15)) @6 := move (@16) - _ref_mut@5 := &mut (*(@6), copy (@Global0)) + _ref_mut@5 := &mut *(@6) storage_live(_ptr@7) storage_live(@8) @17 := () @@ -248,9 +248,9 @@ fn non_copy_static() storage_live(@1) storage_live(@2) @3 := () - @4 := &(FOO, move (@3)) + @4 := &FOO @2 := move (@4) - @1 := &(*(@2), copy (@Global0)) + @1 := &*(@2) @0 := method<'_>(move (@1)) storage_dead(@1) storage_dead(@2) diff --git a/charon/tests/ui/string-literal.out b/charon/tests/ui/string-literal.out index 7f42b4328..7f105314a 100644 --- a/charon/tests/ui/string-literal.out +++ b/charon/tests/ui/string-literal.out @@ -144,9 +144,9 @@ fn BAR() -> &'static (Slice) storage_live(@2) @3 := [const (104 : u8), const (101 : u8), const (108 : u8), const (108 : u8), const (111 : u8)] @4 := () - @5 := &(@3, move (@4)) + @5 := &@3 @2 := move (@5) - @1 := &(*(@2), copy (@Global0)) + @1 := &*(@2) @0 := @ArrayToSliceShared<'_, u8, 5 : usize>(move (@1)) storage_dead(@2) storage_dead(@1) diff --git a/charon/tests/ui/traits.out b/charon/tests/ui/traits.out index 49d7cf382..744609e83 100644 --- a/charon/tests/ui/traits.out +++ b/charon/tests/ui/traits.out @@ -196,12 +196,12 @@ pub fn test_bool_trait_bool(@1: bool) -> bool storage_live(@4) storage_live(@2) storage_live(@3) - @3 := &(x@1, copy (@Global0)) + @3 := &x@1 @2 := {impl BoolTrait for bool}::get_bool<'_>(move (@3)) if move (@2) { storage_dead(@3) storage_live(@4) - @4 := &(x@1, copy (@Global0)) + @4 := &x@1 @0 := test_crate::{impl BoolTrait for bool}::ret_true<'_>(move (@4)) storage_dead(@4) } @@ -269,12 +269,12 @@ where storage_live(@4) storage_live(@2) storage_live(@3) - @3 := &(x@1, copy (@Global0)) + @3 := &x@1 @2 := {impl BoolTrait for Option[@TraitClause0]}::get_bool<'_, T>[@TraitClause0](move (@3)) if move (@2) { storage_dead(@3) storage_live(@4) - @4 := &(x@1, copy (@Global0)) + @4 := &x@1 @0 := test_crate::{impl BoolTrait for Option[@TraitClause0]}::ret_true<'_, T>[@TraitClause0](move (@4)) storage_dead(@4) } @@ -298,7 +298,7 @@ where let @2: &'_ (T); // anonymous local storage_live(@2) - @2 := &(x@1, copy (@Global0)) + @2 := &x@1 @0 := @TraitClause1::get_bool<'_>(move (@2)) storage_dead(@2) drop[Drop] x@1 @@ -679,7 +679,7 @@ where if move (@6) { storage_dead(@7) storage_live(@8) - @8 := &(y@5, copy (@Global0)) + @8 := &y@5 @0 := {impl TestTrait for TestType1}::test<'_>(move (@8)) storage_dead(@8) } @@ -942,7 +942,7 @@ where let @2: &'_ (T); // anonymous local storage_live(@2) - @2 := &(*(x@1), copy (@Global0)) + @2 := &*(x@1) @0 := @TraitClause1::parent_clause1::get_name<'_>(move (@2)) storage_dead(@2) return @@ -959,7 +959,7 @@ where let @2: &'_ (T); // anonymous local storage_live(@2) - @2 := &(*(x@1), copy (@Global0)) + @2 := &*(x@1) @0 := @TraitClause1::parent_clause1::get_w<'_>(move (@2)) storage_dead(@2) return @@ -1184,7 +1184,7 @@ where let @2: &'_ (T); // anonymous local storage_live(@2) - @2 := &(*(x@1), copy (@Global0)) + @2 := &*(x@1) @0 := @TraitClause1::get_w<'_>(move (@2)) storage_dead(@2) return diff --git a/charon/tests/ui/type_inference_is_order_dependent.out b/charon/tests/ui/type_inference_is_order_dependent.out index ae2063a7c..60f450c89 100644 --- a/charon/tests/ui/type_inference_is_order_dependent.out +++ b/charon/tests/ui/type_inference_is_order_dependent.out @@ -178,8 +178,8 @@ where storage_live(@6) storage_live(@7) @7 := @TraitClause4::default() - @6 := &(@7, copy (@Global0)) - @5 := &(*(@6), copy (@Global0)) + @6 := &@7 + @5 := &*(@6) @4 := new_debug<'_, '_, U>[@TraitClause1, @TraitClause5](move (@5)) storage_dead(@5) args@3 := [move (@4)] @@ -188,12 +188,12 @@ where storage_live(@9) storage_live(@10) @10 := [const (""), const ("\n")] - @9 := &(@10, copy (@Global0)) - @8 := &(*(@9), copy (@Global0)) + @9 := &@10 + @8 := &*(@9) storage_live(@11) storage_live(@12) - @12 := &(args@3, copy (@Global0)) - @11 := &(*(@12), copy (@Global0)) + @12 := &args@3 + @11 := &*(@12) @2 := new_v1<'_, 2 : usize, 1 : usize>(move (@8), move (@11)) storage_dead(@12) storage_dead(@11) diff --git a/charon/tests/ui/ullbc-control-flow.out b/charon/tests/ui/ullbc-control-flow.out index 199d6ff79..6c9e9480d 100644 --- a/charon/tests/ui/ullbc-control-flow.out +++ b/charon/tests/ui/ullbc-control-flow.out @@ -631,8 +631,8 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize storage_live(@9); storage_live(@10); storage_live(@11); - @11 := &mut (iter@7, copy (@Global0)); - @10 := &two-phase-mut (*(@11), copy (@Global0)); + @11 := &mut iter@7; + @10 := &two-phase-mut *(@11); @9 := {impl Iterator for Range[@TraitClause0]}::next<'_, i32>[Sized, {impl Step for i32}](move (@10)) -> bb4 (unwind: bb2); } @@ -684,8 +684,8 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize storage_live(@20); storage_live(@21); storage_live(@22); - @22 := &mut (iter@18, copy (@Global0)); - @21 := &two-phase-mut (*(@22), copy (@Global0)); + @22 := &mut iter@18; + @21 := &two-phase-mut *(@22); @20 := {impl Iterator for Range[@TraitClause0]}::next<'_, usize>[Sized, {impl Step for usize}](move (@21)) -> bb10 (unwind: bb2); } @@ -734,8 +734,8 @@ pub fn nested_loops_enum(@1: usize, @2: usize) -> usize storage_live(@29); storage_live(@30); storage_live(@31); - @31 := &mut (iter@27, copy (@Global0)); - @30 := &two-phase-mut (*(@31), copy (@Global0)); + @31 := &mut iter@27; + @30 := &two-phase-mut *(@31); @29 := {impl Iterator for Range[@TraitClause0]}::next<'_, usize>[Sized, {impl Step for usize}](move (@30)) -> bb16 (unwind: bb2); } diff --git a/charon/tests/ui/unsize.out b/charon/tests/ui/unsize.out index 511b0f2da..2cbfda595 100644 --- a/charon/tests/ui/unsize.out +++ b/charon/tests/ui/unsize.out @@ -219,8 +219,8 @@ fn foo() storage_live(@2) storage_live(@3) storage_live(@4) - @4 := &(array@1, copy (@Global0)) - @3 := &(*(@4), copy (@Global0)) + @4 := &array@1 + @3 := &*(@4) @2 := @ArrayToSliceShared<'_, i32, 2 : usize>(move (@3)) storage_dead(@3) storage_dead(@4) @@ -252,8 +252,8 @@ fn foo() storage_live(@12) storage_live(@13) storage_live(@14) - @14 := &(string@11, copy (@Global0)) - @13 := &(*(@14), copy (@Global0)) + @14 := &string@11 + @13 := &*(@14) @12 := unsize_cast<&'_ (String), &'_ ((dyn exists<_dyn> [@TraitClause0]: Display<_dyn> + _dyn : '_)), {impl Display for String}>(move (@13)) storage_dead(@13) storage_dead(@14) @@ -262,7 +262,7 @@ fn foo() storage_live(@16) storage_live(@17) storage_live(@18) - @18 := &(string@11, copy (@Global0)) + @18 := &string@11 @17 := {impl Clone for String}::clone<'_>(move (@18)) storage_dead(@18) @16 := @BoxNew[Sized](move (@17)) @@ -276,7 +276,7 @@ fn foo() storage_live(@20) storage_live(@21) storage_live(@22) - @22 := &(string@11, copy (@Global0)) + @22 := &string@11 @21 := {impl Clone for String}::clone<'_>(move (@22)) storage_dead(@22) @20 := alloc::rc::{Rc[@TraitClause0::parent_clause0, Sized]}::new[Sized](move (@21)) diff --git a/charon/tests/ui/unsupported/issue-79-bound-regions.out b/charon/tests/ui/unsupported/issue-79-bound-regions.out index 20713a002..f2ab72703 100644 --- a/charon/tests/ui/unsupported/issue-79-bound-regions.out +++ b/charon/tests/ui/unsupported/issue-79-bound-regions.out @@ -435,8 +435,8 @@ fn main() storage_live(@3) storage_live(@4) @4 := [const (0 : i32)] - @3 := &(@4, copy (@Global0)) - @2 := &(*(@3), copy (@Global0)) + @3 := &@4 + @2 := &*(@3) slice@1 := @ArrayToSliceShared<'_, i32, 1 : usize>(move (@2)) storage_dead(@2) storage_dead(@3) @@ -448,7 +448,7 @@ fn main() @9 := ptr_metadata(copy (slice@1)) @8 := &(*(slice@1), move (@9)) @7 := iter<'_, i32>[Sized](move (@8)) - @6 := &two-phase-mut (@7, copy (@Global0)) + @6 := &two-phase-mut @7 storage_dead(@8) @5 := {impl Iterator for Iter<'a, T>[@TraitClause0]}::next<'_, '_, i32>[Sized](move (@6)) storage_dead(@6) diff --git a/charon/tests/ui/vtables.out b/charon/tests/ui/vtables.out index 1976f130d..82068cfc2 100644 --- a/charon/tests/ui/vtables.out +++ b/charon/tests/ui/vtables.out @@ -259,7 +259,7 @@ fn {impl Checkable for i32}::check<'_0>(@1: &'_0 (i32)) -> bool storage_live(@2) storage_live(@3) - @3 := &(*(self@1), copy (@Global0)) + @3 := &*(self@1) @2 := {impl Super for i32}::super_method<'_>(move (@3), const (10 : i32)) storage_dead(@3) @0 := move (@2) > const (0 : i32) @@ -277,7 +277,7 @@ fn {impl Checkable for i32}::{vtable}() -> test_crate::Checkable::{vtable}< storage_live(@1) storage_live(@2) @1 := () - @2 := &({impl Super for i32}::{vtable}, move (@1)) + @2 := &{impl Super for i32}::{vtable} ret@0 := test_crate::Checkable::{vtable} { size: const (Opaque(unknown size)), align: const (Opaque(unknown align)), drop: const (Opaque(unknown drop)), method_check: const ({impl Checkable for i32}::check), super_trait_0: const (Opaque(missing supertrait vtable)), super_trait_1: move (@2) } return } @@ -365,7 +365,7 @@ where storage_live(@2) storage_live(@3) storage_live(@4) - @4 := &(*(arg@1), copy (@Global0)) + @4 := &*(arg@1) @3 := unsize_cast<&'_ (T), &'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)), @TraitClause1>(move (@4)) storage_dead(@4) storage_live(@5) @@ -414,7 +414,7 @@ where @3 := copy (*(self@1)) panic.+ const (1 : i32) *(self@1) := move (@3) storage_live(@4) - @4 := &(*(arg@2), copy (@Global0)) + @4 := &*(arg@2) @0 := @TraitClause1::clone<'_>(move (@4)) storage_dead(@4) return @@ -472,8 +472,8 @@ where storage_live(@4) storage_live(@5) @5 := const (199 : i32) - @4 := &mut (@5, copy (@Global0)) - @3 := &mut (*(@4), copy (@Global0)) + @4 := &mut @5 + @3 := &mut *(@4) x@2 := unsize_cast<&'_ mut (i32), &'_ mut ((dyn exists<_dyn> [@TraitClause0]: Modifiable<_dyn, T> + _dyn : '_)), {impl Modifiable for i32}[@TraitClause0, @TraitClause1]>(move (@3)) storage_dead(@3) storage_dead(@4) @@ -482,7 +482,7 @@ where @8 := ptr_metadata(copy (x@2)) @6 := &two-phase-mut (*(x@2), move (@8)) storage_live(@7) - @7 := &(*(arg@1), copy (@Global0)) + @7 := &*(arg@1) @0 := Modifiable<(dyn exists<_dyn> [@TraitClause0]: Modifiable<_dyn, T> + _dyn : '_), T>::modify<'_, '_>(move (@6), move (@7)) storage_dead(@7) storage_dead(@6) @@ -548,7 +548,7 @@ where @10 := ptr_metadata(copy (self@1)) @5 := &(*(self@1), move (@10)) storage_live(@6) - @6 := &(*(t32@2), copy (@Global0)) + @6 := &*(t32@2) @4 := @TraitClause0::parent_clause1::operate_on<'_, '_>(move (@5), move (@6)) storage_dead(@6) storage_dead(@5) @@ -559,7 +559,7 @@ where @11 := ptr_metadata(copy (self@1)) @8 := &(*(self@1), move (@11)) storage_live(@9) - @9 := &(*(t64@3), copy (@Global0)) + @9 := &*(t64@3) @7 := @TraitClause0::parent_clause2::operate_on<'_, '_>(move (@8), move (@9)) storage_dead(@9) storage_dead(@8) @@ -672,18 +672,18 @@ fn test_crate::{impl Both32And64 for i32}::both_operate<'_0, '_1, '_2>(@1: &'_0 storage_live(@4) storage_live(@5) - @5 := &(*(self@1), copy (@Global0)) + @5 := &*(self@1) storage_live(@6) - @6 := &(*(t32@2), copy (@Global0)) + @6 := &*(t32@2) @4 := {impl Both32And64 for i32}::parent_clause1::operate_on<'_, '_>(move (@5), move (@6)) storage_dead(@6) storage_dead(@5) storage_dead(@4) storage_live(@7) storage_live(@8) - @8 := &(*(self@1), copy (@Global0)) + @8 := &*(self@1) storage_live(@9) - @9 := &(*(t64@3), copy (@Global0)) + @9 := &*(t64@3) @7 := {impl Both32And64 for i32}::parent_clause2::operate_on<'_, '_>(move (@8), move (@9)) storage_dead(@9) storage_dead(@8) @@ -707,9 +707,9 @@ fn {impl Both32And64 for i32}::{vtable}() -> test_crate::Both32And64::{vtable} storage_live(@3) storage_live(@4) @1 := () - @2 := &({impl BaseOn for i32}::{vtable}, move (@1)) + @2 := &{impl BaseOn for i32}::{vtable} @3 := () - @4 := &({impl BaseOn for i32}::{vtable}, move (@3)) + @4 := &{impl BaseOn for i32}::{vtable} ret@0 := test_crate::Both32And64::{vtable} { size: const (Opaque(unknown size)), align: const (Opaque(unknown align)), drop: const (Opaque(unknown drop)), method_both_operate: const (Opaque(shim for provided methods aren't yet supported)), super_trait_0: const (Opaque(missing supertrait vtable)), super_trait_1: move (@2), super_trait_2: move (@4) } return } @@ -758,14 +758,14 @@ fn use_alias<'_0>(@1: &'_0 ((dyn exists<_dyn> [@TraitClause0]: Both32And64<_dyn> storage_live(@5) storage_live(@6) @6 := const (100 : i32) - @5 := &(@6, copy (@Global0)) - @4 := &(*(@5), copy (@Global0)) + @5 := &@6 + @4 := &*(@5) storage_live(@7) storage_live(@8) storage_live(@9) @9 := const (200 : i64) - @8 := &(@9, copy (@Global0)) - @7 := &(*(@8), copy (@Global0)) + @8 := &@9 + @7 := &*(@8) @2 := Both32And64<(dyn exists<_dyn> [@TraitClause0]: Both32And64<_dyn> + _dyn : '_)>::both_operate<'_, '_, '_>(move (@3), move (@4), move (@7)) storage_dead(@7) storage_dead(@4) @@ -904,8 +904,8 @@ fn main() storage_live(@3) storage_live(@4) @4 := const (42 : i32) - @3 := &(@4, copy (@Global0)) - @2 := &(*(@3), copy (@Global0)) + @3 := &@4 + @2 := &*(@3) x@1 := unsize_cast<&'_ (i32), &'_ ((dyn exists<_dyn> [@TraitClause0]: Checkable<_dyn, i32> + _dyn : '_)), {impl Checkable for i32}>(move (@2)) storage_dead(@2) storage_dead(@3) @@ -930,8 +930,8 @@ fn main() storage_live(@10) storage_live(@11) @11 := const (99 : i32) - @10 := &mut (@11, copy (@Global0)) - @9 := &mut (*(@10), copy (@Global0)) + @10 := &mut @11 + @9 := &mut *(@10) y@8 := unsize_cast<&'_ mut (i32), &'_ mut ((dyn exists<_dyn> [@TraitClause0]: Modifiable<_dyn, i32> + _dyn : '_)), {impl Modifiable for i32}[Sized, {impl Clone for i32}]>(move (@9)) storage_dead(@9) storage_dead(@10) @@ -950,10 +950,10 @@ fn main() @19 := &(*(@20), move (@64)) @18 := {impl ToString for T}::to_string<'_, Str>[MetaSized, {impl Display for Str}](move (@19)) storage_dead(@19) - @17 := &(@18, copy (@Global0)) - @16 := &(*(@17), copy (@Global0)) + @17 := &@18 + @16 := &*(@17) @15 := modify_trait_object<'_, String>[Sized, {impl Clone for String}](move (@16)) - @14 := &(@15, copy (@Global0)) + @14 := &@15 storage_dead(@16) @13 := is_empty<'_>(move (@14)) if move (@13) { @@ -980,16 +980,16 @@ fn main() storage_live(@27) storage_live(@28) @28 := const (100 : i32) - @27 := &mut (@28, copy (@Global0)) - @26 := &(*(@27), copy (@Global0)) + @27 := &mut @28 + @26 := &*(@27) @24 := Modifiable<(dyn exists<_dyn> [@TraitClause0]: Modifiable<_dyn, i32> + _dyn : '_), i32>::modify<'_, '_>(move (@25), move (@26)) storage_dead(@26) storage_dead(@25) - @23 := &(@24, copy (@Global0)) + @23 := &@24 storage_live(@29) storage_live(@30) @30 := const (100 : i32) - @29 := &(@30, copy (@Global0)) + @29 := &@30 @22 := (move (@23), move (@29)) storage_dead(@29) storage_dead(@23) @@ -1014,12 +1014,12 @@ fn main() @37 := move (kind@36) storage_live(@38) storage_live(@39) - @39 := &(*(left_val@31), copy (@Global0)) - @38 := &(*(@39), copy (@Global0)) + @39 := &*(left_val@31) + @38 := &*(@39) storage_live(@40) storage_live(@41) - @41 := &(*(right_val@32), copy (@Global0)) - @40 := &(*(@41), copy (@Global0)) + @41 := &*(right_val@32) + @40 := &*(@41) storage_live(@42) @42 := Option::None { } panic(core::panicking::assert_failed) @@ -1042,8 +1042,8 @@ fn main() storage_live(@47) storage_live(@48) @48 := const (42 : i32) - @47 := &(@48, copy (@Global0)) - @46 := &(*(@47), copy (@Global0)) + @47 := &@48 + @46 := &*(@47) @45 := to_dyn_obj<'_, i32>[Sized, {impl NoParam for i32}](move (@46)) storage_live(@67) @67 := ptr_metadata(copy (@45)) @@ -1067,8 +1067,8 @@ fn main() storage_live(@53) storage_live(@54) @54 := const (42 : i32) - @53 := &(@54, copy (@Global0)) - @52 := &(*(@53), copy (@Global0)) + @53 := &@54 + @52 := &*(@53) a@51 := unsize_cast<&'_ (i32), &'_ ((dyn exists<_dyn> [@TraitClause0]: Both32And64<_dyn> + _dyn : '_)), {impl Both32And64 for i32}>(move (@52)) storage_dead(@52) storage_dead(@53) @@ -1081,14 +1081,14 @@ fn main() storage_live(@58) storage_live(@59) @59 := const (100 : i32) - @58 := &(@59, copy (@Global0)) - @57 := &(*(@58), copy (@Global0)) + @58 := &@59 + @57 := &*(@58) storage_live(@60) storage_live(@61) storage_live(@62) @62 := const (200 : i64) - @61 := &(@62, copy (@Global0)) - @60 := &(*(@61), copy (@Global0)) + @61 := &@62 + @60 := &*(@61) @55 := Both32And64<(dyn exists<_dyn> [@TraitClause0]: Both32And64<_dyn> + _dyn : '_)>::both_operate<'_, '_, '_>(move (@56), move (@57), move (@60)) storage_dead(@60) storage_dead(@57) From 6fc0d528b14325485ca7e87e35db9a77a17ad24a Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Wed, 17 Sep 2025 16:59:00 +0200 Subject: [PATCH 04/10] Add test --- charon/tests/ui/issue-320-slice-pattern.out | 85 +++++++++++++++++++ charon/tests/ui/issue-320-slice-pattern.rs | 17 ++++ charon/tests/ui/remove-dynamic-checks.out | 17 ++++ charon/tests/ui/remove-dynamic-checks.rs | 6 ++ .../simple/metadata-without-marker-trait.out | 38 +++++++++ .../simple/metadata-without-marker-trait.rs | 4 + 6 files changed, 167 insertions(+) create mode 100644 charon/tests/ui/simple/metadata-without-marker-trait.out create mode 100644 charon/tests/ui/simple/metadata-without-marker-trait.rs diff --git a/charon/tests/ui/issue-320-slice-pattern.out b/charon/tests/ui/issue-320-slice-pattern.out index 02330e437..1949c1a7d 100644 --- a/charon/tests/ui/issue-320-slice-pattern.out +++ b/charon/tests/ui/issue-320-slice-pattern.out @@ -215,5 +215,90 @@ fn slice_pat3() return } +// Full name: test_crate::slice_pat4 +fn slice_pat4<'_0>(@1: &'_0 (Slice)) +{ + let @0: (); // return + let x@1: &'_ (Slice); // arg #1 + let @2: usize; // anonymous local + let @3: usize; // anonymous local + let @4: bool; // anonymous local + let _y@5: &'_ (u32); // local + let @6: usize; // anonymous local + let @7: &'_ (Slice); // anonymous local + let @8: &'_ (u32); // anonymous local + + storage_live(@2) + storage_live(@3) + storage_live(@4) + @2 := len(*(x@1)) + @3 := const (1 : usize) + @4 := move (@2) == move (@3) + if move (@4) { + } + else { + @0 := () + @0 := () + return + } + storage_live(_y@5) + storage_live(@6) + @6 := ptr_metadata(copy (x@1)) + storage_live(@7) + @7 := &(*(x@1), move (@6)) + storage_live(@8) + @8 := @SliceIndexShared<'_, u32>(move (@7), const (0 : usize)) + _y@5 := &*(@8) + @0 := () + storage_dead(_y@5) + @0 := () + return +} + +// Full name: test_crate::Unsized +struct Unsized { + Slice, +} + +// Full name: test_crate::slice_pat5 +fn slice_pat5<'_0>(@1: &'_0 (Unsized)) +{ + let @0: (); // return + let x@1: &'_ (Unsized); // arg #1 + let @2: usize; // anonymous local + let @3: usize; // anonymous local + let @4: bool; // anonymous local + let _y@5: u32; // local + let @6: usize; // anonymous local + let @7: &'_ (Slice); // anonymous local + let @8: &'_ (u32); // anonymous local + + storage_live(@2) + storage_live(@3) + storage_live(@4) + @2 := len((*(x@1)).0) + @3 := const (1 : usize) + @4 := move (@2) == move (@3) + if move (@4) { + } + else { + @0 := () + @0 := () + return + } + storage_live(_y@5) + storage_live(@6) + @6 := ptr_metadata(copy (x@1)) + storage_live(@7) + @7 := &((*(x@1)).0, move (@6)) + storage_live(@8) + @8 := @SliceIndexShared<'_, u32>(move (@7), const (0 : usize)) + _y@5 := copy (*(@8)) + @0 := () + storage_dead(_y@5) + @0 := () + return +} + diff --git a/charon/tests/ui/issue-320-slice-pattern.rs b/charon/tests/ui/issue-320-slice-pattern.rs index 5339b896b..7e541406c 100644 --- a/charon/tests/ui/issue-320-slice-pattern.rs +++ b/charon/tests/ui/issue-320-slice-pattern.rs @@ -12,3 +12,20 @@ fn slice_pat3() { let slice: &[_] = &[0; 4]; let [_a, _b @ .., _c] = slice else { panic!() }; } + +fn slice_pat4(x: &[u32]) { + match x { + [_y] => {} + _ => {} + } +} + +/// This test generates a `RValue::Len` on a place that isn't `Deref`. It's a regression test to +/// avoid the mistaken assumption that `Len` only applies to `Deref` places. +struct Unsized([u32]); +fn slice_pat5(x: &Unsized) { + match x.0 { + [_y] => {} + _ => {} + } +} diff --git a/charon/tests/ui/remove-dynamic-checks.out b/charon/tests/ui/remove-dynamic-checks.out index 256a13b35..d0f4e4a5d 100644 --- a/charon/tests/ui/remove-dynamic-checks.out +++ b/charon/tests/ui/remove-dynamic-checks.out @@ -604,6 +604,23 @@ fn shr_i32_manual_cast(@1: i32, @2: i32) -> i32 return } +// Full name: test_crate::index_slice_ignore_value +fn index_slice_ignore_value<'_0>(@1: &'_0 (Slice)) +{ + let @0: (); // return + let x@1: &'_ (Slice); // arg #1 + let @2: usize; // anonymous local + + storage_live(@2) + // FIXME: Bug: the bound check is removed but the place is not mentioned, so the translated + // function doesn't panic on empty slices anymore. + @2 := const (0 : usize) + storage_dead(@2) + @0 := () + @0 := () + return +} + pub fn test_crate::_() -> isize { let @0: isize; // return diff --git a/charon/tests/ui/remove-dynamic-checks.rs b/charon/tests/ui/remove-dynamic-checks.rs index d271afada..e64070bac 100644 --- a/charon/tests/ui/remove-dynamic-checks.rs +++ b/charon/tests/ui/remove-dynamic-checks.rs @@ -102,6 +102,12 @@ fn shr_i32_manual_cast(x: i32, y: i32) -> i32 { x >> (y as u32) } +fn index_slice_ignore_value(x: &[u32]) { + // FIXME: Bug: the bound check is removed but the place is not mentioned, so the translated + // function doesn't panic on empty slices anymore. + let _ = x[0]; +} + // Checking the simplification of binop operations *inside* global constants. // Even in release mode, rustc inserts additional checks inside constant bodies. pub const _: isize = 1 + 1; diff --git a/charon/tests/ui/simple/metadata-without-marker-trait.out b/charon/tests/ui/simple/metadata-without-marker-trait.out new file mode 100644 index 000000000..9fc24912a --- /dev/null +++ b/charon/tests/ui/simple/metadata-without-marker-trait.out @@ -0,0 +1,38 @@ +# Final LLBC before serialization: + +// Full name: core::option::Option +#[lang_item("Option")] +pub enum Option { + None, + Some(T), +} + +fn UNIT_METADATA() +{ + let @0: (); // return + + @0 := () + return +} + +const UNIT_METADATA: () = @Fun0() + +// Full name: test_crate::wrap_shared_in_option +pub fn wrap_shared_in_option<'a, T>(@1: &'a (T)) -> Option<&'a (T)> +{ + let @0: Option<&'_ (T)>; // return + let x@1: &'_ (T); // arg #1 + let @2: &'_ (T); // anonymous local + let @3: PtrMetadata; // anonymous local + + storage_live(@2) + storage_live(@3) + @3 := ptr_metadata(copy (x@1)) + @2 := &(*(x@1), move (@3)) + @0 := Option::Some { 0: move (@2) } + storage_dead(@2) + return +} + + + diff --git a/charon/tests/ui/simple/metadata-without-marker-trait.rs b/charon/tests/ui/simple/metadata-without-marker-trait.rs new file mode 100644 index 000000000..b6494cb81 --- /dev/null +++ b/charon/tests/ui/simple/metadata-without-marker-trait.rs @@ -0,0 +1,4 @@ +//@ charon-args=--hide-marker-traits +pub fn wrap_shared_in_option<'a, T>(x: &'a T) -> Option<&'a T> { + Option::Some(x) +} From 634cce395424d1962d0a660ad758ee0386287529 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Wed, 17 Sep 2025 17:02:03 +0200 Subject: [PATCH 05/10] Consider every param to be sized when hiding marker traits --- charon/src/transform/insert_ptr_metadata.rs | 4 ++++ .../resolve_sized_ptr_metadata_inherit.rs | 17 ++++++++++------- .../ui/simple/metadata-without-marker-trait.out | 5 +---- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/charon/src/transform/insert_ptr_metadata.rs b/charon/src/transform/insert_ptr_metadata.rs index 7a33ee5fb..68ab22b15 100644 --- a/charon/src/transform/insert_ptr_metadata.rs +++ b/charon/src/transform/insert_ptr_metadata.rs @@ -93,6 +93,10 @@ fn outmost_deref_at_last_field( fn is_sized_type_var(ctx: &mut T, ty: &Ty) -> bool { match ty.kind() { TyKind::TypeVar(..) => { + if ctx.get_ctx().options.hide_marker_traits { + // If we're hiding `Sized`, let's consider everything to be sized. + return true; + } let params = ctx.get_params(); for clause in ¶ms.trait_clauses { let tref = clause.trait_.clone().erase(); diff --git a/charon/src/transform/resolve_sized_ptr_metadata_inherit.rs b/charon/src/transform/resolve_sized_ptr_metadata_inherit.rs index 16438ff33..61bc9b777 100644 --- a/charon/src/transform/resolve_sized_ptr_metadata_inherit.rs +++ b/charon/src/transform/resolve_sized_ptr_metadata_inherit.rs @@ -6,6 +6,8 @@ pub struct Transform; impl TransformPass for Transform { fn transform_ctx(&self, ctx: &mut TransformCtx) { + // If we're hiding `Sized`, let's consider everything to be sized. + let everything_is_sized = ctx.options.hide_marker_traits; let trait_decls = &ctx.translated.trait_decls; let mut metadata = vec![]; for type_decl in &ctx.translated.type_decls { @@ -14,13 +16,14 @@ impl TransformPass for Transform { PtrMetadata::InheritFrom(ty) => { match ty.kind() { TyKind::TypeVar(..) => { - let is_sized = type_decl.generics.trait_clauses.iter().any(|clause| { - let impl_trait = clause.trait_.clone().erase(); - impl_trait.generics.types[0] == *ty && { - let trait_decl = trait_decls.get(impl_trait.id).unwrap(); - matches!(trait_decl.item_meta.lang_item, Some("sized")) - } - }); + let is_sized = everything_is_sized + || type_decl.generics.trait_clauses.iter().any(|clause| { + let impl_trait = clause.trait_.clone().erase(); + impl_trait.generics.types[0] == *ty && { + let trait_decl = trait_decls.get(impl_trait.id).unwrap(); + matches!(trait_decl.item_meta.lang_item, Some("sized")) + } + }); if is_sized { trace!( "Resolved ptr-metadata for type {}", diff --git a/charon/tests/ui/simple/metadata-without-marker-trait.out b/charon/tests/ui/simple/metadata-without-marker-trait.out index 9fc24912a..170eab206 100644 --- a/charon/tests/ui/simple/metadata-without-marker-trait.out +++ b/charon/tests/ui/simple/metadata-without-marker-trait.out @@ -23,12 +23,9 @@ pub fn wrap_shared_in_option<'a, T>(@1: &'a (T)) -> Option<&'a (T)> let @0: Option<&'_ (T)>; // return let x@1: &'_ (T); // arg #1 let @2: &'_ (T); // anonymous local - let @3: PtrMetadata; // anonymous local storage_live(@2) - storage_live(@3) - @3 := ptr_metadata(copy (x@1)) - @2 := &(*(x@1), move (@3)) + @2 := &*(x@1) @0 := Option::Some { 0: move (@2) } storage_dead(@2) return From 8dca512ce5a1e34ce5ccd6101629d5d7b545594e Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Wed, 1 Oct 2025 11:42:27 +0200 Subject: [PATCH 06/10] Cleanup `insert_ptr_metadata` --- charon/src/ast/types_utils.rs | 16 +- .../src/transform/index_to_function_calls.rs | 12 +- charon/src/transform/insert_ptr_metadata.rs | 207 ++++++------------ 3 files changed, 81 insertions(+), 154 deletions(-) diff --git a/charon/src/ast/types_utils.rs b/charon/src/ast/types_utils.rs index c4453ab2f..e9cc33dd6 100644 --- a/charon/src/ast/types_utils.rs +++ b/charon/src/ast/types_utils.rs @@ -857,14 +857,16 @@ impl TraitRef { } impl PtrMetadata { - /// Substitute the type in `InheritFrom` with the given generic arguments. - pub fn substitute(&self, args: &GenericArgs) -> Self { + pub fn into_type(self) -> Ty { match self { - PtrMetadata::InheritFrom(ty) => PtrMetadata::InheritFrom(ty.clone().substitute(args)), - PtrMetadata::VTable(vtable_ref) => { - PtrMetadata::VTable(vtable_ref.clone().substitute(args)) - } - PtrMetadata::Length | PtrMetadata::None => self.clone(), + PtrMetadata::None => Ty::mk_unit(), + PtrMetadata::Length => Ty::mk_usize(), + PtrMetadata::VTable(type_decl_ref) => Ty::new(TyKind::Ref( + Region::Static, + Ty::new(TyKind::Adt(type_decl_ref)), + RefKind::Shared, + )), + PtrMetadata::InheritFrom(ty) => Ty::new(TyKind::PtrMetadata(ty)), } } } diff --git a/charon/src/transform/index_to_function_calls.rs b/charon/src/transform/index_to_function_calls.rs index 42b9d17d2..d7bcceac2 100644 --- a/charon/src/transform/index_to_function_calls.rs +++ b/charon/src/transform/index_to_function_calls.rs @@ -1,11 +1,9 @@ //! Desugar array/slice index operations to function calls. use crate::llbc_ast::*; -use crate::transform::ctx::BodyTransformCtx; -use crate::transform::insert_ptr_metadata::{ - place_ptr_metadata_operand, BodyTransformCtxWithParams, -}; use crate::transform::TransformCtx; +use crate::transform::ctx::BodyTransformCtx; +use crate::transform::insert_ptr_metadata::{BodyTransformCtxWithParams, compute_place_metadata}; use derive_generic_visitor::*; use super::ctx::LlbcPass; @@ -67,7 +65,7 @@ impl BodyTransformCtxWithParams for IndexVisitor<'_, '_> { /// New local variables are created as needed. /// /// The `last_arg` is either the `offset` for `Index` or the `to` for `Subslice` for the projections. -pub fn compute_to_idx( +pub fn compute_subslice_end_idx( ctx: &mut T, len_place: &Place, last_arg: Operand, @@ -167,7 +165,7 @@ impl<'a, 'b> IndexVisitor<'a, 'b> { }; // do something similar to the `input_var` below, but for the metadata. - let ptr_metadata = place_ptr_metadata_operand(self, subplace); + let ptr_metadata = compute_place_metadata(self, subplace); // Push the statements: // `storage_live(tmp0)` @@ -202,7 +200,7 @@ impl<'a, 'b> IndexVisitor<'a, 'b> { } => (x.as_ref().clone(), *from_end), _ => unreachable!(), }; - let to_idx = compute_to_idx(self, subplace, last_arg, from_end); + let to_idx = compute_subslice_end_idx(self, subplace, last_arg, from_end); args.push(to_idx); // Call the indexing function: diff --git a/charon/src/transform/insert_ptr_metadata.rs b/charon/src/transform/insert_ptr_metadata.rs index 68ab22b15..9f7edc4d5 100644 --- a/charon/src/transform/insert_ptr_metadata.rs +++ b/charon/src/transform/insert_ptr_metadata.rs @@ -2,7 +2,7 @@ use crate::formatter::IntoFormatter; use crate::pretty::FmtWithCtx; use crate::transform::TransformCtx; use crate::transform::ctx::BodyTransformCtx; -use crate::transform::index_to_function_calls::compute_to_idx; +use crate::transform::index_to_function_calls::compute_subslice_end_idx; use crate::{transform::ctx::UllbcPass, ullbc_ast::*}; use derive_generic_visitor::*; @@ -16,80 +16,6 @@ struct BodyVisitor<'a, 'b> { params: &'a GenericParams, } -fn is_last_field_of_ty_decl_id( - ctx: &TransformCtx, - type_decl_id: &TypeDeclId, - field: &FieldId, -) -> bool { - let type_decl = ctx.translated.type_decls.get(*type_decl_id).unwrap(); - match &type_decl.kind { - TypeDeclKind::Struct(vector) => vector.slot_count() - 1 == field.index(), - // `enum` does not have "last field" concept, also, it should not have metadata as per Rust rules - TypeDeclKind::Enum(..) => false, - // Same as `enum` above - TypeDeclKind::Union(..) => false, - TypeDeclKind::Opaque => panic!( - "Accessing the field {} of an opaque type {}! Cannot tell whether this is the last field. Please consider translating the opaque type definition by `--include`.", - field, - type_decl_id.with_ctx(&ctx.into_fmt()) - ), - TypeDeclKind::Alias(ty) => panic!( - "Alias type {} should have been resolved before this point! Found alias to {}.", - type_decl_id.with_ctx(&ctx.into_fmt()), - ty.with_ctx(&ctx.into_fmt()) - ), - TypeDeclKind::Error(_) => panic!("Accessing the field of an error type!"), - } -} - -fn is_last_field(ctx: &TransformCtx, proj_kind: &FieldProjKind, field: &FieldId) -> bool { - match proj_kind { - FieldProjKind::Adt(type_decl_id, _) => { - is_last_field_of_ty_decl_id(ctx, type_decl_id, field) - } - FieldProjKind::Tuple(arity) => arity - 1 == field.index(), - } -} - -/// Get the outmost deref of a place, if it exists. Returns the place that the deref happens upon and the derefed type. -/// Also check if the projection always performs on the last field, otherwise return None, -/// as it should never have metadata if it is not the last field. -fn outmost_deref_at_last_field( - ctx: &mut T, - place: &Place, -) -> Option<(Rvalue, Ty)> { - let (subplace, proj) = place.as_projection()?; - match proj { - // *subplace - // So that `subplace` is a pointer / reference type - // We will need to keep the derefed type to get the metadata type - ProjectionElem::Deref => Some(( - Rvalue::UnaryOp(UnOp::PtrMetadata, Operand::Copy(subplace.clone())), - place.ty().clone(), - )), - ProjectionElem::Field(proj_kind, field) - if is_last_field(ctx.get_ctx(), proj_kind, field) => - { - outmost_deref_at_last_field(ctx, subplace) - } - // This is not the last field, so it will never have metadata - ProjectionElem::Field(..) => None, - // Indexing for array & slice will only result in sized types, hence no metadata - ProjectionElem::Index { .. } => None, - // Subslice must have metadata length, compute the metadata here as `to` - `from` - ProjectionElem::Subslice { from, to, from_end } => { - let to_idx = compute_to_idx(ctx, subplace, *to.clone(), *from_end); - let diff_place = ctx.fresh_var(None, Ty::mk_usize()); - ctx.insert_assn_stmt( - diff_place.clone(), - // `to` cannot be less than `from` as per Rust rules, so panic - Rvalue::BinaryOp(BinOp::Sub(OverflowMode::UB), to_idx, *from.clone()), - ); - Some((Rvalue::Use(Operand::Copy(diff_place)), place.ty().clone())) - } - } -} - fn is_sized_type_var(ctx: &mut T, ty: &Ty) -> bool { match ty.kind() { TyKind::TypeVar(..) => { @@ -119,63 +45,70 @@ fn is_sized_type_var(ctx: &mut T, ty: &Ty) -> boo } } -fn get_ptr_metadata_aux( +/// No metadata. We use the `unit_metadata` global to avoid having to define unit locals +/// everywhere. +fn no_metadata(ctx: &T) -> Operand { + let unit_meta = ctx.get_ctx().translated.unit_metadata.clone().unwrap(); + Operand::Copy(Place::new_global(unit_meta, Ty::mk_unit())) +} + +/// Compute the metadata for a place. Return `None` if the place has no metadata. +fn compute_place_metadata_inner(ctx: &mut T, place: &Place) -> Option { + let (subplace, proj) = place.as_projection()?; + match proj { + // The outermost deref we encountered gives us the metadata of the place. + ProjectionElem::Deref => Some(Rvalue::UnaryOp( + UnOp::PtrMetadata, + Operand::Copy(subplace.clone()), + )), + ProjectionElem::Field { .. } => compute_place_metadata_inner(ctx, subplace), + // Indexing for array & slice will only result in sized types, hence no metadata + ProjectionElem::Index { .. } => None, + // Subslice must have metadata length, compute the metadata here as `to` - `from` + ProjectionElem::Subslice { from, to, from_end } => { + let to_idx = compute_subslice_end_idx(ctx, subplace, *to.clone(), *from_end); + let diff_place = ctx.fresh_var(None, Ty::mk_usize()); + ctx.insert_assn_stmt( + diff_place.clone(), + // Overflow is UB and should have been prevented by a bound check beforehand. + Rvalue::BinaryOp(BinOp::Sub(OverflowMode::UB), to_idx, *from.clone()), + ); + Some(Rvalue::Use(Operand::Copy(diff_place))) + } + } +} + +/// Emit statements that compute the metadata of the given place. Returns an operand containing the +/// metadata value. +pub fn compute_place_metadata( ctx: &mut T, place: &Place, -) -> Option { +) -> Operand { trace!( "getting ptr metadata for place: {}", place.with_ctx(&ctx.get_ctx().into_fmt()) ); - let (rvalue, deref_ty) = outmost_deref_at_last_field(ctx, place)?; - let ty = match deref_ty.get_ptr_metadata(&ctx.get_ctx().translated) { - PtrMetadata::None => None, - PtrMetadata::Length => Some(Ty::new(TyKind::Literal(LiteralTy::UInt(UIntTy::Usize)))), - PtrMetadata::VTable(type_decl_ref) => Some(Ty::new(TyKind::Ref( - Region::Static, - Ty::new(TyKind::Adt(type_decl_ref)), - RefKind::Shared, - ))), + let metadata_ty = place + .ty() + .get_ptr_metadata(&ctx.get_ctx().translated) + .into_type(); + if metadata_ty.is_unit() + || matches!(metadata_ty.kind(), TyKind::PtrMetadata(ty) if is_sized_type_var(ctx, ty)) + { // If the type var is known to be `Sized`, then no metadata is needed - PtrMetadata::InheritFrom(ty) => { - if is_sized_type_var(ctx, &ty) { - None - } else { - Some(Ty::new(TyKind::PtrMetadata(ty))) - } - } - }?; + return no_metadata(ctx); + } trace!( "computed metadata type: {}", - ty.with_ctx(&ctx.get_ctx().into_fmt()) + metadata_ty.with_ctx(&ctx.get_ctx().into_fmt()) ); - let new_place = ctx.fresh_var(None, ty); - // it is `Copy` because `place` is a deref, which means it is a pointer / ref - ctx.insert_assn_stmt(new_place.clone(), rvalue); - Some(Operand::Move(new_place)) -} - -/// No metadata, use unit, but as const ADT (for `()`) is not allowed -/// Introduce a new local to hold this -fn no_metadata(ctx: &mut T) -> Operand { - let unit_meta = ctx.get_ctx().translated.unit_metadata.clone().unwrap(); - Operand::Copy(Place::new_global(unit_meta, Ty::mk_unit())) -} - -/// When a place is to be referred to as a reference or a raw pointer, we compute the metadata required -/// for this operation and return it as an operand. -/// New locals & statements are to be inserted before the target place to keep the metadata. -pub fn place_ptr_metadata_operand( - ctx: &mut T, - place: &Place, -) -> Operand { - // add a shortcut here -- if the type is originally not a type with ptr-metadata, ignore it - match place.ty().get_ptr_metadata(&ctx.get_ctx().translated) { - PtrMetadata::None => return no_metadata(ctx), - _ => match get_ptr_metadata_aux(ctx, place) { - Some(metadata) => metadata, - None => no_metadata(ctx), - }, + match compute_place_metadata_inner(ctx, place) { + Some(rvalue) => { + let new_place = ctx.fresh_var(None, metadata_ty); + ctx.insert_assn_stmt(new_place.clone(), rvalue); + Operand::Move(new_place) + } + None => no_metadata(ctx), } } @@ -218,24 +151,18 @@ impl BodyTransformCtx for BodyVisitor<'_, '_> { impl VisitBodyMut for BodyVisitor<'_, '_> { fn visit_rvalue(&mut self, x: &mut Rvalue) -> ::std::ops::ControlFlow { - match x { - Rvalue::Ref { place, kind, .. } => { - let metadata = place_ptr_metadata_operand(self, &place); - *x = Rvalue::Ref { - place: place.clone(), - kind: *kind, - ptr_metadata: metadata, - }; - } - Rvalue::RawPtr { place, kind, .. } => { - let metadata = place_ptr_metadata_operand(self, &place); - *x = Rvalue::RawPtr { - place: place.clone(), - kind: *kind, - ptr_metadata: metadata, - }; - } - _ => {} + if let Rvalue::Ref { + place, + ptr_metadata, + .. + } + | Rvalue::RawPtr { + place, + ptr_metadata, + .. + } = x + { + *ptr_metadata = compute_place_metadata(self, place); } Continue(()) } From 609ded11149624f2f3ba6f0567dd8649a351eda3 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 29 Sep 2025 16:40:30 +0200 Subject: [PATCH 07/10] Make ptr metadata work like a field projection This is important to give llbc clear semantics wrt references: we previously had to copy a mutable reference in order to read its metadata, but mutable references are importantly not copyable. --- charon-ml/src/ExpressionsUtils.ml | 2 +- charon-ml/src/PrintExpressions.ml | 2 +- .../src/generated/Generated_Expressions.ml | 31 +++++++------------ .../src/generated/Generated_GAstOfJson.ml | 2 +- charon/src/ast/expressions.rs | 25 ++++++--------- charon/src/ast/expressions_utils.rs | 14 +++------ .../translate/translate_bodies.rs | 24 +++++++++----- charon/src/pretty/fmt_with_ctx.rs | 11 ++++++- charon/src/transform/insert_ptr_metadata.rs | 22 ++++++++----- charon/src/transform/remove_dynamic_checks.rs | 31 ++++++++++--------- 10 files changed, 88 insertions(+), 76 deletions(-) diff --git a/charon-ml/src/ExpressionsUtils.ml b/charon-ml/src/ExpressionsUtils.ml index 331a691db..5b61a64bb 100644 --- a/charon-ml/src/ExpressionsUtils.ml +++ b/charon-ml/src/ExpressionsUtils.ml @@ -1,7 +1,7 @@ open Expressions let unop_can_fail : unop -> bool = function - | Neg (OPanic | OUB) | Cast _ | PtrMetadata -> true + | Neg (OPanic | OUB) | Cast _ -> true | Neg OWrap | Not -> false let binop_can_fail : binop -> bool = function diff --git a/charon-ml/src/PrintExpressions.ml b/charon-ml/src/PrintExpressions.ml index 101c7d5ee..1738b895c 100644 --- a/charon-ml/src/PrintExpressions.ml +++ b/charon-ml/src/PrintExpressions.ml @@ -58,6 +58,7 @@ let rec projection_elem_to_string (env : 'a fmt_env) (sub : string) | Some variant_id -> let variant_name = adt_variant_to_string env adt_id variant_id in "(" ^ sub ^ " as " ^ variant_name ^ ")." ^ field_name) + | PtrMetadata -> sub ^ ".metadata" and place_to_string (env : 'a fmt_env) (p : place) : string = match p.kind with @@ -90,7 +91,6 @@ and unop_to_string (env : 'a fmt_env) (unop : unop) : string = match unop with | Not -> "¬" | Neg om -> overflow_mode_to_string om ^ ".-" - | PtrMetadata -> "ptr_metadata" | Cast cast_kind -> cast_kind_to_string env cast_kind and overflow_mode_to_string (mode : overflow_mode) : string = diff --git a/charon-ml/src/generated/Generated_Expressions.ml b/charon-ml/src/generated/Generated_Expressions.ml index 9e7e8322b..1a2fdd706 100644 --- a/charon-ml/src/generated/Generated_Expressions.ml +++ b/charon-ml/src/generated/Generated_Expressions.ml @@ -245,6 +245,14 @@ and projection_elem = be used as left-values and right-values. We should never have projections to fields of symbolic variants (they should have been expanded before through a match). *) + | PtrMetadata + (** A built-in pointer (a reference, raw pointer, or [Box]) in Rust is + always a fat pointer: it contains an address and metadata for the + pointed-to place. This metadata is empty for sized types, it's the + length for slices, and the vtable for [dyn Trait]. + + We consider such pointers to be like a struct with two fields; this + represent access to the metadata "field". *) | ProjIndex of operand * bool (** MIR imposes that the argument to an index projection be a local variable, meaning that even constant indices into arrays are let-bound @@ -319,19 +327,9 @@ and rvalue = Remark: in case of closures, the aggregated value groups the closure id together with its state. *) | Len of place * ty * const_generic option - (** Length of a memory location. The run-time length of e.g. a vector or a - slice is represented differently (but pretty-prints the same, FIXME). - Should be seen as a function of signature: - - [fn(&[T;N]) -> usize] - - [fn(&[T]) -> usize] - - We store the type argument and the const generic (the latter only for - arrays). - - [Len] is automatically introduced by rustc, notably for the bound - checks: we eliminate it together with the bounds checks whenever - possible. There are however occurrences that we don't eliminate (yet). - For instance, for the following Rust code: + (** Length of a place of type [[T]] or [[T; N]]. This applies to the place + itself, not to a pointer value. This is inserted by rustc in a single + case: slice patterns. {@rust[ fn slice_pattern_4(x: &[()]) { match x { @@ -339,9 +337,7 @@ and rvalue = _ => (), } } - ]} - rustc introduces a check that the length of the slice is exactly equal - to 1 and that we preserve. *) + ]} *) | Repeat of operand * ty * const_generic (** [Repeat(x, n)] creates an array where [x] is copied [n] times. @@ -356,9 +352,6 @@ and rvalue = and unop = | Not | Neg of overflow_mode (** This can overflow, for [-i::MIN]. *) - | PtrMetadata - (** Retreive the metadata part of a fat pointer. For slices, this - retreives their length. *) | Cast of cast_kind (** Casts are rvalues in MIR, but we treat them as unops. *) diff --git a/charon-ml/src/generated/Generated_GAstOfJson.ml b/charon-ml/src/generated/Generated_GAstOfJson.ml index ae8127a53..734a3372e 100644 --- a/charon-ml/src/generated/Generated_GAstOfJson.ml +++ b/charon-ml/src/generated/Generated_GAstOfJson.ml @@ -1336,6 +1336,7 @@ and projection_elem_of_json (ctx : of_json_ctx) (js : json) : let* x_0 = field_proj_kind_of_json ctx x_0 in let* x_1 = field_id_of_json ctx x_1 in Ok (Field (x_0, x_1)) + | `String "PtrMetadata" -> Ok PtrMetadata | `Assoc [ ("Index", `Assoc [ ("offset", offset); ("from_end", from_end) ]) ] -> let* offset = box_of_json operand_of_json ctx offset in @@ -2010,7 +2011,6 @@ and unop_of_json (ctx : of_json_ctx) (js : json) : (unop, string) result = | `Assoc [ ("Neg", neg) ] -> let* neg = overflow_mode_of_json ctx neg in Ok (Neg neg) - | `String "PtrMetadata" -> Ok PtrMetadata | `Assoc [ ("Cast", cast) ] -> let* cast = cast_kind_of_json ctx cast in Ok (Cast cast) diff --git a/charon/src/ast/expressions.rs b/charon/src/ast/expressions.rs index 102e203f0..6e16a181a 100644 --- a/charon/src/ast/expressions.rs +++ b/charon/src/ast/expressions.rs @@ -66,6 +66,13 @@ pub enum ProjectionElem { /// We should never have projections to fields of symbolic variants (they /// should have been expanded before through a match). Field(FieldProjKind, FieldId), + /// A built-in pointer (a reference, raw pointer, or `Box`) in Rust is always a fat pointer: it + /// contains an address and metadata for the pointed-to place. This metadata is empty for sized + /// types, it's the length for slices, and the vtable for `dyn Trait`. + /// + /// We consider such pointers to be like a struct with two fields; this represent access to the + /// metadata "field". + PtrMetadata, /// MIR imposes that the argument to an index projection be a local variable, meaning /// that even constant indices into arrays are let-bound as separate variables. /// We **eliminate** this variant in a micro-pass for LLBC. @@ -157,8 +164,6 @@ pub enum UnOp { /// This can overflow, for `-i::MIN`. #[drive(skip)] Neg(OverflowMode), - /// Retreive the metadata part of a fat pointer. For slices, this retreives their length. - PtrMetadata, /// Casts are rvalues in MIR, but we treat them as unops. Cast(CastKind), } @@ -626,18 +631,8 @@ pub enum Rvalue { /// Remark: in case of closures, the aggregated value groups the closure id /// together with its state. Aggregate(AggregateKind, Vec), - /// Length of a memory location. The run-time length of e.g. a vector or a slice is - /// represented differently (but pretty-prints the same, FIXME). - /// Should be seen as a function of signature: - /// - `fn(&[T;N]) -> usize` - /// - `fn(&[T]) -> usize` - /// - /// We store the type argument and the const generic (the latter only for arrays). - /// - /// `Len` is automatically introduced by rustc, notably for the bound checks: - /// we eliminate it together with the bounds checks whenever possible. - /// There are however occurrences that we don't eliminate (yet). - /// For instance, for the following Rust code: + /// Length of a place of type `[T]` or `[T; N]`. This applies to the place itself, not to a + /// pointer value. This is inserted by rustc in a single case: slice patterns. /// ```text /// fn slice_pattern_4(x: &[()]) { /// match x { @@ -646,8 +641,6 @@ pub enum Rvalue { /// } /// } /// ``` - /// rustc introduces a check that the length of the slice is exactly equal - /// to 1 and that we preserve. Len(Place, Ty, Option), /// `Repeat(x, n)` creates an array where `x` is copied `n` times. /// diff --git a/charon/src/ast/expressions_utils.rs b/charon/src/ast/expressions_utils.rs index d8e6f0af2..f6c953282 100644 --- a/charon/src/ast/expressions_utils.rs +++ b/charon/src/ast/expressions_utils.rs @@ -1,6 +1,5 @@ //! This file groups everything which is linked to implementations about [crate::expressions] use crate::ast::*; -use crate::ids::Vector; impl Place { pub fn new(local_id: LocalId, ty: Ty) -> Place { @@ -56,11 +55,11 @@ impl Place { pub fn project_auto_ty( self, - type_decls: &Vector, + krate: &TranslatedCrate, proj: ProjectionElem, ) -> Result { Ok(Place { - ty: proj.project_type(type_decls, &self.ty)?, + ty: proj.project_type(krate, &self.ty)?, kind: PlaceKind::Projection(Box::new(self), proj), }) } @@ -132,11 +131,7 @@ impl BorrowKind { impl ProjectionElem { /// Compute the type obtained when applying the current projection to a place of type `ty`. - pub fn project_type( - &self, - type_decls: &Vector, - ty: &Ty, - ) -> Result { + pub fn project_type(&self, krate: &TranslatedCrate, ty: &Ty) -> Result { use ProjectionElem::*; Ok(match self { Deref => { @@ -159,7 +154,7 @@ impl ProjectionElem { match pkind { Adt(type_decl_id, variant_id) => { // Can fail if the type declaration was not translated. - let type_decl = type_decls.get(*type_decl_id).ok_or(())?; + let type_decl = krate.type_decls.get(*type_decl_id).ok_or(())?; let tref = ty.as_adt().ok_or(())?; assert!(TypeId::Adt(*type_decl_id) == tref.id); use TypeDeclKind::*; @@ -197,6 +192,7 @@ impl ProjectionElem { .clone(), } } + PtrMetadata => ty.get_ptr_metadata(krate).into_type(), Index { .. } | Subslice { .. } => ty.as_array_or_slice().ok_or(())?.clone(), }) } diff --git a/charon/src/bin/charon-driver/translate/translate_bodies.rs b/charon/src/bin/charon-driver/translate/translate_bodies.rs index de6ebc4b7..44ce8292b 100644 --- a/charon/src/bin/charon-driver/translate/translate_bodies.rs +++ b/charon/src/bin/charon-driver/translate/translate_bodies.rs @@ -396,7 +396,12 @@ impl BodyTransCtx<'_, '_, '_> { } /// Translate an rvalue - fn translate_rvalue(&mut self, span: Span, rvalue: &hax::Rvalue) -> Result { + fn translate_rvalue( + &mut self, + span: Span, + rvalue: &hax::Rvalue, + tgt_ty: &Ty, + ) -> Result { match rvalue { hax::Rvalue::Use(operand) => Ok(Rvalue::Use(self.translate_operand(span, operand)?)), hax::Rvalue::CopyForDeref(place) => { @@ -568,15 +573,20 @@ impl BodyTransCtx<'_, '_, '_> { Ok(Rvalue::NullaryOp(op, ty)) } hax::Rvalue::UnaryOp(unop, operand) => { + let operand = self.translate_operand(span, operand)?; let unop = match unop { hax::UnOp::Not => UnOp::Not, hax::UnOp::Neg => UnOp::Neg(OverflowMode::Wrap), - hax::UnOp::PtrMetadata => UnOp::PtrMetadata, + hax::UnOp::PtrMetadata => match operand { + Operand::Copy(p) | Operand::Move(p) => { + return Ok(Rvalue::Use(Operand::Copy( + p.project(ProjectionElem::PtrMetadata, tgt_ty.clone()), + ))); + } + Operand::Const(_) => panic!("const metadata"), + }, }; - Ok(Rvalue::UnaryOp( - unop, - self.translate_operand(span, operand)?, - )) + Ok(Rvalue::UnaryOp(unop, operand)) } hax::Rvalue::Discriminant(place) => { let place = self.translate_place(span, place)?; @@ -730,7 +740,7 @@ impl BodyTransCtx<'_, '_, '_> { let t_statement: Option = match &*statement.kind { hax::StatementKind::Assign((place, rvalue)) => { let t_place = self.translate_place(span, place)?; - let t_rvalue = self.translate_rvalue(span, rvalue)?; + let t_rvalue = self.translate_rvalue(span, rvalue, t_place.ty())?; Some(StatementKind::Assign(t_place, t_rvalue)) } hax::StatementKind::SetDiscriminant { diff --git a/charon/src/pretty/fmt_with_ctx.rs b/charon/src/pretty/fmt_with_ctx.rs index f5de356ee..bcc81eb5a 100644 --- a/charon/src/pretty/fmt_with_ctx.rs +++ b/charon/src/pretty/fmt_with_ctx.rs @@ -1045,6 +1045,9 @@ impl FmtWithCtx for Place { write!(f, "({sub}).{field_id}") } }, + ProjectionElem::PtrMetadata => { + write!(f, "{sub}.metadata") + } ProjectionElem::Index { offset, from_end: true, @@ -1198,6 +1201,13 @@ impl_display_via_ctx!(Rvalue); impl FmtWithCtx for Rvalue { fn fmt_with_ctx(&self, ctx: &C, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { + // HACK: reproduce old output to ensure we didn't change anything. + Rvalue::Use(Operand::Copy(p)) + if let Some((sub, ProjectionElem::PtrMetadata)) = p.as_projection() => + { + let sub = sub.with_ctx(ctx); + write!(f, "ptr_metadata(copy ({sub}))") + } Rvalue::Use(x) => write!(f, "{}", x.with_ctx(ctx)), Rvalue::Ref { place, @@ -1946,7 +1956,6 @@ impl FmtWithCtx for UnOp { match self { UnOp::Not => write!(f, "~"), UnOp::Neg(mode) => write!(f, "{}.-", mode), - UnOp::PtrMetadata => write!(f, "ptr_metadata"), UnOp::Cast(kind) => write!(f, "{}", kind.with_ctx(ctx)), } } diff --git a/charon/src/transform/insert_ptr_metadata.rs b/charon/src/transform/insert_ptr_metadata.rs index 9f7edc4d5..9f1a9ec7c 100644 --- a/charon/src/transform/insert_ptr_metadata.rs +++ b/charon/src/transform/insert_ptr_metadata.rs @@ -53,17 +53,25 @@ fn no_metadata(ctx: &T) -> Operand { } /// Compute the metadata for a place. Return `None` if the place has no metadata. -fn compute_place_metadata_inner(ctx: &mut T, place: &Place) -> Option { +fn compute_place_metadata_inner( + ctx: &mut T, + place: &Place, + metadata_ty: &Ty, +) -> Option { let (subplace, proj) = place.as_projection()?; match proj { // The outermost deref we encountered gives us the metadata of the place. - ProjectionElem::Deref => Some(Rvalue::UnaryOp( - UnOp::PtrMetadata, - Operand::Copy(subplace.clone()), - )), - ProjectionElem::Field { .. } => compute_place_metadata_inner(ctx, subplace), + ProjectionElem::Deref => { + let metadata_place = subplace + .clone() + .project(ProjectionElem::PtrMetadata, metadata_ty.clone()); + Some(Rvalue::Use(Operand::Copy(metadata_place))) + } + ProjectionElem::Field { .. } => compute_place_metadata_inner(ctx, subplace, metadata_ty), // Indexing for array & slice will only result in sized types, hence no metadata ProjectionElem::Index { .. } => None, + // Ptr metadata is always sized. + ProjectionElem::PtrMetadata { .. } => None, // Subslice must have metadata length, compute the metadata here as `to` - `from` ProjectionElem::Subslice { from, to, from_end } => { let to_idx = compute_subslice_end_idx(ctx, subplace, *to.clone(), *from_end); @@ -102,7 +110,7 @@ pub fn compute_place_metadata( "computed metadata type: {}", metadata_ty.with_ctx(&ctx.get_ctx().into_fmt()) ); - match compute_place_metadata_inner(ctx, place) { + match compute_place_metadata_inner(ctx, place, &metadata_ty) { Some(rvalue) => { let new_place = ctx.fresh_var(None, metadata_ty); ctx.insert_assn_stmt(new_place.clone(), rvalue); diff --git a/charon/src/transform/remove_dynamic_checks.rs b/charon/src/transform/remove_dynamic_checks.rs index 138f15acf..ec71c8e54 100644 --- a/charon/src/transform/remove_dynamic_checks.rs +++ b/charon/src/transform/remove_dynamic_checks.rs @@ -90,16 +90,12 @@ fn remove_dynamic_checks( // We return the statements we want to keep, which must be a prefix of `block.statements`. let statements_to_keep = match statements { // Bounds checks for slices. They look like: - // l := ptr_metadata(copy a) + // l := use(copy a.metadata) // b := copy x < copy l // assert(move b == true) [ Statement { - kind: - StatementKind::Assign( - len, - Rvalue::UnaryOp(UnOp::PtrMetadata, Operand::Copy(len_op)), - ), + kind: StatementKind::Assign(len, Rvalue::Use(Operand::Copy(len_op))), .. }, Statement { @@ -120,10 +116,15 @@ fn remove_dynamic_checks( .. }, rest @ .., - ] if lt_op2 == len && cond == is_in_bounds && len_op.ty().is_ref() => rest, + ] if lt_op2 == len + && cond == is_in_bounds + && let Some((_, ProjectionElem::PtrMetadata)) = len_op.as_projection() => + { + rest + } // Sometimes that instead looks like: // a := &raw const *z - // l := ptr_metadata(move a) + // l := use(copy a.metadata) // b := copy x < copy l // assert(move b == true) [ @@ -139,11 +140,7 @@ fn remove_dynamic_checks( .. }, Statement { - kind: - StatementKind::Assign( - len, - Rvalue::UnaryOp(UnOp::PtrMetadata, Operand::Move(len_op)), - ), + kind: StatementKind::Assign(len, Rvalue::Use(Operand::Copy(len_op))), .. }, Statement { @@ -164,7 +161,13 @@ fn remove_dynamic_checks( .. }, rest @ .., - ] if reborrow == len_op && lt_op2 == len && cond == is_in_bounds => rest, + ] if lt_op2 == len + && cond == is_in_bounds + && let Some((slice_place, ProjectionElem::PtrMetadata)) = len_op.as_projection() + && reborrow == slice_place => + { + rest + } // Zero checks for division and remainder. They look like: // b := copy y == const 0 From eaa116ab1782ff49cc9c7c1f4d0ae61c357b280b Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 30 Sep 2025 11:06:26 +0200 Subject: [PATCH 08/10] No longer need to introduce extra statements to compute metadata --- charon/src/pretty/fmt_with_ctx.rs | 7 - charon/src/transform/insert_ptr_metadata.rs | 15 +- charon/tests/ui/arrays.out | 397 ++++++------------ charon/tests/ui/comments.out | 22 +- charon/tests/ui/dyn-trait.out | 5 +- .../tests/ui/dyn-with-diamond-supertraits.out | 5 +- charon/tests/ui/impl-trait.out | 5 +- charon/tests/ui/issue-297-cfg.out | 130 ++---- charon/tests/ui/issue-320-slice-pattern.out | 92 ++-- .../tests/ui/issue-4-slice-try-into-array.out | 5 +- charon/tests/ui/issue-4-traits.out | 5 +- charon/tests/ui/issue-45-misc.out | 12 +- .../issue-70-override-provided-method.2.out | 20 +- charon/tests/ui/ml-name-matcher-tests.out | 10 +- charon/tests/ui/projection-index-from-end.out | 21 +- charon/tests/ui/raw-boxes.out | 17 +- charon/tests/ui/remove-dynamic-checks.out | 64 +-- charon/tests/ui/simple/const-subslice.out | 21 +- charon/tests/ui/simple/dyn-fn.out | 5 +- .../tests/ui/simple/generic-cast-to-dyn.out | 5 +- charon/tests/ui/simple/slice_increment.out | 33 +- charon/tests/ui/simple/slice_index.out | 13 +- charon/tests/ui/simple/slice_index_range.out | 159 +++---- charon/tests/ui/slice-index-range.out | 100 ++--- charon/tests/ui/string-literal.out | 5 +- .../ui/unsupported/issue-79-bound-regions.out | 5 +- charon/tests/ui/vtables.out | 59 +-- 27 files changed, 383 insertions(+), 854 deletions(-) diff --git a/charon/src/pretty/fmt_with_ctx.rs b/charon/src/pretty/fmt_with_ctx.rs index bcc81eb5a..9fdd29777 100644 --- a/charon/src/pretty/fmt_with_ctx.rs +++ b/charon/src/pretty/fmt_with_ctx.rs @@ -1201,13 +1201,6 @@ impl_display_via_ctx!(Rvalue); impl FmtWithCtx for Rvalue { fn fmt_with_ctx(&self, ctx: &C, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - // HACK: reproduce old output to ensure we didn't change anything. - Rvalue::Use(Operand::Copy(p)) - if let Some((sub, ProjectionElem::PtrMetadata)) = p.as_projection() => - { - let sub = sub.with_ctx(ctx); - write!(f, "ptr_metadata(copy ({sub}))") - } Rvalue::Use(x) => write!(f, "{}", x.with_ctx(ctx)), Rvalue::Ref { place, diff --git a/charon/src/transform/insert_ptr_metadata.rs b/charon/src/transform/insert_ptr_metadata.rs index 9f1a9ec7c..6ba44bd37 100644 --- a/charon/src/transform/insert_ptr_metadata.rs +++ b/charon/src/transform/insert_ptr_metadata.rs @@ -57,7 +57,7 @@ fn compute_place_metadata_inner( ctx: &mut T, place: &Place, metadata_ty: &Ty, -) -> Option { +) -> Option { let (subplace, proj) = place.as_projection()?; match proj { // The outermost deref we encountered gives us the metadata of the place. @@ -65,7 +65,7 @@ fn compute_place_metadata_inner( let metadata_place = subplace .clone() .project(ProjectionElem::PtrMetadata, metadata_ty.clone()); - Some(Rvalue::Use(Operand::Copy(metadata_place))) + Some(Operand::Copy(metadata_place)) } ProjectionElem::Field { .. } => compute_place_metadata_inner(ctx, subplace, metadata_ty), // Indexing for array & slice will only result in sized types, hence no metadata @@ -81,7 +81,7 @@ fn compute_place_metadata_inner( // Overflow is UB and should have been prevented by a bound check beforehand. Rvalue::BinaryOp(BinOp::Sub(OverflowMode::UB), to_idx, *from.clone()), ); - Some(Rvalue::Use(Operand::Copy(diff_place))) + Some(Operand::Copy(diff_place)) } } } @@ -110,14 +110,7 @@ pub fn compute_place_metadata( "computed metadata type: {}", metadata_ty.with_ctx(&ctx.get_ctx().into_fmt()) ); - match compute_place_metadata_inner(ctx, place, &metadata_ty) { - Some(rvalue) => { - let new_place = ctx.fresh_var(None, metadata_ty); - ctx.insert_assn_stmt(new_place.clone(), rvalue); - Operand::Move(new_place) - } - None => no_metadata(ctx), - } + compute_place_metadata_inner(ctx, place, &metadata_ty).unwrap_or_else(|| no_metadata(ctx)) } pub trait BodyTransformCtxWithParams: BodyTransformCtx { diff --git a/charon/tests/ui/arrays.out b/charon/tests/ui/arrays.out index e40f90202..245971234 100644 --- a/charon/tests/ui/arrays.out +++ b/charon/tests/ui/arrays.out @@ -324,16 +324,13 @@ where let s@1: &'_ mut (Array); // arg #1 let @2: &'_ mut (Slice); // anonymous local let @3: &'_ mut (Array); // anonymous local - let @4: usize; // anonymous local storage_live(@2) storage_live(@3) @3 := &mut *(s@1) @2 := @ArrayToSliceMut<'_, T, 32 : usize>(move (@3)) storage_dead(@3) - storage_live(@4) - @4 := ptr_metadata(copy (@2)) - @0 := &mut (*(@2), move (@4)) + @0 := &mut (*(@2), copy (@2.metadata)) storage_dead(@2) return } @@ -387,12 +384,9 @@ where let @0: usize; // return let s@1: &'_ (Slice); // arg #1 let @2: &'_ (Slice); // anonymous local - let @3: usize; // anonymous local storage_live(@2) - storage_live(@3) - @3 := ptr_metadata(copy (s@1)) - @2 := &(*(s@1), move (@3)) + @2 := &(*(s@1), copy (s@1.metadata)) @0 := len<'_, T>[@TraitClause0](move (@2)) storage_dead(@2) return @@ -507,20 +501,17 @@ where let i@2: usize; // arg #2 let @3: &'_ (T); // anonymous local let @4: usize; // anonymous local - let @5: usize; // anonymous local - let @6: &'_ (Slice); // anonymous local - let @7: &'_ (T); // anonymous local + let @5: &'_ (Slice); // anonymous local + let @6: &'_ (T); // anonymous local storage_live(@3) storage_live(@4) @4 := copy (i@2) storage_live(@5) - @5 := ptr_metadata(copy (s@1)) + @5 := &(*(s@1), copy (s@1.metadata)) storage_live(@6) - @6 := &(*(s@1), move (@5)) - storage_live(@7) - @7 := @SliceIndexShared<'_, T>(move (@6), copy (@4)) - @3 := &*(@7) + @6 := @SliceIndexShared<'_, T>(move (@5), copy (@4)) + @3 := &*(@6) @0 := &*(@3) storage_dead(@4) storage_dead(@3) @@ -538,24 +529,18 @@ where let @3: &'_ mut (T); // anonymous local let @4: &'_ mut (T); // anonymous local let @5: usize; // anonymous local - let @6: usize; // anonymous local - let @7: usize; // anonymous local - let @8: &'_ mut (Slice); // anonymous local - let @9: &'_ mut (T); // anonymous local + let @6: &'_ mut (Slice); // anonymous local + let @7: &'_ mut (T); // anonymous local storage_live(@3) storage_live(@4) storage_live(@5) @5 := copy (i@2) storage_live(@6) - @6 := ptr_metadata(copy (s@1)) + @6 := &mut (*(s@1), copy (s@1.metadata)) storage_live(@7) - @7 := ptr_metadata(copy (s@1)) - storage_live(@8) - @8 := &mut (*(s@1), move (@7)) - storage_live(@9) - @9 := @SliceIndexMut<'_, T>(move (@8), copy (@5)) - @4 := &mut *(@9) + @7 := @SliceIndexMut<'_, T>(move (@6), copy (@5)) + @4 := &mut *(@7) @3 := &mut *(@4) @0 := &mut *(@3) storage_dead(@5) @@ -577,16 +562,11 @@ pub fn slice_subslice_shared_<'_0>(@1: &'_0 (Slice), @2: usize, @3: usize) let @7: Range[Sized]; // anonymous local let @8: usize; // anonymous local let @9: usize; // anonymous local - let @10: usize; // anonymous local - let @11: usize; // anonymous local - let @12: usize; // anonymous local storage_live(@4) storage_live(@5) storage_live(@6) - storage_live(@10) - @10 := ptr_metadata(copy (x@1)) - @6 := &(*(x@1), move (@10)) + @6 := &(*(x@1), copy (x@1.metadata)) storage_live(@7) storage_live(@8) @8 := copy (y@2) @@ -598,12 +578,8 @@ pub fn slice_subslice_shared_<'_0>(@1: &'_0 (Slice), @2: usize, @3: usize) @5 := {impl Index for Slice}::index<'_, u32, Range[Sized], Slice>[Sized, Sized[Sized]>, {impl SliceIndex, Slice> for Range[Sized]}[Sized]](move (@6), move (@7)) storage_dead(@7) storage_dead(@6) - storage_live(@12) - @12 := ptr_metadata(copy (@5)) - @4 := &(*(@5), move (@12)) - storage_live(@11) - @11 := ptr_metadata(copy (@4)) - @0 := &(*(@4), move (@11)) + @4 := &(*(@5), copy (@5.metadata)) + @0 := &(*(@4), copy (@4.metadata)) storage_dead(@5) storage_dead(@4) return @@ -623,18 +599,12 @@ pub fn slice_subslice_mut_<'_0>(@1: &'_0 mut (Slice), @2: usize, @3: usize) let @8: Range[Sized]; // anonymous local let @9: usize; // anonymous local let @10: usize; // anonymous local - let @11: usize; // anonymous local - let @12: usize; // anonymous local - let @13: usize; // anonymous local - let @14: usize; // anonymous local storage_live(@4) storage_live(@5) storage_live(@6) storage_live(@7) - storage_live(@11) - @11 := ptr_metadata(copy (x@1)) - @7 := &mut (*(x@1), move (@11)) + @7 := &mut (*(x@1), copy (x@1.metadata)) storage_live(@8) storage_live(@9) @9 := copy (y@2) @@ -646,15 +616,9 @@ pub fn slice_subslice_mut_<'_0>(@1: &'_0 mut (Slice), @2: usize, @3: usize) @6 := {impl IndexMut for Slice}::index_mut<'_, u32, Range[Sized], Slice>[Sized, Sized[Sized]>, {impl SliceIndex, Slice> for Range[Sized]}[Sized]](move (@7), move (@8)) storage_dead(@8) storage_dead(@7) - storage_live(@14) - @14 := ptr_metadata(copy (@6)) - @5 := &mut (*(@6), move (@14)) - storage_live(@13) - @13 := ptr_metadata(copy (@5)) - @4 := &mut (*(@5), move (@13)) - storage_live(@12) - @12 := ptr_metadata(copy (@4)) - @0 := &mut (*(@4), move (@12)) + @5 := &mut (*(@6), copy (@6.metadata)) + @4 := &mut (*(@5), copy (@5.metadata)) + @0 := &mut (*(@4), copy (@4.metadata)) storage_dead(@6) storage_dead(@5) storage_dead(@4) @@ -682,16 +646,13 @@ pub fn array_to_slice_mut_<'_0>(@1: &'_0 mut (Array)) -> &'_0 m let x@1: &'_ mut (Array); // arg #1 let @2: &'_ mut (Slice); // anonymous local let @3: &'_ mut (Array); // anonymous local - let @4: usize; // anonymous local storage_live(@2) storage_live(@3) @3 := &mut *(x@1) @2 := @ArrayToSliceMut<'_, u32, 32 : usize>(move (@3)) storage_dead(@3) - storage_live(@4) - @4 := ptr_metadata(copy (@2)) - @0 := &mut (*(@2), move (@4)) + @0 := &mut (*(@2), copy (@2.metadata)) storage_dead(@2) return } @@ -709,8 +670,6 @@ pub fn array_subslice_shared_<'_0>(@1: &'_0 (Array), @2: usize, let @7: Range[Sized]; // anonymous local let @8: usize; // anonymous local let @9: usize; // anonymous local - let @10: usize; // anonymous local - let @11: usize; // anonymous local storage_live(@4) storage_live(@5) @@ -727,12 +686,8 @@ pub fn array_subslice_shared_<'_0>(@1: &'_0 (Array), @2: usize, @5 := {impl Index for Array}::index<'_, u32, Range[Sized], Slice, 32 : usize>[Sized, Sized[Sized]>, {impl Index for Slice}[Sized], Slice>[Sized, Sized[Sized]>, {impl SliceIndex, Slice> for Range[Sized]}[Sized]]](move (@6), move (@7)) storage_dead(@7) storage_dead(@6) - storage_live(@11) - @11 := ptr_metadata(copy (@5)) - @4 := &(*(@5), move (@11)) - storage_live(@10) - @10 := ptr_metadata(copy (@4)) - @0 := &(*(@4), move (@10)) + @4 := &(*(@5), copy (@5.metadata)) + @0 := &(*(@4), copy (@4.metadata)) storage_dead(@5) storage_dead(@4) return @@ -752,9 +707,6 @@ pub fn array_subslice_mut_<'_0>(@1: &'_0 mut (Array), @2: usize let @8: Range[Sized]; // anonymous local let @9: usize; // anonymous local let @10: usize; // anonymous local - let @11: usize; // anonymous local - let @12: usize; // anonymous local - let @13: usize; // anonymous local storage_live(@4) storage_live(@5) @@ -772,15 +724,9 @@ pub fn array_subslice_mut_<'_0>(@1: &'_0 mut (Array), @2: usize @6 := {impl IndexMut for Array}::index_mut<'_, u32, Range[Sized], Slice, 32 : usize>[Sized, Sized[Sized]>, {impl IndexMut for Slice}[Sized], Slice>[Sized, Sized[Sized]>, {impl SliceIndex, Slice> for Range[Sized]}[Sized]]](move (@7), move (@8)) storage_dead(@8) storage_dead(@7) - storage_live(@13) - @13 := ptr_metadata(copy (@6)) - @5 := &mut (*(@6), move (@13)) - storage_live(@12) - @12 := ptr_metadata(copy (@5)) - @4 := &mut (*(@5), move (@12)) - storage_live(@11) - @11 := ptr_metadata(copy (@4)) - @0 := &mut (*(@4), move (@11)) + @5 := &mut (*(@6), copy (@6.metadata)) + @4 := &mut (*(@5), copy (@5.metadata)) + @0 := &mut (*(@4), copy (@4.metadata)) storage_dead(@6) storage_dead(@5) storage_dead(@4) @@ -796,20 +742,17 @@ where let s@1: &'_ (Slice); // arg #1 let @2: &'_ (T); // anonymous local let @3: usize; // anonymous local - let @4: usize; // anonymous local - let @5: &'_ (Slice); // anonymous local - let @6: &'_ (T); // anonymous local + let @4: &'_ (Slice); // anonymous local + let @5: &'_ (T); // anonymous local storage_live(@2) storage_live(@3) @3 := const (0 : usize) storage_live(@4) - @4 := ptr_metadata(copy (s@1)) + @4 := &(*(s@1), copy (s@1.metadata)) storage_live(@5) - @5 := &(*(s@1), move (@4)) - storage_live(@6) - @6 := @SliceIndexShared<'_, T>(move (@5), copy (@3)) - @2 := &*(@6) + @5 := @SliceIndexShared<'_, T>(move (@4), copy (@3)) + @2 := &*(@5) @0 := &*(@2) storage_dead(@3) storage_dead(@2) @@ -946,33 +889,24 @@ pub fn incr_slice_self<'_0>(@1: &'_0 mut (Slice)) let s@1: &'_ mut (Slice); // arg #1 let @2: usize; // anonymous local let @3: u32; // anonymous local - let @4: usize; // anonymous local - let @5: usize; // anonymous local - let @6: &'_ mut (Slice); // anonymous local - let @7: &'_ mut (u32); // anonymous local - let @8: usize; // anonymous local - let @9: &'_ (Slice); // anonymous local - let @10: &'_ (u32); // anonymous local + let @4: &'_ mut (Slice); // anonymous local + let @5: &'_ mut (u32); // anonymous local + let @6: &'_ (Slice); // anonymous local + let @7: &'_ (u32); // anonymous local storage_live(@3) storage_live(@2) @2 := const (0 : usize) - storage_live(@4) - @4 := ptr_metadata(copy (s@1)) - storage_live(@8) - @8 := ptr_metadata(copy (s@1)) - storage_live(@9) - @9 := &(*(s@1), move (@8)) - storage_live(@10) - @10 := @SliceIndexShared<'_, u32>(move (@9), copy (@2)) - @3 := copy (*(@10)) panic.+ const (1 : u32) - storage_live(@5) - @5 := ptr_metadata(copy (s@1)) storage_live(@6) - @6 := &mut (*(s@1), move (@5)) + @6 := &(*(s@1), copy (s@1.metadata)) storage_live(@7) - @7 := @SliceIndexMut<'_, u32>(move (@6), copy (@2)) - *(@7) := move (@3) + @7 := @SliceIndexShared<'_, u32>(move (@6), copy (@2)) + @3 := copy (*(@7)) panic.+ const (1 : u32) + storage_live(@4) + @4 := &mut (*(s@1), copy (s@1.metadata)) + storage_live(@5) + @5 := @SliceIndexMut<'_, u32>(move (@4), copy (@2)) + *(@5) := move (@3) storage_dead(@2) @0 := () @0 := () @@ -1198,19 +1132,16 @@ pub fn index_slice_u32_0<'_0>(@1: &'_0 (Slice)) -> u32 let @0: u32; // return let x@1: &'_ (Slice); // arg #1 let @2: usize; // anonymous local - let @3: usize; // anonymous local - let @4: &'_ (Slice); // anonymous local - let @5: &'_ (u32); // anonymous local + let @3: &'_ (Slice); // anonymous local + let @4: &'_ (u32); // anonymous local storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := ptr_metadata(copy (x@1)) + @3 := &(*(x@1), copy (x@1.metadata)) storage_live(@4) - @4 := &(*(x@1), move (@3)) - storage_live(@5) - @5 := @SliceIndexShared<'_, u32>(move (@4), copy (@2)) - @0 := copy (*(@5)) + @4 := @SliceIndexShared<'_, u32>(move (@3), copy (@2)) + @0 := copy (*(@4)) storage_dead(@2) return } @@ -1221,22 +1152,16 @@ pub fn index_mut_slice_u32_0<'_0>(@1: &'_0 mut (Slice)) -> u32 let @0: u32; // return let x@1: &'_ mut (Slice); // arg #1 let @2: usize; // anonymous local - let @3: usize; // anonymous local - let @4: usize; // anonymous local - let @5: &'_ (Slice); // anonymous local - let @6: &'_ (u32); // anonymous local + let @3: &'_ (Slice); // anonymous local + let @4: &'_ (u32); // anonymous local storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := ptr_metadata(copy (x@1)) + @3 := &(*(x@1), copy (x@1.metadata)) storage_live(@4) - @4 := ptr_metadata(copy (x@1)) - storage_live(@5) - @5 := &(*(x@1), move (@4)) - storage_live(@6) - @6 := @SliceIndexShared<'_, u32>(move (@5), copy (@2)) - @0 := copy (*(@6)) + @4 := @SliceIndexShared<'_, u32>(move (@3), copy (@2)) + @0 := copy (*(@4)) storage_dead(@2) return } @@ -1409,22 +1334,16 @@ pub fn update_mut_slice<'_0>(@1: &'_0 mut (Slice)) let @0: (); // return let x@1: &'_ mut (Slice); // arg #1 let @2: usize; // anonymous local - let @3: usize; // anonymous local - let @4: usize; // anonymous local - let @5: &'_ mut (Slice); // anonymous local - let @6: &'_ mut (u32); // anonymous local + let @3: &'_ mut (Slice); // anonymous local + let @4: &'_ mut (u32); // anonymous local storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := ptr_metadata(copy (x@1)) + @3 := &mut (*(x@1), copy (x@1.metadata)) storage_live(@4) - @4 := ptr_metadata(copy (x@1)) - storage_live(@5) - @5 := &mut (*(x@1), move (@4)) - storage_live(@6) - @6 := @SliceIndexMut<'_, u32>(move (@5), copy (@2)) - *(@6) := const (1 : u32) + @4 := @SliceIndexMut<'_, u32>(move (@3), copy (@2)) + *(@4) := const (1 : u32) @0 := () storage_dead(@2) @0 := () @@ -1500,8 +1419,6 @@ pub fn range_all() let @5: &'_ mut (Slice); // anonymous local let @6: &'_ mut (Array); // anonymous local let @7: Range[Sized]; // anonymous local - let @8: usize; // anonymous local - let @9: usize; // anonymous local storage_live(x@1) x@1 := @ArrayRepeat<'_, u32, 4 : usize>(const (0 : u32)) @@ -1517,12 +1434,8 @@ pub fn range_all() @5 := {impl IndexMut for Array}::index_mut<'_, u32, Range[Sized], Slice, 4 : usize>[Sized, Sized[Sized]>, {impl IndexMut for Slice}[Sized], Slice>[Sized, Sized[Sized]>, {impl SliceIndex, Slice> for Range[Sized]}[Sized]]](move (@6), move (@7)) storage_dead(@7) storage_dead(@6) - storage_live(@9) - @9 := ptr_metadata(copy (@5)) - @4 := &mut (*(@5), move (@9)) - storage_live(@8) - @8 := ptr_metadata(copy (@4)) - @3 := &two-phase-mut (*(@4), move (@8)) + @4 := &mut (*(@5), copy (@5.metadata)) + @3 := &two-phase-mut (*(@4), copy (@4.metadata)) @2 := update_mut_slice<'_>(move (@3)) storage_dead(@3) storage_dead(@5) @@ -1644,10 +1557,8 @@ pub fn sum<'_0>(@1: &'_0 (Slice)) -> u32 let @11: u32; // anonymous local let @12: usize; // anonymous local let @13: (); // anonymous local - let @14: usize; // anonymous local - let @15: usize; // anonymous local - let @16: &'_ (Slice); // anonymous local - let @17: &'_ (u32); // anonymous local + let @14: &'_ (Slice); // anonymous local + let @15: &'_ (u32); // anonymous local storage_live(@8) storage_live(@9) @@ -1656,8 +1567,6 @@ pub fn sum<'_0>(@1: &'_0 (Slice)) -> u32 storage_live(@12) storage_live(@14) storage_live(@15) - storage_live(@16) - storage_live(@17) storage_live(sum@2) sum@2 := const (0 : u32) storage_live(i@3) @@ -1669,9 +1578,7 @@ pub fn sum<'_0>(@1: &'_0 (Slice)) -> u32 @6 := copy (i@3) storage_live(@7) storage_live(@8) - storage_live(@14) - @14 := ptr_metadata(copy (s@1)) - @8 := &(*(s@1), move (@14)) + @8 := &(*(s@1), copy (s@1.metadata)) @7 := len<'_, u32>[Sized](move (@8)) storage_dead(@8) @5 := move (@6) < move (@7) @@ -1685,13 +1592,11 @@ pub fn sum<'_0>(@1: &'_0 (Slice)) -> u32 storage_live(@9) storage_live(@10) @10 := copy (i@3) + storage_live(@14) + @14 := &(*(s@1), copy (s@1.metadata)) storage_live(@15) - @15 := ptr_metadata(copy (s@1)) - storage_live(@16) - @16 := &(*(s@1), move (@15)) - storage_live(@17) - @17 := @SliceIndexShared<'_, u32>(move (@16), copy (@10)) - @9 := copy (*(@17)) + @15 := @SliceIndexShared<'_, u32>(move (@14), copy (@10)) + @9 := copy (*(@15)) @11 := copy (sum@2) panic.+ copy (@9) sum@2 := move (@11) storage_dead(@9) @@ -1741,15 +1646,10 @@ pub fn sum2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) -> u32 let @22: u32; // anonymous local let @23: usize; // anonymous local let @24: (); // anonymous local - let @25: usize; // anonymous local - let @26: usize; // anonymous local - let @27: usize; // anonymous local - let @28: usize; // anonymous local - let @29: &'_ (Slice); // anonymous local - let @30: &'_ (u32); // anonymous local - let @31: usize; // anonymous local - let @32: &'_ (Slice); // anonymous local - let @33: &'_ (u32); // anonymous local + let @25: &'_ (Slice); // anonymous local + let @26: &'_ (u32); // anonymous local + let @27: &'_ (Slice); // anonymous local + let @28: &'_ (u32); // anonymous local storage_live(@15) storage_live(@16) @@ -1760,29 +1660,22 @@ pub fn sum2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) -> u32 storage_live(@21) storage_live(@22) storage_live(@23) + storage_live(@25) + storage_live(@26) storage_live(@27) storage_live(@28) - storage_live(@29) - storage_live(@30) - storage_live(@31) - storage_live(@32) - storage_live(@33) storage_live(sum@3) sum@3 := const (0 : u32) storage_live(@4) storage_live(@5) storage_live(@6) storage_live(@7) - storage_live(@25) - @25 := ptr_metadata(copy (s@1)) - @7 := &(*(s@1), move (@25)) + @7 := &(*(s@1), copy (s@1.metadata)) @6 := len<'_, u32>[Sized](move (@7)) storage_dead(@7) storage_live(@8) storage_live(@9) - storage_live(@26) - @26 := ptr_metadata(copy (s2@2)) - @9 := &(*(s2@2), move (@26)) + @9 := &(*(s2@2), copy (s2@2.metadata)) @8 := len<'_, u32>[Sized](move (@9)) storage_dead(@9) @5 := move (@6) == move (@8) @@ -1806,9 +1699,7 @@ pub fn sum2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) -> u32 @13 := copy (i@10) storage_live(@14) storage_live(@15) - storage_live(@27) - @27 := ptr_metadata(copy (s@1)) - @15 := &(*(s@1), move (@27)) + @15 := &(*(s@1), copy (s@1.metadata)) @14 := len<'_, u32>[Sized](move (@15)) storage_dead(@15) @12 := move (@13) < move (@14) @@ -1823,23 +1714,19 @@ pub fn sum2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) -> u32 storage_live(@17) storage_live(@18) @18 := copy (i@10) - storage_live(@31) - @31 := ptr_metadata(copy (s@1)) - storage_live(@32) - @32 := &(*(s@1), move (@31)) - storage_live(@33) - @33 := @SliceIndexShared<'_, u32>(move (@32), copy (@18)) - @17 := copy (*(@33)) + storage_live(@27) + @27 := &(*(s@1), copy (s@1.metadata)) + storage_live(@28) + @28 := @SliceIndexShared<'_, u32>(move (@27), copy (@18)) + @17 := copy (*(@28)) storage_live(@19) storage_live(@20) @20 := copy (i@10) - storage_live(@28) - @28 := ptr_metadata(copy (s2@2)) - storage_live(@29) - @29 := &(*(s2@2), move (@28)) - storage_live(@30) - @30 := @SliceIndexShared<'_, u32>(move (@29), copy (@20)) - @19 := copy (*(@30)) + storage_live(@25) + @25 := &(*(s2@2), copy (s2@2.metadata)) + storage_live(@26) + @26 := @SliceIndexShared<'_, u32>(move (@25), copy (@20)) + @19 := copy (*(@26)) @21 := copy (@17) panic.+ copy (@19) @16 := move (@21) storage_dead(@19) @@ -1875,10 +1762,8 @@ pub fn f0() let @3: &'_ mut (Array); // anonymous local let @4: Array; // anonymous local let @5: usize; // anonymous local - let @6: usize; // anonymous local - let @7: usize; // anonymous local - let @8: &'_ mut (Slice); // anonymous local - let @9: &'_ mut (u32); // anonymous local + let @6: &'_ mut (Slice); // anonymous local + let @7: &'_ mut (u32); // anonymous local storage_live(s@1) storage_live(@2) @@ -1893,14 +1778,10 @@ pub fn f0() storage_live(@5) @5 := const (0 : usize) storage_live(@6) - @6 := ptr_metadata(copy (s@1)) + @6 := &mut (*(s@1), copy (s@1.metadata)) storage_live(@7) - @7 := ptr_metadata(copy (s@1)) - storage_live(@8) - @8 := &mut (*(s@1), move (@7)) - storage_live(@9) - @9 := @SliceIndexMut<'_, u32>(move (@8), copy (@5)) - *(@9) := const (1 : u32) + @7 := @SliceIndexMut<'_, u32>(move (@6), copy (@5)) + *(@7) := const (1 : u32) storage_dead(@5) @0 := () storage_dead(@4) @@ -1958,8 +1839,6 @@ pub fn f4<'_0>(@1: &'_0 (Array), @2: usize, @3: usize) -> &'_0 let @7: Range[Sized]; // anonymous local let @8: usize; // anonymous local let @9: usize; // anonymous local - let @10: usize; // anonymous local - let @11: usize; // anonymous local storage_live(@4) storage_live(@5) @@ -1976,12 +1855,8 @@ pub fn f4<'_0>(@1: &'_0 (Array), @2: usize, @3: usize) -> &'_0 @5 := {impl Index for Array}::index<'_, u32, Range[Sized], Slice, 32 : usize>[Sized, Sized[Sized]>, {impl Index for Slice}[Sized], Slice>[Sized, Sized[Sized]>, {impl SliceIndex, Slice> for Range[Sized]}[Sized]]](move (@6), move (@7)) storage_dead(@7) storage_dead(@6) - storage_live(@11) - @11 := ptr_metadata(copy (@5)) - @4 := &(*(@5), move (@11)) - storage_live(@10) - @10 := ptr_metadata(copy (@4)) - @0 := &(*(@4), move (@10)) + @4 := &(*(@5), copy (@5.metadata)) + @0 := &(*(@4), copy (@4.metadata)) storage_dead(@5) storage_dead(@4) return @@ -2003,9 +1878,8 @@ pub fn f3() -> u32 let @10: &'_ (Slice); // anonymous local let @11: &'_ (Array); // anonymous local let @12: &'_ (Array); // anonymous local - let @13: usize; // anonymous local - let @14: &'_ (Array); // anonymous local - let @15: &'_ (u32); // anonymous local + let @13: &'_ (Array); // anonymous local + let @14: &'_ (u32); // anonymous local storage_live(a@1) a@1 := [const (1 : u32), const (2 : u32)] @@ -2013,11 +1887,11 @@ pub fn f3() -> u32 storage_live(@3) storage_live(@4) @4 := const (0 : usize) + storage_live(@13) + @13 := &a@1 storage_live(@14) - @14 := &a@1 - storage_live(@15) - @15 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@14), copy (@4)) - @3 := copy (*(@15)) + @14 := @ArrayIndexShared<'_, u32, 2 : usize>(move (@13), copy (@4)) + @3 := copy (*(@14)) @2 := f2(move (@3)) storage_dead(@3) storage_dead(@4) @@ -2038,9 +1912,7 @@ pub fn f3() -> u32 @12 := &b@5 @11 := &*(@12) @10 := f4<'_>(move (@11), const (16 : usize), const (18 : usize)) - storage_live(@13) - @13 := ptr_metadata(copy (@10)) - @9 := &(*(@10), move (@13)) + @9 := &(*(@10), copy (@10.metadata)) storage_dead(@11) @0 := sum2<'_, '_>(move (@6), move (@9)) storage_dead(@9) @@ -2167,25 +2039,18 @@ pub fn zero_slice<'_0>(@1: &'_0 mut (Slice)) let @8: usize; // anonymous local let @9: usize; // anonymous local let @10: (); // anonymous local - let @11: usize; // anonymous local - let @12: usize; // anonymous local - let @13: usize; // anonymous local - let @14: &'_ mut (Slice); // anonymous local - let @15: &'_ mut (u8); // anonymous local + let @11: &'_ mut (Slice); // anonymous local + let @12: &'_ mut (u8); // anonymous local storage_live(@8) storage_live(@9) + storage_live(@11) storage_live(@12) - storage_live(@13) - storage_live(@14) - storage_live(@15) storage_live(i@2) i@2 := const (0 : usize) storage_live(len@3) storage_live(@4) - storage_live(@11) - @11 := ptr_metadata(copy (a@1)) - @4 := &(*(a@1), move (@11)) + @4 := &(*(a@1), copy (a@1.metadata)) len@3 := len<'_, u8>[Sized](move (@4)) storage_dead(@4) loop { @@ -2200,15 +2065,11 @@ pub fn zero_slice<'_0>(@1: &'_0 mut (Slice)) storage_dead(@6) storage_live(@8) @8 := copy (i@2) + storage_live(@11) + @11 := &mut (*(a@1), copy (a@1.metadata)) storage_live(@12) - @12 := ptr_metadata(copy (a@1)) - storage_live(@13) - @13 := ptr_metadata(copy (a@1)) - storage_live(@14) - @14 := &mut (*(a@1), move (@13)) - storage_live(@15) - @15 := @SliceIndexMut<'_, u8>(move (@14), copy (@8)) - *(@15) := const (0 : u8) + @12 := @SliceIndexMut<'_, u8>(move (@11), copy (@8)) + *(@12) := const (0 : u8) storage_dead(@8) @9 := copy (i@2) panic.+ const (1 : usize) i@2 := move (@9) @@ -2244,14 +2105,11 @@ pub fn iter_mut_slice<'_0>(@1: &'_0 mut (Slice)) let @7: usize; // anonymous local let @8: usize; // anonymous local let @9: (); // anonymous local - let @10: usize; // anonymous local storage_live(@8) storage_live(len@2) storage_live(@3) - storage_live(@10) - @10 := ptr_metadata(copy (a@1)) - @3 := &(*(a@1), move (@10)) + @3 := &(*(a@1), copy (a@1.metadata)) len@2 := len<'_, u8>[Sized](move (@3)) storage_dead(@3) storage_live(i@4) @@ -2304,11 +2162,8 @@ pub fn sum_mut_slice<'_0>(@1: &'_0 mut (Slice)) -> u32 let @11: u32; // anonymous local let @12: usize; // anonymous local let @13: (); // anonymous local - let @14: usize; // anonymous local - let @15: usize; // anonymous local - let @16: usize; // anonymous local - let @17: &'_ (Slice); // anonymous local - let @18: &'_ (u32); // anonymous local + let @14: &'_ (Slice); // anonymous local + let @15: &'_ (u32); // anonymous local storage_live(@8) storage_live(@9) @@ -2317,9 +2172,6 @@ pub fn sum_mut_slice<'_0>(@1: &'_0 mut (Slice)) -> u32 storage_live(@12) storage_live(@14) storage_live(@15) - storage_live(@16) - storage_live(@17) - storage_live(@18) storage_live(i@2) i@2 := const (0 : usize) storage_live(s@3) @@ -2331,9 +2183,7 @@ pub fn sum_mut_slice<'_0>(@1: &'_0 mut (Slice)) -> u32 @6 := copy (i@2) storage_live(@7) storage_live(@8) - storage_live(@14) - @14 := ptr_metadata(copy (a@1)) - @8 := &(*(a@1), move (@14)) + @8 := &(*(a@1), copy (a@1.metadata)) @7 := len<'_, u32>[Sized](move (@8)) storage_dead(@8) @5 := move (@6) < move (@7) @@ -2347,15 +2197,11 @@ pub fn sum_mut_slice<'_0>(@1: &'_0 mut (Slice)) -> u32 storage_live(@9) storage_live(@10) @10 := copy (i@2) + storage_live(@14) + @14 := &(*(a@1), copy (a@1.metadata)) storage_live(@15) - @15 := ptr_metadata(copy (a@1)) - storage_live(@16) - @16 := ptr_metadata(copy (a@1)) - storage_live(@17) - @17 := &(*(a@1), move (@16)) - storage_live(@18) - @18 := @SliceIndexShared<'_, u32>(move (@17), copy (@10)) - @9 := copy (*(@18)) + @15 := @SliceIndexShared<'_, u32>(move (@14), copy (@10)) + @9 := copy (*(@15)) @11 := copy (s@3) panic.+ copy (@9) s@3 := move (@11) storage_dead(@9) @@ -2471,9 +2317,8 @@ fn slice_pattern_4<'_0>(@1: &'_0 (Slice<()>)) let @3: usize; // anonymous local let @4: bool; // anonymous local let _named@5: &'_ (()); // local - let @6: usize; // anonymous local - let @7: &'_ (Slice<()>); // anonymous local - let @8: &'_ (()); // anonymous local + let @6: &'_ (Slice<()>); // anonymous local + let @7: &'_ (()); // anonymous local storage_live(@2) storage_live(@3) @@ -2490,12 +2335,10 @@ fn slice_pattern_4<'_0>(@1: &'_0 (Slice<()>)) } storage_live(_named@5) storage_live(@6) - @6 := ptr_metadata(copy (x@1)) + @6 := &(*(x@1), copy (x@1.metadata)) storage_live(@7) - @7 := &(*(x@1), move (@6)) - storage_live(@8) - @8 := @SliceIndexShared<'_, ()>(move (@7), const (0 : usize)) - _named@5 := &*(@8) + @7 := @SliceIndexShared<'_, ()>(move (@6), const (0 : usize)) + _named@5 := &*(@7) @0 := () storage_dead(_named@5) @0 := () diff --git a/charon/tests/ui/comments.out b/charon/tests/ui/comments.out index 525c7c6c9..f8b7f13c9 100644 --- a/charon/tests/ui/comments.out +++ b/charon/tests/ui/comments.out @@ -130,10 +130,8 @@ pub fn sum<'_0>(@1: &'_0 (Slice)) -> u32 let @24: u32; // anonymous local let @25: u32; // anonymous local let @26: u32; // anonymous local - let @27: usize; // anonymous local - let @28: usize; // anonymous local - let @29: &'_ (Slice); // anonymous local - let @30: &'_ (u32); // anonymous local + let @27: &'_ (Slice); // anonymous local + let @28: &'_ (u32); // anonymous local storage_live(@7) storage_live(@12) @@ -146,8 +144,6 @@ pub fn sum<'_0>(@1: &'_0 (Slice)) -> u32 storage_live(@26) storage_live(@27) storage_live(@28) - storage_live(@29) - storage_live(@30) storage_live(sum@2) // `let sum` sum@2 := const (0 : u32) @@ -175,9 +171,7 @@ pub fn sum<'_0>(@1: &'_0 (Slice)) -> u32 @10 := copy (i@3) storage_live(@11) storage_live(@12) - storage_live(@27) - @27 := ptr_metadata(copy (s@1)) - @12 := &(*(s@1), move (@27)) + @12 := &(*(s@1), copy (s@1.metadata)) @11 := len<'_, u32>[Sized](move (@12)) storage_dead(@12) @9 := move (@10) < move (@11) @@ -192,13 +186,11 @@ pub fn sum<'_0>(@1: &'_0 (Slice)) -> u32 storage_live(@14) // Add to running sum @14 := copy (i@3) + storage_live(@27) + @27 := &(*(s@1), copy (s@1.metadata)) storage_live(@28) - @28 := ptr_metadata(copy (s@1)) - storage_live(@29) - @29 := &(*(s@1), move (@28)) - storage_live(@30) - @30 := @SliceIndexShared<'_, u32>(move (@29), copy (@14)) - @13 := copy (*(@30)) + @28 := @SliceIndexShared<'_, u32>(move (@27), copy (@14)) + @13 := copy (*(@28)) @15 := copy (sum@2) panic.+ copy (@13) sum@2 := move (@15) storage_dead(@13) diff --git a/charon/tests/ui/dyn-trait.out b/charon/tests/ui/dyn-trait.out index 71633c9bf..9826aaeb2 100644 --- a/charon/tests/ui/dyn-trait.out +++ b/charon/tests/ui/dyn-trait.out @@ -209,12 +209,9 @@ fn destruct<'_0>(@1: &'_0 ((dyn exists<_dyn> [@TraitClause0]: Display<_dyn> + _d let @0: String; // return let x@1: &'_ ((dyn exists<_dyn> [@TraitClause0]: Display<_dyn> + _dyn : '_)); // arg #1 let @2: &'_ ((dyn exists<_dyn> [@TraitClause0]: Display<_dyn> + _dyn : '_)); // anonymous local - let @3: &'static (core::fmt::Display::{vtable}); // anonymous local storage_live(@2) - storage_live(@3) - @3 := ptr_metadata(copy (x@1)) - @2 := &(*(x@1), move (@3)) + @2 := &(*(x@1), copy (x@1.metadata)) @0 := {impl ToString for T}::to_string<'_, (dyn exists<_dyn> [@TraitClause0]: Display<_dyn> + _dyn : '_)>[MetaSized<(dyn exists<_dyn> [@TraitClause0]: Display<_dyn> + _dyn : '_)>, Display<(dyn exists<_dyn> [@TraitClause0]: Display<_dyn> + _dyn : '_)>](move (@2)) storage_dead(@2) return diff --git a/charon/tests/ui/dyn-with-diamond-supertraits.out b/charon/tests/ui/dyn-with-diamond-supertraits.out index 4437390be..9c5c8c815 100644 --- a/charon/tests/ui/dyn-with-diamond-supertraits.out +++ b/charon/tests/ui/dyn-with-diamond-supertraits.out @@ -345,7 +345,6 @@ fn main() let @4: i32; // anonymous local let @5: (i32, i32); // anonymous local let @6: &'_ ((dyn exists<_dyn> [@TraitClause0]: Join<_dyn, i32> + _dyn : '_ + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause2::Right = i32 + @TraitClause1_0::parent_clause1::Left = i32)); // anonymous local - let @7: &'static (test_crate::Join::{vtable}); // anonymous local storage_live(v@1) storage_live(@2) @@ -359,9 +358,7 @@ fn main() storage_dead(@3) storage_live(@5) storage_live(@6) - storage_live(@7) - @7 := ptr_metadata(copy (v@1)) - @6 := &(*(v@1), move (@7)) + @6 := &(*(v@1), copy (v@1.metadata)) @5 := Join<(dyn exists<_dyn> [@TraitClause0]: Join<_dyn, i32> + _dyn : '_ + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause2::Right = i32 + @TraitClause1_0::parent_clause1::Left = i32), i32>::join_method<'_>(move (@6)) storage_dead(@6) storage_dead(@5) diff --git a/charon/tests/ui/impl-trait.out b/charon/tests/ui/impl-trait.out index 837aa4689..7aafecb4e 100644 --- a/charon/tests/ui/impl-trait.out +++ b/charon/tests/ui/impl-trait.out @@ -243,7 +243,6 @@ where let @3: &'_ (@TraitClause1::parent_clause2::Type); // anonymous local let @4: &'_ (@TraitClause1::parent_clause2::Type); // anonymous local let @5: &'_ (@TraitClause1::); // anonymous local - let @6: PtrMetadata<@TraitClause1::parent_clause2::Type>; // anonymous local storage_live(foo@1) foo@1 := @TraitClause1::make_foo() @@ -253,9 +252,7 @@ where storage_live(@5) @5 := &foo@1 @4 := @TraitClause1::parent_clause2::get_ty<'_>(move (@5)) - storage_live(@6) - @6 := ptr_metadata(copy (@4)) - @3 := &(*(@4), move (@6)) + @3 := &(*(@4), copy (@4.metadata)) storage_dead(@5) @2 := @TraitClause1::parent_clause2::parent_clause2::clone<'_>(move (@3)) storage_dead(@3) diff --git a/charon/tests/ui/issue-297-cfg.out b/charon/tests/ui/issue-297-cfg.out index 713bf8549..675173189 100644 --- a/charon/tests/ui/issue-297-cfg.out +++ b/charon/tests/ui/issue-297-cfg.out @@ -450,12 +450,10 @@ fn f1<'_0>(@1: &'_0 (Slice)) -> usize let @9: usize; // anonymous local let @10: usize; // anonymous local let @11: usize; // anonymous local - let @12: usize; // anonymous local - let @13: &'_ (Slice); // anonymous local - let @14: &'_ (u8); // anonymous local - let @15: usize; // anonymous local - let @16: &'_ (Slice); // anonymous local - let @17: &'_ (u8); // anonymous local + let @12: &'_ (Slice); // anonymous local + let @13: &'_ (u8); // anonymous local + let @14: &'_ (Slice); // anonymous local + let @15: &'_ (u8); // anonymous local storage_live(@8) storage_live(@9) @@ -463,7 +461,6 @@ fn f1<'_0>(@1: &'_0 (Slice)) -> usize storage_live(@11) storage_live(@12) storage_live(@13) - storage_live(@14) storage_live(sampled@2) sampled@2 := const (0 : usize) storage_live(@3) @@ -471,13 +468,11 @@ fn f1<'_0>(@1: &'_0 (Slice)) -> usize storage_live(@5) storage_live(@6) @6 := const (0 : usize) + storage_live(@14) + @14 := &(*(a@1), copy (a@1.metadata)) storage_live(@15) - @15 := ptr_metadata(copy (a@1)) - storage_live(@16) - @16 := &(*(a@1), move (@15)) - storage_live(@17) - @17 := @SliceIndexShared<'_, u8>(move (@16), copy (@6)) - @5 := copy (*(@17)) + @15 := @SliceIndexShared<'_, u8>(move (@14), copy (@6)) + @5 := copy (*(@15)) @4 := move (@5) < const (42 : u8) if move (@4) { storage_dead(@6) @@ -487,12 +482,10 @@ fn f1<'_0>(@1: &'_0 (Slice)) -> usize storage_live(@9) @9 := const (1 : usize) storage_live(@12) - @12 := ptr_metadata(copy (a@1)) + @12 := &(*(a@1), copy (a@1.metadata)) storage_live(@13) - @13 := &(*(a@1), move (@12)) - storage_live(@14) - @14 := @SliceIndexShared<'_, u8>(move (@13), copy (@9)) - @8 := copy (*(@14)) + @13 := @SliceIndexShared<'_, u8>(move (@12), copy (@9)) + @8 := copy (*(@13)) @7 := move (@8) < const (16 : u8) if move (@7) { storage_dead(@9) @@ -582,24 +575,16 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize let @45: i16; // anonymous local let @46: usize; // anonymous local let @47: usize; // anonymous local - let @48: usize; // anonymous local - let @49: usize; // anonymous local - let @50: usize; // anonymous local - let @51: usize; // anonymous local - let @52: &'_ mut (Slice); // anonymous local - let @53: &'_ mut (i16); // anonymous local - let @54: usize; // anonymous local - let @55: &'_ mut (Slice); // anonymous local - let @56: &'_ mut (i16); // anonymous local - let @57: usize; // anonymous local - let @58: &'_ (Slice); // anonymous local - let @59: &'_ (u8); // anonymous local - let @60: usize; // anonymous local - let @61: &'_ (Slice); // anonymous local - let @62: &'_ (u8); // anonymous local - let @63: usize; // anonymous local - let @64: &'_ (Slice); // anonymous local - let @65: &'_ (u8); // anonymous local + let @48: &'_ mut (Slice); // anonymous local + let @49: &'_ mut (i16); // anonymous local + let @50: &'_ mut (Slice); // anonymous local + let @51: &'_ mut (i16); // anonymous local + let @52: &'_ (Slice); // anonymous local + let @53: &'_ (u8); // anonymous local + let @54: &'_ (Slice); // anonymous local + let @55: &'_ (u8); // anonymous local + let @56: &'_ (Slice); // anonymous local + let @57: &'_ (u8); // anonymous local storage_live(@11) storage_live(bytes@13) @@ -637,6 +622,7 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@45) storage_live(@46) storage_live(@47) + storage_live(@48) storage_live(@49) storage_live(@50) storage_live(@51) @@ -646,23 +632,13 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@55) storage_live(@56) storage_live(@57) - storage_live(@58) - storage_live(@59) - storage_live(@60) - storage_live(@61) - storage_live(@62) - storage_live(@63) - storage_live(@64) - storage_live(@65) storage_live(sampled@3) sampled@3 := const (0 : usize) storage_live(@4) storage_live(@5) storage_live(@6) storage_live(@7) - storage_live(@48) - @48 := ptr_metadata(copy (a@1)) - @7 := &(*(a@1), move (@48)) + @7 := &(*(a@1), copy (a@1.metadata)) @6 := chunks<'_, u8>[Sized](move (@7), const (3 : usize)) storage_dead(@7) @5 := {impl IntoIterator for I}::into_iter[Sized]>[Sized[Sized]>, {impl Iterator for Chunks<'a, T>[@TraitClause0]}<'_, u8>[Sized]](move (@6)) @@ -689,13 +665,11 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@15) storage_live(@16) @16 := const (0 : usize) - storage_live(@63) - @63 := ptr_metadata(copy (bytes@13)) - storage_live(@64) - @64 := &(*(bytes@13), move (@63)) - storage_live(@65) - @65 := @SliceIndexShared<'_, u8>(move (@64), copy (@16)) - @15 := copy (*(@65)) + storage_live(@56) + @56 := &(*(bytes@13), copy (bytes@13.metadata)) + storage_live(@57) + @57 := @SliceIndexShared<'_, u8>(move (@56), copy (@16)) + @15 := copy (*(@57)) b1@14 := cast(move (@15)) storage_dead(@15) storage_dead(@16) @@ -703,13 +677,11 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@18) storage_live(@19) @19 := const (1 : usize) - storage_live(@60) - @60 := ptr_metadata(copy (bytes@13)) - storage_live(@61) - @61 := &(*(bytes@13), move (@60)) - storage_live(@62) - @62 := @SliceIndexShared<'_, u8>(move (@61), copy (@19)) - @18 := copy (*(@62)) + storage_live(@54) + @54 := &(*(bytes@13), copy (bytes@13.metadata)) + storage_live(@55) + @55 := @SliceIndexShared<'_, u8>(move (@54), copy (@19)) + @18 := copy (*(@55)) b2@17 := cast(move (@18)) storage_dead(@18) storage_dead(@19) @@ -717,13 +689,11 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@21) storage_live(@22) @22 := const (2 : usize) - storage_live(@57) - @57 := ptr_metadata(copy (bytes@13)) - storage_live(@58) - @58 := &(*(bytes@13), move (@57)) - storage_live(@59) - @59 := @SliceIndexShared<'_, u8>(move (@58), copy (@22)) - @21 := copy (*(@59)) + storage_live(@52) + @52 := &(*(bytes@13), copy (bytes@13.metadata)) + storage_live(@53) + @53 := @SliceIndexShared<'_, u8>(move (@52), copy (@22)) + @21 := copy (*(@53)) b3@20 := cast(move (@21)) storage_dead(@21) storage_dead(@22) @@ -772,15 +742,11 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize @38 := copy (d1@23) storage_live(@39) @39 := copy (sampled@3) + storage_live(@48) + @48 := &mut (*(result@2), copy (result@2.metadata)) storage_live(@49) - @49 := ptr_metadata(copy (result@2)) - storage_live(@51) - @51 := ptr_metadata(copy (result@2)) - storage_live(@52) - @52 := &mut (*(result@2), move (@51)) - storage_live(@53) - @53 := @SliceIndexMut<'_, i16>(move (@52), copy (@39)) - *(@53) := move (@38) + @49 := @SliceIndexMut<'_, i16>(move (@48), copy (@39)) + *(@49) := move (@38) storage_dead(@38) storage_dead(@39) @40 := copy (sampled@3) panic.+ const (1 : usize) @@ -813,14 +779,10 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@46) @46 := copy (sampled@3) storage_live(@50) - @50 := ptr_metadata(copy (result@2)) - storage_live(@54) - @54 := ptr_metadata(copy (result@2)) - storage_live(@55) - @55 := &mut (*(result@2), move (@54)) - storage_live(@56) - @56 := @SliceIndexMut<'_, i16>(move (@55), copy (@46)) - *(@56) := move (@45) + @50 := &mut (*(result@2), copy (result@2.metadata)) + storage_live(@51) + @51 := @SliceIndexMut<'_, i16>(move (@50), copy (@46)) + *(@51) := move (@45) storage_dead(@45) storage_dead(@46) @47 := copy (sampled@3) panic.+ const (1 : usize) diff --git a/charon/tests/ui/issue-320-slice-pattern.out b/charon/tests/ui/issue-320-slice-pattern.out index 1949c1a7d..72f847bcf 100644 --- a/charon/tests/ui/issue-320-slice-pattern.out +++ b/charon/tests/ui/issue-320-slice-pattern.out @@ -123,20 +123,16 @@ fn slice_pat3() let @11: usize; // anonymous local let @12: usize; // anonymous local let @13: usize; // anonymous local - let @14: usize; // anonymous local + let @14: &'_ (Slice); // anonymous local let @15: usize; // anonymous local - let @16: &'_ (Slice); // anonymous local - let @17: usize; // anonymous local - let @18: usize; // anonymous local - let @19: &'_ (i32); // anonymous local + let @16: usize; // anonymous local + let @17: &'_ (i32); // anonymous local + let @18: &'_ (Slice); // anonymous local + let @19: usize; // anonymous local let @20: usize; // anonymous local let @21: &'_ (Slice); // anonymous local - let @22: usize; // anonymous local - let @23: usize; // anonymous local - let @24: &'_ (Slice); // anonymous local - let @25: usize; // anonymous local - let @26: &'_ (Slice); // anonymous local - let @27: &'_ (i32); // anonymous local + let @22: &'_ (Slice); // anonymous local + let @23: &'_ (i32); // anonymous local storage_live(@8) storage_live(@9) @@ -165,13 +161,11 @@ fn slice_pat3() storage_dead(_a@5) panic(core::panicking::panic_explicit) } - storage_live(@25) - @25 := ptr_metadata(copy (slice@1)) - storage_live(@26) - @26 := &(*(slice@1), move (@25)) - storage_live(@27) - @27 := @SliceIndexShared<'_, i32>(move (@26), const (0 : usize)) - _a@5 := &*(@27) + storage_live(@22) + @22 := &(*(slice@1), copy (slice@1.metadata)) + storage_live(@23) + @23 := @SliceIndexShared<'_, i32>(move (@22), const (0 : usize)) + _a@5 := &*(@23) storage_live(@11) @11 := len(*(slice@1)) storage_live(@12) @@ -179,32 +173,26 @@ fn slice_pat3() storage_dead(@11) storage_live(@13) @13 := copy (@12) ub.- const (1 : usize) - storage_live(@14) - @14 := copy (@13) + storage_live(@18) + @18 := &(*(slice@1), copy (slice@1.metadata)) + storage_live(@19) + @19 := len(*(slice@1)) storage_live(@20) - @20 := ptr_metadata(copy (slice@1)) + @20 := copy (@19) ub.- const (1 : usize) + storage_dead(@19) storage_live(@21) - @21 := &(*(slice@1), move (@20)) - storage_live(@22) - @22 := len(*(slice@1)) - storage_live(@23) - @23 := copy (@22) ub.- const (1 : usize) - storage_dead(@22) - storage_live(@24) - @24 := @SliceSubSliceShared<'_, i32>(move (@21), const (1 : usize), copy (@23)) - _b@6 := &(*(@24), move (@14)) + @21 := @SliceSubSliceShared<'_, i32>(move (@18), const (1 : usize), copy (@20)) + _b@6 := &(*(@21), copy (@13)) + storage_live(@14) + @14 := &(*(slice@1), copy (slice@1.metadata)) storage_live(@15) - @15 := ptr_metadata(copy (slice@1)) + @15 := len(*(slice@1)) storage_live(@16) - @16 := &(*(slice@1), move (@15)) + @16 := copy (@15) ub.- const (1 : usize) + storage_dead(@15) storage_live(@17) - @17 := len(*(slice@1)) - storage_live(@18) - @18 := copy (@17) ub.- const (1 : usize) - storage_dead(@17) - storage_live(@19) - @19 := @SliceIndexShared<'_, i32>(move (@16), copy (@18)) - _c@7 := &*(@19) + @17 := @SliceIndexShared<'_, i32>(move (@14), copy (@16)) + _c@7 := &*(@17) @0 := () storage_dead(_c@7) storage_dead(_b@6) @@ -224,9 +212,8 @@ fn slice_pat4<'_0>(@1: &'_0 (Slice)) let @3: usize; // anonymous local let @4: bool; // anonymous local let _y@5: &'_ (u32); // local - let @6: usize; // anonymous local - let @7: &'_ (Slice); // anonymous local - let @8: &'_ (u32); // anonymous local + let @6: &'_ (Slice); // anonymous local + let @7: &'_ (u32); // anonymous local storage_live(@2) storage_live(@3) @@ -243,12 +230,10 @@ fn slice_pat4<'_0>(@1: &'_0 (Slice)) } storage_live(_y@5) storage_live(@6) - @6 := ptr_metadata(copy (x@1)) + @6 := &(*(x@1), copy (x@1.metadata)) storage_live(@7) - @7 := &(*(x@1), move (@6)) - storage_live(@8) - @8 := @SliceIndexShared<'_, u32>(move (@7), const (0 : usize)) - _y@5 := &*(@8) + @7 := @SliceIndexShared<'_, u32>(move (@6), const (0 : usize)) + _y@5 := &*(@7) @0 := () storage_dead(_y@5) @0 := () @@ -269,9 +254,8 @@ fn slice_pat5<'_0>(@1: &'_0 (Unsized)) let @3: usize; // anonymous local let @4: bool; // anonymous local let _y@5: u32; // local - let @6: usize; // anonymous local - let @7: &'_ (Slice); // anonymous local - let @8: &'_ (u32); // anonymous local + let @6: &'_ (Slice); // anonymous local + let @7: &'_ (u32); // anonymous local storage_live(@2) storage_live(@3) @@ -288,12 +272,10 @@ fn slice_pat5<'_0>(@1: &'_0 (Unsized)) } storage_live(_y@5) storage_live(@6) - @6 := ptr_metadata(copy (x@1)) + @6 := &((*(x@1)).0, copy (x@1.metadata)) storage_live(@7) - @7 := &((*(x@1)).0, move (@6)) - storage_live(@8) - @8 := @SliceIndexShared<'_, u32>(move (@7), const (0 : usize)) - _y@5 := copy (*(@8)) + @7 := @SliceIndexShared<'_, u32>(move (@6), const (0 : usize)) + _y@5 := copy (*(@7)) @0 := () storage_dead(_y@5) @0 := () diff --git a/charon/tests/ui/issue-4-slice-try-into-array.out b/charon/tests/ui/issue-4-slice-try-into-array.out index b50d2cf85..de432a9b7 100644 --- a/charon/tests/ui/issue-4-slice-try-into-array.out +++ b/charon/tests/ui/issue-4-slice-try-into-array.out @@ -198,14 +198,11 @@ pub fn trait_error<'_0>(@1: &'_0 (Slice)) let _array@2: Array; // local let @3: Result, TryFromSliceError>[Sized>, Sized]; // anonymous local let @4: &'_ (Slice); // anonymous local - let @5: usize; // anonymous local storage_live(_array@2) storage_live(@3) storage_live(@4) - storage_live(@5) - @5 := ptr_metadata(copy (s@1)) - @4 := &(*(s@1), move (@5)) + @4 := &(*(s@1), copy (s@1.metadata)) @3 := {impl TryInto for T}::try_into<&'_ (Slice), Array>[Sized<&'_ (Slice)>, Sized>, {impl TryFrom<&'_0 (Slice)> for Array}<'_, u8, 4 : usize>[Sized, {impl Copy for u8}]](move (@4)) storage_dead(@4) _array@2 := unwrap, TryFromSliceError>[Sized>, Sized, {impl Debug for TryFromSliceError}](move (@3)) diff --git a/charon/tests/ui/issue-4-traits.out b/charon/tests/ui/issue-4-traits.out index 2b8e84ee6..b3f0bea09 100644 --- a/charon/tests/ui/issue-4-traits.out +++ b/charon/tests/ui/issue-4-traits.out @@ -198,14 +198,11 @@ fn trait_error<'_0>(@1: &'_0 (Slice)) let _array@2: Array; // local let @3: Result, TryFromSliceError>[Sized>, Sized]; // anonymous local let @4: &'_ (Slice); // anonymous local - let @5: usize; // anonymous local storage_live(_array@2) storage_live(@3) storage_live(@4) - storage_live(@5) - @5 := ptr_metadata(copy (s@1)) - @4 := &(*(s@1), move (@5)) + @4 := &(*(s@1), copy (s@1.metadata)) @3 := {impl TryInto for T}::try_into<&'_ (Slice), Array>[Sized<&'_ (Slice)>, Sized>, {impl TryFrom<&'_0 (Slice)> for Array}<'_, u8, 4 : usize>[Sized, {impl Copy for u8}]](move (@4)) storage_dead(@4) _array@2 := unwrap, TryFromSliceError>[Sized>, Sized, {impl Debug for TryFromSliceError}](move (@3)) diff --git a/charon/tests/ui/issue-45-misc.out b/charon/tests/ui/issue-45-misc.out index db53034d9..eae6296d7 100644 --- a/charon/tests/ui/issue-45-misc.out +++ b/charon/tests/ui/issue-45-misc.out @@ -729,8 +729,6 @@ fn select<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) let @22: &'_ (usize); // anonymous local let @23: &'_ (usize); // anonymous local let @24: Option>[Sized>]; // anonymous local - let @25: usize; // anonymous local - let @26: usize; // anonymous local storage_live(@5) storage_live(@6) @@ -752,8 +750,6 @@ fn select<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) storage_live(@22) storage_live(@23) storage_live(@24) - storage_live(@25) - storage_live(@26) storage_live(@3) storage_live(@4) @4 := const (true) @@ -763,18 +759,14 @@ fn select<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) storage_live(@7) storage_live(@8) storage_live(@9) - storage_live(@25) - @25 := ptr_metadata(copy (lhs@1)) - @9 := &(*(lhs@1), move (@25)) + @9 := &(*(lhs@1), copy (lhs@1.metadata)) @8 := core::slice::{Slice}::len<'_, u8>[Sized](move (@9)) storage_dead(@9) @7 := &@8 storage_live(@10) storage_live(@11) storage_live(@12) - storage_live(@26) - @26 := ptr_metadata(copy (rhs@2)) - @12 := &(*(rhs@2), move (@26)) + @12 := &(*(rhs@2), copy (rhs@2.metadata)) @11 := core::slice::{Slice}::len<'_, u8>[Sized](move (@12)) storage_dead(@12) @10 := &@11 diff --git a/charon/tests/ui/issue-70-override-provided-method.2.out b/charon/tests/ui/issue-70-override-provided-method.2.out index 01ec79087..4949730ca 100644 --- a/charon/tests/ui/issue-70-override-provided-method.2.out +++ b/charon/tests/ui/issue-70-override-provided-method.2.out @@ -38,22 +38,16 @@ where let @3: &'_ (Self); // anonymous local let @4: (); // anonymous local let @5: &'_ (Self); // anonymous local - let @6: PtrMetadata; // anonymous local - let @7: PtrMetadata; // anonymous local storage_live(@2) storage_live(@3) - storage_live(@6) - @6 := ptr_metadata(copy (self@1)) - @3 := &(*(self@1), move (@6)) + @3 := &(*(self@1), copy (self@1.metadata)) @2 := @TraitClause0::required<'_>(move (@3)) storage_dead(@3) storage_dead(@2) storage_live(@4) storage_live(@5) - storage_live(@7) - @7 := ptr_metadata(copy (self@1)) - @5 := &(*(self@1), move (@7)) + @5 := &(*(self@1), copy (self@1.metadata)) @4 := @TraitClause0::provided2<'_>(move (@5)) storage_dead(@5) storage_dead(@4) @@ -73,22 +67,16 @@ where let @3: &'_ (Self); // anonymous local let @4: (); // anonymous local let @5: &'_ (Self); // anonymous local - let @6: PtrMetadata; // anonymous local - let @7: PtrMetadata; // anonymous local storage_live(@2) storage_live(@3) - storage_live(@6) - @6 := ptr_metadata(copy (self@1)) - @3 := &(*(self@1), move (@6)) + @3 := &(*(self@1), copy (self@1.metadata)) @2 := @TraitClause0::required<'_>(move (@3)) storage_dead(@3) storage_dead(@2) storage_live(@4) storage_live(@5) - storage_live(@7) - @7 := ptr_metadata(copy (self@1)) - @5 := &(*(self@1), move (@7)) + @5 := &(*(self@1), copy (self@1.metadata)) @4 := @TraitClause0::provided1<'_>(move (@5)) storage_dead(@5) storage_dead(@4) diff --git a/charon/tests/ui/ml-name-matcher-tests.out b/charon/tests/ui/ml-name-matcher-tests.out index 0607ea1e9..75b85e61c 100644 --- a/charon/tests/ui/ml-name-matcher-tests.out +++ b/charon/tests/ui/ml-name-matcher-tests.out @@ -281,8 +281,6 @@ fn foo() let @9: &'_ (Slice); // anonymous local let @10: &'_ (Slice); // anonymous local let @11: RangeFrom[Sized]; // anonymous local - let @12: usize; // anonymous local - let @13: usize; // anonymous local storage_live(@1) storage_live(@2) @@ -306,17 +304,13 @@ fn foo() storage_live(@8) storage_live(@9) storage_live(@10) - storage_live(@12) - @12 := ptr_metadata(copy (slice@4)) - @10 := &(*(slice@4), move (@12)) + @10 := &(*(slice@4), copy (slice@4.metadata)) storage_live(@11) @11 := RangeFrom { start: const (1 : usize) } @9 := {impl Index for Slice}::index<'_, bool, RangeFrom[Sized]>[Sized, Sized[Sized]>, {impl SliceIndex> for RangeFrom[Sized]}[Sized]](move (@10), move (@11)) storage_dead(@11) storage_dead(@10) - storage_live(@13) - @13 := ptr_metadata(copy (@9)) - @8 := &(*(@9), move (@13)) + @8 := &(*(@9), copy (@9.metadata)) storage_dead(@8) @0 := () storage_dead(@9) diff --git a/charon/tests/ui/projection-index-from-end.out b/charon/tests/ui/projection-index-from-end.out index d5151cc63..354e6be7a 100644 --- a/charon/tests/ui/projection-index-from-end.out +++ b/charon/tests/ui/projection-index-from-end.out @@ -19,11 +19,10 @@ fn slice_pattern_end<'_0>(@1: &'_0 (Slice<()>)) let @3: usize; // anonymous local let @4: bool; // anonymous local let _named@5: &'_ (()); // local - let @6: usize; // anonymous local - let @7: &'_ (Slice<()>); // anonymous local + let @6: &'_ (Slice<()>); // anonymous local + let @7: usize; // anonymous local let @8: usize; // anonymous local - let @9: usize; // anonymous local - let @10: &'_ (()); // anonymous local + let @9: &'_ (()); // anonymous local storage_live(@2) storage_live(@3) @@ -40,17 +39,15 @@ fn slice_pattern_end<'_0>(@1: &'_0 (Slice<()>)) } storage_live(_named@5) storage_live(@6) - @6 := ptr_metadata(copy (x@1)) + @6 := &(*(x@1), copy (x@1.metadata)) storage_live(@7) - @7 := &(*(x@1), move (@6)) + @7 := len(*(x@1)) storage_live(@8) - @8 := len(*(x@1)) + @8 := copy (@7) ub.- const (1 : usize) + storage_dead(@7) storage_live(@9) - @9 := copy (@8) ub.- const (1 : usize) - storage_dead(@8) - storage_live(@10) - @10 := @SliceIndexShared<'_, ()>(move (@7), copy (@9)) - _named@5 := &*(@10) + @9 := @SliceIndexShared<'_, ()>(move (@6), copy (@8)) + _named@5 := &*(@9) @0 := () storage_dead(_named@5) @0 := () diff --git a/charon/tests/ui/raw-boxes.out b/charon/tests/ui/raw-boxes.out index 40f616f40..d4336345d 100644 --- a/charon/tests/ui/raw-boxes.out +++ b/charon/tests/ui/raw-boxes.out @@ -729,7 +729,7 @@ where self@7 := cast<*mut Slice, *mut u8>(copy (@13)) storage_dead(self@8) storage_live(count@9) - count@9 := ptr_metadata(copy (@13)) + count@9 := copy (@13.metadata) storage_live(@17) @17 := ub_checks if copy (@17) { @@ -4215,7 +4215,6 @@ where let @2: ManuallyDrop[@TraitClause0, Sized, {impl Allocator for Global}]>[MetaSized[@TraitClause0, Sized, {impl Allocator for Global}]>]; // anonymous local let @3: Box[@TraitClause0, Sized, {impl Allocator for Global}]; // anonymous local let @4: *const T; // anonymous local - let @5: PtrMetadata; // anonymous local storage_live(@3) storage_live(@4) @@ -4223,9 +4222,7 @@ where @2 := ManuallyDrop { value: copy (b@1) } @3 := copy ((@2).value) @4 := transmute, *const T>(copy (((@3).0).pointer)) - storage_live(@5) - @5 := ptr_metadata(copy (@4)) - @0 := &raw mut (*(@4), move (@5)) + @0 := &raw mut (*(@4), copy (@4.metadata)) storage_dead(@2) return } @@ -4243,22 +4240,16 @@ where let @2: *mut T; // anonymous local let @3: *const T; // anonymous local let @4: NonNull; // anonymous local - let @5: PtrMetadata; // anonymous local - let @6: PtrMetadata; // anonymous local storage_live(@2) storage_live(@4) storage_live(@3) @4 := copy (((b@1).0).pointer) @3 := transmute, *const T>(copy (@4)) - storage_live(@6) - @6 := ptr_metadata(copy (@3)) - @2 := &raw mut (*(@3), move (@6)) + @2 := &raw mut (*(@3), copy (@3.metadata)) storage_dead(@3) storage_dead(@4) - storage_live(@5) - @5 := ptr_metadata(copy (@2)) - @0 := &mut (*(@2), move (@5)) + @0 := &mut (*(@2), copy (@2.metadata)) return } diff --git a/charon/tests/ui/remove-dynamic-checks.out b/charon/tests/ui/remove-dynamic-checks.out index d0f4e4a5d..70651945f 100644 --- a/charon/tests/ui/remove-dynamic-checks.out +++ b/charon/tests/ui/remove-dynamic-checks.out @@ -826,24 +826,18 @@ fn div_unsigned_to_slice<'_0>(@1: &'_0 mut (Slice), @2: u32) let x@2: u32; // arg #2 let @3: u32; // anonymous local let @4: usize; // anonymous local - let @5: usize; // anonymous local - let @6: usize; // anonymous local - let @7: &'_ mut (Slice); // anonymous local - let @8: &'_ mut (u32); // anonymous local + let @5: &'_ mut (Slice); // anonymous local + let @6: &'_ mut (u32); // anonymous local storage_live(@3) @3 := copy (x@2) storage_live(@4) @4 := const (0 : usize) storage_live(@5) - @5 := ptr_metadata(copy (result@1)) + @5 := &mut (*(result@1), copy (result@1.metadata)) storage_live(@6) - @6 := ptr_metadata(copy (result@1)) - storage_live(@7) - @7 := &mut (*(result@1), move (@6)) - storage_live(@8) - @8 := @SliceIndexMut<'_, u32>(move (@7), copy (@4)) - *(@8) := move (@3) panic./ const (3329 : u32) + @6 := @SliceIndexMut<'_, u32>(move (@5), copy (@4)) + *(@6) := move (@3) panic./ const (3329 : u32) storage_dead(@3) storage_dead(@4) @0 := () @@ -859,24 +853,18 @@ fn div_signed_to_slice<'_0>(@1: &'_0 mut (Slice), @2: i32) let x@2: i32; // arg #2 let @3: i32; // anonymous local let @4: usize; // anonymous local - let @5: usize; // anonymous local - let @6: usize; // anonymous local - let @7: &'_ mut (Slice); // anonymous local - let @8: &'_ mut (i32); // anonymous local + let @5: &'_ mut (Slice); // anonymous local + let @6: &'_ mut (i32); // anonymous local storage_live(@3) @3 := copy (x@2) storage_live(@4) @4 := const (0 : usize) storage_live(@5) - @5 := ptr_metadata(copy (result@1)) + @5 := &mut (*(result@1), copy (result@1.metadata)) storage_live(@6) - @6 := ptr_metadata(copy (result@1)) - storage_live(@7) - @7 := &mut (*(result@1), move (@6)) - storage_live(@8) - @8 := @SliceIndexMut<'_, i32>(move (@7), copy (@4)) - *(@8) := move (@3) panic./ const (3329 : i32) + @6 := @SliceIndexMut<'_, i32>(move (@5), copy (@4)) + *(@6) := move (@3) panic./ const (3329 : i32) storage_dead(@3) storage_dead(@4) @0 := () @@ -893,10 +881,8 @@ fn add_to_slice<'_0>(@1: &'_0 mut (Slice), @2: u32) let @3: u32; // anonymous local let @4: u32; // anonymous local let @5: usize; // anonymous local - let @6: usize; // anonymous local - let @7: usize; // anonymous local - let @8: &'_ mut (Slice); // anonymous local - let @9: &'_ mut (u32); // anonymous local + let @6: &'_ mut (Slice); // anonymous local + let @7: &'_ mut (u32); // anonymous local storage_live(@4) storage_live(@3) @@ -905,14 +891,10 @@ fn add_to_slice<'_0>(@1: &'_0 mut (Slice), @2: u32) storage_live(@5) @5 := const (0 : usize) storage_live(@6) - @6 := ptr_metadata(copy (result@1)) + @6 := &mut (*(result@1), copy (result@1.metadata)) storage_live(@7) - @7 := ptr_metadata(copy (result@1)) - storage_live(@8) - @8 := &mut (*(result@1), move (@7)) - storage_live(@9) - @9 := @SliceIndexMut<'_, u32>(move (@8), copy (@5)) - *(@9) := move (@4) + @7 := @SliceIndexMut<'_, u32>(move (@6), copy (@5)) + *(@7) := move (@4) storage_dead(@3) storage_dead(@5) @0 := () @@ -932,10 +914,8 @@ fn add_to_slice2<'_0>(@1: &'_0 mut (Slice), @2: usize, @3: u8) let @6: usize; // anonymous local let @7: usize; // anonymous local let @8: usize; // anonymous local - let @9: usize; // anonymous local - let @10: usize; // anonymous local - let @11: &'_ mut (Slice); // anonymous local - let @12: &'_ mut (u8); // anonymous local + let @9: &'_ mut (Slice); // anonymous local + let @10: &'_ mut (u8); // anonymous local storage_live(@5) storage_live(@8) @@ -949,14 +929,10 @@ fn add_to_slice2<'_0>(@1: &'_0 mut (Slice), @2: usize, @3: u8) @6 := move (@8) storage_dead(@7) storage_live(@9) - @9 := ptr_metadata(copy (result@1)) + @9 := &mut (*(result@1), copy (result@1.metadata)) storage_live(@10) - @10 := ptr_metadata(copy (result@1)) - storage_live(@11) - @11 := &mut (*(result@1), move (@10)) - storage_live(@12) - @12 := @SliceIndexMut<'_, u8>(move (@11), copy (@6)) - *(@12) := move (@5) + @10 := @SliceIndexMut<'_, u8>(move (@9), copy (@6)) + *(@10) := move (@5) storage_dead(@4) storage_dead(@6) @0 := () diff --git a/charon/tests/ui/simple/const-subslice.out b/charon/tests/ui/simple/const-subslice.out index 369e6b964..4cd1d5f2e 100644 --- a/charon/tests/ui/simple/const-subslice.out +++ b/charon/tests/ui/simple/const-subslice.out @@ -19,24 +19,21 @@ fn main() let @3: *const Slice; // anonymous local let @4: usize; // anonymous local let @5: *const u8; // anonymous local - let @6: usize; // anonymous local - let @7: Slice; // anonymous local - let @8: (); // anonymous local - let @9: &'_ (Slice); // anonymous local + let @6: Slice; // anonymous local + let @7: (); // anonymous local + let @8: &'_ (Slice); // anonymous local + storage_live(@6) storage_live(@7) storage_live(@8) - storage_live(@9) storage_live(y@1) - @7 := [const (0 : u8), const (1 : u8), const (2 : u8)] - @8 := () - @9 := &@7 - y@1 := move (@9) + @6 := [const (0 : u8), const (1 : u8), const (2 : u8)] + @7 := () + @8 := &@6 + y@1 := move (@8) storage_live(z@2) storage_live(@3) - storage_live(@6) - @6 := ptr_metadata(copy (y@1)) - @3 := &raw const (*(y@1), move (@6)) + @3 := &raw const (*(y@1), copy (y@1.metadata)) z@2 := cast<*const Slice, *const u8>(move (@3)) storage_dead(@3) storage_live(@4) diff --git a/charon/tests/ui/simple/dyn-fn.out b/charon/tests/ui/simple/dyn-fn.out index d174c054a..64892dcb1 100644 --- a/charon/tests/ui/simple/dyn-fn.out +++ b/charon/tests/ui/simple/dyn-fn.out @@ -113,15 +113,12 @@ fn takes_fn<'_0>(@1: &'_0 ((dyn exists<_dyn> [@TraitClause0]: for<'a> Fn<_dyn, ( let @5: (&'_ mut (u32)); // anonymous local let @6: &'_ mut (u32); // anonymous local let @7: &'_ mut (u32); // anonymous local - let @8: &'static (core::ops::function::Fn::{vtable}<(&'_ mut (u32)), bool>); // anonymous local storage_live(counter@2) counter@2 := const (0 : u32) storage_live(@3) storage_live(@4) - storage_live(@8) - @8 := ptr_metadata(copy (f@1)) - @4 := &(*(f@1), move (@8)) + @4 := &(*(f@1), copy (f@1.metadata)) storage_live(@5) storage_live(@6) storage_live(@7) diff --git a/charon/tests/ui/simple/generic-cast-to-dyn.out b/charon/tests/ui/simple/generic-cast-to-dyn.out index 69768a90f..2a2b92aba 100644 --- a/charon/tests/ui/simple/generic-cast-to-dyn.out +++ b/charon/tests/ui/simple/generic-cast-to-dyn.out @@ -61,7 +61,6 @@ where let @2: &'_ ((dyn exists<_dyn> [@TraitClause0]: Any<_dyn> + _dyn : '_)); // anonymous local let @3: &'_ ((dyn exists<_dyn> [@TraitClause0]: Any<_dyn> + _dyn : '_)); // anonymous local let @4: &'_ (T); // anonymous local - let @5: &'static (core::any::Any::{vtable}); // anonymous local storage_live(@2) storage_live(@3) @@ -69,9 +68,7 @@ where @4 := &*(x@1) @3 := unsize_cast<&'_ (T), &'_ ((dyn exists<_dyn> [@TraitClause0]: Any<_dyn> + _dyn : '_)), @TraitClause1>(move (@4)) storage_dead(@4) - storage_live(@5) - @5 := ptr_metadata(copy (@3)) - @2 := &(*(@3), move (@5)) + @2 := &(*(@3), copy (@3.metadata)) @0 := unsize_cast<&'_ ((dyn exists<_dyn> [@TraitClause0]: Any<_dyn> + _dyn : '_)), &'_ ((dyn exists<_dyn> [@TraitClause0]: Any<_dyn> + _dyn : '_)), Any<(dyn exists<_dyn> [@TraitClause0]: Any<_dyn> + _dyn : '_)>>(move (@2)) storage_dead(@3) storage_dead(@2) diff --git a/charon/tests/ui/simple/slice_increment.out b/charon/tests/ui/simple/slice_increment.out index 2dfc69637..10d023a90 100644 --- a/charon/tests/ui/simple/slice_increment.out +++ b/charon/tests/ui/simple/slice_increment.out @@ -17,33 +17,24 @@ pub fn incr<'_0>(@1: &'_0 mut (Slice)) let s@1: &'_ mut (Slice); // arg #1 let @2: usize; // anonymous local let @3: u32; // anonymous local - let @4: usize; // anonymous local - let @5: usize; // anonymous local - let @6: &'_ mut (Slice); // anonymous local - let @7: &'_ mut (u32); // anonymous local - let @8: usize; // anonymous local - let @9: &'_ (Slice); // anonymous local - let @10: &'_ (u32); // anonymous local + let @4: &'_ mut (Slice); // anonymous local + let @5: &'_ mut (u32); // anonymous local + let @6: &'_ (Slice); // anonymous local + let @7: &'_ (u32); // anonymous local storage_live(@3) storage_live(@2) @2 := const (0 : usize) - storage_live(@4) - @4 := ptr_metadata(copy (s@1)) - storage_live(@8) - @8 := ptr_metadata(copy (s@1)) - storage_live(@9) - @9 := &(*(s@1), move (@8)) - storage_live(@10) - @10 := @SliceIndexShared<'_, u32>(move (@9), copy (@2)) - @3 := copy (*(@10)) panic.+ const (1 : u32) - storage_live(@5) - @5 := ptr_metadata(copy (s@1)) storage_live(@6) - @6 := &mut (*(s@1), move (@5)) + @6 := &(*(s@1), copy (s@1.metadata)) storage_live(@7) - @7 := @SliceIndexMut<'_, u32>(move (@6), copy (@2)) - *(@7) := move (@3) + @7 := @SliceIndexShared<'_, u32>(move (@6), copy (@2)) + @3 := copy (*(@7)) panic.+ const (1 : u32) + storage_live(@4) + @4 := &mut (*(s@1), copy (s@1.metadata)) + storage_live(@5) + @5 := @SliceIndexMut<'_, u32>(move (@4), copy (@2)) + *(@5) := move (@3) storage_dead(@2) @0 := () @0 := () diff --git a/charon/tests/ui/simple/slice_index.out b/charon/tests/ui/simple/slice_index.out index 34cc27551..a7708df49 100644 --- a/charon/tests/ui/simple/slice_index.out +++ b/charon/tests/ui/simple/slice_index.out @@ -16,19 +16,16 @@ pub fn first<'_0>(@1: &'_0 (Slice)) -> u32 let @0: u32; // return let s@1: &'_ (Slice); // arg #1 let @2: usize; // anonymous local - let @3: usize; // anonymous local - let @4: &'_ (Slice); // anonymous local - let @5: &'_ (u32); // anonymous local + let @3: &'_ (Slice); // anonymous local + let @4: &'_ (u32); // anonymous local storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := ptr_metadata(copy (s@1)) + @3 := &(*(s@1), copy (s@1.metadata)) storage_live(@4) - @4 := &(*(s@1), move (@3)) - storage_live(@5) - @5 := @SliceIndexShared<'_, u32>(move (@4), copy (@2)) - @0 := copy (*(@5)) + @4 := @SliceIndexShared<'_, u32>(move (@3), copy (@2)) + @0 := copy (*(@4)) storage_dead(@2) return } diff --git a/charon/tests/ui/simple/slice_index_range.out b/charon/tests/ui/simple/slice_index_range.out index 19fb536d5..a55e46bdb 100644 --- a/charon/tests/ui/simple/slice_index_range.out +++ b/charon/tests/ui/simple/slice_index_range.out @@ -410,9 +410,7 @@ where let @13: usize; // anonymous local let @14: *const T; // anonymous local let @15: *const T; // anonymous local - let @16: usize; // anonymous local - let @17: usize; // anonymous local - let @18: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @16: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(self@4) storage_live(rhs@5) @@ -425,8 +423,6 @@ where storage_live(@14) storage_live(@15) storage_live(@16) - storage_live(@17) - storage_live(@18) storage_live(@3) self@4 := copy ((self@1).end) rhs@5 := copy ((self@1).start) @@ -435,8 +431,8 @@ where if move (@12) { storage_dead(@12) storage_dead(@3) - @18 := Option::None { } - @0 := move (@18) + @16 := Option::None { } + @0 := move (@16) } else { storage_live(@13) @@ -447,15 +443,13 @@ where new_len@6 := copy ((@3 as variant Option::Some).0) storage_live(@7) storage_live(@8) - @8 := ptr_metadata(copy (slice@2)) + @8 := copy (slice@2.metadata) @7 := copy (self@4) <= move (@8) if move (@7) { storage_dead(@8) storage_live(@10) storage_live(@11) - storage_live(@17) - @17 := ptr_metadata(copy (slice@2)) - @11 := &raw const (*(slice@2), move (@17)) + @11 := &raw const (*(slice@2), copy (slice@2.metadata)) storage_live(@14) storage_live(@15) @14 := cast<*const Slice, *const T>(copy (@11)) @@ -464,9 +458,7 @@ where storage_dead(@15) storage_dead(@14) storage_dead(@11) - storage_live(@16) - @16 := ptr_metadata(copy (@10)) - @9 := &(*(@10), move (@16)) + @9 := &(*(@10), copy (@10.metadata)) @0 := Option::Some { 0: copy (@9) } storage_dead(@10) storage_dead(@3) @@ -474,8 +466,8 @@ where else { storage_dead(@8) storage_dead(@3) - @18 := Option::None { } - @0 := move (@18) + @16 := Option::None { } + @0 := move (@16) } } storage_dead(@7) @@ -503,9 +495,7 @@ where let @13: usize; // anonymous local let @14: *mut T; // anonymous local let @15: *mut T; // anonymous local - let @16: usize; // anonymous local - let @17: usize; // anonymous local - let @18: Option<&'_ mut (Slice)>[Sized<&'_ mut (Slice)>]; // anonymous local + let @16: Option<&'_ mut (Slice)>[Sized<&'_ mut (Slice)>]; // anonymous local storage_live(self@4) storage_live(rhs@5) @@ -518,8 +508,6 @@ where storage_live(@14) storage_live(@15) storage_live(@16) - storage_live(@17) - storage_live(@18) storage_live(@3) self@4 := copy ((self@1).end) rhs@5 := copy ((self@1).start) @@ -528,8 +516,8 @@ where if move (@12) { storage_dead(@12) storage_dead(@3) - @18 := Option::None { } - @0 := move (@18) + @16 := Option::None { } + @0 := move (@16) } else { storage_live(@13) @@ -540,15 +528,13 @@ where new_len@6 := copy ((@3 as variant Option::Some).0) storage_live(@7) storage_live(@8) - @8 := ptr_metadata(copy (slice@2)) + @8 := copy (slice@2.metadata) @7 := copy (self@4) <= move (@8) if move (@7) { storage_dead(@8) storage_live(@10) storage_live(ptr@11) - storage_live(@17) - @17 := ptr_metadata(copy (slice@2)) - ptr@11 := &raw mut (*(slice@2), move (@17)) + ptr@11 := &raw mut (*(slice@2), copy (slice@2.metadata)) storage_live(@14) storage_live(@15) @14 := cast<*mut Slice, *mut T>(copy (ptr@11)) @@ -557,9 +543,7 @@ where storage_dead(@15) storage_dead(@14) storage_dead(ptr@11) - storage_live(@16) - @16 := ptr_metadata(copy (@10)) - @9 := &mut (*(@10), move (@16)) + @9 := &mut (*(@10), copy (@10.metadata)) @0 := Option::Some { 0: copy (@9) } storage_dead(@10) storage_dead(@3) @@ -567,8 +551,8 @@ where else { storage_dead(@8) storage_dead(@3) - @18 := Option::None { } - @0 := move (@18) + @16 := Option::None { } + @0 := move (@16) } } storage_dead(@7) @@ -666,7 +650,7 @@ where storage_live(@6) @6 := copy ((self@1).end) storage_live(@7) - @7 := ptr_metadata(copy (slice@2)) + @7 := copy (slice@2.metadata) @4 := {impl SliceIndex> for Range[Sized]}::get_unchecked::precondition_check(move (@5), move (@6), move (@7)) storage_dead(@7) storage_dead(@6) @@ -781,7 +765,7 @@ where storage_live(@6) @6 := copy ((self@1).end) storage_live(@7) - @7 := ptr_metadata(copy (slice@2)) + @7 := copy (slice@2.metadata) @4 := {impl SliceIndex> for Range[Sized]}::get_unchecked_mut::precondition_check(move (@5), move (@6), move (@7)) storage_dead(@7) storage_dead(@6) @@ -827,8 +811,6 @@ where let @14: usize; // anonymous local let @15: *const T; // anonymous local let @16: *const T; // anonymous local - let @17: usize; // anonymous local - let @18: usize; // anonymous local storage_live(@3) storage_live(new_len@4) @@ -842,8 +824,6 @@ where storage_live(@14) storage_live(@15) storage_live(@16) - storage_live(@17) - storage_live(@18) storage_live(@5) self@6 := copy ((self@1).end) rhs@7 := copy ((self@1).start) @@ -860,7 +840,7 @@ where new_len@4 := copy ((@5 as variant Option::Some).0) storage_dead(@5) storage_live(@8) - @9 := ptr_metadata(copy (slice@2)) + @9 := copy (slice@2.metadata) @8 := copy (self@6) > copy (@9) if move (@8) { } @@ -868,9 +848,7 @@ where storage_dead(@8) storage_live(@11) storage_live(@12) - storage_live(@18) - @18 := ptr_metadata(copy (slice@2)) - @12 := &raw const (*(slice@2), move (@18)) + @12 := &raw const (*(slice@2), copy (slice@2.metadata)) storage_live(@15) storage_live(@16) @15 := cast<*const Slice, *const T>(copy (@12)) @@ -879,9 +857,7 @@ where storage_dead(@16) storage_dead(@15) storage_dead(@12) - storage_live(@17) - @17 := ptr_metadata(copy (@11)) - @0 := &(*(@11), move (@17)) + @0 := &(*(@11), copy (@11.metadata)) storage_dead(@11) return } @@ -914,8 +890,6 @@ where let @14: usize; // anonymous local let @15: *mut T; // anonymous local let @16: *mut T; // anonymous local - let @17: usize; // anonymous local - let @18: usize; // anonymous local storage_live(@3) storage_live(new_len@4) @@ -929,8 +903,6 @@ where storage_live(@14) storage_live(@15) storage_live(@16) - storage_live(@17) - storage_live(@18) storage_live(@5) self@6 := copy ((self@1).end) rhs@7 := copy ((self@1).start) @@ -947,7 +919,7 @@ where new_len@4 := copy ((@5 as variant Option::Some).0) storage_dead(@5) storage_live(@8) - @9 := ptr_metadata(copy (slice@2)) + @9 := copy (slice@2.metadata) @8 := copy (self@6) > copy (@9) if move (@8) { } @@ -955,9 +927,7 @@ where storage_dead(@8) storage_live(@11) storage_live(ptr@12) - storage_live(@18) - @18 := ptr_metadata(copy (slice@2)) - ptr@12 := &raw mut (*(slice@2), move (@18)) + ptr@12 := &raw mut (*(slice@2), copy (slice@2.metadata)) storage_live(@15) storage_live(@16) @15 := cast<*mut Slice, *mut T>(copy (ptr@12)) @@ -966,9 +936,7 @@ where storage_dead(@16) storage_dead(@15) storage_dead(ptr@12) - storage_live(@17) - @17 := ptr_metadata(copy (@11)) - @0 := &mut (*(@11), move (@17)) + @0 := &mut (*(@11), copy (@11.metadata)) storage_dead(@11) return } @@ -1023,10 +991,8 @@ where let @17: *const T; // anonymous local let self@18: usize; // local let self@19: bool; // local - let @20: usize; // anonymous local - let @21: usize; // anonymous local - let @22: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local - let @23: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @20: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @21: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(self@4) storage_live(exclusive_end@6) @@ -1045,8 +1011,6 @@ where storage_live(self@19) storage_live(@20) storage_live(@21) - storage_live(@22) - storage_live(@23) storage_live(@3) storage_live(self@5) self@5 := &self@1 @@ -1054,8 +1018,8 @@ where self@4 := copy ((self@1).end) @3 := copy (self@4) == copy (MAX) if move (@3) { - @22 := Option::None { } - @0 := move (@22) + @20 := Option::None { } + @0 := move (@20) } else { storage_live(self@18) @@ -1077,8 +1041,8 @@ where @14 := copy (exclusive_end@6) < copy (self@8) if move (@14) { storage_dead(@14) - @23 := Option::None { } - @0 := move (@23) + @21 := Option::None { } + @0 := move (@21) storage_dead(@9) storage_dead(@11) } @@ -1087,15 +1051,13 @@ where storage_dead(@14) storage_live(@9) storage_live(@10) - @10 := ptr_metadata(copy (slice@2)) + @10 := copy (slice@2.metadata) @9 := copy (exclusive_end@6) <= move (@10) if move (@9) { storage_dead(@10) storage_live(@12) storage_live(@13) - storage_live(@21) - @21 := ptr_metadata(copy (slice@2)) - @13 := &raw const (*(slice@2), move (@21)) + @13 := &raw const (*(slice@2), copy (slice@2.metadata)) storage_live(@16) storage_live(@17) @16 := cast<*const Slice, *const T>(copy (@13)) @@ -1104,16 +1066,14 @@ where storage_dead(@17) storage_dead(@16) storage_dead(@13) - storage_live(@20) - @20 := ptr_metadata(copy (@12)) - @11 := &(*(@12), move (@20)) + @11 := &(*(@12), copy (@12.metadata)) @0 := Option::Some { 0: copy (@11) } storage_dead(@12) } else { storage_dead(@10) - @23 := Option::None { } - @0 := move (@23) + @21 := Option::None { } + @0 := move (@21) } storage_dead(@9) storage_dead(@11) @@ -1148,10 +1108,8 @@ where let @17: *mut T; // anonymous local let self@18: usize; // local let self@19: bool; // local - let @20: usize; // anonymous local - let @21: usize; // anonymous local - let @22: Option<&'_ mut (Slice)>[Sized<&'_ mut (Slice)>]; // anonymous local - let @23: Option<&'_ mut (Slice)>[Sized<&'_ mut (Slice)>]; // anonymous local + let @20: Option<&'_ mut (Slice)>[Sized<&'_ mut (Slice)>]; // anonymous local + let @21: Option<&'_ mut (Slice)>[Sized<&'_ mut (Slice)>]; // anonymous local storage_live(self@4) storage_live(exclusive_end@6) @@ -1170,8 +1128,6 @@ where storage_live(self@19) storage_live(@20) storage_live(@21) - storage_live(@22) - storage_live(@23) storage_live(@3) storage_live(self@5) self@5 := &self@1 @@ -1179,8 +1135,8 @@ where self@4 := copy ((self@1).end) @3 := copy (self@4) == copy (MAX) if move (@3) { - @22 := Option::None { } - @0 := move (@22) + @20 := Option::None { } + @0 := move (@20) } else { storage_live(self@18) @@ -1202,8 +1158,8 @@ where @14 := copy (exclusive_end@6) < copy (self@8) if move (@14) { storage_dead(@14) - @23 := Option::None { } - @0 := move (@23) + @21 := Option::None { } + @0 := move (@21) storage_dead(@9) storage_dead(@11) } @@ -1212,15 +1168,13 @@ where storage_dead(@14) storage_live(@9) storage_live(@10) - @10 := ptr_metadata(copy (slice@2)) + @10 := copy (slice@2.metadata) @9 := copy (exclusive_end@6) <= move (@10) if move (@9) { storage_dead(@10) storage_live(@12) storage_live(ptr@13) - storage_live(@21) - @21 := ptr_metadata(copy (slice@2)) - ptr@13 := &raw mut (*(slice@2), move (@21)) + ptr@13 := &raw mut (*(slice@2), copy (slice@2.metadata)) storage_live(@16) storage_live(@17) @16 := cast<*mut Slice, *mut T>(copy (ptr@13)) @@ -1229,16 +1183,14 @@ where storage_dead(@17) storage_dead(@16) storage_dead(ptr@13) - storage_live(@20) - @20 := ptr_metadata(copy (@12)) - @11 := &mut (*(@12), move (@20)) + @11 := &mut (*(@12), copy (@12.metadata)) @0 := Option::Some { 0: copy (@11) } storage_dead(@12) } else { storage_dead(@10) - @23 := Option::None { } - @0 := move (@23) + @21 := Option::None { } + @0 := move (@21) } storage_dead(@9) storage_dead(@11) @@ -1295,7 +1247,7 @@ where @6 := ub_checks if move (@6) { storage_live(@8) - @8 := ptr_metadata(copy (slice@2)) + @8 := copy (slice@2.metadata) @7 := {impl SliceIndex> for Range[Sized]}::get_unchecked::precondition_check(copy (self@5), copy (exclusive_end@3), move (@8)) storage_dead(@8) } @@ -1361,7 +1313,7 @@ where @6 := ub_checks if move (@6) { storage_live(@8) - @8 := ptr_metadata(copy (slice@2)) + @8 := copy (slice@2.metadata) @7 := {impl SliceIndex> for Range[Sized]}::get_unchecked_mut::precondition_check(copy (self@5), copy (exclusive_end@3), move (@8)) storage_dead(@8) } @@ -1536,27 +1488,18 @@ pub fn slice_index_range<'_0>(@1: &'_0 (Slice)) -> &'_0 (Slice) let @3: &'_ (Slice); // anonymous local let @4: &'_ (Slice); // anonymous local let @5: RangeInclusive[Sized]; // anonymous local - let @6: usize; // anonymous local - let @7: usize; // anonymous local - let @8: usize; // anonymous local storage_live(@2) storage_live(@3) storage_live(@4) - storage_live(@6) - @6 := ptr_metadata(copy (slice@1)) - @4 := &(*(slice@1), move (@6)) + @4 := &(*(slice@1), copy (slice@1.metadata)) storage_live(@5) @5 := new[Sized](const (0 : usize), const (10 : usize)) @3 := {impl Index for Slice}::index<'_, u8, RangeInclusive[Sized]>[Sized, Sized[Sized]>, {impl SliceIndex> for RangeInclusive[Sized]}[Sized]](move (@4), move (@5)) storage_dead(@5) storage_dead(@4) - storage_live(@8) - @8 := ptr_metadata(copy (@3)) - @2 := &(*(@3), move (@8)) - storage_live(@7) - @7 := ptr_metadata(copy (@2)) - @0 := &(*(@2), move (@7)) + @2 := &(*(@3), copy (@3.metadata)) + @0 := &(*(@2), copy (@2.metadata)) storage_dead(@3) storage_dead(@2) return diff --git a/charon/tests/ui/slice-index-range.out b/charon/tests/ui/slice-index-range.out index 748e224db..6a675d1ad 100644 --- a/charon/tests/ui/slice-index-range.out +++ b/charon/tests/ui/slice-index-range.out @@ -260,9 +260,7 @@ where let @13: usize; // anonymous local let @14: *const T; // anonymous local let @15: *const T; // anonymous local - let @16: usize; // anonymous local - let @17: usize; // anonymous local - let @18: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local + let @16: Option<&'_ (Slice)>[Sized<&'_ (Slice)>]; // anonymous local storage_live(self@4) storage_live(rhs@5) @@ -275,8 +273,6 @@ where storage_live(@14) storage_live(@15) storage_live(@16) - storage_live(@17) - storage_live(@18) storage_live(@3) self@4 := copy ((self@1).end) rhs@5 := copy ((self@1).start) @@ -285,8 +281,8 @@ where if move (@12) { storage_dead(@12) storage_dead(@3) - @18 := Option::None { } - @0 := move (@18) + @16 := Option::None { } + @0 := move (@16) } else { storage_live(@13) @@ -297,15 +293,13 @@ where new_len@6 := copy ((@3 as variant Option::Some).0) storage_live(@7) storage_live(@8) - @8 := ptr_metadata(copy (slice@2)) + @8 := copy (slice@2.metadata) @7 := copy (self@4) <= move (@8) if move (@7) { storage_dead(@8) storage_live(@10) storage_live(@11) - storage_live(@17) - @17 := ptr_metadata(copy (slice@2)) - @11 := &raw const (*(slice@2), move (@17)) + @11 := &raw const (*(slice@2), copy (slice@2.metadata)) storage_live(@14) storage_live(@15) @14 := cast<*const Slice, *const T>(copy (@11)) @@ -314,9 +308,7 @@ where storage_dead(@15) storage_dead(@14) storage_dead(@11) - storage_live(@16) - @16 := ptr_metadata(copy (@10)) - @9 := &(*(@10), move (@16)) + @9 := &(*(@10), copy (@10.metadata)) @0 := Option::Some { 0: copy (@9) } storage_dead(@10) storage_dead(@3) @@ -324,8 +316,8 @@ where else { storage_dead(@8) storage_dead(@3) - @18 := Option::None { } - @0 := move (@18) + @16 := Option::None { } + @0 := move (@16) } } storage_dead(@7) @@ -353,9 +345,7 @@ where let @13: usize; // anonymous local let @14: *mut T; // anonymous local let @15: *mut T; // anonymous local - let @16: usize; // anonymous local - let @17: usize; // anonymous local - let @18: Option<&'_ mut (Slice)>[Sized<&'_ mut (Slice)>]; // anonymous local + let @16: Option<&'_ mut (Slice)>[Sized<&'_ mut (Slice)>]; // anonymous local storage_live(self@4) storage_live(rhs@5) @@ -368,8 +358,6 @@ where storage_live(@14) storage_live(@15) storage_live(@16) - storage_live(@17) - storage_live(@18) storage_live(@3) self@4 := copy ((self@1).end) rhs@5 := copy ((self@1).start) @@ -378,8 +366,8 @@ where if move (@12) { storage_dead(@12) storage_dead(@3) - @18 := Option::None { } - @0 := move (@18) + @16 := Option::None { } + @0 := move (@16) } else { storage_live(@13) @@ -390,15 +378,13 @@ where new_len@6 := copy ((@3 as variant Option::Some).0) storage_live(@7) storage_live(@8) - @8 := ptr_metadata(copy (slice@2)) + @8 := copy (slice@2.metadata) @7 := copy (self@4) <= move (@8) if move (@7) { storage_dead(@8) storage_live(@10) storage_live(ptr@11) - storage_live(@17) - @17 := ptr_metadata(copy (slice@2)) - ptr@11 := &raw mut (*(slice@2), move (@17)) + ptr@11 := &raw mut (*(slice@2), copy (slice@2.metadata)) storage_live(@14) storage_live(@15) @14 := cast<*mut Slice, *mut T>(copy (ptr@11)) @@ -407,9 +393,7 @@ where storage_dead(@15) storage_dead(@14) storage_dead(ptr@11) - storage_live(@16) - @16 := ptr_metadata(copy (@10)) - @9 := &mut (*(@10), move (@16)) + @9 := &mut (*(@10), copy (@10.metadata)) @0 := Option::Some { 0: copy (@9) } storage_dead(@10) storage_dead(@3) @@ -417,8 +401,8 @@ where else { storage_dead(@8) storage_dead(@3) - @18 := Option::None { } - @0 := move (@18) + @16 := Option::None { } + @0 := move (@16) } } storage_dead(@7) @@ -520,7 +504,7 @@ where storage_live(@6) @6 := copy ((self@1).end) storage_live(@7) - @7 := ptr_metadata(copy (slice@2)) + @7 := copy (slice@2.metadata) @4 := {impl SliceIndex> for Range[Sized]}::get_unchecked::precondition_check(move (@5), move (@6), move (@7)) storage_dead(@7) storage_dead(@6) @@ -629,7 +613,7 @@ where storage_live(@6) @6 := copy ((self@1).end) storage_live(@7) - @7 := ptr_metadata(copy (slice@2)) + @7 := copy (slice@2.metadata) @4 := {impl SliceIndex> for Range[Sized]}::get_unchecked_mut::precondition_check(move (@5), move (@6), move (@7)) storage_dead(@7) storage_dead(@6) @@ -675,8 +659,6 @@ where let @14: usize; // anonymous local let @15: *const T; // anonymous local let @16: *const T; // anonymous local - let @17: usize; // anonymous local - let @18: usize; // anonymous local storage_live(@3) storage_live(new_len@4) @@ -690,8 +672,6 @@ where storage_live(@14) storage_live(@15) storage_live(@16) - storage_live(@17) - storage_live(@18) storage_live(@5) self@6 := copy ((self@1).end) rhs@7 := copy ((self@1).start) @@ -708,7 +688,7 @@ where new_len@4 := copy ((@5 as variant Option::Some).0) storage_dead(@5) storage_live(@8) - @9 := ptr_metadata(copy (slice@2)) + @9 := copy (slice@2.metadata) @8 := copy (self@6) > copy (@9) if move (@8) { } @@ -716,9 +696,7 @@ where storage_dead(@8) storage_live(@11) storage_live(@12) - storage_live(@18) - @18 := ptr_metadata(copy (slice@2)) - @12 := &raw const (*(slice@2), move (@18)) + @12 := &raw const (*(slice@2), copy (slice@2.metadata)) storage_live(@15) storage_live(@16) @15 := cast<*const Slice, *const T>(copy (@12)) @@ -727,9 +705,7 @@ where storage_dead(@16) storage_dead(@15) storage_dead(@12) - storage_live(@17) - @17 := ptr_metadata(copy (@11)) - @0 := &(*(@11), move (@17)) + @0 := &(*(@11), copy (@11.metadata)) storage_dead(@11) return } @@ -762,8 +738,6 @@ where let @14: usize; // anonymous local let @15: *mut T; // anonymous local let @16: *mut T; // anonymous local - let @17: usize; // anonymous local - let @18: usize; // anonymous local storage_live(@3) storage_live(new_len@4) @@ -777,8 +751,6 @@ where storage_live(@14) storage_live(@15) storage_live(@16) - storage_live(@17) - storage_live(@18) storage_live(@5) self@6 := copy ((self@1).end) rhs@7 := copy ((self@1).start) @@ -795,7 +767,7 @@ where new_len@4 := copy ((@5 as variant Option::Some).0) storage_dead(@5) storage_live(@8) - @9 := ptr_metadata(copy (slice@2)) + @9 := copy (slice@2.metadata) @8 := copy (self@6) > copy (@9) if move (@8) { } @@ -803,9 +775,7 @@ where storage_dead(@8) storage_live(@11) storage_live(ptr@12) - storage_live(@18) - @18 := ptr_metadata(copy (slice@2)) - ptr@12 := &raw mut (*(slice@2), move (@18)) + ptr@12 := &raw mut (*(slice@2), copy (slice@2.metadata)) storage_live(@15) storage_live(@16) @15 := cast<*mut Slice, *mut T>(copy (ptr@12)) @@ -814,9 +784,7 @@ where storage_dead(@16) storage_dead(@15) storage_dead(ptr@12) - storage_live(@17) - @17 := ptr_metadata(copy (@11)) - @0 := &mut (*(@11), move (@17)) + @0 := &mut (*(@11), copy (@11.metadata)) storage_dead(@11) return } @@ -859,10 +827,8 @@ fn main() let @7: bool; // anonymous local let @8: i32; // anonymous local let @9: usize; // anonymous local - let @10: usize; // anonymous local - let @11: usize; // anonymous local - let @12: &'_ (Slice); // anonymous local - let @13: &'_ (i32); // anonymous local + let @10: &'_ (Slice); // anonymous local + let @11: &'_ (i32); // anonymous local storage_live(array@1) array@1 := [const (1 : i32), const (2 : i32), const (3 : i32), const (4 : i32), const (5 : i32), const (6 : i32)] @@ -875,21 +841,17 @@ fn main() @3 := {impl Index for Array}::index<'_, i32, Range[Sized], 6 : usize>[Sized, Sized[Sized]>, {impl Index for Slice}[Sized]>[Sized, Sized[Sized]>, {impl SliceIndex> for Range[Sized]}[Sized]]](move (@4), move (@5)) storage_dead(@5) storage_dead(@4) - storage_live(@10) - @10 := ptr_metadata(copy (@3)) - slice@2 := &(*(@3), move (@10)) + slice@2 := &(*(@3), copy (@3.metadata)) storage_live(@6) storage_live(@7) storage_live(@8) storage_live(@9) @9 := const (0 : usize) + storage_live(@10) + @10 := &(*(slice@2), copy (slice@2.metadata)) storage_live(@11) - @11 := ptr_metadata(copy (slice@2)) - storage_live(@12) - @12 := &(*(slice@2), move (@11)) - storage_live(@13) - @13 := @SliceIndexShared<'_, i32>(move (@12), copy (@9)) - @8 := copy (*(@13)) + @11 := @SliceIndexShared<'_, i32>(move (@10), copy (@9)) + @8 := copy (*(@11)) @7 := move (@8) == const (3 : i32) if move (@7) { } diff --git a/charon/tests/ui/string-literal.out b/charon/tests/ui/string-literal.out index 7f105314a..4a2da9352 100644 --- a/charon/tests/ui/string-literal.out +++ b/charon/tests/ui/string-literal.out @@ -163,15 +163,12 @@ fn main() let _s@1: String; // local let @2: &'_ (Str); // anonymous local let @3: &'_ (Str); // anonymous local - let @4: usize; // anonymous local storage_live(_s@1) storage_live(@2) storage_live(@3) @3 := const ("Hello") - storage_live(@4) - @4 := ptr_metadata(copy (@3)) - @2 := &(*(@3), move (@4)) + @2 := &(*(@3), copy (@3.metadata)) _s@1 := {impl ToString for T}::to_string<'_, Str>[MetaSized, {impl Display for Str}](move (@2)) storage_dead(@2) storage_dead(@3) diff --git a/charon/tests/ui/unsupported/issue-79-bound-regions.out b/charon/tests/ui/unsupported/issue-79-bound-regions.out index f2ab72703..fbe5e928c 100644 --- a/charon/tests/ui/unsupported/issue-79-bound-regions.out +++ b/charon/tests/ui/unsupported/issue-79-bound-regions.out @@ -428,7 +428,6 @@ fn main() let @6: &'_ mut (Iter<'_, i32>[Sized]); // anonymous local let @7: Iter<'_, i32>[Sized]; // anonymous local let @8: &'_ (Slice); // anonymous local - let @9: usize; // anonymous local storage_live(slice@1) storage_live(@2) @@ -444,9 +443,7 @@ fn main() storage_live(@6) storage_live(@7) storage_live(@8) - storage_live(@9) - @9 := ptr_metadata(copy (slice@1)) - @8 := &(*(slice@1), move (@9)) + @8 := &(*(slice@1), copy (slice@1.metadata)) @7 := iter<'_, i32>[Sized](move (@8)) @6 := &two-phase-mut @7 storage_dead(@8) diff --git a/charon/tests/ui/vtables.out b/charon/tests/ui/vtables.out index 82068cfc2..03af3f7a9 100644 --- a/charon/tests/ui/vtables.out +++ b/charon/tests/ui/vtables.out @@ -360,7 +360,6 @@ where let @2: &'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)); // anonymous local let @3: &'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)); // anonymous local let @4: &'_ (T); // anonymous local - let @5: &'static (test_crate::NoParam::{vtable}); // anonymous local storage_live(@2) storage_live(@3) @@ -368,9 +367,7 @@ where @4 := &*(arg@1) @3 := unsize_cast<&'_ (T), &'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)), @TraitClause1>(move (@4)) storage_dead(@4) - storage_live(@5) - @5 := ptr_metadata(copy (@3)) - @2 := &(*(@3), move (@5)) + @2 := &(*(@3), copy (@3.metadata)) @0 := unsize_cast<&'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)), &'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)), NoParam<(dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)>>(move (@2)) storage_dead(@3) storage_dead(@2) @@ -465,7 +462,6 @@ where let @5: i32; // anonymous local let @6: &'_ mut ((dyn exists<_dyn> [@TraitClause0]: Modifiable<_dyn, T> + _dyn : '_)); // anonymous local let @7: &'_ (T); // anonymous local - let @8: &'static (test_crate::Modifiable::{vtable}); // anonymous local storage_live(x@2) storage_live(@3) @@ -478,9 +474,7 @@ where storage_dead(@3) storage_dead(@4) storage_live(@6) - storage_live(@8) - @8 := ptr_metadata(copy (x@2)) - @6 := &two-phase-mut (*(x@2), move (@8)) + @6 := &two-phase-mut (*(x@2), copy (x@2.metadata)) storage_live(@7) @7 := &*(arg@1) @0 := Modifiable<(dyn exists<_dyn> [@TraitClause0]: Modifiable<_dyn, T> + _dyn : '_), T>::modify<'_, '_>(move (@6), move (@7)) @@ -539,14 +533,10 @@ where let @7: (); // anonymous local let @8: &'_ (Self); // anonymous local let @9: &'_ (i64); // anonymous local - let @10: PtrMetadata; // anonymous local - let @11: PtrMetadata; // anonymous local storage_live(@4) storage_live(@5) - storage_live(@10) - @10 := ptr_metadata(copy (self@1)) - @5 := &(*(self@1), move (@10)) + @5 := &(*(self@1), copy (self@1.metadata)) storage_live(@6) @6 := &*(t32@2) @4 := @TraitClause0::parent_clause1::operate_on<'_, '_>(move (@5), move (@6)) @@ -555,9 +545,7 @@ where storage_dead(@4) storage_live(@7) storage_live(@8) - storage_live(@11) - @11 := ptr_metadata(copy (self@1)) - @8 := &(*(self@1), move (@11)) + @8 := &(*(self@1), copy (self@1.metadata)) storage_live(@9) @9 := &*(t64@3) @7 := @TraitClause0::parent_clause2::operate_on<'_, '_>(move (@8), move (@9)) @@ -747,13 +735,10 @@ fn use_alias<'_0>(@1: &'_0 ((dyn exists<_dyn> [@TraitClause0]: Both32And64<_dyn> let @7: &'_ (i64); // anonymous local let @8: &'_ (i64); // anonymous local let @9: i64; // anonymous local - let @10: &'static (test_crate::Both32And64::{vtable}); // anonymous local storage_live(@2) storage_live(@3) - storage_live(@10) - @10 := ptr_metadata(copy (x@1)) - @3 := &(*(x@1), move (@10)) + @3 := &(*(x@1), copy (x@1.metadata)) storage_live(@4) storage_live(@5) storage_live(@6) @@ -846,12 +831,6 @@ fn main() let @60: &'_ (i64); // anonymous local let @61: &'_ (i64); // anonymous local let @62: i64; // anonymous local - let @63: &'static (test_crate::Checkable::{vtable}); // anonymous local - let @64: usize; // anonymous local - let @65: &'static (test_crate::Modifiable::{vtable}); // anonymous local - let @66: &'static (test_crate::NoParam::{vtable}); // anonymous local - let @67: &'static (test_crate::NoParam::{vtable}); // anonymous local - let @68: &'static (test_crate::Both32And64::{vtable}); // anonymous local storage_live(@21) storage_live(@22) @@ -895,10 +874,6 @@ fn main() storage_live(@60) storage_live(@61) storage_live(@62) - storage_live(@65) - storage_live(@66) - storage_live(@67) - storage_live(@68) storage_live(x@1) storage_live(@2) storage_live(@3) @@ -912,9 +887,7 @@ fn main() storage_live(@5) storage_live(@6) storage_live(@7) - storage_live(@63) - @63 := ptr_metadata(copy (x@1)) - @7 := &(*(x@1), move (@63)) + @7 := &(*(x@1), copy (x@1.metadata)) @6 := Checkable<(dyn exists<_dyn> [@TraitClause0]: Checkable<_dyn, i32> + _dyn : '_), i32>::check<'_>(move (@7)) if move (@6) { } @@ -945,9 +918,7 @@ fn main() storage_live(@19) storage_live(@20) @20 := const ("Hello") - storage_live(@64) - @64 := ptr_metadata(copy (@20)) - @19 := &(*(@20), move (@64)) + @19 := &(*(@20), copy (@20.metadata)) @18 := {impl ToString for T}::to_string<'_, Str>[MetaSized, {impl Display for Str}](move (@19)) storage_dead(@19) @17 := &@18 @@ -973,9 +944,7 @@ fn main() storage_live(@23) storage_live(@24) storage_live(@25) - storage_live(@65) - @65 := ptr_metadata(copy (y@8)) - @25 := &two-phase-mut (*(y@8), move (@65)) + @25 := &two-phase-mut (*(y@8), copy (y@8.metadata)) storage_live(@26) storage_live(@27) storage_live(@28) @@ -1045,9 +1014,7 @@ fn main() @47 := &@48 @46 := &*(@47) @45 := to_dyn_obj<'_, i32>[Sized, {impl NoParam for i32}](move (@46)) - storage_live(@67) - @67 := ptr_metadata(copy (@45)) - @44 := &(*(@45), move (@67)) + @44 := &(*(@45), copy (@45.metadata)) z@43 := unsize_cast<&'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)), &'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)), NoParam<(dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)>>(move (@44)) storage_dead(@46) storage_dead(@44) @@ -1056,9 +1023,7 @@ fn main() storage_dead(@45) storage_live(@49) storage_live(@50) - storage_live(@66) - @66 := ptr_metadata(copy (z@43)) - @50 := &(*(z@43), move (@66)) + @50 := &(*(z@43), copy (z@43.metadata)) @49 := NoParam<(dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)>::dummy<'_>(move (@50)) storage_dead(@50) storage_dead(@49) @@ -1074,9 +1039,7 @@ fn main() storage_dead(@53) storage_live(@55) storage_live(@56) - storage_live(@68) - @68 := ptr_metadata(copy (a@51)) - @56 := &(*(a@51), move (@68)) + @56 := &(*(a@51), copy (a@51.metadata)) storage_live(@57) storage_live(@58) storage_live(@59) From fdc1a5212672ebc3904e4887d869a023e10d7a58 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Wed, 1 Oct 2025 11:55:23 +0200 Subject: [PATCH 09/10] Bump version number --- charon-ml/src/CharonVersion.ml | 2 +- charon/Cargo.lock | 2 +- charon/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/charon-ml/src/CharonVersion.ml b/charon-ml/src/CharonVersion.ml index 216d31027..0b0933eb9 100644 --- a/charon-ml/src/CharonVersion.ml +++ b/charon-ml/src/CharonVersion.ml @@ -1,3 +1,3 @@ (* This is an automatically generated file, generated from `charon/Cargo.toml`. *) (* To re-generate this file, rune `make` in the root directory *) -let supported_charon_version = "0.1.129" +let supported_charon_version = "0.1.130" diff --git a/charon/Cargo.lock b/charon/Cargo.lock index 820f23bd0..a74ffa327 100644 --- a/charon/Cargo.lock +++ b/charon/Cargo.lock @@ -201,7 +201,7 @@ checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" [[package]] name = "charon" -version = "0.1.129" +version = "0.1.130" dependencies = [ "annotate-snippets", "anstream", diff --git a/charon/Cargo.toml b/charon/Cargo.toml index 4702321ed..05e847c06 100644 --- a/charon/Cargo.toml +++ b/charon/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "charon" -version = "0.1.129" +version = "0.1.130" authors = [ "Son Ho ", "Guillaume Boisseau ", From 7eca09ff75008117b24a9abc3541594438252fa3 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Wed, 1 Oct 2025 12:22:00 +0200 Subject: [PATCH 10/10] Improve printing of references with metadata --- charon/src/pretty/fmt_with_ctx.rs | 20 +++-- charon/tests/ui/arrays.out | 84 +++++++++---------- charon/tests/ui/comments.out | 4 +- charon/tests/ui/copy_nonoverlapping.out | 4 +- charon/tests/ui/cross_compile_32_bit.out | 2 +- charon/tests/ui/dyn-trait.out | 2 +- .../tests/ui/dyn-with-diamond-supertraits.out | 2 +- charon/tests/ui/impl-trait.out | 2 +- charon/tests/ui/issue-297-cfg.out | 16 ++-- charon/tests/ui/issue-320-slice-pattern.out | 12 +-- .../tests/ui/issue-4-slice-try-into-array.out | 2 +- charon/tests/ui/issue-4-traits.out | 2 +- charon/tests/ui/issue-45-misc.out | 4 +- .../issue-70-override-provided-method.2.out | 8 +- charon/tests/ui/ml-name-matcher-tests.out | 4 +- charon/tests/ui/projection-index-from-end.out | 2 +- charon/tests/ui/raw-boxes.out | 6 +- charon/tests/ui/remove-dynamic-checks.out | 8 +- charon/tests/ui/rvalues.out | 10 +-- charon/tests/ui/simple/const-subslice.out | 2 +- charon/tests/ui/simple/dyn-fn.out | 2 +- .../tests/ui/simple/generic-cast-to-dyn.out | 2 +- charon/tests/ui/simple/pointee_metadata.out | 4 +- charon/tests/ui/simple/ptr-from-raw-parts.out | 2 +- charon/tests/ui/simple/ptr_to_promoted.out | 2 +- charon/tests/ui/simple/slice_increment.out | 4 +- charon/tests/ui/simple/slice_index.out | 2 +- charon/tests/ui/simple/slice_index_range.out | 30 +++---- charon/tests/ui/slice-index-range.out | 20 ++--- charon/tests/ui/statics.out | 16 ++-- charon/tests/ui/string-literal.out | 2 +- charon/tests/ui/unsafe.out | 2 +- .../ui/unsupported/issue-79-bound-regions.out | 2 +- charon/tests/ui/vtables.out | 22 ++--- 34 files changed, 157 insertions(+), 151 deletions(-) diff --git a/charon/src/pretty/fmt_with_ctx.rs b/charon/src/pretty/fmt_with_ctx.rs index 9fdd29777..fb04771e2 100644 --- a/charon/src/pretty/fmt_with_ctx.rs +++ b/charon/src/pretty/fmt_with_ctx.rs @@ -1220,7 +1220,7 @@ impl FmtWithCtx for Rvalue { } else { write!( f, - "{borrow_kind}({}, {})", + "{borrow_kind}{} with_metadata({})", place.with_ctx(ctx), ptr_metadata.with_ctx(ctx) )?; @@ -1236,12 +1236,18 @@ impl FmtWithCtx for Rvalue { RefKind::Shared => "&raw const ", RefKind::Mut => "&raw mut ", }; - write!( - f, - "{ptr_kind}({}, {})", - place.with_ctx(ctx), - ptr_metadata.with_ctx(ctx) - ) + if ptr_metadata.ty().is_unit() { + // Hide unit metadata + write!(f, "{ptr_kind}{}", place.with_ctx(ctx))?; + } else { + write!( + f, + "{ptr_kind}{} with_metadata({})", + place.with_ctx(ctx), + ptr_metadata.with_ctx(ctx) + )?; + } + Ok(()) } Rvalue::BinaryOp(binop, x, y) => { diff --git a/charon/tests/ui/arrays.out b/charon/tests/ui/arrays.out index 245971234..b50c1cd29 100644 --- a/charon/tests/ui/arrays.out +++ b/charon/tests/ui/arrays.out @@ -330,7 +330,7 @@ where @3 := &mut *(s@1) @2 := @ArrayToSliceMut<'_, T, 32 : usize>(move (@3)) storage_dead(@3) - @0 := &mut (*(@2), copy (@2.metadata)) + @0 := &mut *(@2) with_metadata(copy (@2.metadata)) storage_dead(@2) return } @@ -386,7 +386,7 @@ where let @2: &'_ (Slice); // anonymous local storage_live(@2) - @2 := &(*(s@1), copy (s@1.metadata)) + @2 := &*(s@1) with_metadata(copy (s@1.metadata)) @0 := len<'_, T>[@TraitClause0](move (@2)) storage_dead(@2) return @@ -508,7 +508,7 @@ where storage_live(@4) @4 := copy (i@2) storage_live(@5) - @5 := &(*(s@1), copy (s@1.metadata)) + @5 := &*(s@1) with_metadata(copy (s@1.metadata)) storage_live(@6) @6 := @SliceIndexShared<'_, T>(move (@5), copy (@4)) @3 := &*(@6) @@ -537,7 +537,7 @@ where storage_live(@5) @5 := copy (i@2) storage_live(@6) - @6 := &mut (*(s@1), copy (s@1.metadata)) + @6 := &mut *(s@1) with_metadata(copy (s@1.metadata)) storage_live(@7) @7 := @SliceIndexMut<'_, T>(move (@6), copy (@5)) @4 := &mut *(@7) @@ -566,7 +566,7 @@ pub fn slice_subslice_shared_<'_0>(@1: &'_0 (Slice), @2: usize, @3: usize) storage_live(@4) storage_live(@5) storage_live(@6) - @6 := &(*(x@1), copy (x@1.metadata)) + @6 := &*(x@1) with_metadata(copy (x@1.metadata)) storage_live(@7) storage_live(@8) @8 := copy (y@2) @@ -578,8 +578,8 @@ pub fn slice_subslice_shared_<'_0>(@1: &'_0 (Slice), @2: usize, @3: usize) @5 := {impl Index for Slice}::index<'_, u32, Range[Sized], Slice>[Sized, Sized[Sized]>, {impl SliceIndex, Slice> for Range[Sized]}[Sized]](move (@6), move (@7)) storage_dead(@7) storage_dead(@6) - @4 := &(*(@5), copy (@5.metadata)) - @0 := &(*(@4), copy (@4.metadata)) + @4 := &*(@5) with_metadata(copy (@5.metadata)) + @0 := &*(@4) with_metadata(copy (@4.metadata)) storage_dead(@5) storage_dead(@4) return @@ -604,7 +604,7 @@ pub fn slice_subslice_mut_<'_0>(@1: &'_0 mut (Slice), @2: usize, @3: usize) storage_live(@5) storage_live(@6) storage_live(@7) - @7 := &mut (*(x@1), copy (x@1.metadata)) + @7 := &mut *(x@1) with_metadata(copy (x@1.metadata)) storage_live(@8) storage_live(@9) @9 := copy (y@2) @@ -616,9 +616,9 @@ pub fn slice_subslice_mut_<'_0>(@1: &'_0 mut (Slice), @2: usize, @3: usize) @6 := {impl IndexMut for Slice}::index_mut<'_, u32, Range[Sized], Slice>[Sized, Sized[Sized]>, {impl SliceIndex, Slice> for Range[Sized]}[Sized]](move (@7), move (@8)) storage_dead(@8) storage_dead(@7) - @5 := &mut (*(@6), copy (@6.metadata)) - @4 := &mut (*(@5), copy (@5.metadata)) - @0 := &mut (*(@4), copy (@4.metadata)) + @5 := &mut *(@6) with_metadata(copy (@6.metadata)) + @4 := &mut *(@5) with_metadata(copy (@5.metadata)) + @0 := &mut *(@4) with_metadata(copy (@4.metadata)) storage_dead(@6) storage_dead(@5) storage_dead(@4) @@ -652,7 +652,7 @@ pub fn array_to_slice_mut_<'_0>(@1: &'_0 mut (Array)) -> &'_0 m @3 := &mut *(x@1) @2 := @ArrayToSliceMut<'_, u32, 32 : usize>(move (@3)) storage_dead(@3) - @0 := &mut (*(@2), copy (@2.metadata)) + @0 := &mut *(@2) with_metadata(copy (@2.metadata)) storage_dead(@2) return } @@ -686,8 +686,8 @@ pub fn array_subslice_shared_<'_0>(@1: &'_0 (Array), @2: usize, @5 := {impl Index for Array}::index<'_, u32, Range[Sized], Slice, 32 : usize>[Sized, Sized[Sized]>, {impl Index for Slice}[Sized], Slice>[Sized, Sized[Sized]>, {impl SliceIndex, Slice> for Range[Sized]}[Sized]]](move (@6), move (@7)) storage_dead(@7) storage_dead(@6) - @4 := &(*(@5), copy (@5.metadata)) - @0 := &(*(@4), copy (@4.metadata)) + @4 := &*(@5) with_metadata(copy (@5.metadata)) + @0 := &*(@4) with_metadata(copy (@4.metadata)) storage_dead(@5) storage_dead(@4) return @@ -724,9 +724,9 @@ pub fn array_subslice_mut_<'_0>(@1: &'_0 mut (Array), @2: usize @6 := {impl IndexMut for Array}::index_mut<'_, u32, Range[Sized], Slice, 32 : usize>[Sized, Sized[Sized]>, {impl IndexMut for Slice}[Sized], Slice>[Sized, Sized[Sized]>, {impl SliceIndex, Slice> for Range[Sized]}[Sized]]](move (@7), move (@8)) storage_dead(@8) storage_dead(@7) - @5 := &mut (*(@6), copy (@6.metadata)) - @4 := &mut (*(@5), copy (@5.metadata)) - @0 := &mut (*(@4), copy (@4.metadata)) + @5 := &mut *(@6) with_metadata(copy (@6.metadata)) + @4 := &mut *(@5) with_metadata(copy (@5.metadata)) + @0 := &mut *(@4) with_metadata(copy (@4.metadata)) storage_dead(@6) storage_dead(@5) storage_dead(@4) @@ -749,7 +749,7 @@ where storage_live(@3) @3 := const (0 : usize) storage_live(@4) - @4 := &(*(s@1), copy (s@1.metadata)) + @4 := &*(s@1) with_metadata(copy (s@1.metadata)) storage_live(@5) @5 := @SliceIndexShared<'_, T>(move (@4), copy (@3)) @2 := &*(@5) @@ -898,12 +898,12 @@ pub fn incr_slice_self<'_0>(@1: &'_0 mut (Slice)) storage_live(@2) @2 := const (0 : usize) storage_live(@6) - @6 := &(*(s@1), copy (s@1.metadata)) + @6 := &*(s@1) with_metadata(copy (s@1.metadata)) storage_live(@7) @7 := @SliceIndexShared<'_, u32>(move (@6), copy (@2)) @3 := copy (*(@7)) panic.+ const (1 : u32) storage_live(@4) - @4 := &mut (*(s@1), copy (s@1.metadata)) + @4 := &mut *(s@1) with_metadata(copy (s@1.metadata)) storage_live(@5) @5 := @SliceIndexMut<'_, u32>(move (@4), copy (@2)) *(@5) := move (@3) @@ -1138,7 +1138,7 @@ pub fn index_slice_u32_0<'_0>(@1: &'_0 (Slice)) -> u32 storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &(*(x@1), copy (x@1.metadata)) + @3 := &*(x@1) with_metadata(copy (x@1.metadata)) storage_live(@4) @4 := @SliceIndexShared<'_, u32>(move (@3), copy (@2)) @0 := copy (*(@4)) @@ -1158,7 +1158,7 @@ pub fn index_mut_slice_u32_0<'_0>(@1: &'_0 mut (Slice)) -> u32 storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &(*(x@1), copy (x@1.metadata)) + @3 := &*(x@1) with_metadata(copy (x@1.metadata)) storage_live(@4) @4 := @SliceIndexShared<'_, u32>(move (@3), copy (@2)) @0 := copy (*(@4)) @@ -1340,7 +1340,7 @@ pub fn update_mut_slice<'_0>(@1: &'_0 mut (Slice)) storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &mut (*(x@1), copy (x@1.metadata)) + @3 := &mut *(x@1) with_metadata(copy (x@1.metadata)) storage_live(@4) @4 := @SliceIndexMut<'_, u32>(move (@3), copy (@2)) *(@4) := const (1 : u32) @@ -1434,8 +1434,8 @@ pub fn range_all() @5 := {impl IndexMut for Array}::index_mut<'_, u32, Range[Sized], Slice, 4 : usize>[Sized, Sized[Sized]>, {impl IndexMut for Slice}[Sized], Slice>[Sized, Sized[Sized]>, {impl SliceIndex, Slice> for Range[Sized]}[Sized]]](move (@6), move (@7)) storage_dead(@7) storage_dead(@6) - @4 := &mut (*(@5), copy (@5.metadata)) - @3 := &two-phase-mut (*(@4), copy (@4.metadata)) + @4 := &mut *(@5) with_metadata(copy (@5.metadata)) + @3 := &two-phase-mut *(@4) with_metadata(copy (@4.metadata)) @2 := update_mut_slice<'_>(move (@3)) storage_dead(@3) storage_dead(@5) @@ -1578,7 +1578,7 @@ pub fn sum<'_0>(@1: &'_0 (Slice)) -> u32 @6 := copy (i@3) storage_live(@7) storage_live(@8) - @8 := &(*(s@1), copy (s@1.metadata)) + @8 := &*(s@1) with_metadata(copy (s@1.metadata)) @7 := len<'_, u32>[Sized](move (@8)) storage_dead(@8) @5 := move (@6) < move (@7) @@ -1593,7 +1593,7 @@ pub fn sum<'_0>(@1: &'_0 (Slice)) -> u32 storage_live(@10) @10 := copy (i@3) storage_live(@14) - @14 := &(*(s@1), copy (s@1.metadata)) + @14 := &*(s@1) with_metadata(copy (s@1.metadata)) storage_live(@15) @15 := @SliceIndexShared<'_, u32>(move (@14), copy (@10)) @9 := copy (*(@15)) @@ -1670,12 +1670,12 @@ pub fn sum2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) -> u32 storage_live(@5) storage_live(@6) storage_live(@7) - @7 := &(*(s@1), copy (s@1.metadata)) + @7 := &*(s@1) with_metadata(copy (s@1.metadata)) @6 := len<'_, u32>[Sized](move (@7)) storage_dead(@7) storage_live(@8) storage_live(@9) - @9 := &(*(s2@2), copy (s2@2.metadata)) + @9 := &*(s2@2) with_metadata(copy (s2@2.metadata)) @8 := len<'_, u32>[Sized](move (@9)) storage_dead(@9) @5 := move (@6) == move (@8) @@ -1699,7 +1699,7 @@ pub fn sum2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) -> u32 @13 := copy (i@10) storage_live(@14) storage_live(@15) - @15 := &(*(s@1), copy (s@1.metadata)) + @15 := &*(s@1) with_metadata(copy (s@1.metadata)) @14 := len<'_, u32>[Sized](move (@15)) storage_dead(@15) @12 := move (@13) < move (@14) @@ -1715,7 +1715,7 @@ pub fn sum2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) -> u32 storage_live(@18) @18 := copy (i@10) storage_live(@27) - @27 := &(*(s@1), copy (s@1.metadata)) + @27 := &*(s@1) with_metadata(copy (s@1.metadata)) storage_live(@28) @28 := @SliceIndexShared<'_, u32>(move (@27), copy (@18)) @17 := copy (*(@28)) @@ -1723,7 +1723,7 @@ pub fn sum2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) -> u32 storage_live(@20) @20 := copy (i@10) storage_live(@25) - @25 := &(*(s2@2), copy (s2@2.metadata)) + @25 := &*(s2@2) with_metadata(copy (s2@2.metadata)) storage_live(@26) @26 := @SliceIndexShared<'_, u32>(move (@25), copy (@20)) @19 := copy (*(@26)) @@ -1778,7 +1778,7 @@ pub fn f0() storage_live(@5) @5 := const (0 : usize) storage_live(@6) - @6 := &mut (*(s@1), copy (s@1.metadata)) + @6 := &mut *(s@1) with_metadata(copy (s@1.metadata)) storage_live(@7) @7 := @SliceIndexMut<'_, u32>(move (@6), copy (@5)) *(@7) := const (1 : u32) @@ -1855,8 +1855,8 @@ pub fn f4<'_0>(@1: &'_0 (Array), @2: usize, @3: usize) -> &'_0 @5 := {impl Index for Array}::index<'_, u32, Range[Sized], Slice, 32 : usize>[Sized, Sized[Sized]>, {impl Index for Slice}[Sized], Slice>[Sized, Sized[Sized]>, {impl SliceIndex, Slice> for Range[Sized]}[Sized]]](move (@6), move (@7)) storage_dead(@7) storage_dead(@6) - @4 := &(*(@5), copy (@5.metadata)) - @0 := &(*(@4), copy (@4.metadata)) + @4 := &*(@5) with_metadata(copy (@5.metadata)) + @0 := &*(@4) with_metadata(copy (@4.metadata)) storage_dead(@5) storage_dead(@4) return @@ -1912,7 +1912,7 @@ pub fn f3() -> u32 @12 := &b@5 @11 := &*(@12) @10 := f4<'_>(move (@11), const (16 : usize), const (18 : usize)) - @9 := &(*(@10), copy (@10.metadata)) + @9 := &*(@10) with_metadata(copy (@10.metadata)) storage_dead(@11) @0 := sum2<'_, '_>(move (@6), move (@9)) storage_dead(@9) @@ -2050,7 +2050,7 @@ pub fn zero_slice<'_0>(@1: &'_0 mut (Slice)) i@2 := const (0 : usize) storage_live(len@3) storage_live(@4) - @4 := &(*(a@1), copy (a@1.metadata)) + @4 := &*(a@1) with_metadata(copy (a@1.metadata)) len@3 := len<'_, u8>[Sized](move (@4)) storage_dead(@4) loop { @@ -2066,7 +2066,7 @@ pub fn zero_slice<'_0>(@1: &'_0 mut (Slice)) storage_live(@8) @8 := copy (i@2) storage_live(@11) - @11 := &mut (*(a@1), copy (a@1.metadata)) + @11 := &mut *(a@1) with_metadata(copy (a@1.metadata)) storage_live(@12) @12 := @SliceIndexMut<'_, u8>(move (@11), copy (@8)) *(@12) := const (0 : u8) @@ -2109,7 +2109,7 @@ pub fn iter_mut_slice<'_0>(@1: &'_0 mut (Slice)) storage_live(@8) storage_live(len@2) storage_live(@3) - @3 := &(*(a@1), copy (a@1.metadata)) + @3 := &*(a@1) with_metadata(copy (a@1.metadata)) len@2 := len<'_, u8>[Sized](move (@3)) storage_dead(@3) storage_live(i@4) @@ -2183,7 +2183,7 @@ pub fn sum_mut_slice<'_0>(@1: &'_0 mut (Slice)) -> u32 @6 := copy (i@2) storage_live(@7) storage_live(@8) - @8 := &(*(a@1), copy (a@1.metadata)) + @8 := &*(a@1) with_metadata(copy (a@1.metadata)) @7 := len<'_, u32>[Sized](move (@8)) storage_dead(@8) @5 := move (@6) < move (@7) @@ -2198,7 +2198,7 @@ pub fn sum_mut_slice<'_0>(@1: &'_0 mut (Slice)) -> u32 storage_live(@10) @10 := copy (i@2) storage_live(@14) - @14 := &(*(a@1), copy (a@1.metadata)) + @14 := &*(a@1) with_metadata(copy (a@1.metadata)) storage_live(@15) @15 := @SliceIndexShared<'_, u32>(move (@14), copy (@10)) @9 := copy (*(@15)) @@ -2335,7 +2335,7 @@ fn slice_pattern_4<'_0>(@1: &'_0 (Slice<()>)) } storage_live(_named@5) storage_live(@6) - @6 := &(*(x@1), copy (x@1.metadata)) + @6 := &*(x@1) with_metadata(copy (x@1.metadata)) storage_live(@7) @7 := @SliceIndexShared<'_, ()>(move (@6), const (0 : usize)) _named@5 := &*(@7) diff --git a/charon/tests/ui/comments.out b/charon/tests/ui/comments.out index f8b7f13c9..a7e52a6b8 100644 --- a/charon/tests/ui/comments.out +++ b/charon/tests/ui/comments.out @@ -171,7 +171,7 @@ pub fn sum<'_0>(@1: &'_0 (Slice)) -> u32 @10 := copy (i@3) storage_live(@11) storage_live(@12) - @12 := &(*(s@1), copy (s@1.metadata)) + @12 := &*(s@1) with_metadata(copy (s@1.metadata)) @11 := len<'_, u32>[Sized](move (@12)) storage_dead(@12) @9 := move (@10) < move (@11) @@ -187,7 +187,7 @@ pub fn sum<'_0>(@1: &'_0 (Slice)) -> u32 // Add to running sum @14 := copy (i@3) storage_live(@27) - @27 := &(*(s@1), copy (s@1.metadata)) + @27 := &*(s@1) with_metadata(copy (s@1.metadata)) storage_live(@28) @28 := @SliceIndexShared<'_, u32>(move (@27), copy (@14)) @13 := copy (*(@28)) diff --git a/charon/tests/ui/copy_nonoverlapping.out b/charon/tests/ui/copy_nonoverlapping.out index 0c6360b64..28bbf2182 100644 --- a/charon/tests/ui/copy_nonoverlapping.out +++ b/charon/tests/ui/copy_nonoverlapping.out @@ -85,9 +85,9 @@ where storage_live(@3) storage_live(@4) - @4 := &raw const (*(y@2), copy (@Global0)) + @4 := &raw const *(y@2) storage_live(@5) - @5 := &raw mut (*(x@1), copy (@Global0)) + @5 := &raw mut *(x@1) @3 := copy_nonoverlapping[@TraitClause0](move (@4), move (@5), const (1 : usize)) storage_dead(@5) storage_dead(@4) diff --git a/charon/tests/ui/cross_compile_32_bit.out b/charon/tests/ui/cross_compile_32_bit.out index 8e3b85e55..bab3307bf 100644 --- a/charon/tests/ui/cross_compile_32_bit.out +++ b/charon/tests/ui/cross_compile_32_bit.out @@ -60,7 +60,7 @@ fn main() storage_live(a@7) storage_live(@8) storage_live(@9) - @9 := &raw mut (x@1, copy (@Global0)) + @9 := &raw mut x@1 @8 := new_unchecked(move (@9)) storage_dead(@9) a@7 := HasPointerNiche::Second { 0: move (@8) } diff --git a/charon/tests/ui/dyn-trait.out b/charon/tests/ui/dyn-trait.out index 9826aaeb2..8495ae7ca 100644 --- a/charon/tests/ui/dyn-trait.out +++ b/charon/tests/ui/dyn-trait.out @@ -211,7 +211,7 @@ fn destruct<'_0>(@1: &'_0 ((dyn exists<_dyn> [@TraitClause0]: Display<_dyn> + _d let @2: &'_ ((dyn exists<_dyn> [@TraitClause0]: Display<_dyn> + _dyn : '_)); // anonymous local storage_live(@2) - @2 := &(*(x@1), copy (x@1.metadata)) + @2 := &*(x@1) with_metadata(copy (x@1.metadata)) @0 := {impl ToString for T}::to_string<'_, (dyn exists<_dyn> [@TraitClause0]: Display<_dyn> + _dyn : '_)>[MetaSized<(dyn exists<_dyn> [@TraitClause0]: Display<_dyn> + _dyn : '_)>, Display<(dyn exists<_dyn> [@TraitClause0]: Display<_dyn> + _dyn : '_)>](move (@2)) storage_dead(@2) return diff --git a/charon/tests/ui/dyn-with-diamond-supertraits.out b/charon/tests/ui/dyn-with-diamond-supertraits.out index 9c5c8c815..fc673780b 100644 --- a/charon/tests/ui/dyn-with-diamond-supertraits.out +++ b/charon/tests/ui/dyn-with-diamond-supertraits.out @@ -358,7 +358,7 @@ fn main() storage_dead(@3) storage_live(@5) storage_live(@6) - @6 := &(*(v@1), copy (v@1.metadata)) + @6 := &*(v@1) with_metadata(copy (v@1.metadata)) @5 := Join<(dyn exists<_dyn> [@TraitClause0]: Join<_dyn, i32> + _dyn : '_ + @TraitClause1_0::parent_clause1::parent_clause1::Internal = i32 + @TraitClause1_0::parent_clause2::Right = i32 + @TraitClause1_0::parent_clause1::Left = i32), i32>::join_method<'_>(move (@6)) storage_dead(@6) storage_dead(@5) diff --git a/charon/tests/ui/impl-trait.out b/charon/tests/ui/impl-trait.out index 7aafecb4e..0c500ba94 100644 --- a/charon/tests/ui/impl-trait.out +++ b/charon/tests/ui/impl-trait.out @@ -252,7 +252,7 @@ where storage_live(@5) @5 := &foo@1 @4 := @TraitClause1::parent_clause2::get_ty<'_>(move (@5)) - @3 := &(*(@4), copy (@4.metadata)) + @3 := &*(@4) with_metadata(copy (@4.metadata)) storage_dead(@5) @2 := @TraitClause1::parent_clause2::parent_clause2::clone<'_>(move (@3)) storage_dead(@3) diff --git a/charon/tests/ui/issue-297-cfg.out b/charon/tests/ui/issue-297-cfg.out index 675173189..377f111b2 100644 --- a/charon/tests/ui/issue-297-cfg.out +++ b/charon/tests/ui/issue-297-cfg.out @@ -469,7 +469,7 @@ fn f1<'_0>(@1: &'_0 (Slice)) -> usize storage_live(@6) @6 := const (0 : usize) storage_live(@14) - @14 := &(*(a@1), copy (a@1.metadata)) + @14 := &*(a@1) with_metadata(copy (a@1.metadata)) storage_live(@15) @15 := @SliceIndexShared<'_, u8>(move (@14), copy (@6)) @5 := copy (*(@15)) @@ -482,7 +482,7 @@ fn f1<'_0>(@1: &'_0 (Slice)) -> usize storage_live(@9) @9 := const (1 : usize) storage_live(@12) - @12 := &(*(a@1), copy (a@1.metadata)) + @12 := &*(a@1) with_metadata(copy (a@1.metadata)) storage_live(@13) @13 := @SliceIndexShared<'_, u8>(move (@12), copy (@9)) @8 := copy (*(@13)) @@ -638,7 +638,7 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@5) storage_live(@6) storage_live(@7) - @7 := &(*(a@1), copy (a@1.metadata)) + @7 := &*(a@1) with_metadata(copy (a@1.metadata)) @6 := chunks<'_, u8>[Sized](move (@7), const (3 : usize)) storage_dead(@7) @5 := {impl IntoIterator for I}::into_iter[Sized]>[Sized[Sized]>, {impl Iterator for Chunks<'a, T>[@TraitClause0]}<'_, u8>[Sized]](move (@6)) @@ -666,7 +666,7 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@16) @16 := const (0 : usize) storage_live(@56) - @56 := &(*(bytes@13), copy (bytes@13.metadata)) + @56 := &*(bytes@13) with_metadata(copy (bytes@13.metadata)) storage_live(@57) @57 := @SliceIndexShared<'_, u8>(move (@56), copy (@16)) @15 := copy (*(@57)) @@ -678,7 +678,7 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@19) @19 := const (1 : usize) storage_live(@54) - @54 := &(*(bytes@13), copy (bytes@13.metadata)) + @54 := &*(bytes@13) with_metadata(copy (bytes@13.metadata)) storage_live(@55) @55 := @SliceIndexShared<'_, u8>(move (@54), copy (@19)) @18 := copy (*(@55)) @@ -690,7 +690,7 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@22) @22 := const (2 : usize) storage_live(@52) - @52 := &(*(bytes@13), copy (bytes@13.metadata)) + @52 := &*(bytes@13) with_metadata(copy (bytes@13.metadata)) storage_live(@53) @53 := @SliceIndexShared<'_, u8>(move (@52), copy (@22)) @21 := copy (*(@53)) @@ -743,7 +743,7 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@39) @39 := copy (sampled@3) storage_live(@48) - @48 := &mut (*(result@2), copy (result@2.metadata)) + @48 := &mut *(result@2) with_metadata(copy (result@2.metadata)) storage_live(@49) @49 := @SliceIndexMut<'_, i16>(move (@48), copy (@39)) *(@49) := move (@38) @@ -779,7 +779,7 @@ fn f2<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 mut (Slice)) -> usize storage_live(@46) @46 := copy (sampled@3) storage_live(@50) - @50 := &mut (*(result@2), copy (result@2.metadata)) + @50 := &mut *(result@2) with_metadata(copy (result@2.metadata)) storage_live(@51) @51 := @SliceIndexMut<'_, i16>(move (@50), copy (@46)) *(@51) := move (@45) diff --git a/charon/tests/ui/issue-320-slice-pattern.out b/charon/tests/ui/issue-320-slice-pattern.out index 72f847bcf..db0b826ca 100644 --- a/charon/tests/ui/issue-320-slice-pattern.out +++ b/charon/tests/ui/issue-320-slice-pattern.out @@ -162,7 +162,7 @@ fn slice_pat3() panic(core::panicking::panic_explicit) } storage_live(@22) - @22 := &(*(slice@1), copy (slice@1.metadata)) + @22 := &*(slice@1) with_metadata(copy (slice@1.metadata)) storage_live(@23) @23 := @SliceIndexShared<'_, i32>(move (@22), const (0 : usize)) _a@5 := &*(@23) @@ -174,7 +174,7 @@ fn slice_pat3() storage_live(@13) @13 := copy (@12) ub.- const (1 : usize) storage_live(@18) - @18 := &(*(slice@1), copy (slice@1.metadata)) + @18 := &*(slice@1) with_metadata(copy (slice@1.metadata)) storage_live(@19) @19 := len(*(slice@1)) storage_live(@20) @@ -182,9 +182,9 @@ fn slice_pat3() storage_dead(@19) storage_live(@21) @21 := @SliceSubSliceShared<'_, i32>(move (@18), const (1 : usize), copy (@20)) - _b@6 := &(*(@21), copy (@13)) + _b@6 := &*(@21) with_metadata(copy (@13)) storage_live(@14) - @14 := &(*(slice@1), copy (slice@1.metadata)) + @14 := &*(slice@1) with_metadata(copy (slice@1.metadata)) storage_live(@15) @15 := len(*(slice@1)) storage_live(@16) @@ -230,7 +230,7 @@ fn slice_pat4<'_0>(@1: &'_0 (Slice)) } storage_live(_y@5) storage_live(@6) - @6 := &(*(x@1), copy (x@1.metadata)) + @6 := &*(x@1) with_metadata(copy (x@1.metadata)) storage_live(@7) @7 := @SliceIndexShared<'_, u32>(move (@6), const (0 : usize)) _y@5 := &*(@7) @@ -272,7 +272,7 @@ fn slice_pat5<'_0>(@1: &'_0 (Unsized)) } storage_live(_y@5) storage_live(@6) - @6 := &((*(x@1)).0, copy (x@1.metadata)) + @6 := &(*(x@1)).0 with_metadata(copy (x@1.metadata)) storage_live(@7) @7 := @SliceIndexShared<'_, u32>(move (@6), const (0 : usize)) _y@5 := copy (*(@7)) diff --git a/charon/tests/ui/issue-4-slice-try-into-array.out b/charon/tests/ui/issue-4-slice-try-into-array.out index de432a9b7..a14835336 100644 --- a/charon/tests/ui/issue-4-slice-try-into-array.out +++ b/charon/tests/ui/issue-4-slice-try-into-array.out @@ -202,7 +202,7 @@ pub fn trait_error<'_0>(@1: &'_0 (Slice)) storage_live(_array@2) storage_live(@3) storage_live(@4) - @4 := &(*(s@1), copy (s@1.metadata)) + @4 := &*(s@1) with_metadata(copy (s@1.metadata)) @3 := {impl TryInto for T}::try_into<&'_ (Slice), Array>[Sized<&'_ (Slice)>, Sized>, {impl TryFrom<&'_0 (Slice)> for Array}<'_, u8, 4 : usize>[Sized, {impl Copy for u8}]](move (@4)) storage_dead(@4) _array@2 := unwrap, TryFromSliceError>[Sized>, Sized, {impl Debug for TryFromSliceError}](move (@3)) diff --git a/charon/tests/ui/issue-4-traits.out b/charon/tests/ui/issue-4-traits.out index b3f0bea09..b2cab8c0a 100644 --- a/charon/tests/ui/issue-4-traits.out +++ b/charon/tests/ui/issue-4-traits.out @@ -202,7 +202,7 @@ fn trait_error<'_0>(@1: &'_0 (Slice)) storage_live(_array@2) storage_live(@3) storage_live(@4) - @4 := &(*(s@1), copy (s@1.metadata)) + @4 := &*(s@1) with_metadata(copy (s@1.metadata)) @3 := {impl TryInto for T}::try_into<&'_ (Slice), Array>[Sized<&'_ (Slice)>, Sized>, {impl TryFrom<&'_0 (Slice)> for Array}<'_, u8, 4 : usize>[Sized, {impl Copy for u8}]](move (@4)) storage_dead(@4) _array@2 := unwrap, TryFromSliceError>[Sized>, Sized, {impl Debug for TryFromSliceError}](move (@3)) diff --git a/charon/tests/ui/issue-45-misc.out b/charon/tests/ui/issue-45-misc.out index eae6296d7..372b2b5a9 100644 --- a/charon/tests/ui/issue-45-misc.out +++ b/charon/tests/ui/issue-45-misc.out @@ -759,14 +759,14 @@ fn select<'_0, '_1>(@1: &'_0 (Slice), @2: &'_1 (Slice)) storage_live(@7) storage_live(@8) storage_live(@9) - @9 := &(*(lhs@1), copy (lhs@1.metadata)) + @9 := &*(lhs@1) with_metadata(copy (lhs@1.metadata)) @8 := core::slice::{Slice}::len<'_, u8>[Sized](move (@9)) storage_dead(@9) @7 := &@8 storage_live(@10) storage_live(@11) storage_live(@12) - @12 := &(*(rhs@2), copy (rhs@2.metadata)) + @12 := &*(rhs@2) with_metadata(copy (rhs@2.metadata)) @11 := core::slice::{Slice}::len<'_, u8>[Sized](move (@12)) storage_dead(@12) @10 := &@11 diff --git a/charon/tests/ui/issue-70-override-provided-method.2.out b/charon/tests/ui/issue-70-override-provided-method.2.out index 4949730ca..e282d980e 100644 --- a/charon/tests/ui/issue-70-override-provided-method.2.out +++ b/charon/tests/ui/issue-70-override-provided-method.2.out @@ -41,13 +41,13 @@ where storage_live(@2) storage_live(@3) - @3 := &(*(self@1), copy (self@1.metadata)) + @3 := &*(self@1) with_metadata(copy (self@1.metadata)) @2 := @TraitClause0::required<'_>(move (@3)) storage_dead(@3) storage_dead(@2) storage_live(@4) storage_live(@5) - @5 := &(*(self@1), copy (self@1.metadata)) + @5 := &*(self@1) with_metadata(copy (self@1.metadata)) @4 := @TraitClause0::provided2<'_>(move (@5)) storage_dead(@5) storage_dead(@4) @@ -70,13 +70,13 @@ where storage_live(@2) storage_live(@3) - @3 := &(*(self@1), copy (self@1.metadata)) + @3 := &*(self@1) with_metadata(copy (self@1.metadata)) @2 := @TraitClause0::required<'_>(move (@3)) storage_dead(@3) storage_dead(@2) storage_live(@4) storage_live(@5) - @5 := &(*(self@1), copy (self@1.metadata)) + @5 := &*(self@1) with_metadata(copy (self@1.metadata)) @4 := @TraitClause0::provided1<'_>(move (@5)) storage_dead(@5) storage_dead(@4) diff --git a/charon/tests/ui/ml-name-matcher-tests.out b/charon/tests/ui/ml-name-matcher-tests.out index 75b85e61c..93285ad8f 100644 --- a/charon/tests/ui/ml-name-matcher-tests.out +++ b/charon/tests/ui/ml-name-matcher-tests.out @@ -304,13 +304,13 @@ fn foo() storage_live(@8) storage_live(@9) storage_live(@10) - @10 := &(*(slice@4), copy (slice@4.metadata)) + @10 := &*(slice@4) with_metadata(copy (slice@4.metadata)) storage_live(@11) @11 := RangeFrom { start: const (1 : usize) } @9 := {impl Index for Slice}::index<'_, bool, RangeFrom[Sized]>[Sized, Sized[Sized]>, {impl SliceIndex> for RangeFrom[Sized]}[Sized]](move (@10), move (@11)) storage_dead(@11) storage_dead(@10) - @8 := &(*(@9), copy (@9.metadata)) + @8 := &*(@9) with_metadata(copy (@9.metadata)) storage_dead(@8) @0 := () storage_dead(@9) diff --git a/charon/tests/ui/projection-index-from-end.out b/charon/tests/ui/projection-index-from-end.out index 354e6be7a..08f7a1773 100644 --- a/charon/tests/ui/projection-index-from-end.out +++ b/charon/tests/ui/projection-index-from-end.out @@ -39,7 +39,7 @@ fn slice_pattern_end<'_0>(@1: &'_0 (Slice<()>)) } storage_live(_named@5) storage_live(@6) - @6 := &(*(x@1), copy (x@1.metadata)) + @6 := &*(x@1) with_metadata(copy (x@1.metadata)) storage_live(@7) @7 := len(*(x@1)) storage_live(@8) diff --git a/charon/tests/ui/raw-boxes.out b/charon/tests/ui/raw-boxes.out index d4336345d..987d4e851 100644 --- a/charon/tests/ui/raw-boxes.out +++ b/charon/tests/ui/raw-boxes.out @@ -4222,7 +4222,7 @@ where @2 := ManuallyDrop { value: copy (b@1) } @3 := copy ((@2).value) @4 := transmute, *const T>(copy (((@3).0).pointer)) - @0 := &raw mut (*(@4), copy (@4.metadata)) + @0 := &raw mut *(@4) with_metadata(copy (@4.metadata)) storage_dead(@2) return } @@ -4246,10 +4246,10 @@ where storage_live(@3) @4 := copy (((b@1).0).pointer) @3 := transmute, *const T>(copy (@4)) - @2 := &raw mut (*(@3), copy (@3.metadata)) + @2 := &raw mut *(@3) with_metadata(copy (@3.metadata)) storage_dead(@3) storage_dead(@4) - @0 := &mut (*(@2), copy (@2.metadata)) + @0 := &mut *(@2) with_metadata(copy (@2.metadata)) return } diff --git a/charon/tests/ui/remove-dynamic-checks.out b/charon/tests/ui/remove-dynamic-checks.out index 70651945f..6b20a009f 100644 --- a/charon/tests/ui/remove-dynamic-checks.out +++ b/charon/tests/ui/remove-dynamic-checks.out @@ -834,7 +834,7 @@ fn div_unsigned_to_slice<'_0>(@1: &'_0 mut (Slice), @2: u32) storage_live(@4) @4 := const (0 : usize) storage_live(@5) - @5 := &mut (*(result@1), copy (result@1.metadata)) + @5 := &mut *(result@1) with_metadata(copy (result@1.metadata)) storage_live(@6) @6 := @SliceIndexMut<'_, u32>(move (@5), copy (@4)) *(@6) := move (@3) panic./ const (3329 : u32) @@ -861,7 +861,7 @@ fn div_signed_to_slice<'_0>(@1: &'_0 mut (Slice), @2: i32) storage_live(@4) @4 := const (0 : usize) storage_live(@5) - @5 := &mut (*(result@1), copy (result@1.metadata)) + @5 := &mut *(result@1) with_metadata(copy (result@1.metadata)) storage_live(@6) @6 := @SliceIndexMut<'_, i32>(move (@5), copy (@4)) *(@6) := move (@3) panic./ const (3329 : i32) @@ -891,7 +891,7 @@ fn add_to_slice<'_0>(@1: &'_0 mut (Slice), @2: u32) storage_live(@5) @5 := const (0 : usize) storage_live(@6) - @6 := &mut (*(result@1), copy (result@1.metadata)) + @6 := &mut *(result@1) with_metadata(copy (result@1.metadata)) storage_live(@7) @7 := @SliceIndexMut<'_, u32>(move (@6), copy (@5)) *(@7) := move (@4) @@ -929,7 +929,7 @@ fn add_to_slice2<'_0>(@1: &'_0 mut (Slice), @2: usize, @3: u8) @6 := move (@8) storage_dead(@7) storage_live(@9) - @9 := &mut (*(result@1), copy (result@1.metadata)) + @9 := &mut *(result@1) with_metadata(copy (result@1.metadata)) storage_live(@10) @10 := @SliceIndexMut<'_, u8>(move (@9), copy (@6)) *(@10) := move (@5) diff --git a/charon/tests/ui/rvalues.out b/charon/tests/ui/rvalues.out index fbf46ee50..84d498a3f 100644 --- a/charon/tests/ui/rvalues.out +++ b/charon/tests/ui/rvalues.out @@ -156,14 +156,14 @@ fn addr_of() storage_live(@2) storage_live(@3) @3 := &x@1 - @2 := &raw const (*(@3), copy (@Global0)) + @2 := &raw const *(@3) storage_dead(@3) storage_dead(@2) storage_live(@4) - @4 := &raw const (x@1, copy (@Global0)) + @4 := &raw const x@1 storage_dead(@4) storage_live(@5) - @5 := &raw mut (x@1, copy (@Global0)) + @5 := &raw mut x@1 storage_dead(@5) @0 := () storage_dead(x@1) @@ -237,7 +237,7 @@ fn ptr_casts() storage_live(@3) @3 := @ArrayRepeat<'_, u32, 64 : usize>(const (0 : u32)) @2 := &@3 - array_ptr@1 := &raw const (*(@2), copy (@Global0)) + array_ptr@1 := &raw const *(@2) storage_dead(@2) storage_live(@4) storage_live(@5) @@ -250,7 +250,7 @@ fn ptr_casts() storage_live(x@7) storage_live(@8) @8 := &x@6 - x@7 := &raw const (*(@8), copy (@Global0)) + x@7 := &raw const *(@8) storage_dead(@8) storage_live(@9) storage_live(@10) diff --git a/charon/tests/ui/simple/const-subslice.out b/charon/tests/ui/simple/const-subslice.out index 4cd1d5f2e..866f25c3f 100644 --- a/charon/tests/ui/simple/const-subslice.out +++ b/charon/tests/ui/simple/const-subslice.out @@ -33,7 +33,7 @@ fn main() y@1 := move (@8) storage_live(z@2) storage_live(@3) - @3 := &raw const (*(y@1), copy (y@1.metadata)) + @3 := &raw const *(y@1) with_metadata(copy (y@1.metadata)) z@2 := cast<*const Slice, *const u8>(move (@3)) storage_dead(@3) storage_live(@4) diff --git a/charon/tests/ui/simple/dyn-fn.out b/charon/tests/ui/simple/dyn-fn.out index 64892dcb1..9b7f632fa 100644 --- a/charon/tests/ui/simple/dyn-fn.out +++ b/charon/tests/ui/simple/dyn-fn.out @@ -118,7 +118,7 @@ fn takes_fn<'_0>(@1: &'_0 ((dyn exists<_dyn> [@TraitClause0]: for<'a> Fn<_dyn, ( counter@2 := const (0 : u32) storage_live(@3) storage_live(@4) - @4 := &(*(f@1), copy (f@1.metadata)) + @4 := &*(f@1) with_metadata(copy (f@1.metadata)) storage_live(@5) storage_live(@6) storage_live(@7) diff --git a/charon/tests/ui/simple/generic-cast-to-dyn.out b/charon/tests/ui/simple/generic-cast-to-dyn.out index 2a2b92aba..1941c053f 100644 --- a/charon/tests/ui/simple/generic-cast-to-dyn.out +++ b/charon/tests/ui/simple/generic-cast-to-dyn.out @@ -68,7 +68,7 @@ where @4 := &*(x@1) @3 := unsize_cast<&'_ (T), &'_ ((dyn exists<_dyn> [@TraitClause0]: Any<_dyn> + _dyn : '_)), @TraitClause1>(move (@4)) storage_dead(@4) - @2 := &(*(@3), copy (@3.metadata)) + @2 := &*(@3) with_metadata(copy (@3.metadata)) @0 := unsize_cast<&'_ ((dyn exists<_dyn> [@TraitClause0]: Any<_dyn> + _dyn : '_)), &'_ ((dyn exists<_dyn> [@TraitClause0]: Any<_dyn> + _dyn : '_)), Any<(dyn exists<_dyn> [@TraitClause0]: Any<_dyn> + _dyn : '_)>>(move (@2)) storage_dead(@3) storage_dead(@2) diff --git a/charon/tests/ui/simple/pointee_metadata.out b/charon/tests/ui/simple/pointee_metadata.out index f7b2a1956..e0f57b099 100644 --- a/charon/tests/ui/simple/pointee_metadata.out +++ b/charon/tests/ui/simple/pointee_metadata.out @@ -237,7 +237,7 @@ fn empty_metadata() storage_live(@4) @4 := const (0 : u32) @3 := &@4 - @2 := &raw const (*(@3), copy (@Global0)) + @2 := &raw const *(@3) @1 := to_raw_parts(move (@2)) storage_dead(@2) storage_dead(@4) @@ -265,7 +265,7 @@ fn slice_metadata() storage_live(@5) @5 := [const (0 : u32), const (1 : u32)] @4 := &@5 - @3 := &raw const (*(@4), copy (@Global0)) + @3 := &raw const *(@4) @2 := unsize_cast<*const Array, *const Slice, 2 : usize>(move (@3)) storage_dead(@3) @1 := to_raw_parts>(move (@2)) diff --git a/charon/tests/ui/simple/ptr-from-raw-parts.out b/charon/tests/ui/simple/ptr-from-raw-parts.out index 09c2813c2..9b177c57c 100644 --- a/charon/tests/ui/simple/ptr-from-raw-parts.out +++ b/charon/tests/ui/simple/ptr-from-raw-parts.out @@ -280,7 +280,7 @@ fn main() a@1 := @ArrayRepeat<'_, u32, 2 : usize>(const (1 : u32)) storage_live(@2) storage_live(@3) - @3 := &raw const (a@1, copy (@Global0)) + @3 := &raw const a@1 @2 := from_raw_parts, Array>[Sized>, {impl#0}>[Pointee> where Metadata = ()]](move (@3), const (2 : usize)) storage_dead(@3) storage_dead(@2) diff --git a/charon/tests/ui/simple/ptr_to_promoted.out b/charon/tests/ui/simple/ptr_to_promoted.out index 1ebf1d003..b8ac80e07 100644 --- a/charon/tests/ui/simple/ptr_to_promoted.out +++ b/charon/tests/ui/simple/ptr_to_promoted.out @@ -31,7 +31,7 @@ fn main() storage_live(@2) @5 := move (@6) @2 := &*(@5) - x@1 := &raw const (*(@2), copy (@Global0)) + x@1 := &raw const *(@2) storage_dead(@2) storage_live(@3) storage_live(@4) diff --git a/charon/tests/ui/simple/slice_increment.out b/charon/tests/ui/simple/slice_increment.out index 10d023a90..e6b488ea0 100644 --- a/charon/tests/ui/simple/slice_increment.out +++ b/charon/tests/ui/simple/slice_increment.out @@ -26,12 +26,12 @@ pub fn incr<'_0>(@1: &'_0 mut (Slice)) storage_live(@2) @2 := const (0 : usize) storage_live(@6) - @6 := &(*(s@1), copy (s@1.metadata)) + @6 := &*(s@1) with_metadata(copy (s@1.metadata)) storage_live(@7) @7 := @SliceIndexShared<'_, u32>(move (@6), copy (@2)) @3 := copy (*(@7)) panic.+ const (1 : u32) storage_live(@4) - @4 := &mut (*(s@1), copy (s@1.metadata)) + @4 := &mut *(s@1) with_metadata(copy (s@1.metadata)) storage_live(@5) @5 := @SliceIndexMut<'_, u32>(move (@4), copy (@2)) *(@5) := move (@3) diff --git a/charon/tests/ui/simple/slice_index.out b/charon/tests/ui/simple/slice_index.out index a7708df49..e38f15e4e 100644 --- a/charon/tests/ui/simple/slice_index.out +++ b/charon/tests/ui/simple/slice_index.out @@ -22,7 +22,7 @@ pub fn first<'_0>(@1: &'_0 (Slice)) -> u32 storage_live(@2) @2 := const (0 : usize) storage_live(@3) - @3 := &(*(s@1), copy (s@1.metadata)) + @3 := &*(s@1) with_metadata(copy (s@1.metadata)) storage_live(@4) @4 := @SliceIndexShared<'_, u32>(move (@3), copy (@2)) @0 := copy (*(@4)) diff --git a/charon/tests/ui/simple/slice_index_range.out b/charon/tests/ui/simple/slice_index_range.out index a55e46bdb..55ce799ec 100644 --- a/charon/tests/ui/simple/slice_index_range.out +++ b/charon/tests/ui/simple/slice_index_range.out @@ -449,7 +449,7 @@ where storage_dead(@8) storage_live(@10) storage_live(@11) - @11 := &raw const (*(slice@2), copy (slice@2.metadata)) + @11 := &raw const *(slice@2) with_metadata(copy (slice@2.metadata)) storage_live(@14) storage_live(@15) @14 := cast<*const Slice, *const T>(copy (@11)) @@ -458,7 +458,7 @@ where storage_dead(@15) storage_dead(@14) storage_dead(@11) - @9 := &(*(@10), copy (@10.metadata)) + @9 := &*(@10) with_metadata(copy (@10.metadata)) @0 := Option::Some { 0: copy (@9) } storage_dead(@10) storage_dead(@3) @@ -534,7 +534,7 @@ where storage_dead(@8) storage_live(@10) storage_live(ptr@11) - ptr@11 := &raw mut (*(slice@2), copy (slice@2.metadata)) + ptr@11 := &raw mut *(slice@2) with_metadata(copy (slice@2.metadata)) storage_live(@14) storage_live(@15) @14 := cast<*mut Slice, *mut T>(copy (ptr@11)) @@ -543,7 +543,7 @@ where storage_dead(@15) storage_dead(@14) storage_dead(ptr@11) - @9 := &mut (*(@10), copy (@10.metadata)) + @9 := &mut *(@10) with_metadata(copy (@10.metadata)) @0 := Option::Some { 0: copy (@9) } storage_dead(@10) storage_dead(@3) @@ -848,7 +848,7 @@ where storage_dead(@8) storage_live(@11) storage_live(@12) - @12 := &raw const (*(slice@2), copy (slice@2.metadata)) + @12 := &raw const *(slice@2) with_metadata(copy (slice@2.metadata)) storage_live(@15) storage_live(@16) @15 := cast<*const Slice, *const T>(copy (@12)) @@ -857,7 +857,7 @@ where storage_dead(@16) storage_dead(@15) storage_dead(@12) - @0 := &(*(@11), copy (@11.metadata)) + @0 := &*(@11) with_metadata(copy (@11.metadata)) storage_dead(@11) return } @@ -927,7 +927,7 @@ where storage_dead(@8) storage_live(@11) storage_live(ptr@12) - ptr@12 := &raw mut (*(slice@2), copy (slice@2.metadata)) + ptr@12 := &raw mut *(slice@2) with_metadata(copy (slice@2.metadata)) storage_live(@15) storage_live(@16) @15 := cast<*mut Slice, *mut T>(copy (ptr@12)) @@ -936,7 +936,7 @@ where storage_dead(@16) storage_dead(@15) storage_dead(ptr@12) - @0 := &mut (*(@11), copy (@11.metadata)) + @0 := &mut *(@11) with_metadata(copy (@11.metadata)) storage_dead(@11) return } @@ -1057,7 +1057,7 @@ where storage_dead(@10) storage_live(@12) storage_live(@13) - @13 := &raw const (*(slice@2), copy (slice@2.metadata)) + @13 := &raw const *(slice@2) with_metadata(copy (slice@2.metadata)) storage_live(@16) storage_live(@17) @16 := cast<*const Slice, *const T>(copy (@13)) @@ -1066,7 +1066,7 @@ where storage_dead(@17) storage_dead(@16) storage_dead(@13) - @11 := &(*(@12), copy (@12.metadata)) + @11 := &*(@12) with_metadata(copy (@12.metadata)) @0 := Option::Some { 0: copy (@11) } storage_dead(@12) } @@ -1174,7 +1174,7 @@ where storage_dead(@10) storage_live(@12) storage_live(ptr@13) - ptr@13 := &raw mut (*(slice@2), copy (slice@2.metadata)) + ptr@13 := &raw mut *(slice@2) with_metadata(copy (slice@2.metadata)) storage_live(@16) storage_live(@17) @16 := cast<*mut Slice, *mut T>(copy (ptr@13)) @@ -1183,7 +1183,7 @@ where storage_dead(@17) storage_dead(@16) storage_dead(ptr@13) - @11 := &mut (*(@12), copy (@12.metadata)) + @11 := &mut *(@12) with_metadata(copy (@12.metadata)) @0 := Option::Some { 0: copy (@11) } storage_dead(@12) } @@ -1492,14 +1492,14 @@ pub fn slice_index_range<'_0>(@1: &'_0 (Slice)) -> &'_0 (Slice) storage_live(@2) storage_live(@3) storage_live(@4) - @4 := &(*(slice@1), copy (slice@1.metadata)) + @4 := &*(slice@1) with_metadata(copy (slice@1.metadata)) storage_live(@5) @5 := new[Sized](const (0 : usize), const (10 : usize)) @3 := {impl Index for Slice}::index<'_, u8, RangeInclusive[Sized]>[Sized, Sized[Sized]>, {impl SliceIndex> for RangeInclusive[Sized]}[Sized]](move (@4), move (@5)) storage_dead(@5) storage_dead(@4) - @2 := &(*(@3), copy (@3.metadata)) - @0 := &(*(@2), copy (@2.metadata)) + @2 := &*(@3) with_metadata(copy (@3.metadata)) + @0 := &*(@2) with_metadata(copy (@2.metadata)) storage_dead(@3) storage_dead(@2) return diff --git a/charon/tests/ui/slice-index-range.out b/charon/tests/ui/slice-index-range.out index 6a675d1ad..231bbb5e7 100644 --- a/charon/tests/ui/slice-index-range.out +++ b/charon/tests/ui/slice-index-range.out @@ -299,7 +299,7 @@ where storage_dead(@8) storage_live(@10) storage_live(@11) - @11 := &raw const (*(slice@2), copy (slice@2.metadata)) + @11 := &raw const *(slice@2) with_metadata(copy (slice@2.metadata)) storage_live(@14) storage_live(@15) @14 := cast<*const Slice, *const T>(copy (@11)) @@ -308,7 +308,7 @@ where storage_dead(@15) storage_dead(@14) storage_dead(@11) - @9 := &(*(@10), copy (@10.metadata)) + @9 := &*(@10) with_metadata(copy (@10.metadata)) @0 := Option::Some { 0: copy (@9) } storage_dead(@10) storage_dead(@3) @@ -384,7 +384,7 @@ where storage_dead(@8) storage_live(@10) storage_live(ptr@11) - ptr@11 := &raw mut (*(slice@2), copy (slice@2.metadata)) + ptr@11 := &raw mut *(slice@2) with_metadata(copy (slice@2.metadata)) storage_live(@14) storage_live(@15) @14 := cast<*mut Slice, *mut T>(copy (ptr@11)) @@ -393,7 +393,7 @@ where storage_dead(@15) storage_dead(@14) storage_dead(ptr@11) - @9 := &mut (*(@10), copy (@10.metadata)) + @9 := &mut *(@10) with_metadata(copy (@10.metadata)) @0 := Option::Some { 0: copy (@9) } storage_dead(@10) storage_dead(@3) @@ -696,7 +696,7 @@ where storage_dead(@8) storage_live(@11) storage_live(@12) - @12 := &raw const (*(slice@2), copy (slice@2.metadata)) + @12 := &raw const *(slice@2) with_metadata(copy (slice@2.metadata)) storage_live(@15) storage_live(@16) @15 := cast<*const Slice, *const T>(copy (@12)) @@ -705,7 +705,7 @@ where storage_dead(@16) storage_dead(@15) storage_dead(@12) - @0 := &(*(@11), copy (@11.metadata)) + @0 := &*(@11) with_metadata(copy (@11.metadata)) storage_dead(@11) return } @@ -775,7 +775,7 @@ where storage_dead(@8) storage_live(@11) storage_live(ptr@12) - ptr@12 := &raw mut (*(slice@2), copy (slice@2.metadata)) + ptr@12 := &raw mut *(slice@2) with_metadata(copy (slice@2.metadata)) storage_live(@15) storage_live(@16) @15 := cast<*mut Slice, *mut T>(copy (ptr@12)) @@ -784,7 +784,7 @@ where storage_dead(@16) storage_dead(@15) storage_dead(ptr@12) - @0 := &mut (*(@11), copy (@11.metadata)) + @0 := &mut *(@11) with_metadata(copy (@11.metadata)) storage_dead(@11) return } @@ -841,14 +841,14 @@ fn main() @3 := {impl Index for Array}::index<'_, i32, Range[Sized], 6 : usize>[Sized, Sized[Sized]>, {impl Index for Slice}[Sized]>[Sized, Sized[Sized]>, {impl SliceIndex> for Range[Sized]}[Sized]]](move (@4), move (@5)) storage_dead(@5) storage_dead(@4) - slice@2 := &(*(@3), copy (@3.metadata)) + slice@2 := &*(@3) with_metadata(copy (@3.metadata)) storage_live(@6) storage_live(@7) storage_live(@8) storage_live(@9) @9 := const (0 : usize) storage_live(@10) - @10 := &(*(slice@2), copy (slice@2.metadata)) + @10 := &*(slice@2) with_metadata(copy (slice@2.metadata)) storage_live(@11) @11 := @SliceIndexShared<'_, i32>(move (@10), copy (@9)) @8 := copy (*(@11)) diff --git a/charon/tests/ui/statics.out b/charon/tests/ui/statics.out index f71b68e39..c4f5e6d3e 100644 --- a/charon/tests/ui/statics.out +++ b/charon/tests/ui/statics.out @@ -105,7 +105,7 @@ fn shared_static() @11 := () @12 := &SHARED_STATIC @6 := move (@12) - _ptr@5 := &raw const (*(@6), copy (@Global0)) + _ptr@5 := &raw const *(@6) @0 := () storage_dead(@6) storage_dead(_ptr@5) @@ -166,34 +166,34 @@ fn mut_static() storage_live(_val@1) storage_live(@2) @11 := () - @12 := &raw mut (MUT_STATIC, move (@11)) + @12 := &raw mut MUT_STATIC @2 := move (@12) _val@1 := copy (*(@2)) storage_dead(@2) storage_live(_ref@3) storage_live(@4) @13 := () - @14 := &raw mut (MUT_STATIC, move (@13)) + @14 := &raw mut MUT_STATIC @4 := move (@14) _ref@3 := &*(@4) storage_live(_ref_mut@5) storage_live(@6) @15 := () - @16 := &raw mut (MUT_STATIC, move (@15)) + @16 := &raw mut MUT_STATIC @6 := move (@16) _ref_mut@5 := &mut *(@6) storage_live(_ptr@7) storage_live(@8) @17 := () - @18 := &raw mut (MUT_STATIC, move (@17)) + @18 := &raw mut MUT_STATIC @8 := move (@18) - _ptr@7 := &raw const (*(@8), copy (@Global0)) + _ptr@7 := &raw const *(@8) storage_live(_ptr_mut@9) storage_live(@10) @19 := () - @20 := &raw mut (MUT_STATIC, move (@19)) + @20 := &raw mut MUT_STATIC @10 := move (@20) - _ptr_mut@9 := &raw mut (*(@10), copy (@Global0)) + _ptr_mut@9 := &raw mut *(@10) @0 := () storage_dead(@10) storage_dead(_ptr_mut@9) diff --git a/charon/tests/ui/string-literal.out b/charon/tests/ui/string-literal.out index 4a2da9352..afe2aa814 100644 --- a/charon/tests/ui/string-literal.out +++ b/charon/tests/ui/string-literal.out @@ -168,7 +168,7 @@ fn main() storage_live(@2) storage_live(@3) @3 := const ("Hello") - @2 := &(*(@3), copy (@3.metadata)) + @2 := &*(@3) with_metadata(copy (@3.metadata)) _s@1 := {impl ToString for T}::to_string<'_, Str>[MetaSized, {impl Display for Str}](move (@2)) storage_dead(@2) storage_dead(@3) diff --git a/charon/tests/ui/unsafe.out b/charon/tests/ui/unsafe.out index 60d7945fc..73fc60e49 100644 --- a/charon/tests/ui/unsafe.out +++ b/charon/tests/ui/unsafe.out @@ -363,7 +363,7 @@ fn access_mutable_static() storage_live(@4) storage_live(@1) @3 := () - @4 := &raw mut (COUNTER, move (@3)) + @4 := &raw mut COUNTER @1 := move (@4) @2 := copy (*(@1)) panic.+ const (1 : usize) *(@1) := move (@2) diff --git a/charon/tests/ui/unsupported/issue-79-bound-regions.out b/charon/tests/ui/unsupported/issue-79-bound-regions.out index fbe5e928c..8f5cb7436 100644 --- a/charon/tests/ui/unsupported/issue-79-bound-regions.out +++ b/charon/tests/ui/unsupported/issue-79-bound-regions.out @@ -443,7 +443,7 @@ fn main() storage_live(@6) storage_live(@7) storage_live(@8) - @8 := &(*(slice@1), copy (slice@1.metadata)) + @8 := &*(slice@1) with_metadata(copy (slice@1.metadata)) @7 := iter<'_, i32>[Sized](move (@8)) @6 := &two-phase-mut @7 storage_dead(@8) diff --git a/charon/tests/ui/vtables.out b/charon/tests/ui/vtables.out index 03af3f7a9..c10b188fd 100644 --- a/charon/tests/ui/vtables.out +++ b/charon/tests/ui/vtables.out @@ -367,7 +367,7 @@ where @4 := &*(arg@1) @3 := unsize_cast<&'_ (T), &'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)), @TraitClause1>(move (@4)) storage_dead(@4) - @2 := &(*(@3), copy (@3.metadata)) + @2 := &*(@3) with_metadata(copy (@3.metadata)) @0 := unsize_cast<&'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)), &'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)), NoParam<(dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)>>(move (@2)) storage_dead(@3) storage_dead(@2) @@ -474,7 +474,7 @@ where storage_dead(@3) storage_dead(@4) storage_live(@6) - @6 := &two-phase-mut (*(x@2), copy (x@2.metadata)) + @6 := &two-phase-mut *(x@2) with_metadata(copy (x@2.metadata)) storage_live(@7) @7 := &*(arg@1) @0 := Modifiable<(dyn exists<_dyn> [@TraitClause0]: Modifiable<_dyn, T> + _dyn : '_), T>::modify<'_, '_>(move (@6), move (@7)) @@ -536,7 +536,7 @@ where storage_live(@4) storage_live(@5) - @5 := &(*(self@1), copy (self@1.metadata)) + @5 := &*(self@1) with_metadata(copy (self@1.metadata)) storage_live(@6) @6 := &*(t32@2) @4 := @TraitClause0::parent_clause1::operate_on<'_, '_>(move (@5), move (@6)) @@ -545,7 +545,7 @@ where storage_dead(@4) storage_live(@7) storage_live(@8) - @8 := &(*(self@1), copy (self@1.metadata)) + @8 := &*(self@1) with_metadata(copy (self@1.metadata)) storage_live(@9) @9 := &*(t64@3) @7 := @TraitClause0::parent_clause2::operate_on<'_, '_>(move (@8), move (@9)) @@ -738,7 +738,7 @@ fn use_alias<'_0>(@1: &'_0 ((dyn exists<_dyn> [@TraitClause0]: Both32And64<_dyn> storage_live(@2) storage_live(@3) - @3 := &(*(x@1), copy (x@1.metadata)) + @3 := &*(x@1) with_metadata(copy (x@1.metadata)) storage_live(@4) storage_live(@5) storage_live(@6) @@ -887,7 +887,7 @@ fn main() storage_live(@5) storage_live(@6) storage_live(@7) - @7 := &(*(x@1), copy (x@1.metadata)) + @7 := &*(x@1) with_metadata(copy (x@1.metadata)) @6 := Checkable<(dyn exists<_dyn> [@TraitClause0]: Checkable<_dyn, i32> + _dyn : '_), i32>::check<'_>(move (@7)) if move (@6) { } @@ -918,7 +918,7 @@ fn main() storage_live(@19) storage_live(@20) @20 := const ("Hello") - @19 := &(*(@20), copy (@20.metadata)) + @19 := &*(@20) with_metadata(copy (@20.metadata)) @18 := {impl ToString for T}::to_string<'_, Str>[MetaSized, {impl Display for Str}](move (@19)) storage_dead(@19) @17 := &@18 @@ -944,7 +944,7 @@ fn main() storage_live(@23) storage_live(@24) storage_live(@25) - @25 := &two-phase-mut (*(y@8), copy (y@8.metadata)) + @25 := &two-phase-mut *(y@8) with_metadata(copy (y@8.metadata)) storage_live(@26) storage_live(@27) storage_live(@28) @@ -1014,7 +1014,7 @@ fn main() @47 := &@48 @46 := &*(@47) @45 := to_dyn_obj<'_, i32>[Sized, {impl NoParam for i32}](move (@46)) - @44 := &(*(@45), copy (@45.metadata)) + @44 := &*(@45) with_metadata(copy (@45.metadata)) z@43 := unsize_cast<&'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)), &'_ ((dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)), NoParam<(dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)>>(move (@44)) storage_dead(@46) storage_dead(@44) @@ -1023,7 +1023,7 @@ fn main() storage_dead(@45) storage_live(@49) storage_live(@50) - @50 := &(*(z@43), copy (z@43.metadata)) + @50 := &*(z@43) with_metadata(copy (z@43.metadata)) @49 := NoParam<(dyn exists<_dyn> [@TraitClause0]: NoParam<_dyn> + _dyn : '_)>::dummy<'_>(move (@50)) storage_dead(@50) storage_dead(@49) @@ -1039,7 +1039,7 @@ fn main() storage_dead(@53) storage_live(@55) storage_live(@56) - @56 := &(*(a@51), copy (a@51.metadata)) + @56 := &*(a@51) with_metadata(copy (a@51.metadata)) storage_live(@57) storage_live(@58) storage_live(@59)