From 837b550238aa671a591ccf282dddeab29cadb206 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 18 May 2024 04:49:42 +0200 Subject: Merging upstream version 1.71.1+dfsg1. Signed-off-by: Daniel Baumann --- tests/assembly/asm/inline-asm-avx.rs | 25 + tests/assembly/asm/loongarch-type.rs | 196 +++++ tests/assembly/option-nonzero-eq.rs | 28 + tests/assembly/slice-is_ascii.rs | 35 + .../item-collection/cross-crate-trait-method.rs | 2 +- .../item-collection/function-as-argument.rs | 3 +- .../item-collection/generic-functions.rs | 2 +- .../codegen-units/item-collection/generic-impl.rs | 2 +- .../item-collection/trait-implementations.rs | 2 +- .../item-collection/trait-method-as-argument.rs | 3 +- .../item-collection/trait-method-default-impl.rs | 2 +- tests/codegen/abi-main-signature-16bit-c-int.rs | 1 + tests/codegen/addr-of-mutate.rs | 34 + tests/codegen/align-fn.rs | 40 + tests/codegen/align-offset.rs | 78 ++ tests/codegen/alloc-optimisation.rs | 3 +- tests/codegen/array-map.rs | 2 +- tests/codegen/ascii-char.rs | 37 + .../codegen/binary-search-index-no-bound-check.rs | 4 +- tests/codegen/call-llvm-intrinsics.rs | 1 + tests/codegen/catch-unwind.rs | 2 + tests/codegen/debug-vtable.rs | 2 - tests/codegen/debuginfo-constant-locals.rs | 28 + tests/codegen/drop-in-place-noalias.rs | 38 + tests/codegen/enable-lto-unit-splitting.rs | 10 + tests/codegen/fewer-names.rs | 14 +- tests/codegen/global_asm.rs | 1 + tests/codegen/global_asm_include.rs | 1 + tests/codegen/global_asm_x2.rs | 1 + tests/codegen/inline-hint.rs | 2 +- tests/codegen/intrinsics/offset.rs | 34 + tests/codegen/intrinsics/transmute-niched.rs | 184 ++++ tests/codegen/intrinsics/transmute.rs | 50 +- tests/codegen/issues/issue-103840.rs | 1 + .../codegen/issues/issue-105386-ub-in-debuginfo.rs | 3 +- tests/codegen/issues/issue-111603.rs | 28 + .../issue-73396-bounds-check-after-position.rs | 30 +- tests/codegen/issues/issue-86106.rs | 29 +- .../codegen/local-generics-in-exe-internalized.rs | 2 +- .../codegen/loongarch-abi/call-llvm-intrinsics.rs | 31 + .../codegen/loongarch-abi/loongarch64-lp64d-abi.rs | 293 +++++++ tests/codegen/mem-replace-big-type.rs | 19 +- tests/codegen/mem-replace-direct-memcpy.rs | 33 - tests/codegen/mem-replace-simple-type.rs | 34 + tests/codegen/noalias-box-off.rs | 5 +- tests/codegen/nrvo.rs | 2 +- tests/codegen/optimize-attr-1.rs | 2 +- tests/codegen/option-as-slice.rs | 2 + tests/codegen/option-nonzero-eq.rs | 12 +- .../remap_path_prefix/auxiliary/xcrate-generic.rs | 4 +- tests/codegen/remap_path_prefix/xcrate-generic.rs | 2 +- tests/codegen/repr-transparent-aggregates-1.rs | 1 + tests/codegen/repr-transparent-aggregates-2.rs | 1 + tests/codegen/repr-transparent.rs | 1 + ...sanitizer-cfi-add-canonical-jump-tables-flag.rs | 2 +- ...sanitizer-cfi-add-enable-split-lto-unit-flag.rs | 11 + ...itizer-cfi-emit-type-checks-attr-no-sanitize.rs | 18 + tests/codegen/sanitizer-cfi-emit-type-checks.rs | 3 +- ...zer-cfi-emit-type-metadata-attr-cfi-encoding.rs | 48 + ...er-cfi-emit-type-metadata-id-itanium-cxx-abi.rs | 345 ++++---- ...it-type-metadata-itanium-cxx-abi-generalized.rs | 31 + ...adata-itanium-cxx-abi-normalized-generalized.rs | 31 + ...mit-type-metadata-itanium-cxx-abi-normalized.rs | 31 + ...tizer-cfi-emit-type-metadata-itanium-cxx-abi.rs | 6 +- ...nitizer-cfi-emit-type-metadata-trait-objects.rs | 120 +++ tests/codegen/sanitizer-cfi-generalize-pointers.rs | 46 + tests/codegen/sanitizer-cfi-normalize-integers.rs | 83 ++ ...fi-emit-kcfi-operand-bundle-attr-no-sanitize.rs | 30 + ...i-operand-bundle-itanium-cxx-abi-generalized.rs | 44 + ...undle-itanium-cxx-abi-normalized-generalized.rs | 44 + ...fi-operand-bundle-itanium-cxx-abi-normalized.rs | 44 + ...cfi-emit-kcfi-operand-bundle-itanium-cxx-abi.rs | 12 +- .../sanitizer-kcfi-emit-kcfi-operand-bundle.rs | 27 + ...itizer-kcfi-emit-type-metadata-trait-objects.rs | 144 +++ tests/codegen/slice-iter-nonnull.rs | 77 ++ tests/codegen/split-lto-unit.rs | 11 + tests/codegen/thread-local.rs | 8 +- tests/codegen/tied-features-strength.rs | 29 + tests/codegen/transmute-optimized.rs | 109 +++ tests/codegen/transmute-scalar.rs | 14 +- tests/codegen/vec-optimizes-away.rs | 3 +- tests/codegen/vec-shrink-panik.rs | 4 +- tests/debuginfo/associated-types.rs | 2 +- .../dependency-with-embedded-visualizers.rs | 1 - tests/debuginfo/auxiliary/macro-stepping.rs | 2 +- tests/debuginfo/borrowed-enum.rs | 2 +- tests/debuginfo/embedded-visualizer.rs | 1 - .../debuginfo/generic-method-on-generic-struct.rs | 2 +- tests/debuginfo/generic-struct.rs | 2 +- tests/debuginfo/generic-tuple-style-enum.rs | 2 +- tests/debuginfo/macro-stepping.rs | 20 +- tests/debuginfo/method-on-generic-struct.rs | 2 +- tests/debuginfo/pretty-std.rs | 4 +- tests/debuginfo/reference-debuginfo.rs | 173 ++++ tests/debuginfo/struct-style-enum.rs | 2 +- tests/debuginfo/thread.rs | 2 +- tests/debuginfo/tuple-style-enum.rs | 2 +- tests/debuginfo/unique-enum.rs | 2 +- tests/debuginfo/unsized.rs | 2 + tests/incremental/change_crate_dep_kind.rs | 1 + tests/incremental/const-generic-type-cycle.rs | 17 + .../const-generics/change-const-param-gat.rs | 29 + .../const-generics/change-const-param-type.rs | 68 ++ tests/incremental/hashes/enum_constructors.rs | 4 +- tests/incremental/hashes/let_expressions.rs | 12 +- tests/incremental/issue-80691-bad-eval-cache.rs | 1 + tests/mir-opt/bool_compare.opt1.InstCombine.diff | 35 - tests/mir-opt/bool_compare.opt1.InstSimplify.diff | 35 + tests/mir-opt/bool_compare.opt2.InstCombine.diff | 35 - tests/mir-opt/bool_compare.opt2.InstSimplify.diff | 35 + tests/mir-opt/bool_compare.opt3.InstCombine.diff | 35 - tests/mir-opt/bool_compare.opt3.InstSimplify.diff | 35 + tests/mir-opt/bool_compare.opt4.InstCombine.diff | 35 - tests/mir-opt/bool_compare.opt4.InstSimplify.diff | 35 + tests/mir-opt/bool_compare.rs | 10 +- ...sync_await.b-{closure#0}.generator_resume.0.mir | 178 ++-- .../projections.copy_for_deref.built.after.mir | 12 + tests/mir-opt/building/custom/projections.rs | 25 +- .../custom/projections.tuples.built.after.mir | 8 +- .../mir-opt/building/enum_cast.bar.built.after.mir | 9 +- .../mir-opt/building/enum_cast.boo.built.after.mir | 9 +- .../building/enum_cast.droppy.built.after.mir | 9 +- .../mir-opt/building/enum_cast.far.built.after.mir | 22 + .../building/enum_cast.offsetty.built.after.mir | 26 + tests/mir-opt/building/enum_cast.rs | 42 + .../building/enum_cast.signy.built.after.mir | 26 + .../building/enum_cast.unsigny.built.after.mir | 17 + tests/mir-opt/casts.redundant.InstCombine.diff | 25 - tests/mir-opt/casts.redundant.InstSimplify.diff | 25 + tests/mir-opt/casts.rs | 2 +- .../combine_array_len.norm2.InstCombine.diff | 77 -- .../combine_array_len.norm2.InstSimplify.diff | 77 ++ tests/mir-opt/combine_array_len.rs | 4 +- tests/mir-opt/combine_clone_of_primitives.rs | 4 +- ...e_of_primitives.{impl#0}-clone.InstCombine.diff | 82 -- ..._of_primitives.{impl#0}-clone.InstSimplify.diff | 82 ++ ...bine_transmutes.adt_transmutes.InstCombine.diff | 158 ---- ...ine_transmutes.adt_transmutes.InstSimplify.diff | 90 ++ ...transmutes.identity_transmutes.InstCombine.diff | 43 - ...ransmutes.identity_transmutes.InstSimplify.diff | 43 + ..._transmutes.integer_transmutes.InstCombine.diff | 24 - ...transmutes.integer_transmutes.InstSimplify.diff | 24 + tests/mir-opt/combine_transmutes.rs | 30 +- ...const_allocation.main.ConstProp.after.32bit.mir | 32 +- ...const_allocation.main.ConstProp.after.64bit.mir | 36 +- ...onst_allocation2.main.ConstProp.after.32bit.mir | 30 +- ...onst_allocation2.main.ConstProp.after.64bit.mir | 32 +- ...onst_allocation3.main.ConstProp.after.32bit.mir | 16 +- ...onst_allocation3.main.ConstProp.after.64bit.mir | 14 +- ...omoted[0].SimplifyCfg-elaborate-drops.after.mir | 6 +- ...t_promotion_extern_static.FOO.PromoteTemps.diff | 6 +- .../const_prop/address_of_pair.fn0.ConstProp.diff | 46 + tests/mir-opt/const_prop/address_of_pair.rs | 17 + .../bad_op_mod_by_zero.main.ConstProp.diff | 18 +- tests/mir-opt/const_prop/bad_op_mod_by_zero.rs | 1 + ...unsafe_oob_for_slices.main.ConstProp.32bit.diff | 46 +- ...unsafe_oob_for_slices.main.ConstProp.64bit.diff | 46 +- .../const_prop/bad_op_unsafe_oob_for_slices.rs | 3 + .../invalid_constant.main.ConstProp.diff | 22 +- tests/mir-opt/const_prop/invalid_constant.rs | 2 + .../large_array_index.main.ConstProp.32bit.diff | 9 +- .../large_array_index.main.ConstProp.64bit.diff | 9 +- tests/mir-opt/const_prop/large_array_index.rs | 2 + tests/mir-opt/const_prop/mult_by_zero.rs | 3 +- .../const_prop/mult_by_zero.test.ConstProp.diff | 5 +- .../mutable_variable.main.ConstProp.diff | 1 + tests/mir-opt/const_prop/mutable_variable.rs | 3 +- .../mutable_variable_aggregate.main.ConstProp.diff | 25 +- .../const_prop/mutable_variable_aggregate.rs | 3 +- ..._variable_aggregate_mut_ref.main.ConstProp.diff | 11 +- .../mutable_variable_aggregate_mut_ref.rs | 3 +- ...able_aggregate_partial_read.main.ConstProp.diff | 3 +- .../mutable_variable_aggregate_partial_read.rs | 3 +- .../mutable_variable_no_prop.main.ConstProp.diff | 33 +- .../mir-opt/const_prop/mutable_variable_no_prop.rs | 3 +- ...able_variable_unprop_assign.main.ConstProp.diff | 42 +- .../const_prop/mutable_variable_unprop_assign.rs | 3 +- .../const_prop/offset_of.concrete.ConstProp.diff | 44 + .../const_prop/offset_of.generic.ConstProp.diff | 40 + tests/mir-opt/const_prop/offset_of.rs | 48 + ...timizes_into_variable.main.ConstProp.32bit.diff | 59 -- ...timizes_into_variable.main.ConstProp.64bit.diff | 59 -- ...s_into_variable.main.PreCodegen.after.32bit.mir | 25 - ...s_into_variable.main.PreCodegen.after.64bit.mir | 25 - ...e.main.ScalarReplacementOfAggregates.32bit.diff | 71 -- ...e.main.ScalarReplacementOfAggregates.64bit.diff | 71 -- ...iable.main.SimplifyLocals-final.after.32bit.mir | 25 - ...iable.main.SimplifyLocals-final.after.64bit.mir | 25 - .../mir-opt/const_prop/optimizes_into_variable.rs | 19 - .../read_immutable_static.main.ConstProp.diff | 5 +- tests/mir-opt/const_prop/read_immutable_static.rs | 3 +- .../const_prop/reify_fn_ptr.main.ConstProp.diff | 23 +- tests/mir-opt/const_prop/reify_fn_ptr.rs | 1 + .../const_prop/repeat.main.ConstProp.32bit.diff | 6 +- .../const_prop/repeat.main.ConstProp.64bit.diff | 6 +- tests/mir-opt/const_prop/repeat.rs | 5 +- .../return_place.add.PreCodegen.before.mir | 6 + tests/mir-opt/const_prop/return_place.rs | 1 + .../scalar_literal_propagation.main.ConstProp.diff | 14 +- .../const_prop/scalar_literal_propagation.rs | 1 + tests/mir-opt/const_prop/slice_len.rs | 2 +- .../const_prop/switch_int.main.ConstProp.diff | 4 +- ...in.SimplifyConstCondition-after-const-prop.diff | 4 +- tests/mir-opt/const_prop/switch_int.rs | 2 + .../transmute.from_char.ConstProp.32bit.diff | 15 + .../transmute.from_char.ConstProp.64bit.diff | 15 + .../const_prop/transmute.from_char.ConstProp.diff | 15 - .../transmute.invalid_bool.ConstProp.32bit.diff | 15 + .../transmute.invalid_bool.ConstProp.64bit.diff | 15 + .../transmute.invalid_bool.ConstProp.diff | 14 - .../transmute.invalid_char.ConstProp.32bit.diff | 15 + .../transmute.invalid_char.ConstProp.64bit.diff | 15 + .../transmute.invalid_char.ConstProp.diff | 14 - .../transmute.less_as_i8.ConstProp.32bit.diff | 23 + .../transmute.less_as_i8.ConstProp.64bit.diff | 23 + .../const_prop/transmute.less_as_i8.ConstProp.diff | 23 - tests/mir-opt/const_prop/transmute.rs | 2 + ...ute.undef_union_as_integer.ConstProp.32bit.diff | 22 + ...ute.undef_union_as_integer.ConstProp.64bit.diff | 22 + ...transmute.undef_union_as_integer.ConstProp.diff | 22 - .../transmute.unreachable_box.ConstProp.32bit.diff | 23 + .../transmute.unreachable_box.ConstProp.64bit.diff | 23 + .../transmute.unreachable_box.ConstProp.diff | 23 - ...ansmute.unreachable_direct.ConstProp.32bit.diff | 22 + ...ansmute.unreachable_direct.ConstProp.64bit.diff | 22 + .../transmute.unreachable_direct.ConstProp.diff | 25 - .../transmute.unreachable_mut.ConstProp.32bit.diff | 27 + .../transmute.unreachable_mut.ConstProp.64bit.diff | 27 + .../transmute.unreachable_mut.ConstProp.diff | 27 - .../transmute.unreachable_ref.ConstProp.32bit.diff | 23 + .../transmute.unreachable_ref.ConstProp.64bit.diff | 23 + .../transmute.unreachable_ref.ConstProp.diff | 23 - .../transmute.valid_char.ConstProp.32bit.diff | 15 + .../transmute.valid_char.ConstProp.64bit.diff | 15 + .../const_prop/transmute.valid_char.ConstProp.diff | 15 - .../tuple_literal_propagation.main.ConstProp.diff | 13 +- .../const_prop/tuple_literal_propagation.rs | 1 + ...while_let_loops.change_loop_body.ConstProp.diff | 54 ++ tests/mir-opt/const_prop/while_let_loops.rs | 14 + .../const_prop_miscompile.bar.ConstProp.diff | 3 +- .../const_prop_miscompile.foo.ConstProp.diff | 3 +- .../copy-prop/borrowed_local.f.CopyProp.diff | 3 +- .../copy_propagation_arg.arg_src.CopyProp.diff | 12 +- .../copy-prop/partial_init.main.CopyProp.diff | 13 + tests/mir-opt/copy-prop/partial_init.rs | 18 + .../place_mention.main.DeadStoreElimination.diff | 25 + .../dead-store-elimination/place_mention.rs | 9 + .../dont_yeet_assert.generic.InstCombine.diff | 23 - .../dont_yeet_assert.generic.InstSimplify.diff | 23 + tests/mir-opt/dont_yeet_assert.rs | 4 +- tests/mir-opt/equal_true.opt.InstCombine.diff | 35 - tests/mir-opt/equal_true.opt.InstSimplify.diff | 35 + tests/mir-opt/equal_true.rs | 4 +- .../mir-opt/inline/issue_106141.outer.Inline.diff | 2 +- ...ifts.unchecked_shl_unsigned_smaller.Inline.diff | 162 ++-- ...ecked_shl_unsigned_smaller.PreCodegen.after.mir | 162 ++-- ...shifts.unchecked_shr_signed_smaller.Inline.diff | 162 ++-- ...checked_shr_signed_smaller.PreCodegen.after.mir | 162 ++-- .../inline/unsized_argument.caller.Inline.diff | 50 ++ tests/mir-opt/inline/unsized_argument.rs | 15 + .../unwrap_unchecked.unwrap_unchecked.Inline.diff | 2 +- ...ate_switch_targets.assert_zero.InstCombine.diff | 21 - .../instcombine_duplicate_switch_targets.rs | 27 - ...te_switch_targets.assert_zero.InstSimplify.diff | 21 + .../instsimplify_duplicate_switch_targets.rs | 27 + .../intrinsic_asserts.generic.InstCombine.diff | 42 - .../intrinsic_asserts.generic.InstSimplify.diff | 42 + .../intrinsic_asserts.panics.InstCombine.diff | 47 - .../intrinsic_asserts.panics.InstSimplify.diff | 47 + .../intrinsic_asserts.removable.InstCombine.diff | 45 - .../intrinsic_asserts.removable.InstSimplify.diff | 45 + tests/mir-opt/intrinsic_asserts.rs | 6 +- tests/mir-opt/issue_41888.main.ElaborateDrops.diff | 2 +- tests/mir-opt/issue_72181_1.f.built.after.mir | 14 - ...ssue_76432.test.SimplifyComparisonIntegral.diff | 15 +- tests/mir-opt/issue_78192.f.InstCombine.diff | 29 - tests/mir-opt/issue_78192.f.InstSimplify.diff | 29 + tests/mir-opt/issue_78192.rs | 2 +- tests/mir-opt/issue_99325.main.built.after.mir | 4 +- .../issue_59352.num_to_digit.PreCodegen.after.mir | 35 +- ..._intrinsics.option_payload.LowerIntrinsics.diff | 4 +- ...ower_intrinsics.ptr_offset.LowerIntrinsics.diff | 30 + tests/mir-opt/lower_intrinsics.rs | 11 +- ...ansmute_to_box_uninhabited.LowerIntrinsics.diff | 14 +- ...ansmute_to_mut_uninhabited.LowerIntrinsics.diff | 14 +- ...ansmute_to_ref_uninhabited.LowerIntrinsics.diff | 14 +- ...wer_intrinsics.unreachable.LowerIntrinsics.diff | 11 +- .../lower_intrinsics.wrapping.LowerIntrinsics.diff | 8 +- ...sics.write_via_move_string.LowerIntrinsics.diff | 36 + ...lower_intrinsics_e2e.f_u64.PreCodegen.after.mir | 25 - ...ower_intrinsics_e2e.f_unit.PreCodegen.after.mir | 22 - tests/mir-opt/lower_intrinsics_e2e.rs | 32 - .../nll/named_lifetimes_basic.use_x.nll.0.mir | 56 +- .../region_subtyping_basic.main.nll.0.32bit.mir | 36 +- .../region_subtyping_basic.main.nll.0.64bit.mir | 36 +- tests/mir-opt/not_equal_false.opt.InstCombine.diff | 35 - .../mir-opt/not_equal_false.opt.InstSimplify.diff | 35 + tests/mir-opt/not_equal_false.rs | 4 +- tests/mir-opt/nrvo_miscompile_111005.rs | 22 + ..._miscompile_111005.wrong.RenameReturnPlace.diff | 18 + tests/mir-opt/pre-codegen/README.md | 3 + .../pre-codegen/duplicate_switch_targets.rs | 17 + ...ate_switch_targets.ub_if_b.PreCodegen.after.mir | 27 + .../intrinsics.f_u64.PreCodegen.after.mir | 26 + .../intrinsics.f_unit.PreCodegen.after.mir | 22 + tests/mir-opt/pre-codegen/intrinsics.rs | 36 + ...mem_replace.manual_replace.PreCodegen.after.mir | 16 + .../mem_replace.mem_replace.PreCodegen.after.mir | 53 ++ tests/mir-opt/pre-codegen/mem_replace.rs | 17 + ...timizes_into_variable.main.ConstProp.32bit.diff | 59 ++ ...timizes_into_variable.main.ConstProp.64bit.diff | 59 ++ ...s_into_variable.main.PreCodegen.after.32bit.mir | 18 + ...s_into_variable.main.PreCodegen.after.64bit.mir | 18 + ...e.main.ScalarReplacementOfAggregates.32bit.diff | 71 ++ ...e.main.ScalarReplacementOfAggregates.64bit.diff | 71 ++ ...iable.main.SimplifyLocals-final.after.32bit.mir | 18 + ...iable.main.SimplifyLocals-final.after.64bit.mir | 18 + .../mir-opt/pre-codegen/optimizes_into_variable.rs | 18 + .../range_iter.forward_loop.PreCodegen.after.mir | 91 ++ .../range_iter.inclusive_loop.PreCodegen.after.mir | 95 ++ ....range_inclusive_iter_next.PreCodegen.after.mir | 20 + ...range_iter.range_iter_next.PreCodegen.after.mir | 20 + tests/mir-opt/pre-codegen/range_iter.rs | 31 + .../simple_option_map.ezmap.PreCodegen.after.mir | 56 ++ tests/mir-opt/pre-codegen/simple_option_map.rs | 23 + tests/mir-opt/pre-codegen/slice_index.rs | 27 + ..._index.slice_get_mut_usize.PreCodegen.after.mir | 105 +++ ...ce_get_unchecked_mut_range.PreCodegen.after.mir | 134 +++ ...ce_index.slice_index_range.PreCodegen.after.mir | 26 + ...ce_index.slice_index_usize.PreCodegen.after.mir | 20 + .../slice_iter.forward_loop.PreCodegen.after.mir | 203 +++++ .../slice_iter.reverse_loop.PreCodegen.after.mir | 220 +++++ tests/mir-opt/pre-codegen/slice_iter.rs | 38 + ...r.slice_iter_mut_next_back.PreCodegen.after.mir | 17 + ...slice_iter.slice_iter_next.PreCodegen.after.mir | 17 + .../try_identity.new.PreCodegen.after.mir | 70 ++ .../try_identity.old.PreCodegen.after.mir | 40 + tests/mir-opt/pre-codegen/try_identity.rs | 38 + ...erence_prop.debuginfo.ReferencePropagation.diff | 175 ++++ ...prop.dominate_storage.ReferencePropagation.diff | 38 + ...rence_prop.maybe_dead.ReferencePropagation.diff | 56 ++ ...prop.multiple_storage.ReferencePropagation.diff | 27 + ....mut_raw_then_mut_shr.ReferencePropagation.diff | 75 ++ ...prop.read_through_raw.ReferencePropagation.diff | 23 + ...reference_propagation.ReferencePropagation.diff | 475 ++++++++++ ...propagation_const_ptr.ReferencePropagation.diff | 536 ++++++++++++ ...rence_propagation_mut.ReferencePropagation.diff | 472 ++++++++++ ...e_propagation_mut_ptr.ReferencePropagation.diff | 482 ++++++++++ tests/mir-opt/reference_prop.rs | 592 +++++++++++++ ...op.unique_with_copies.ReferencePropagation.diff | 67 ++ ...imple_option_map_e2e.ezmap.PreCodegen.after.mir | 42 - tests/mir-opt/simple_option_map_e2e.rs | 19 - tests/mir-opt/simplify_arm.rs | 3 +- tests/mir-opt/simplify_arm_identity.rs | 3 +- tests/mir-opt/slice_filter.rs | 2 + ...lice_filter.variant_a-{closure#0}.CopyProp.diff | 16 +- ...riant_a-{closure#0}.DestinationPropagation.diff | 258 ++---- ...variant_a-{closure#0}.ReferencePropagation.diff | 267 ++++++ ...variant_b-{closure#0}.ReferencePropagation.diff | 103 +++ ...ifetimes.foo.ScalarReplacementOfAggregates.diff | 24 +- tests/mir-opt/storage_ranges.main.nll.0.mir | 22 +- .../try_identity_e2e.new.PreCodegen.after.mir | 66 -- .../try_identity_e2e.old.PreCodegen.after.mir | 36 - tests/mir-opt/try_identity_e2e.rs | 34 - ...num.process_void.SimplifyLocals-final.after.mir | 5 +- ...while_let_loops.change_loop_body.ConstProp.diff | 45 - ...let_loops.change_loop_body.PreCodegen.after.mir | 17 - tests/mir-opt/while_let_loops.rs | 14 - tests/pretty/offset_of.rs | 4 + tests/pretty/tests-are-sorted.pp | 1 + .../hotplug_codegen_backend/the_backend.rs | 2 +- tests/run-make-fulldeps/obtain-borrowck/driver.rs | 20 +- tests/run-make/CURRENT_RUSTC_VERSION/Makefile | 6 + tests/run-make/CURRENT_RUSTC_VERSION/main.rs | 4 + tests/run-make/CURRENT_RUSTC_VERSION/stable.rs | 5 + .../run-make/allocator-shim-circular-deps/Makefile | 7 + .../run-make/allocator-shim-circular-deps/main.rs | 5 + .../allocator-shim-circular-deps/my_lib.rs | 10 + .../run-make/branch-protection-check-IBT/Makefile | 15 + tests/run-make/branch-protection-check-IBT/main.rs | 3 + .../run-make/c-unwind-abi-catch-lib-panic/Makefile | 1 + .../run-make/c-unwind-abi-catch-lib-panic/main.rs | 1 - .../run-make/c-unwind-abi-catch-lib-panic/panic.rs | 1 - tests/run-make/c-unwind-abi-catch-panic/Makefile | 1 + tests/run-make/c-unwind-abi-catch-panic/main.rs | 1 - tests/run-make/const-prop-lint/Makefile | 9 + tests/run-make/const-prop-lint/input.rs | 5 + tests/run-make/const_fn_mir/Makefile | 1 + tests/run-make/core-no-oom-handling/Makefile | 6 + .../coverage-llvmir/filecheck.testprog.txt | 2 +- tests/run-make/coverage-reports/Makefile | 25 +- .../expected_show_coverage.async.txt | 4 +- .../expected_show_coverage.generics.txt | 10 +- .../expected_show_coverage.sort_groups.txt | 49 ++ .../expected_show_coverage.test_harness.txt | 11 + .../expected_show_coverage.uses_crate.txt | 16 +- .../expected_show_coverage.uses_inline_crate.txt | 14 +- tests/run-make/coverage-reports/sort_subviews.py | 50 ++ tests/run-make/coverage/sort_groups.rs | 23 + tests/run-make/coverage/test_harness.rs | 10 + tests/run-make/coverage/uses_crate.rs | 3 + tests/run-make/coverage/uses_inline_crate.rs | 3 + tests/run-make/debug-assertions/Makefile | 1 + .../run-make/debugger-visualizer-dep-info/Makefile | 9 + tests/run-make/debugger-visualizer-dep-info/foo.py | 1 + .../run-make/debugger-visualizer-dep-info/main.rs | 12 + .../my_visualizers/bar.natvis | 1 + .../run-make/forced-unwind-terminate-pof/Makefile | 9 + tests/run-make/forced-unwind-terminate-pof/foo.rs | 17 + tests/run-make/foreign-double-unwind/Makefile | 1 + tests/run-make/foreign-double-unwind/foo.rs | 2 - tests/run-make/foreign-exceptions/Makefile | 1 + tests/run-make/foreign-exceptions/foo.rs | 2 - tests/run-make/foreign-rust-exceptions/Makefile | 1 + tests/run-make/foreign-rust-exceptions/bar.rs | 1 - tests/run-make/foreign-rust-exceptions/foo.rs | 2 - tests/run-make/inaccessible-temp-dir/Makefile | 32 + tests/run-make/inaccessible-temp-dir/program.rs | 1 + .../incremental-debugger-visualizer/Makefile | 49 ++ .../incremental-debugger-visualizer/foo.rs | 6 + tests/run-make/issue-107094/Makefile | 7 + tests/run-make/issue-83045/Makefile | 2 +- tests/run-make/libtest-json/Makefile | 1 + tests/run-make/libtest-junit/Makefile | 19 + tests/run-make/libtest-junit/f.rs | 23 + tests/run-make/libtest-junit/output-default.xml | 1 + .../libtest-junit/output-stdout-success.xml | 1 + tests/run-make/libtest-junit/validate_junit.py | 12 + tests/run-make/no-alloc-shim/Makefile | 24 + tests/run-make/no-alloc-shim/foo.rs | 44 + tests/run-make/pointer-auth-link-with-c/Makefile | 4 +- tests/run-make/print-native-static-libs/Makefile | 15 + tests/run-make/print-native-static-libs/bar.rs | 13 + tests/run-make/print-native-static-libs/foo.rs | 15 + .../raw-dylib-alt-calling-convention/lib.rs | 1 - tests/run-make/raw-dylib-c/lib.rs | 2 - tests/run-make/raw-dylib-cross-compilation/lib.rs | 1 - tests/run-make/raw-dylib-custom-dlltool/Makefile | 11 + tests/run-make/raw-dylib-custom-dlltool/lib.rs | 10 + tests/run-make/raw-dylib-custom-dlltool/output.txt | 1 + tests/run-make/raw-dylib-custom-dlltool/script.cmd | 2 + .../run-make/raw-dylib-import-name-type/driver.rs | 1 - .../raw-dylib-inline-cross-dylib/driver.rs | 2 - tests/run-make/raw-dylib-inline-cross-dylib/lib.rs | 2 - tests/run-make/raw-dylib-link-ordinal/lib.rs | 2 - tests/run-make/raw-dylib-stdcall-ordinal/lib.rs | 2 - tests/run-make/short-ice/Makefile | 9 + tests/run-make/short-ice/check.sh | 36 + tests/run-make/short-ice/src/lib.rs | 7 + tests/run-make/static-unwinding/Makefile | 1 + tests/run-make/staticlib-dylib-linkage/Makefile | 21 + tests/run-make/staticlib-dylib-linkage/bar.rs | 5 + tests/run-make/staticlib-dylib-linkage/foo.c | 10 + tests/run-make/staticlib-dylib-linkage/foo.rs | 13 + tests/run-make/test-benches/Makefile | 1 + tests/run-make/translation/Makefile | 2 + .../valid-print-requests.stderr | 2 +- tests/rustdoc-gui/anchors.goml | 36 +- tests/rustdoc-gui/check-stab-in-docblock.goml | 18 +- tests/rustdoc-gui/codeblock-sub.goml | 2 +- tests/rustdoc-gui/codeblock-tooltip.goml | 18 +- tests/rustdoc-gui/docblock-details.goml | 2 +- tests/rustdoc-gui/highlight-colors.goml | 84 +- tests/rustdoc-gui/item-info.goml | 4 +- tests/rustdoc-gui/jump-to-def-background.goml | 6 +- tests/rustdoc-gui/notable-trait.goml | 8 +- .../rustdoc-gui/scrape-examples-button-focus.goml | 6 +- tests/rustdoc-gui/scrape-examples-color.goml | 42 +- tests/rustdoc-gui/scrape-examples-layout.goml | 7 +- tests/rustdoc-gui/search-corrections.goml | 56 ++ tests/rustdoc-gui/search-result-color.goml | 172 ++-- tests/rustdoc-gui/search-result-display.goml | 4 +- tests/rustdoc-gui/settings.goml | 15 +- tests/rustdoc-gui/sidebar-source-code-display.goml | 26 +- tests/rustdoc-gui/sidebar.goml | 14 +- tests/rustdoc-gui/source-anchor-scroll.goml | 8 +- tests/rustdoc-gui/source-code-page.goml | 69 +- tests/rustdoc-gui/src-font-size.goml | 2 +- tests/rustdoc-gui/src/extend_css/lib.rs | 1 + tests/rustdoc-gui/src/link_to_definition/lib.rs | 1 + tests/rustdoc-gui/src/scrape_examples/src/lib.rs | 1 + tests/rustdoc-gui/stab-badge.goml | 12 +- tests/rustdoc-gui/struct-fields.goml | 2 +- tests/rustdoc-gui/type-declation-overflow.goml | 2 +- tests/rustdoc-js/generics-trait.js | 27 + tests/rustdoc-js/slice-array.js | 65 ++ tests/rustdoc-js/slice-array.rs | 16 + tests/rustdoc-json/assoc_items.rs | 27 +- tests/rustdoc-json/blanket_impls.rs | 6 +- tests/rustdoc-json/enums/discriminant/basic.rs | 12 +- tests/rustdoc-json/enums/discriminant/expr.rs | 36 +- tests/rustdoc-json/enums/discriminant/limits.rs | 32 +- .../discriminant/num_underscore_and_suffix.rs | 18 +- .../discriminant/only_some_have_discriminant.rs | 10 +- tests/rustdoc-json/enums/discriminant/struct.rs | 12 +- tests/rustdoc-json/enums/discriminant/tuple.rs | 12 +- .../enums/doc_link_to_foreign_variant.rs | 2 +- tests/rustdoc-json/enums/field_hidden.rs | 4 +- tests/rustdoc-json/enums/kind.rs | 28 +- tests/rustdoc-json/enums/struct_field_hidden.rs | 8 +- tests/rustdoc-json/enums/tuple_fields_hidden.rs | 80 +- tests/rustdoc-json/enums/use_glob.rs | 8 +- tests/rustdoc-json/enums/use_variant.rs | 8 +- tests/rustdoc-json/enums/use_variant_foreign.rs | 2 +- tests/rustdoc-json/enums/variant_struct.rs | 8 +- tests/rustdoc-json/enums/variant_tuple_struct.rs | 8 +- tests/rustdoc-json/fn_pointer/abi.rs | 15 +- tests/rustdoc-json/fn_pointer/generics.rs | 15 +- tests/rustdoc-json/fn_pointer/qualifiers.rs | 14 +- tests/rustdoc-json/fns/abi.rs | 15 +- tests/rustdoc-json/fns/async_return.rs | 26 +- tests/rustdoc-json/fns/extern_c_variadic.rs | 4 +- tests/rustdoc-json/fns/generic_args.rs | 88 +- tests/rustdoc-json/fns/generic_returns.rs | 9 +- tests/rustdoc-json/fns/generics.rs | 29 +- tests/rustdoc-json/fns/pattern_arg.rs | 4 +- tests/rustdoc-json/fns/qualifiers.rs | 36 +- tests/rustdoc-json/fns/return_type_alias.rs | 3 +- .../rustdoc-json/generic-associated-types/gats.rs | 36 +- tests/rustdoc-json/glob_import.rs | 2 +- tests/rustdoc-json/impls/auto.rs | 3 +- tests/rustdoc-json/impls/foreign_for_local.rs | 8 +- tests/rustdoc-json/impls/impl_item_visibility.rs | 26 + .../impls/impl_item_visibility_show_hidden.rs | 28 + .../impls/impl_item_visibility_show_private.rs | 27 + tests/rustdoc-json/impls/import_from_private.rs | 16 +- tests/rustdoc-json/impls/local_for_foreign.rs | 8 +- tests/rustdoc-json/impls/local_for_local.rs | 8 +- .../impls/local_for_local_primitive.rs | 7 +- tests/rustdoc-json/impls/local_for_primitive.rs | 2 +- tests/rustdoc-json/lifetime/longest.rs | 37 +- tests/rustdoc-json/lifetime/outlives.rs | 32 +- tests/rustdoc-json/methods/abi.rs | 29 +- tests/rustdoc-json/methods/qualifiers.rs | 36 +- tests/rustdoc-json/nested.rs | 31 +- tests/rustdoc-json/non_lifetime_binders.rs | 10 +- tests/rustdoc-json/primitives/local_primitive.rs | 2 +- tests/rustdoc-json/primitives/primitive_impls.rs | 6 +- tests/rustdoc-json/primitives/primitive_type.rs | 15 +- tests/rustdoc-json/primitives/use_primitive.rs | 4 +- .../reexport/auxiliary/enum_with_discriminant.rs | 6 + .../reexport/doc_inline_external_crate.rs | 11 + .../reexport/export_extern_crate_as_self.rs | 2 +- tests/rustdoc-json/reexport/extern_crate_glob.rs | 11 + tests/rustdoc-json/reexport/glob_collision.rs | 28 +- tests/rustdoc-json/reexport/glob_empty_mod.rs | 4 +- tests/rustdoc-json/reexport/glob_extern.rs | 13 +- tests/rustdoc-json/reexport/glob_private.rs | 20 +- tests/rustdoc-json/reexport/in_root_and_mod.rs | 4 +- tests/rustdoc-json/reexport/in_root_and_mod_pub.rs | 16 +- tests/rustdoc-json/reexport/macro.rs | 5 +- tests/rustdoc-json/reexport/mod_not_included.rs | 4 +- .../reexport/private_twice_one_inline.rs | 10 +- tests/rustdoc-json/reexport/private_two_names.rs | 16 +- .../reexport_method_from_private_module.rs | 4 +- tests/rustdoc-json/reexport/rename_private.rs | 4 +- tests/rustdoc-json/reexport/rename_public.rs | 11 +- .../reexport/same_name_different_types.rs | 8 +- .../same_type_reexported_more_than_once.rs | 12 +- tests/rustdoc-json/reexport/simple_private.rs | 8 +- tests/rustdoc-json/reexport/simple_public.rs | 9 +- tests/rustdoc-json/return_private.rs | 4 +- tests/rustdoc-json/structs/plain_all_pub.rs | 8 +- tests/rustdoc-json/structs/plain_doc_hidden.rs | 6 +- tests/rustdoc-json/structs/plain_empty.rs | 6 +- tests/rustdoc-json/structs/plain_pub_priv.rs | 6 +- tests/rustdoc-json/structs/tuple.rs | 4 +- tests/rustdoc-json/structs/tuple_empty.rs | 2 +- tests/rustdoc-json/structs/tuple_pub_priv.rs | 8 +- tests/rustdoc-json/structs/unit.rs | 4 +- tests/rustdoc-json/structs/with_generics.rs | 14 +- tests/rustdoc-json/structs/with_primitives.rs | 12 +- tests/rustdoc-json/traits/has_body.rs | 14 +- tests/rustdoc-json/traits/implementors.rs | 10 +- tests/rustdoc-json/traits/supertrait.rs | 16 +- tests/rustdoc-json/traits/trait_alias.rs | 18 +- tests/rustdoc-json/type/dyn.rs | 68 +- tests/rustdoc-json/type/extern.rs | 3 +- tests/rustdoc-json/type/fn_lifetime.rs | 39 +- tests/rustdoc-json/type/generic_default.rs | 42 +- tests/rustdoc-json/type/hrtb.rs | 18 +- .../rustdoc-json/type/inherent_associated_type.rs | 26 + .../type/inherent_associated_type_bound.rs | 19 + .../type/inherent_associated_type_projections.rs | 32 + tests/rustdoc-json/unions/impl.rs | 6 +- tests/rustdoc-json/unions/union.rs | 8 +- tests/rustdoc-ui/assoc-item-not-in-scope.rs | 22 - tests/rustdoc-ui/assoc-item-not-in-scope.stderr | 14 - tests/rustdoc-ui/auxiliary/empty-fn.rs | 3 - tests/rustdoc-ui/auxiliary/extern_macros.rs | 7 - tests/rustdoc-ui/auxiliary/issue-61592.rs | 3 - tests/rustdoc-ui/auxiliary/panic-handler.rs | 9 - tests/rustdoc-ui/bare-urls.fixed | 60 -- tests/rustdoc-ui/bare-urls.rs | 60 -- tests/rustdoc-ui/bare-urls.stderr | 143 --- tests/rustdoc-ui/block-doc-comment.rs | 17 - tests/rustdoc-ui/block-doc-comment.stdout | 5 - tests/rustdoc-ui/cfg-test.rs | 31 - tests/rustdoc-ui/cfg-test.stdout | 7 - tests/rustdoc-ui/check-attr-test.rs | 31 - tests/rustdoc-ui/check-attr-test.stderr | 151 ---- tests/rustdoc-ui/check-attr.rs | 41 - tests/rustdoc-ui/check-attr.stderr | 175 ---- tests/rustdoc-ui/check-cfg-test.rs | 12 - tests/rustdoc-ui/check-cfg-test.stderr | 11 - tests/rustdoc-ui/check-cfg-test.stdout | 6 - tests/rustdoc-ui/check-cfg-unstable.rs | 2 - tests/rustdoc-ui/check-cfg-unstable.stderr | 2 - tests/rustdoc-ui/check-cfg.rs | 7 - tests/rustdoc-ui/check-cfg.stderr | 10 - tests/rustdoc-ui/check-cfg/check-cfg-test.stderr | 11 + tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs | 2 + .../rustdoc-ui/check-cfg/check-cfg-unstable.stderr | 2 + tests/rustdoc-ui/check-cfg/check-cfg.rs | 7 + tests/rustdoc-ui/check-cfg/check-cfg.stderr | 10 + tests/rustdoc-ui/check-fail.rs | 23 - tests/rustdoc-ui/check-fail.stderr | 56 -- tests/rustdoc-ui/check.rs | 15 - tests/rustdoc-ui/check.stderr | 61 -- .../deny-intra-link-resolution-failure.rs | 4 - .../deny-intra-link-resolution-failure.stderr | 15 - tests/rustdoc-ui/deny-missing-docs-crate.rs | 3 - tests/rustdoc-ui/deny-missing-docs-crate.stderr | 22 - tests/rustdoc-ui/deny-missing-docs-macro.rs | 8 - tests/rustdoc-ui/deny-missing-docs-macro.stderr | 14 - tests/rustdoc-ui/display-output.rs | 15 - tests/rustdoc-ui/display-output.stdout | 43 - tests/rustdoc-ui/doc-attr.rs | 25 - tests/rustdoc-ui/doc-attr.stderr | 71 -- tests/rustdoc-ui/doc-comment-multi-line-attr.rs | 11 - .../rustdoc-ui/doc-comment-multi-line-attr.stdout | 6 - .../rustdoc-ui/doc-comment-multi-line-cfg-attr.rs | 12 - .../doc-comment-multi-line-cfg-attr.stdout | 6 - tests/rustdoc-ui/doc-spotlight.fixed | 8 - tests/rustdoc-ui/doc-spotlight.rs | 8 - tests/rustdoc-ui/doc-spotlight.stderr | 19 - tests/rustdoc-ui/doc-test-attr-pass.rs | 8 - tests/rustdoc-ui/doc-test-attr.rs | 14 - tests/rustdoc-ui/doc-test-attr.stderr | 34 - tests/rustdoc-ui/doc-test-doctest-feature.rs | 13 - tests/rustdoc-ui/doc-test-doctest-feature.stdout | 6 - tests/rustdoc-ui/doc-test-rustdoc-feature.rs | 15 - tests/rustdoc-ui/doc-test-rustdoc-feature.stdout | 6 - tests/rustdoc-ui/doc-without-codeblock.rs | 23 - tests/rustdoc-ui/doc-without-codeblock.stderr | 38 - tests/rustdoc-ui/doc_cfg_hide.rs | 11 - tests/rustdoc-ui/doc_cfg_hide.stderr | 40 - tests/rustdoc-ui/doctest-edition.rs | 16 - tests/rustdoc-ui/doctest-edition.stderr | 22 - .../doctest-multiline-crate-attribute.rs | 10 - .../doctest-multiline-crate-attribute.stdout | 6 - tests/rustdoc-ui/doctest-output.rs | 28 - tests/rustdoc-ui/doctest-output.stdout | 8 - .../rustdoc-ui/doctest/auxiliary/extern_macros.rs | 7 + tests/rustdoc-ui/doctest/block-doc-comment.rs | 17 + tests/rustdoc-ui/doctest/block-doc-comment.stdout | 5 + tests/rustdoc-ui/doctest/cfg-test.rs | 31 + tests/rustdoc-ui/doctest/cfg-test.stdout | 7 + tests/rustdoc-ui/doctest/check-attr-test.rs | 31 + tests/rustdoc-ui/doctest/check-attr-test.stderr | 151 ++++ tests/rustdoc-ui/doctest/check-cfg-test.rs | 12 + tests/rustdoc-ui/doctest/check-cfg-test.stderr | 11 + tests/rustdoc-ui/doctest/check-cfg-test.stdout | 6 + tests/rustdoc-ui/doctest/display-output.rs | 15 + tests/rustdoc-ui/doctest/display-output.stdout | 43 + .../doctest/doc-comment-multi-line-attr.rs | 11 + .../doctest/doc-comment-multi-line-attr.stdout | 6 + .../doctest/doc-comment-multi-line-cfg-attr.rs | 12 + .../doctest/doc-comment-multi-line-cfg-attr.stdout | 6 + tests/rustdoc-ui/doctest/doc-test-attr-pass.rs | 8 + tests/rustdoc-ui/doctest/doc-test-attr.rs | 14 + tests/rustdoc-ui/doctest/doc-test-attr.stderr | 34 + .../rustdoc-ui/doctest/doc-test-doctest-feature.rs | 13 + .../doctest/doc-test-doctest-feature.stdout | 6 + .../rustdoc-ui/doctest/doc-test-rustdoc-feature.rs | 15 + .../doctest/doc-test-rustdoc-feature.stdout | 6 + tests/rustdoc-ui/doctest/doctest-edition.rs | 16 + tests/rustdoc-ui/doctest/doctest-edition.stderr | 22 + .../doctest/doctest-multiline-crate-attribute.rs | 10 + .../doctest-multiline-crate-attribute.stdout | 6 + tests/rustdoc-ui/doctest/doctest-output.rs | 28 + tests/rustdoc-ui/doctest/doctest-output.stdout | 8 + .../doctest/failed-doctest-compile-fail.rs | 12 + .../doctest/failed-doctest-compile-fail.stdout | 14 + .../failed-doctest-extra-semicolon-on-item.rs | 18 + .../failed-doctest-extra-semicolon-on-item.stdout | 24 + .../doctest/failed-doctest-missing-codes.rs | 12 + .../doctest/failed-doctest-missing-codes.stdout | 25 + .../doctest/failed-doctest-output-windows.rs | 28 + .../doctest/failed-doctest-output-windows.stdout | 39 + tests/rustdoc-ui/doctest/failed-doctest-output.rs | 28 + .../doctest/failed-doctest-output.stdout | 39 + .../doctest/failed-doctest-should-panic.rs | 12 + .../doctest/failed-doctest-should-panic.stdout | 14 + tests/rustdoc-ui/doctest/no-run-flag-error.rs | 6 + tests/rustdoc-ui/doctest/no-run-flag-error.stderr | 2 + tests/rustdoc-ui/doctest/no-run-flag.rs | 38 + tests/rustdoc-ui/doctest/no-run-flag.stdout | 12 + tests/rustdoc-ui/doctest/nocapture-fail.rs | 12 + tests/rustdoc-ui/doctest/nocapture-fail.stderr | 18 + tests/rustdoc-ui/doctest/nocapture-fail.stdout | 6 + tests/rustdoc-ui/doctest/nocapture.rs | 10 + tests/rustdoc-ui/doctest/nocapture.stderr | 1 + tests/rustdoc-ui/doctest/nocapture.stdout | 7 + tests/rustdoc-ui/doctest/private-doc-test.rs | 12 + tests/rustdoc-ui/doctest/private-item-doc-test.rs | 11 + .../doctest/private-item-doc-test.stderr | 18 + .../doctest/private-public-item-doc-test.rs | 11 + .../doctest/private-public-item-doc-test.stderr | 18 + .../doctest/public-reexported-item-doc-test.rs | 16 + .../doctest/run-directory.correct.stdout | 6 + .../doctest/run-directory.incorrect.stdout | 6 + tests/rustdoc-ui/doctest/run-directory.rs | 23 + tests/rustdoc-ui/doctest/test-compile-fail1.rs | 8 + tests/rustdoc-ui/doctest/test-compile-fail1.stderr | 14 + tests/rustdoc-ui/doctest/test-compile-fail2.rs | 3 + tests/rustdoc-ui/doctest/test-compile-fail2.stderr | 8 + tests/rustdoc-ui/doctest/test-compile-fail3.rs | 3 + tests/rustdoc-ui/doctest/test-compile-fail3.stderr | 9 + tests/rustdoc-ui/doctest/test-no_std.rs | 13 + tests/rustdoc-ui/doctest/test-no_std.stdout | 6 + tests/rustdoc-ui/doctest/test-type.rs | 26 + tests/rustdoc-ui/doctest/test-type.stdout | 10 + tests/rustdoc-ui/doctest/unparseable-doc-test.rs | 11 + .../rustdoc-ui/doctest/unparseable-doc-test.stdout | 23 + .../infinite-recursive-type-2.rs | 9 + .../infinite-recursive-type-impl-trait-return.rs | 14 + ...nfinite-recursive-type-impl-trait-return.stderr | 16 + .../error-in-impl-trait/infinite-recursive-type.rs | 9 + tests/rustdoc-ui/expect-tool-lint-rfc-2383.rs | 157 ---- tests/rustdoc-ui/expect-tool-lint-rfc-2383.stderr | 28 - tests/rustdoc-ui/failed-doctest-compile-fail.rs | 12 - .../rustdoc-ui/failed-doctest-compile-fail.stdout | 14 - .../failed-doctest-extra-semicolon-on-item.rs | 18 - .../failed-doctest-extra-semicolon-on-item.stdout | 24 - tests/rustdoc-ui/failed-doctest-missing-codes.rs | 12 - .../rustdoc-ui/failed-doctest-missing-codes.stdout | 25 - tests/rustdoc-ui/failed-doctest-output-windows.rs | 28 - .../failed-doctest-output-windows.stdout | 39 - tests/rustdoc-ui/failed-doctest-output.rs | 28 - tests/rustdoc-ui/failed-doctest-output.stdout | 39 - tests/rustdoc-ui/failed-doctest-should-panic.rs | 12 - .../rustdoc-ui/failed-doctest-should-panic.stdout | 14 - ...ature-gate-rustdoc_missing_doc_code_examples.rs | 12 - ...e-gate-rustdoc_missing_doc_code_examples.stderr | 37 - .../generate-link-to-definition-opt-unstable.rs | 6 - ...generate-link-to-definition-opt-unstable.stderr | 2 - .../rustdoc-ui/generate-link-to-definition-opt.rs | 6 - .../generate-link-to-definition-opt.stderr | 2 - .../rustdoc-ui/generate-link-to-definition-opt2.rs | 6 - .../generate-link-to-definition-opt2.stderr | 2 - .../generate-link-to-definition-opt-unstable.rs | 6 + ...generate-link-to-definition-opt-unstable.stderr | 2 + .../generate-link-to-definition-opt.rs | 6 + .../generate-link-to-definition-opt.stderr | 2 + .../generate-link-to-definition-opt2.rs | 6 + .../generate-link-to-definition-opt2.stderr | 2 + tests/rustdoc-ui/ice-bug-report-url.rs | 14 + tests/rustdoc-ui/ice-bug-report-url.stderr | 17 + .../infinite-recursive-type-impl-trait-return.rs | 14 - ...nfinite-recursive-type-impl-trait-return.stderr | 16 - .../infinite-recursive-type-impl-trait.rs | 6 - .../infinite-recursive-type-impl-trait.stderr | 16 - .../intra-doc/assoc-item-not-in-scope.rs | 22 + .../intra-doc/assoc-item-not-in-scope.stderr | 14 + .../intra-doc/auxiliary/inner-crate-enum.rs | 3 - .../deny-intra-link-resolution-failure.rs | 4 + .../deny-intra-link-resolution-failure.stderr | 15 + tests/rustdoc-ui/intra-doc/inline-external-enum.rs | 8 - .../intra-doc/issue-110495-suffix-with-space.rs | 6 + .../issue-110495-suffix-with-space.stderr | 55 ++ .../intra-doc/issue-111189-resolution-ice.rs | 10 + .../intra-doc/issue-111189-resolution-ice.stderr | 21 + tests/rustdoc-ui/intra-doc/pub-export-lint.rs | 5 + tests/rustdoc-ui/intra-doc/pub-export-lint.stderr | 15 + .../intra-doc/reference-link-reports-error-once.rs | 20 + .../reference-link-reports-error-once.stderr | 63 ++ tests/rustdoc-ui/intra-doc/reference-links.rs | 6 + tests/rustdoc-ui/intra-doc/reference-links.stderr | 14 + tests/rustdoc-ui/intra-doc/weird-syntax.rs | 140 +++ tests/rustdoc-ui/intra-doc/weird-syntax.stderr | 272 ++++++ tests/rustdoc-ui/invalid-doc-attr.rs | 32 - tests/rustdoc-ui/invalid-doc-attr.stderr | 78 -- tests/rustdoc-ui/invalid-html-self-closing-tag.rs | 70 -- .../invalid-html-self-closing-tag.stderr | 80 -- tests/rustdoc-ui/invalid-html-tags.rs | 123 --- tests/rustdoc-ui/invalid-html-tags.stderr | 104 --- tests/rustdoc-ui/issue-101076.rs | 14 - tests/rustdoc-ui/issue-102986.rs | 4 - tests/rustdoc-ui/issue-102986.stderr | 14 - tests/rustdoc-ui/issue-103997.rs | 6 - tests/rustdoc-ui/issue-103997.stderr | 10 - tests/rustdoc-ui/issue-105334.rs | 2 - tests/rustdoc-ui/issue-105334.stderr | 9 - tests/rustdoc-ui/issue-105737.rs | 4 - tests/rustdoc-ui/issue-105737.stderr | 12 - tests/rustdoc-ui/issue-105742.rs | 50 -- tests/rustdoc-ui/issue-105742.stderr | 354 -------- tests/rustdoc-ui/issue-106213.rs | 7 - tests/rustdoc-ui/issue-106213.stderr | 9 - tests/rustdoc-ui/issue-106226.rs | 3 - tests/rustdoc-ui/issue-106226.stderr | 9 - tests/rustdoc-ui/issue-107918.rs | 12 - .../rustdoc-ui/issue-109282-import-inline-merge.rs | 14 - .../issue-110629-private-type-cycle-dyn.rs | 12 + .../issue-110629-private-type-cycle-dyn.stderr | 25 + .../rustdoc-ui/issue-110629-private-type-cycle.rs | 15 + tests/rustdoc-ui/issue-58473-2.rs | 12 - tests/rustdoc-ui/issue-58473.rs | 10 - tests/rustdoc-ui/issue-61592-2.rs | 10 - tests/rustdoc-ui/issue-61592-2.stderr | 12 - tests/rustdoc-ui/issue-61592.rs | 8 - tests/rustdoc-ui/issue-61592.stderr | 11 - tests/rustdoc-ui/issue-61732.rs | 4 - tests/rustdoc-ui/issue-61732.stderr | 11 - tests/rustdoc-ui/issue-74134.private.stderr | 11 - tests/rustdoc-ui/issue-74134.public.stderr | 11 - tests/rustdoc-ui/issue-74134.rs | 41 - tests/rustdoc-ui/issue-79465.rs | 2 - tests/rustdoc-ui/issue-79465.stderr | 9 - tests/rustdoc-ui/issue-79467.rs | 8 - tests/rustdoc-ui/issue-79467.stderr | 9 - tests/rustdoc-ui/issue-79494.rs | 5 - tests/rustdoc-ui/issue-79494.stderr | 12 - tests/rustdoc-ui/issue-80992.rs | 11 - tests/rustdoc-ui/issue-80992.stdout | 6 - tests/rustdoc-ui/issue-81662-shortness.rs | 12 - tests/rustdoc-ui/issue-81662-shortness.stdout | 16 - tests/rustdoc-ui/issue-83883-describe-lints.rs | 10 - tests/rustdoc-ui/issue-83883-describe-lints.stdout | 24 - tests/rustdoc-ui/issue-91134.rs | 14 - tests/rustdoc-ui/issue-91134.stdout | 6 - tests/rustdoc-ui/issue-91713.rs | 3 - tests/rustdoc-ui/issue-91713.stderr | 5 - tests/rustdoc-ui/issue-91713.stdout | 25 - tests/rustdoc-ui/issue-96287.rs | 16 - tests/rustdoc-ui/issue-96287.stderr | 9 - tests/rustdoc-ui/issue-98690.rs | 10 - tests/rustdoc-ui/issue-98690.stderr | 1 - tests/rustdoc-ui/issues/auxiliary/empty-fn.rs | 3 + tests/rustdoc-ui/issues/auxiliary/issue-61592.rs | 3 + tests/rustdoc-ui/issues/auxiliary/panic-handler.rs | 9 + tests/rustdoc-ui/issues/issue-101076.rs | 14 + tests/rustdoc-ui/issues/issue-102986.rs | 4 + tests/rustdoc-ui/issues/issue-102986.stderr | 14 + tests/rustdoc-ui/issues/issue-103997.rs | 6 + tests/rustdoc-ui/issues/issue-103997.stderr | 10 + tests/rustdoc-ui/issues/issue-105334.rs | 2 + tests/rustdoc-ui/issues/issue-105334.stderr | 9 + tests/rustdoc-ui/issues/issue-105737.rs | 4 + tests/rustdoc-ui/issues/issue-105737.stderr | 12 + tests/rustdoc-ui/issues/issue-105742.rs | 58 ++ tests/rustdoc-ui/issues/issue-105742.stderr | 482 ++++++++++ tests/rustdoc-ui/issues/issue-106213.rs | 7 + tests/rustdoc-ui/issues/issue-106213.stderr | 9 + tests/rustdoc-ui/issues/issue-106226.rs | 3 + tests/rustdoc-ui/issues/issue-106226.stderr | 9 + tests/rustdoc-ui/issues/issue-107918.rs | 12 + .../issues/issue-109282-import-inline-merge.rs | 14 + tests/rustdoc-ui/issues/issue-110900.rs | 28 + tests/rustdoc-ui/issues/issue-58473-2.rs | 12 + tests/rustdoc-ui/issues/issue-58473.rs | 10 + tests/rustdoc-ui/issues/issue-61592-2.rs | 10 + tests/rustdoc-ui/issues/issue-61592-2.stderr | 12 + tests/rustdoc-ui/issues/issue-61592.rs | 8 + tests/rustdoc-ui/issues/issue-61592.stderr | 11 + tests/rustdoc-ui/issues/issue-61732.rs | 4 + tests/rustdoc-ui/issues/issue-61732.stderr | 11 + tests/rustdoc-ui/issues/issue-74134.private.stderr | 11 + tests/rustdoc-ui/issues/issue-74134.public.stderr | 11 + tests/rustdoc-ui/issues/issue-74134.rs | 41 + tests/rustdoc-ui/issues/issue-79465.rs | 2 + tests/rustdoc-ui/issues/issue-79465.stderr | 9 + tests/rustdoc-ui/issues/issue-79467.rs | 8 + tests/rustdoc-ui/issues/issue-79467.stderr | 9 + tests/rustdoc-ui/issues/issue-79494.rs | 5 + tests/rustdoc-ui/issues/issue-79494.stderr | 12 + tests/rustdoc-ui/issues/issue-80992.rs | 11 + tests/rustdoc-ui/issues/issue-80992.stdout | 6 + tests/rustdoc-ui/issues/issue-81662-shortness.rs | 12 + .../rustdoc-ui/issues/issue-81662-shortness.stdout | 16 + .../issues/issue-83883-describe-lints.rs | 10 + .../issues/issue-83883-describe-lints.stdout | 24 + tests/rustdoc-ui/issues/issue-91134.rs | 14 + tests/rustdoc-ui/issues/issue-91134.stdout | 6 + tests/rustdoc-ui/issues/issue-91713.rs | 3 + tests/rustdoc-ui/issues/issue-91713.stderr | 5 + tests/rustdoc-ui/issues/issue-91713.stdout | 25 + tests/rustdoc-ui/issues/issue-96287.rs | 16 + tests/rustdoc-ui/issues/issue-96287.stderr | 9 + tests/rustdoc-ui/issues/issue-98690.rs | 10 + tests/rustdoc-ui/issues/issue-98690.stderr | 1 + tests/rustdoc-ui/lint-group.rs | 32 - tests/rustdoc-ui/lint-group.stderr | 54 -- tests/rustdoc-ui/lint-missing-doc-code-example.rs | 101 --- .../lint-missing-doc-code-example.stderr | 38 - tests/rustdoc-ui/lints/bare-urls.fixed | 60 ++ tests/rustdoc-ui/lints/bare-urls.rs | 60 ++ tests/rustdoc-ui/lints/bare-urls.stderr | 143 +++ tests/rustdoc-ui/lints/check-attr.rs | 41 + tests/rustdoc-ui/lints/check-attr.stderr | 175 ++++ tests/rustdoc-ui/lints/check-fail.rs | 23 + tests/rustdoc-ui/lints/check-fail.stderr | 56 ++ tests/rustdoc-ui/lints/check.rs | 15 + tests/rustdoc-ui/lints/check.stderr | 61 ++ tests/rustdoc-ui/lints/deny-missing-docs-crate.rs | 3 + .../lints/deny-missing-docs-crate.stderr | 22 + tests/rustdoc-ui/lints/deny-missing-docs-macro.rs | 8 + .../lints/deny-missing-docs-macro.stderr | 14 + tests/rustdoc-ui/lints/doc-attr.rs | 25 + tests/rustdoc-ui/lints/doc-attr.stderr | 71 ++ tests/rustdoc-ui/lints/doc-spotlight.fixed | 8 + tests/rustdoc-ui/lints/doc-spotlight.rs | 8 + tests/rustdoc-ui/lints/doc-spotlight.stderr | 19 + tests/rustdoc-ui/lints/doc-without-codeblock.rs | 23 + .../rustdoc-ui/lints/doc-without-codeblock.stderr | 38 + tests/rustdoc-ui/lints/doc_cfg_hide.rs | 11 + tests/rustdoc-ui/lints/doc_cfg_hide.stderr | 40 + .../rustdoc-ui/lints/expect-tool-lint-rfc-2383.rs | 157 ++++ .../lints/expect-tool-lint-rfc-2383.stderr | 28 + ...ature-gate-rustdoc_missing_doc_code_examples.rs | 12 + ...e-gate-rustdoc_missing_doc_code_examples.stderr | 37 + tests/rustdoc-ui/lints/invalid-doc-attr.rs | 32 + tests/rustdoc-ui/lints/invalid-doc-attr.stderr | 78 ++ .../lints/invalid-html-self-closing-tag.rs | 70 ++ .../lints/invalid-html-self-closing-tag.stderr | 80 ++ tests/rustdoc-ui/lints/invalid-html-tags.rs | 123 +++ tests/rustdoc-ui/lints/invalid-html-tags.stderr | 104 +++ tests/rustdoc-ui/lints/lint-group.rs | 32 + tests/rustdoc-ui/lints/lint-group.stderr | 54 ++ .../lints/lint-missing-doc-code-example.rs | 101 +++ .../lints/lint-missing-doc-code-example.stderr | 38 + tests/rustdoc-ui/lints/no-crate-level-doc-lint.rs | 6 + .../lints/no-crate-level-doc-lint.stderr | 12 + .../rustdoc-ui/lints/renamed-lint-still-applies.rs | 10 + .../lints/renamed-lint-still-applies.stderr | 42 + .../lints/rustdoc-all-only-stable-lints.rs | 6 + tests/rustdoc-ui/lints/unknown-renamed-lints.rs | 24 + .../rustdoc-ui/lints/unknown-renamed-lints.stderr | 62 ++ tests/rustdoc-ui/lints/unused-braces-lint.rs | 14 + tests/rustdoc-ui/lints/unused.rs | 14 + tests/rustdoc-ui/no-crate-level-doc-lint.rs | 6 - tests/rustdoc-ui/no-crate-level-doc-lint.stderr | 12 - tests/rustdoc-ui/no-run-flag-error.rs | 6 - tests/rustdoc-ui/no-run-flag-error.stderr | 2 - tests/rustdoc-ui/no-run-flag.rs | 38 - tests/rustdoc-ui/no-run-flag.stdout | 12 - tests/rustdoc-ui/nocapture-fail.rs | 12 - tests/rustdoc-ui/nocapture-fail.stderr | 18 - tests/rustdoc-ui/nocapture-fail.stdout | 6 - tests/rustdoc-ui/nocapture.rs | 10 - tests/rustdoc-ui/nocapture.stderr | 1 - tests/rustdoc-ui/nocapture.stdout | 7 - tests/rustdoc-ui/private-doc-test.rs | 12 - tests/rustdoc-ui/private-item-doc-test.rs | 11 - tests/rustdoc-ui/private-item-doc-test.stderr | 18 - tests/rustdoc-ui/private-public-item-doc-test.rs | 11 - .../rustdoc-ui/private-public-item-doc-test.stderr | 18 - tests/rustdoc-ui/pub-export-lint.rs | 5 - tests/rustdoc-ui/pub-export-lint.stderr | 15 - .../rustdoc-ui/public-reexported-item-doc-test.rs | 16 - .../reference-link-reports-error-once.rs | 20 - .../reference-link-reports-error-once.stderr | 63 -- tests/rustdoc-ui/reference-links.rs | 6 - tests/rustdoc-ui/reference-links.stderr | 14 - tests/rustdoc-ui/renamed-lint-still-applies.rs | 10 - tests/rustdoc-ui/renamed-lint-still-applies.stderr | 42 - tests/rustdoc-ui/run-directory.correct.stdout | 6 - tests/rustdoc-ui/run-directory.incorrect.stdout | 6 - tests/rustdoc-ui/run-directory.rs | 23 - tests/rustdoc-ui/rustdoc-all-only-stable-lints.rs | 6 - .../scrape-examples-fail-if-type-error.rs | 7 - .../scrape-examples-fail-if-type-error.stderr | 14 - tests/rustdoc-ui/scrape-examples-ice.rs | 4 - .../rustdoc-ui/scrape-examples-wrong-options-1.rs | 1 - .../scrape-examples-wrong-options-1.stderr | 2 - .../rustdoc-ui/scrape-examples-wrong-options-2.rs | 1 - .../scrape-examples-wrong-options-2.stderr | 2 - .../scrape-examples-fail-if-type-error.rs | 7 + .../scrape-examples-fail-if-type-error.stderr | 14 + .../scrape-examples/scrape-examples-ice.rs | 4 + .../scrape-examples-wrong-options-1.rs | 1 + .../scrape-examples-wrong-options-1.stderr | 2 + .../scrape-examples-wrong-options-2.rs | 1 + .../scrape-examples-wrong-options-2.stderr | 2 + tests/rustdoc-ui/test-compile-fail1.rs | 8 - tests/rustdoc-ui/test-compile-fail1.stderr | 14 - tests/rustdoc-ui/test-compile-fail2.rs | 3 - tests/rustdoc-ui/test-compile-fail2.stderr | 8 - tests/rustdoc-ui/test-compile-fail3.rs | 3 - tests/rustdoc-ui/test-compile-fail3.stderr | 9 - tests/rustdoc-ui/test-no_std.rs | 13 - tests/rustdoc-ui/test-no_std.stdout | 6 - tests/rustdoc-ui/test-type.rs | 26 - tests/rustdoc-ui/test-type.stdout | 10 - tests/rustdoc-ui/unescaped_backticks.rs | 354 ++++++++ tests/rustdoc-ui/unescaped_backticks.stderr | 971 +++++++++++++++++++++ tests/rustdoc-ui/unknown-renamed-lints.rs | 24 - tests/rustdoc-ui/unknown-renamed-lints.stderr | 62 -- tests/rustdoc-ui/unparseable-doc-test.rs | 11 - tests/rustdoc-ui/unparseable-doc-test.stdout | 23 - tests/rustdoc-ui/unused-braces-lint.rs | 14 - tests/rustdoc-ui/unused.rs | 14 - tests/rustdoc/deref-const-fn.rs | 38 - tests/rustdoc/deref-mut-methods.rs | 29 - tests/rustdoc/deref-recursive-pathbuf.rs | 25 - tests/rustdoc/deref-recursive.rs | 41 - tests/rustdoc/deref-slice-core.rs | 22 - tests/rustdoc/deref-to-primitive.rs | 15 - tests/rustdoc/deref-typedef.rs | 46 - tests/rustdoc/deref/deref-const-fn.rs | 38 + tests/rustdoc/deref/deref-multiple-impl-blocks.rs | 43 + tests/rustdoc/deref/deref-mut-methods.rs | 29 + tests/rustdoc/deref/deref-recursive-pathbuf.rs | 25 + tests/rustdoc/deref/deref-recursive.rs | 41 + tests/rustdoc/deref/deref-slice-core.rs | 22 + tests/rustdoc/deref/deref-to-primitive.rs | 15 + tests/rustdoc/deref/deref-typedef.rs | 46 + tests/rustdoc/deref/escape-deref-methods.rs | 35 + .../deref/issue-100679-sidebar-links-deref.rs | 30 + tests/rustdoc/deref/recursive-deref-sidebar.rs | 22 + tests/rustdoc/deref/recursive-deref.rs | 120 +++ tests/rustdoc/escape-deref-methods.rs | 35 - .../hide-complex-unevaluated-const-arguments.rs | 8 +- tests/rustdoc/impl-alias-substituted.rs | 9 + tests/rustdoc/inherent-projections.rs | 44 + tests/rustdoc/inline_cross/auxiliary/repr.rs | 22 + tests/rustdoc/inline_cross/repr.rs | 29 + .../rustdoc/intra-doc/inherent-associated-types.rs | 45 + tests/rustdoc/issue-100679-sidebar-links-deref.rs | 30 - tests/rustdoc/issue-106142.rs | 14 + tests/rustdoc/issue-110422-inner-private.rs | 64 ++ tests/rustdoc/issue-110629-private-type-cycle.rs | 19 + .../issue-111064-reexport-trait-from-hidden-2.rs | 31 + .../issue-111064-reexport-trait-from-hidden.rs | 21 + .../issue-46506-pub-reexport-of-pub-reexport.rs | 24 + .../issue-60522-duplicated-glob-reexport.rs | 39 + .../issue-94183-blanket-impl-reexported-trait.rs | 31 + tests/rustdoc/nested-items-issue-111415.rs | 36 + tests/rustdoc/playground-arg.rs | 2 +- tests/rustdoc/recursive-deref-sidebar.rs | 22 - tests/rustdoc/recursive-deref.rs | 120 --- tests/rustdoc/reexport-doc-hidden.rs | 3 +- tests/rustdoc/reexport-hidden-macro.rs | 2 +- tests/rustdoc/reexport-of-doc-hidden.rs | 42 + tests/rustdoc/rfc-2632-const-trait-impl.rs | 40 +- tests/rustdoc/test-strikethrough.rs | 13 +- tests/ui-fulldeps/auxiliary/empty-plugin.rs | 9 - tests/ui-fulldeps/auxiliary/issue-40001-plugin.rs | 61 -- tests/ui-fulldeps/auxiliary/lint-for-crate.rs | 43 - .../auxiliary/lint-group-plugin-test.rs | 44 - tests/ui-fulldeps/auxiliary/lint-plugin-test.rs | 33 - tests/ui-fulldeps/auxiliary/lint-tool-test.rs | 52 -- .../auxiliary/lto-syntax-extension-lib.rs | 5 - .../auxiliary/lto-syntax-extension-plugin.rs | 11 - tests/ui-fulldeps/auxiliary/multiple-plugins-1.rs | 10 - tests/ui-fulldeps/auxiliary/multiple-plugins-2.rs | 10 - .../auxiliary/outlive-expansion-phase.rs | 24 - tests/ui-fulldeps/auxiliary/rlib-crate-test.rs | 12 - tests/ui-fulldeps/compiler-calls.rs | 1 - .../deriving-encodable-decodable-box.rs | 34 - .../deriving-encodable-decodable-cell-refcell.rs | 44 - tests/ui-fulldeps/feature-gate-plugin.rs | 8 - tests/ui-fulldeps/feature-gate-plugin.stderr | 20 - tests/ui-fulldeps/fluent-messages/test.rs | 4 +- tests/ui-fulldeps/gated-plugin.rs | 8 - tests/ui-fulldeps/gated-plugin.stderr | 20 - tests/ui-fulldeps/hash-stable-is-unstable.rs | 1 - tests/ui-fulldeps/hash-stable-is-unstable.stderr | 10 +- tests/ui-fulldeps/internal-lints/diagnostics.rs | 8 +- .../ui-fulldeps/internal-lints/diagnostics.stderr | 10 +- tests/ui-fulldeps/issue-14021.rs | 33 - tests/ui-fulldeps/issue-15778-fail.rs | 9 - tests/ui-fulldeps/issue-15778-fail.stderr | 22 - tests/ui-fulldeps/issue-40001.rs | 10 - tests/ui-fulldeps/issue-40001.stderr | 10 - .../ui-fulldeps/lint-group-denied-lint-allowed.rs | 7 - .../lint-group-forbid-always-trumps-cli.rs | 7 - .../lint-group-forbid-always-trumps-cli.stderr | 10 - .../ui-fulldeps/lint-group-plugin-deny-cmdline.rs | 17 - .../lint-group-plugin-deny-cmdline.stderr | 26 - tests/ui-fulldeps/lint-group-plugin.rs | 17 - tests/ui-fulldeps/lint-group-plugin.stderr | 26 - tests/ui-fulldeps/lint-plugin-cmdline-allow.rs | 12 - tests/ui-fulldeps/lint-plugin-cmdline-allow.stderr | 10 - tests/ui-fulldeps/lint-plugin-cmdline-load.rs | 13 - tests/ui-fulldeps/lint-plugin-cmdline-load.stderr | 18 - tests/ui-fulldeps/lint-plugin-deny-attr.rs | 13 - tests/ui-fulldeps/lint-plugin-deny-attr.stderr | 22 - tests/ui-fulldeps/lint-plugin-deny-cmdline.rs | 13 - tests/ui-fulldeps/lint-plugin-deny-cmdline.stderr | 18 - tests/ui-fulldeps/lint-plugin-forbid-attrs.rs | 16 - tests/ui-fulldeps/lint-plugin-forbid-attrs.stderr | 41 - tests/ui-fulldeps/lint-plugin-forbid-cmdline.rs | 15 - .../ui-fulldeps/lint-plugin-forbid-cmdline.stderr | 35 - tests/ui-fulldeps/lint-plugin.rs | 13 - tests/ui-fulldeps/lint-plugin.stderr | 18 - tests/ui-fulldeps/lint-tool-cmdline-allow.rs | 12 - tests/ui-fulldeps/lint-tool-cmdline-allow.stderr | 30 - tests/ui-fulldeps/lint-tool-test.rs | 36 - tests/ui-fulldeps/lint-tool-test.stderr | 95 -- tests/ui-fulldeps/lto-syntax-extension.rs | 15 - tests/ui-fulldeps/lto-syntax-extension.stderr | 10 - tests/ui-fulldeps/macro-crate-rlib.rs | 8 - tests/ui-fulldeps/macro-crate-rlib.stderr | 9 - tests/ui-fulldeps/multiple-plugins.rs | 12 - tests/ui-fulldeps/multiple-plugins.stderr | 16 - tests/ui-fulldeps/outlive-expansion-phase.rs | 8 - tests/ui-fulldeps/outlive-expansion-phase.stderr | 10 - tests/ui-fulldeps/pathless-extern-unstable.rs | 1 - tests/ui-fulldeps/pathless-extern-unstable.stderr | 2 +- tests/ui-fulldeps/plugin-args.rs | 9 - tests/ui-fulldeps/plugin-args.stderr | 17 - tests/ui-fulldeps/plugin-as-extern-crate.rs | 10 - tests/ui-fulldeps/plugin/auxiliary/empty-plugin.rs | 9 + .../plugin/auxiliary/issue-40001-plugin.rs | 61 ++ .../ui-fulldeps/plugin/auxiliary/lint-for-crate.rs | 43 + .../plugin/auxiliary/lint-group-plugin-test.rs | 44 + .../plugin/auxiliary/lint-plugin-test.rs | 33 + .../ui-fulldeps/plugin/auxiliary/lint-tool-test.rs | 52 ++ .../plugin/auxiliary/lto-syntax-extension-lib.rs | 5 + .../auxiliary/lto-syntax-extension-plugin.rs | 11 + .../plugin/auxiliary/multiple-plugins-1.rs | 10 + .../plugin/auxiliary/multiple-plugins-2.rs | 10 + .../plugin/auxiliary/outlive-expansion-phase.rs | 24 + .../plugin/auxiliary/rlib-crate-test.rs | 12 + tests/ui-fulldeps/plugin/feature-gate-plugin.rs | 8 + .../ui-fulldeps/plugin/feature-gate-plugin.stderr | 20 + tests/ui-fulldeps/plugin/gated-plugin.rs | 8 + tests/ui-fulldeps/plugin/gated-plugin.stderr | 20 + tests/ui-fulldeps/plugin/issue-15778-fail.rs | 9 + tests/ui-fulldeps/plugin/issue-15778-fail.stderr | 22 + tests/ui-fulldeps/plugin/issue-40001.rs | 10 + tests/ui-fulldeps/plugin/issue-40001.stderr | 10 + .../plugin/lint-group-plugin-deny-cmdline.rs | 17 + .../plugin/lint-group-plugin-deny-cmdline.stderr | 26 + tests/ui-fulldeps/plugin/lint-group-plugin.rs | 17 + tests/ui-fulldeps/plugin/lint-group-plugin.stderr | 26 + .../plugin/lint-plugin-cmdline-allow.rs | 12 + .../plugin/lint-plugin-cmdline-allow.stderr | 10 + .../ui-fulldeps/plugin/lint-plugin-cmdline-load.rs | 13 + .../plugin/lint-plugin-cmdline-load.stderr | 18 + tests/ui-fulldeps/plugin/lint-plugin-deny-attr.rs | 13 + .../plugin/lint-plugin-deny-attr.stderr | 22 + .../ui-fulldeps/plugin/lint-plugin-deny-cmdline.rs | 13 + .../plugin/lint-plugin-deny-cmdline.stderr | 18 + .../ui-fulldeps/plugin/lint-plugin-forbid-attrs.rs | 16 + .../plugin/lint-plugin-forbid-attrs.stderr | 41 + .../plugin/lint-plugin-forbid-cmdline.rs | 15 + .../plugin/lint-plugin-forbid-cmdline.stderr | 35 + tests/ui-fulldeps/plugin/lint-plugin.rs | 13 + tests/ui-fulldeps/plugin/lint-plugin.stderr | 18 + .../ui-fulldeps/plugin/lint-tool-cmdline-allow.rs | 12 + .../plugin/lint-tool-cmdline-allow.stderr | 30 + tests/ui-fulldeps/plugin/lint-tool-test.rs | 36 + tests/ui-fulldeps/plugin/lint-tool-test.stderr | 95 ++ tests/ui-fulldeps/plugin/lto-syntax-extension.rs | 15 + .../ui-fulldeps/plugin/lto-syntax-extension.stderr | 10 + tests/ui-fulldeps/plugin/macro-crate-rlib.rs | 9 + tests/ui-fulldeps/plugin/macro-crate-rlib.stderr | 9 + tests/ui-fulldeps/plugin/multiple-plugins.rs | 12 + tests/ui-fulldeps/plugin/multiple-plugins.stderr | 16 + .../ui-fulldeps/plugin/outlive-expansion-phase.rs | 8 + .../plugin/outlive-expansion-phase.stderr | 10 + tests/ui-fulldeps/plugin/plugin-args.rs | 9 + tests/ui-fulldeps/plugin/plugin-args.stderr | 17 + tests/ui-fulldeps/plugin/plugin-as-extern-crate.rs | 10 + .../diagnostic-derive-doc-comment-field.rs | 49 ++ .../diagnostic-derive-doc-comment-field.stderr | 30 + .../session-diagnostic/diagnostic-derive.rs | 7 +- .../session-diagnostic/diagnostic-derive.stderr | 189 ++-- .../session-diagnostic/subdiagnostic-derive.rs | 5 +- .../session-diagnostic/subdiagnostic-derive.stderr | 182 ++-- tests/ui-fulldeps/stable-mir/crate-info.rs | 38 +- tests/ui/abi/stack-probes-lto.rs | 1 + tests/ui/abi/stack-probes.rs | 1 + tests/ui/argument-suggestions/issue-97484.stderr | 2 +- tests/ui/array-slice-vec/slice-mut-2.stderr | 2 +- .../projection-unspecified-but-bounded.rs | 16 + .../projection-unspecified-but-bounded.stderr | 17 + .../bugs/cycle-iat-inside-of-adt.rs | 10 + .../bugs/cycle-iat-inside-of-adt.stderr | 49 ++ .../bugs/cycle-iat-inside-of-where-predicate.rs | 16 + .../cycle-iat-inside-of-where-predicate.stderr | 37 + .../bugs/ice-substitution.rs | 23 - .../bugs/ice-substitution.stderr | 6 - .../bugs/inference-fail.rs | 15 - .../bugs/inference-fail.stderr | 9 - .../bugs/lack-of-regionck.rs | 19 - .../bugs/wf-check-skipped.rs | 15 + .../ui/associated-inherent-types/const-generics.rs | 23 + .../dispatch-on-self-type-0.rs | 2 +- .../associated-inherent-types/former-subst-ice.rs | 16 + .../generic-associated-types-bad.item.stderr | 15 + .../generic-associated-types-bad.local.stderr | 15 + .../generic-associated-types-bad.region.stderr | 11 + .../generic-associated-types-bad.rs | 26 + .../generic-const-exprs.rs | 28 + .../ui/associated-inherent-types/inference-fail.rs | 11 + .../inference-fail.stderr | 9 + tests/ui/associated-inherent-types/inference.rs | 40 + tests/ui/associated-inherent-types/issue-109768.rs | 12 + .../associated-inherent-types/issue-109768.stderr | 35 + tests/ui/associated-inherent-types/issue-109789.rs | 22 + .../associated-inherent-types/issue-109789.stderr | 21 + tests/ui/associated-inherent-types/issue-109790.rs | 18 + .../ui/associated-inherent-types/issue-111879-0.rs | 14 + .../issue-111879-0.stderr | 8 + .../ui/associated-inherent-types/issue-111879-1.rs | 12 + .../issue-111879-1.stderr | 12 + .../late-bound-regions.rs | 25 + .../late-bound-regions.stderr | 12 + .../normalization-overflow.rs | 12 + .../normalization-overflow.stderr | 8 + .../associated-inherent-types/private-in-public.rs | 26 + .../private-in-public.stderr | 34 + tests/ui/associated-inherent-types/regionck-0.rs | 14 + .../ui/associated-inherent-types/regionck-0.stderr | 10 + tests/ui/associated-inherent-types/regionck-1.rs | 13 + .../ui/associated-inherent-types/regionck-1.stderr | 29 + tests/ui/associated-inherent-types/regionck-2.rs | 14 + .../ui/associated-inherent-types/regionck-2.stderr | 18 + .../type-alias-bounds-are-enforced.rs | 26 + .../unsatisfied-bounds-inferred-type.rs | 12 + .../unsatisfied-bounds-inferred-type.stderr | 17 + .../unsatisfied-bounds-where-clause-on-assoc-ty.rs | 14 + ...atisfied-bounds-where-clause-on-assoc-ty.stderr | 18 + tests/ui/associated-type-bounds/duplicate.rs | 3 + tests/ui/associated-type-bounds/duplicate.stderr | 60 +- .../return-type-notation/bad-inputs-and-output.rs | 1 - .../bad-inputs-and-output.stderr | 20 +- .../return-type-notation/basic.rs | 1 - .../return-type-notation/basic.with.stderr | 10 +- .../return-type-notation/basic.without.stderr | 16 +- .../return-type-notation/equality.rs | 1 - .../return-type-notation/equality.stderr | 12 +- .../return-type-notation/missing.rs | 3 +- .../return-type-notation/missing.stderr | 14 +- .../supertrait-defines-ty.rs | 26 + .../associated-types/associated-types-eq-3.stderr | 2 +- .../associated-types-overridden-binding-2.stderr | 2 +- tests/ui/associated-types/issue-27901.rs | 11 + tests/ui/associated-types/issue-65774-1.stderr | 2 +- tests/ui/associated-types/issue-65774-2.stderr | 2 +- .../associated-types/substs-ppaux.verbose.stderr | 2 +- .../async-await-let-else.drop_tracking.stderr | 16 +- .../async-await-let-else.drop_tracking_mir.stderr | 12 +- .../async-await-let-else.no_drop_tracking.stderr | 20 +- ...sync-block-control-flow-static-semantics.stderr | 4 +- .../async-error-span.drop_tracking.stderr | 4 +- .../async-error-span.no_drop_tracking.stderr | 4 +- .../async-fn-nonsend.drop_tracking.stderr | 8 +- .../async-fn-nonsend.drop_tracking_mir.stderr | 8 +- .../async-fn-nonsend.no_drop_tracking.stderr | 20 +- tests/ui/async-await/async-fn-nonsend.stderr | 49 -- tests/ui/async-await/async-is-unwindsafe.stderr | 4 +- .../incorrect-syntax-suggestions.stderr | 38 +- tests/ui/async-await/clone-suggestion.fixed | 28 + tests/ui/async-await/clone-suggestion.rs | 28 + tests/ui/async-await/clone-suggestion.stderr | 20 + .../async-await/drop-track-bad-field-in-fru.stderr | 8 +- ...track-field-assign-nonsend.drop_tracking.stderr | 4 +- ...k-field-assign-nonsend.drop_tracking_mir.stderr | 4 +- ...ck-field-assign-nonsend.no_drop_tracking.stderr | 4 +- .../ui/async-await/feature-self-return-type.stderr | 1 + .../field-assign-nonsend.drop_tracking.stderr | 4 +- .../field-assign-nonsend.drop_tracking_mir.stderr | 4 +- .../field-assign-nonsend.no_drop_tracking.stderr | 4 +- .../future-sizes/async-awaiting-fut.stdout | 40 +- tests/ui/async-await/future-sizes/large-arg.stdout | 24 +- .../async-default-fn-overridden.current.stderr | 11 - .../async-default-fn-overridden.next.stderr | 11 - .../in-trait/async-default-fn-overridden.rs | 1 - .../in-trait/bad-signatures.current.stderr | 15 +- .../in-trait/bad-signatures.next.stderr | 15 +- tests/ui/async-await/in-trait/bad-signatures.rs | 1 - ...ject-to-specializable-projection.current.stderr | 11 +- ...project-to-specializable-projection.next.stderr | 11 +- .../in-trait/lifetime-mismatch.current.stderr | 13 +- .../in-trait/lifetime-mismatch.next.stderr | 13 +- tests/ui/async-await/in-trait/lifetime-mismatch.rs | 1 - .../in-trait/missing-send-bound.current.stderr | 17 +- .../in-trait/missing-send-bound.next.stderr | 17 +- .../ui/async-await/in-trait/missing-send-bound.rs | 1 - tests/ui/async-await/in-trait/nested-rpit.rs | 4 +- .../in-trait/object-safety.current.stderr | 15 +- .../async-await/in-trait/object-safety.next.stderr | 15 +- tests/ui/async-await/in-trait/object-safety.rs | 1 - .../in-trait/return-type-suggestion.current.stderr | 13 +- .../in-trait/return-type-suggestion.next.stderr | 13 +- .../async-await/in-trait/return-type-suggestion.rs | 1 - tests/ui/async-await/issue-101715.stderr | 8 +- .../issue-61949-self-return-type.stderr | 1 + .../issue-64130-1-sync.drop_tracking.stderr | 4 +- .../issue-64130-1-sync.drop_tracking_mir.stderr | 4 +- .../issue-64130-1-sync.no_drop_tracking.stderr | 4 +- tests/ui/async-await/issue-64130-1-sync.stderr | 24 - .../issue-64130-2-send.drop_tracking.stderr | 4 +- .../issue-64130-2-send.drop_tracking_mir.stderr | 4 +- .../issue-64130-2-send.no_drop_tracking.stderr | 4 +- tests/ui/async-await/issue-64130-2-send.stderr | 24 - .../issue-64130-3-other.drop_tracking.stderr | 4 +- .../issue-64130-3-other.drop_tracking_mir.stderr | 4 +- .../issue-64130-3-other.no_drop_tracking.stderr | 4 +- tests/ui/async-await/issue-64130-3-other.stderr | 27 - ...ssue-64130-4-async-move.no_drop_tracking.stderr | 4 +- .../issue-64130-non-send-future-diags.stderr | 4 +- ...issue-67252-unnamed-future.drop_tracking.stderr | 4 +- ...e-67252-unnamed-future.drop_tracking_mir.stderr | 4 +- ...ue-67252-unnamed-future.no_drop_tracking.stderr | 4 +- tests/ui/async-await/issue-70594.stderr | 16 +- tests/ui/async-await/issue-70818.stderr | 18 - ...sue-70935-complex-spans.no_drop_tracking.stderr | 8 +- tests/ui/async-await/issue-71137.stderr | 4 +- .../issue-73741-type-err-drop-tracking.stderr | 11 - tests/ui/async-await/issue-74047.stderr | 4 +- .../async-await/issue-86507.drop_tracking.stderr | 2 +- .../issue-86507.drop_tracking_mir.stderr | 2 +- .../issue-86507.no_drop_tracking.stderr | 2 +- tests/ui/async-await/issue-98634.stderr | 4 +- tests/ui/async-await/issues/issue-102206.stderr | 10 +- tests/ui/async-await/issues/issue-107280.stderr | 20 +- tests/ui/async-await/issues/issue-112225-1.rs | 18 + tests/ui/async-await/issues/issue-112225-2.rs | 20 + tests/ui/async-await/issues/issue-112225-2.stderr | 17 + tests/ui/async-await/issues/issue-51719.stderr | 4 +- tests/ui/async-await/issues/issue-51751.stderr | 4 +- tests/ui/async-await/issues/issue-62009-1.stderr | 20 +- tests/ui/async-await/issues/issue-62009-2.stderr | 4 +- ...-65436-raw-ptr-not-send.no_drop_tracking.stderr | 8 +- tests/ui/async-await/issues/issue-67893.stderr | 8 +- .../issues/non-async-enclosing-span.stderr | 4 +- .../multiple-lifetimes/partial-relation.rs | 2 +- ...mutually-recursive-async-impl-trait-type.stderr | 21 - .../recursive-async-impl-trait-type.stderr | 12 - .../return-type-notation/issue-110963-early.rs | 48 + .../return-type-notation/issue-110963-early.stderr | 37 + .../return-type-notation/issue-110963-late.rs | 49 ++ .../return-type-notation/issue-110963-late.stderr | 11 + .../super-method-bound-ambig.rs | 32 + .../super-method-bound-ambig.stderr | 19 + .../return-type-notation/super-method-bound.rs | 25 + .../return-type-notation/super-method-bound.stderr | 11 + .../return-type-notation/supertrait-bound.rs | 11 + .../return-type-notation/supertrait-bound.stderr | 11 + tests/ui/async-await/unnecessary-await.rs | 20 + tests/ui/async-await/unnecessary-await.stderr | 36 +- .../unresolved_type_param.drop_tracking.stderr | 12 +- .../unresolved_type_param.no_drop_tracking.stderr | 20 +- tests/ui/async-await/unresolved_type_param.stderr | 39 - tests/ui/attr-bad-crate-attr.rc | 4 - tests/ui/attr-bad-crate-attr.rs | 4 + tests/ui/attr-bad-crate-attr.stderr | 8 + tests/ui/attributes/invalid-doc-attr.rs | 2 +- tests/ui/attributes/invalid-doc-attr.stderr | 2 +- tests/ui/attributes/invalid-repr.rs | 5 + tests/ui/attributes/invalid-repr.stderr | 12 + .../invalid_macro_export_argument.deny.stderr | 20 + .../ui/attributes/invalid_macro_export_argument.rs | 13 +- .../invalid_macro_export_argument.stderr | 16 - tests/ui/backtrace.rs | 6 +- tests/ui/binding/issue-53114-safety-checks.stderr | 18 +- tests/ui/binop/eq-arr.rs | 7 + tests/ui/binop/eq-arr.stderr | 22 + tests/ui/binop/eq-vec.rs | 13 + tests/ui/binop/eq-vec.stderr | 24 + tests/ui/binop/issue-28837.stderr | 60 +- tests/ui/binop/issue-3820.stderr | 4 +- ...-or-patterns-slice-patterns-box-patterns.stderr | 32 +- .../borrow-raw-address-of-deref-mutability.stderr | 4 +- .../ui/borrowck/borrowck-access-permissions.stderr | 6 +- ...rrowck-assign-to-andmut-in-aliasable-loc.stderr | 8 +- tests/ui/borrowck/borrowck-block-uninit.rs | 7 + tests/ui/borrowck/borrowck-block-uninit.stderr | 18 + tests/ui/borrowck/borrowck-block-unint.rs | 7 - tests/ui/borrowck/borrowck-block-unint.stderr | 18 - ...wck-borrow-mut-base-ptr-in-aliasable-loc.stderr | 4 +- .../borrowck-closures-slice-patterns-ok.rs | 1 + .../borrowck/borrowck-field-sensitivity-rpass.rs | 1 + tests/ui/borrowck/borrowck-issue-14498.stderr | 2 +- .../ui/borrowck/borrowck-reborrow-from-mut.stderr | 2 +- tests/ui/borrowck/borrowck-use-mut-borrow-rpass.rs | 2 + tests/ui/borrowck/borrowck-vec-pattern-nesting.rs | 2 - .../borrowck/borrowck-vec-pattern-nesting.stderr | 18 +- .../borrowck/erase-error-in-mir-drop-tracking.rs | 23 + .../erase-error-in-mir-drop-tracking.stderr | 24 + .../issue-109271-pass-self-into-closure.fixed | 39 + .../issue-109271-pass-self-into-closure.rs | 39 + .../issue-109271-pass-self-into-closure.stderr | 85 ++ tests/ui/borrowck/issue-45199.rs | 3 - tests/ui/borrowck/issue-45199.stderr | 4 +- tests/ui/borrowck/issue-47646.rs | 13 + tests/ui/borrowck/issue-47646.stderr | 20 + tests/ui/borrowck/issue-85765.stderr | 2 +- tests/ui/borrowck/let_underscore_temporary.rs | 30 +- tests/ui/borrowck/let_underscore_temporary.stderr | 79 ++ tests/ui/borrowck/move-error-snippets-ext.rs | 2 +- tests/ui/borrowck/mutability-errors.stderr | 24 +- .../borrowck/suggest-lt-on-ty-alias-w-generics.rs | 11 + .../suggest-lt-on-ty-alias-w-generics.stderr | 43 + tests/ui/borrowck/tainted-promoteds.rs | 12 + tests/ui/borrowck/tainted-promoteds.stderr | 14 + tests/ui/cfg/cfg-stmt-recovery.rs | 13 + tests/ui/cfg/cfg-stmt-recovery.stderr | 20 + tests/ui/cfg/conditional-compile-arch.rs | 3 + tests/ui/chalkify/bugs/async.stderr | 2 +- tests/ui/check-cfg/compact-values.stderr | 2 +- tests/ui/check-cfg/diagnotics.rs | 31 + tests/ui/check-cfg/diagnotics.stderr | 62 ++ tests/ui/check-cfg/invalid-cfg-name.stderr | 2 +- tests/ui/check-cfg/invalid-cfg-value.stderr | 6 +- tests/ui/check-cfg/mix.rs | 4 + tests/ui/check-cfg/mix.stderr | 82 +- tests/ui/check-cfg/no-values.stderr | 4 +- .../check-cfg/order-independant.names_after.stderr | 19 + .../order-independant.names_before.stderr | 19 + tests/ui/check-cfg/order-independant.rs | 16 + tests/ui/check-cfg/values-target-json.stderr | 4 +- tests/ui/check-cfg/well-known-names.stderr | 6 +- tests/ui/check-cfg/well-known-values.stderr | 8 +- tests/ui/closure_context/issue-26046-fn-mut.stderr | 2 +- .../ui/closure_context/issue-26046-fn-once.stderr | 2 +- .../closures/2229_closure_analysis/bad-pattern.rs | 23 + .../2229_closure_analysis/bad-pattern.stderr | 113 +++ .../diagnostics/mut_ref.stderr | 2 +- .../diagnostics/repr_packed.stderr | 3 +- .../match/pattern-matching-should-fail.stderr | 28 +- .../match/patterns-capture-analysis.rs | 72 +- .../match/patterns-capture-analysis.stderr | 209 +++-- .../migrations/issue-78720.rs | 1 + .../migrations/issue-78720.stderr | 2 +- .../optimization/edge_case_run_pass.rs | 1 + .../run_pass/drop_then_use_fake_reads.rs | 2 + .../2229_closure_analysis/run_pass/multivariant.rs | 21 + .../closures/binder/nested-closures-regions.stderr | 10 +- tests/ui/closures/issue-868.rs | 18 + ...closure-print-generic-trim-off-verbose-2.stderr | 2 +- .../print/closure-print-generic-verbose-1.stderr | 2 +- .../print/closure-print-generic-verbose-2.stderr | 2 +- .../ui/closures/print/closure-print-verbose.stderr | 2 +- .../static-closures-with-nonstatic-return.rs | 15 + .../ui/codegen/freeze-on-polymorphic-projection.rs | 19 + .../freeze-on-polymorphic-projection.stderr | 12 + tests/ui/codemap_tests/two_files_data.rs | 2 +- ...issue-49593-box-never-windows.nofallback.stderr | 4 +- .../coerce-issue-49593-box-never.nofallback.stderr | 4 +- tests/ui/coercion/coercion-slice.stderr | 11 +- .../coherence/coherence-overlap-negative-impls.rs | 41 + .../indirect-impl-for-trait-obj-coherence.rs | 25 + .../ui/conditional-compilation/module_with_cfg.rs | 2 +- .../adt_const_params/const_param_ty_bad.rs | 13 + .../adt_const_params/const_param_ty_bad.stderr | 87 ++ .../const_param_ty_bad_empty_array.rs | 12 + .../const_param_ty_bad_empty_array.stderr | 16 + .../const_param_ty_generic_bounds_do_not_hold.rs | 13 + ...onst_param_ty_generic_bounds_do_not_hold.stderr | 42 + .../adt_const_params/const_param_ty_good.rs | 53 ++ .../const_param_ty_impl_bad_field.rs | 17 + .../const_param_ty_impl_bad_field.stderr | 23 + .../const_param_ty_impl_no_structural_eq.rs | 21 + .../const_param_ty_impl_no_structural_eq.stderr | 22 + .../adt_const_params/const_param_ty_impl_union.rs | 33 + .../const_param_ty_impl_union.stderr | 8 + .../const-generics/assoc_const_as_type_argument.rs | 13 + .../assoc_const_as_type_argument.stderr | 21 + .../ui/const-generics/assoc_const_eq_diagnostic.rs | 1 + .../assoc_const_eq_diagnostic.stderr | 16 +- .../const-arg-in-const-arg.full.stderr | 163 ---- .../const-arg-in-const-arg.min.stderr | 206 ++--- tests/ui/const-generics/const-arg-in-const-arg.rs | 60 +- .../const-argument-non-static-lifetime.min.stderr | 9 +- .../const-argument-non-static-lifetime.rs | 2 +- ...t-param-type-depends-on-const-param.full.stderr | 4 + ...st-param-type-depends-on-const-param.min.stderr | 4 + ...param-type-depends-on-type-param-ungated.stderr | 2 + ...st-param-type-depends-on-type-param.full.stderr | 2 + ...nst-param-type-depends-on-type-param.min.stderr | 2 + .../defaults/trait_objects_fail.stderr | 4 +- .../cross_crate_predicate.stderr | 6 + .../generic_const_exprs/issue-74713.rs | 2 +- .../generic_const_exprs/issue-74713.stderr | 11 +- .../nested_uneval_unification-2.rs | 24 +- .../typeid-equality-by-subtyping.rs | 10 +- .../typeid-equality-by-subtyping.stderr | 11 + .../generic_const_exprs/unify-op-with-fn-call.rs | 3 +- .../unify-op-with-fn-call.stderr | 11 +- .../unresolved_lifetimes_error.rs | 12 + .../unresolved_lifetimes_error.stderr | 11 + tests/ui/const-generics/issue-46511.rs | 2 +- tests/ui/const-generics/issue-46511.stderr | 11 +- tests/ui/const-generics/issues/issue-105821.rs | 2 +- .../issues/issue-56445-1.full.stderr | 8 +- .../const-generics/issues/issue-56445-1.min.stderr | 8 +- tests/ui/const-generics/issues/issue-56445-1.rs | 2 +- .../const-generics/issues/issue-62878.full.stderr | 2 + .../const-generics/issues/issue-62878.min.stderr | 2 + .../const-generics/issues/issue-71169.full.stderr | 2 + .../const-generics/issues/issue-71169.min.stderr | 2 + .../const-generics/issues/issue-71381.full.stderr | 4 + .../const-generics/issues/issue-71381.min.stderr | 4 + .../const-generics/issues/issue-71611.full.stderr | 2 + .../const-generics/issues/issue-71611.min.stderr | 2 + tests/ui/const-generics/issues/issue-77357.rs | 11 - tests/ui/const-generics/issues/issue-77357.stderr | 11 - tests/ui/const-generics/issues/issue-83993.rs | 14 - tests/ui/const-generics/issues/issue-88997.stderr | 4 + tests/ui/const-generics/issues/issue-90364.stderr | 2 + .../const-generics/late-bound-vars/in_closure.rs | 20 +- .../late-bound-vars/in_closure.stderr | 13 + tests/ui/const-generics/late-bound-vars/simple.rs | 19 +- .../const-generics/late-bound-vars/simple.stderr | 13 + .../forbid-non-static-lifetimes.rs | 4 +- .../forbid-non-static-lifetimes.stderr | 17 +- tests/ui/const-generics/nested-type.rs | 6 +- .../const-generics/occurs-check/unused-substs-2.rs | 8 +- .../const-generics/occurs-check/unused-substs-3.rs | 8 +- .../outer-lifetime-in-const-generic-default.rs | 2 +- .../outer-lifetime-in-const-generic-default.stderr | 8 +- .../ui/const-generics/sneaky-array-repeat-expr.rs | 2 + .../const-generics/sneaky-array-repeat-expr.stderr | 20 +- tests/ui/const-generics/transmute-fail.stderr | 8 +- .../variant-discrimiant-no-generics.full.stderr | 34 + .../variant-discrimiant-no-generics.min.stderr | 34 + .../variant-discrimiant-no-generics.rs | 32 + tests/ui/const-ptr/forbidden_slices.stderr | 4 - tests/ui/const-ptr/out_of_bounds_read.rs | 2 - tests/ui/const-ptr/out_of_bounds_read.stderr | 6 +- tests/ui/const_prop/const-prop-ice.rs | 5 + tests/ui/const_prop/const-prop-ice.stderr | 10 + tests/ui/const_prop/const-prop-ice2.rs | 7 + tests/ui/const_prop/const-prop-ice2.stderr | 10 + tests/ui/const_prop/const-prop-ice3.rs | 7 + .../ui/const_prop/const-prop-overflowing-casts.rs | 15 + .../const_prop/const-prop-read-static-in-const.rs | 10 + .../const-prop-read-static-in-const.stderr | 17 + tests/ui/const_prop/unsized-local-ice.rs | 9 + tests/ui/consts/auxiliary/external_macro.rs | 2 +- tests/ui/consts/const-block-const-bound.rs | 6 - tests/ui/consts/const-block-const-bound.stderr | 18 +- .../const-eval/const-eval-overflow-3b.stderr | 4 +- .../const-eval/const-eval-overflow-4b.stderr | 4 +- tests/ui/consts/const-eval/const_raw_ptr_ops.rs | 4 +- .../ui/consts/const-eval/const_raw_ptr_ops.stderr | 27 +- tests/ui/consts/const-eval/format.stderr | 56 -- tests/ui/consts/const-eval/generic-slice.stderr | 4 + tests/ui/consts/const-eval/issue-100878.rs | 2 + tests/ui/consts/const-eval/raw-bytes.32bit.stderr | 4 +- tests/ui/consts/const-eval/raw-bytes.64bit.stderr | 4 +- tests/ui/consts/const-eval/ub-ref-ptr.rs | 1 - tests/ui/consts/const-eval/ub-ref-ptr.stderr | 34 +- .../ui/consts/const-eval/ub-slice-get-unchecked.rs | 2 + .../const-eval/ub-slice-get-unchecked.stderr | 19 +- tests/ui/consts/const-float-classify.rs | 35 +- tests/ui/consts/const-fn-error.rs | 1 - tests/ui/consts/const-fn-error.stderr | 19 +- tests/ui/consts/const-for.rs | 1 - tests/ui/consts/const-for.stderr | 18 +- tests/ui/consts/const-integer-bool-ops.rs | 10 - tests/ui/consts/const-integer-bool-ops.stderr | 90 +- .../consts/const-mut-refs/issue-76510.32bit.stderr | 6 - .../consts/const-mut-refs/issue-76510.64bit.stderr | 6 - tests/ui/consts/const-mut-refs/issue-76510.rs | 1 - tests/ui/consts/const-prop-ice.rs | 5 - tests/ui/consts/const-prop-ice.stderr | 10 - tests/ui/consts/const-prop-ice2.rs | 7 - tests/ui/consts/const-prop-ice2.stderr | 10 - tests/ui/consts/const-prop-ice3.rs | 7 - tests/ui/consts/const-prop-overflowing-casts.rs | 15 - tests/ui/consts/const-prop-read-static-in-const.rs | 10 - .../consts/const-prop-read-static-in-const.stderr | 17 - tests/ui/consts/const-try.rs | 2 +- tests/ui/consts/const-try.stderr | 20 + tests/ui/consts/const-tup-index-span.rs | 1 - tests/ui/consts/const-tup-index-span.stderr | 6 - tests/ui/consts/const_cmp_type_id.rs | 2 +- tests/ui/consts/const_cmp_type_id.stderr | 74 ++ tests/ui/consts/const_forget.rs | 2 + tests/ui/consts/extra-const-ub/detect-extra-ub.rs | 1 - .../detect-extra-ub.with_flag.stderr | 8 +- tests/ui/consts/fn_trait_refs.rs | 2 +- tests/ui/consts/fn_trait_refs.stderr | 15 + tests/ui/consts/issue-104155.rs | 3 + tests/ui/consts/issue-25826.rs | 2 +- tests/ui/consts/issue-25826.stderr | 14 +- tests/ui/consts/issue-50439.rs | 4 +- tests/ui/consts/issue-50439.stderr | 10 +- tests/ui/consts/issue-54954.rs | 2 - tests/ui/consts/issue-54954.stderr | 12 - tests/ui/consts/issue-56164.stderr | 12 - tests/ui/consts/issue-66693.stderr | 12 - tests/ui/consts/issue-73976-monomorphic.rs | 2 +- tests/ui/consts/issue-73976-monomorphic.stderr | 27 + tests/ui/consts/issue-94675.rs | 5 +- tests/ui/consts/issue-94675.stderr | 28 +- tests/ui/consts/issue-miri-1910.rs | 1 - tests/ui/consts/issue-miri-1910.stderr | 2 +- tests/ui/consts/min_const_fn/cmp_fn_pointers.rs | 2 +- .../ui/consts/min_const_fn/cmp_fn_pointers.stderr | 14 +- tests/ui/consts/non-sync-references-in-const.rs | 38 + tests/ui/consts/promoted_const_call.rs | 2 + tests/ui/consts/promoted_const_call.stderr | 12 +- tests/ui/consts/rustc-impl-const-stability.rs | 2 +- tests/ui/consts/rustc-impl-const-stability.stderr | 11 + tests/ui/consts/try-operator.rs | 2 +- tests/ui/consts/try-operator.stderr | 9 + tests/ui/crate-leading-sep.rs | 2 + tests/ui/cross/cross-file-errors/main.stderr | 2 +- tests/ui/cross/cross-file-errors/underscore.rs | 4 +- tests/ui/custom_test_frameworks/mismatch.stderr | 2 +- tests/ui/cycle-trait/issue-12511.rs | 8 + tests/ui/cycle-trait/issue-12511.stderr | 23 + tests/ui/deployment-target/invalid-target.rs | 4 + tests/ui/deployment-target/invalid-target.stderr | 2 + tests/ui/deployment-target/macos-target.rs | 7 + tests/ui/deployment-target/macos-target.stdout | 1 + ...rives-span-PartialEq-enum-struct-variant.stderr | 4 +- .../ui/derives/derives-span-PartialEq-enum.stderr | 4 +- .../derives/derives-span-PartialEq-struct.stderr | 4 +- .../derives-span-PartialEq-tuple-struct.stderr | 4 +- .../deriving-no-inner-impl-error-message.stderr | 4 +- tests/ui/deriving/issue-15689-1.rs | 10 + tests/ui/deriving/issue-15689-2.rs | 10 + .../note-unsupported.stderr | 4 +- tests/ui/diagnostic-width/E0271.stderr | 4 +- tests/ui/did_you_mean/issue-38147-4.stderr | 4 +- tests/ui/did_you_mean/issue-39544.stderr | 12 +- tests/ui/did_you_mean/issue-40823.stderr | 2 +- ...e-48492-tuple-destructure-missing-parens.stderr | 1 + ...unicode-confusable-in-float-literal-expt.stderr | 4 +- tests/ui/drop/dropck-eyepatch-manuallydrop.rs | 22 + tests/ui/drop/issue-110682.rs | 92 ++ tests/ui/drop/issue-979.rs | 29 + tests/ui/drop/repeat-drop.rs | 2 + tests/ui/dropck/explicit-drop-bounds.bad1.stderr | 35 + tests/ui/dropck/explicit-drop-bounds.bad2.stderr | 35 + tests/ui/dropck/explicit-drop-bounds.rs | 44 + .../dropck/explicit-implied-outlives.bad1.stderr | 15 + .../dropck/explicit-implied-outlives.bad2.stderr | 15 + tests/ui/dropck/explicit-implied-outlives.rs | 43 + tests/ui/dropck/negative.rs | 7 + tests/ui/dropck/negative.stderr | 8 + tests/ui/dropck/reservation.rs | 10 + tests/ui/dropck/reservation.stderr | 8 + tests/ui/dropck/transitive-outlives-2.rs | 18 + tests/ui/dropck/transitive-outlives.bad.stderr | 15 + tests/ui/dropck/transitive-outlives.rs | 26 + tests/ui/dropck/trivial-impl-bounds.rs | 34 + tests/ui/dst/dst-bad-coerce1.stderr | 4 +- tests/ui/dst/dst-object-from-unsized-type.stderr | 8 +- tests/ui/dupe-first-attr.rc | 24 - tests/ui/dupe-first-attr.rs | 26 + ...eck-size-at-cast-polymorphic-bad.current.stderr | 15 + .../check-size-at-cast-polymorphic-bad.next.stderr | 15 + .../dyn-star/check-size-at-cast-polymorphic-bad.rs | 3 + .../check-size-at-cast-polymorphic-bad.stderr | 15 - tests/ui/dyn-star/param-env-infer.current.stderr | 18 + tests/ui/dyn-star/param-env-infer.next.stderr | 73 ++ tests/ui/dyn-star/param-env-infer.rs | 17 + .../ui/editions/edition-raw-pointer-method-2018.rs | 2 +- .../edition-raw-pointer-method-2018.stderr | 2 +- .../ui/enum-discriminant/auxiliary/issue-41394.rs | 16 + tests/ui/enum-discriminant/issue-41394-rpass.rs | 8 + tests/ui/enum-discriminant/issue-41394.rs | 10 + tests/ui/enum-discriminant/issue-41394.stderr | 11 + .../issue-70453-generics-in-discr-ice-2.rs | 2 +- .../issue-70453-generics-in-discr-ice-2.stderr | 5 +- .../issue-70453-generics-in-discr-ice.rs | 2 +- .../issue-70453-generics-in-discr-ice.stderr | 5 +- .../issue-70453-polymorphic-ctfe.stderr | 5 +- tests/ui/enum/issue-1821.rs | 13 + tests/ui/enum/issue-67945-1.stderr | 5 +- tests/ui/enum/issue-67945-2.stderr | 5 +- tests/ui/error-codes/E0026-teach.stderr | 2 +- tests/ui/error-codes/E0277.stderr | 3 +- tests/ui/error-codes/E0389.stderr | 2 +- tests/ui/error-codes/E0719.rs | 1 + tests/ui/error-codes/E0719.stderr | 12 +- tests/ui/error-codes/E0746.fixed | 18 - tests/ui/error-codes/E0746.rs | 2 +- tests/ui/error-codes/E0746.stderr | 22 +- tests/ui/error-codes/E0771.rs | 2 +- tests/ui/error-codes/E0771.stderr | 8 +- .../explicit-call-to-supertrait-dtor.fixed | 3 + .../explicit/explicit-call-to-supertrait-dtor.rs | 3 + .../explicit-call-to-supertrait-dtor.stderr | 2 +- tests/ui/extenv/extenv-escaped-var.rs | 3 + tests/ui/extenv/extenv-escaped-var.stderr | 11 + tests/ui/extenv/issue-110547.rs | 7 + tests/ui/extenv/issue-110547.stderr | 29 + tests/ui/extern-flag/auxiliary/panic_handler.rs | 17 + tests/ui/extern-flag/force-extern.rs | 9 + tests/ui/extern-flag/no-force-extern.rs | 10 + tests/ui/extern-flag/redundant-force-extern.rs | 11 + tests/ui/extern/auxiliary/invalid-utf8.txt | 1 - .../auxiliary/debugger-visualizer.natvis | 3 - .../feature-gates/feature-gate-builtin_syntax.rs | 7 + .../feature-gate-builtin_syntax.stderr | 12 + .../feature-gate-cfg_overflow_checks.rs | 6 + .../feature-gate-cfg_overflow_checks.stderr | 12 + .../ui/feature-gates/feature-gate-cfi_encoding.rs | 4 + .../feature-gates/feature-gate-cfi_encoding.stderr | 12 + .../feature-gate-debugger-visualizer.rs | 3 - .../feature-gate-debugger-visualizer.stderr | 12 - ...ture-gate-dispatch-from-dyn-missing-impl.stderr | 9 +- .../feature-gates/feature-gate-negative_bounds.rs | 4 + .../feature-gate-negative_bounds.stderr | 8 + tests/ui/feature-gates/feature-gate-raw-dylib-2.rs | 12 - .../feature-gates/feature-gate-raw-dylib-2.stderr | 21 - .../feature-gate-raw-dylib-import-name-type.rs | 8 - .../feature-gate-raw-dylib-import-name-type.stderr | 21 - tests/ui/feature-gates/feature-gate-raw-dylib.rs | 7 - .../ui/feature-gates/feature-gate-raw-dylib.stderr | 12 - .../feature-gate-return_type_notation.cfg.stderr | 17 +- .../feature-gate-return_type_notation.no.stderr | 13 +- .../feature-gate-return_type_notation.rs | 1 - tests/ui/feature-gates/feature-gate-thiscall.rs | 38 + .../ui/feature-gates/feature-gate-thiscall.stderr | 115 +++ .../feature-gates/feature-gate-type_ascription.rs | 2 +- .../feature-gate-type_ascription.stderr | 6 +- .../feature-gate-unsafe_pin_internals.rs | 1 - tests/ui/feature-gates/feature-gate-vectorcall.rs | 4 +- tests/ui/fmt/format-string-error.rs | 2 +- tests/ui/fmt/ifmt-bad-arg.stderr | 4 +- tests/ui/fmt/ifmt-unimpl.stderr | 8 +- tests/ui/fmt/send-sync.stderr | 36 +- tests/ui/fn/fn-item-lifetime-bounds.rs | 37 + .../fn/implied-bounds-impl-header-projections.rs | 31 + tests/ui/fn/issue-3099.rs | 11 + tests/ui/fn/issue-3099.stderr | 14 + .../auto-trait-regions.drop_tracking.stderr | 12 +- .../auto-trait-regions.drop_tracking_mir.stderr | 12 +- .../auto-trait-regions.no_drop_tracking.stderr | 12 +- tests/ui/generator/auto-trait-regions.stderr | 47 - tests/ui/generator/borrowing.stderr | 31 - tests/ui/generator/drop-env.rs | 1 + tests/ui/generator/drop-tracking-error-body.rs | 18 + tests/ui/generator/drop-tracking-error-body.stderr | 17 + .../issue-110929-generator-conflict-error-ice.rs | 12 + ...ssue-110929-generator-conflict-error-ice.stderr | 18 + .../generator/issue-57017.no_drop_tracking.stderr | 42 +- tests/ui/generator/issue-57017.rs | 1 + tests/ui/generator/issue-57084.rs | 2 +- tests/ui/generator/non-static-is-unpin.rs | 1 + tests/ui/generator/resume-arg-size.rs | 1 + tests/ui/generator/retain-resume-ref.stderr | 13 - .../unresolved-ct-var-drop-tracking.stderr | 28 +- tests/ui/generator/unresolved-ct-var.stderr | 28 +- .../auxiliary/missing-item-sugg.rs | 5 + .../generic-associated-types/equality-bound.stderr | 5 +- .../issue-76535.base.stderr | 3 +- .../issue-79422.base.stderr | 3 +- .../issue-79422.extended.stderr | 2 +- tests/ui/generic-associated-types/issue-88595.rs | 1 + .../ui/generic-associated-types/issue-88595.stderr | 34 +- .../generic-associated-types/missing-item-sugg.rs | 11 + .../missing-item-sugg.stderr | 11 + .../parse/trait-path-missing-gen_arg.rs | 3 - .../parse/trait-path-missing-gen_arg.stderr | 31 +- .../generic-associated-types/self-outlives-lint.rs | 2 +- tests/ui/generics/issue-79605.rs | 6 + tests/ui/generics/issue-79605.stderr | 14 + .../single-colon-path-not-const-generics.rs | 4 +- .../single-colon-path-not-const-generics.stderr | 11 +- .../ui/hygiene/stdlib-prelude-from-opaque-late.rs | 1 + tests/ui/illegal-ufcs-drop.fixed | 3 + tests/ui/illegal-ufcs-drop.rs | 3 + tests/ui/illegal-ufcs-drop.stderr | 2 +- .../impl-trait/arg-position-impl-trait-too-long.rs | 22 + .../arg-position-impl-trait-too-long.stderr | 22 + tests/ui/impl-trait/auto-trait-leak.stderr | 4 +- .../dyn-trait-return-should-be-impl-trait.rs | 2 +- .../dyn-trait-return-should-be-impl-trait.stderr | 110 ++- tests/ui/impl-trait/extra-impl-in-trait-impl.fixed | 19 + tests/ui/impl-trait/extra-impl-in-trait-impl.rs | 19 + .../ui/impl-trait/extra-impl-in-trait-impl.stderr | 26 + tests/ui/impl-trait/in-assoc-type-unconstrained.rs | 27 + .../impl-trait/in-assoc-type-unconstrained.stderr | 59 ++ tests/ui/impl-trait/in-assoc-type.rs | 21 + tests/ui/impl-trait/in-assoc-type.stderr | 22 + tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs | 4 +- .../box-coerce-span-in-default.current.stderr | 11 - .../box-coerce-span-in-default.next.stderr | 11 - .../in-trait/box-coerce-span-in-default.rs | 1 - .../default-method-binder-shifting.current.stderr | 11 - .../default-method-binder-shifting.next.stderr | 11 - .../in-trait/default-method-binder-shifting.rs | 1 - .../default-method-constraint.current.stderr | 11 - .../in-trait/default-method-constraint.next.stderr | 11 - .../in-trait/default-method-constraint.rs | 1 - ...-project-to-rpitit-with-no-value.current.stderr | 13 +- ...ont-project-to-rpitit-with-no-value.next.stderr | 13 +- .../dont-project-to-rpitit-with-no-value.rs | 1 - tests/ui/impl-trait/in-trait/foreign-dyn-error.rs | 8 + .../impl-trait/in-trait/foreign-dyn-error.stderr | 15 + tests/ui/impl-trait/in-trait/foreign.rs | 9 +- .../in-trait/object-safety.current.stderr | 3 +- .../impl-trait/in-trait/object-safety.next.stderr | 3 +- tests/ui/impl-trait/issue-103181-1.current.stderr | 12 + tests/ui/impl-trait/issue-103181-1.next.stderr | 12 + tests/ui/impl-trait/issue-103181-1.rs | 2 + tests/ui/impl-trait/issue-103181-1.stderr | 12 - tests/ui/impl-trait/issue-108591.rs | 30 + tests/ui/impl-trait/issue-108592.rs | 21 + tests/ui/impl-trait/issue-36792.rs | 7 + tests/ui/impl-trait/issues/issue-86800.rs | 10 +- tests/ui/impl-trait/issues/issue-86800.stderr | 14 +- .../impl-trait/multiple-defining-usages-in-body.rs | 12 + .../multiple-defining-usages-in-body.stderr | 26 + ...point-to-type-err-cause-on-impl-trait-return.rs | 4 +- ...t-to-type-err-cause-on-impl-trait-return.stderr | 108 +-- ...-alias-impl-trait-declaration-too-subtle.stderr | 5 + tests/ui/impl-trait/wf-eval-order.rs | 4 +- ...ed-bounds-on-nested-references-plus-variance.rs | 16 + .../implied-bounds-on-trait-hierarchy.rs | 39 + tests/ui/implied-bounds/issue-110161.rs | 26 + tests/ui/implied-bounds/issue-110161.stderr | 12 + tests/ui/imports/issue-109148.rs | 15 + tests/ui/imports/issue-109148.stderr | 13 + tests/ui/imports/issue-109343.rs | 10 + tests/ui/imports/issue-109343.stderr | 11 + tests/ui/inference/deref-suggestion.rs | 9 + tests/ui/inference/deref-suggestion.stderr | 35 +- tests/ui/inference/issue-70082.rs | 10 + tests/ui/inference/issue-70082.stderr | 17 + tests/ui/inference/issue-71584.rs | 6 + tests/ui/inference/issue-71584.stderr | 17 + .../inline-const/const-match-pat-lifetime-err.rs | 2 +- .../interior-mutability/interior-mutability.stderr | 3 +- tests/ui/invalid/foo.natvis.xml | 1 + .../invalid/invalid-debugger-visualizer-option.rs | 1 - .../invalid-debugger-visualizer-option.stderr | 4 +- .../invalid/invalid-debugger-visualizer-target.rs | 4 +- .../invalid-debugger-visualizer-target.stderr | 6 +- tests/ui/io-checks/inaccessbile-temp-dir.rs | 39 - tests/ui/io-checks/inaccessbile-temp-dir.stderr | 4 - .../io-checks/non-ice-error-on-worker-io-fail.rs | 16 +- .../non-ice-error-on-worker-io-fail.stderr | 2 +- tests/ui/issues/auxiliary/issue-111011.rs | 12 + tests/ui/issues/auxiliary/issue-111011.stderr | 34 + tests/ui/issues/auxiliary/issue-3136-a.rc | 4 - tests/ui/issues/auxiliary/issue-3136-a.rs | 7 +- tests/ui/issues/auxiliary/issue-41394.rs | 16 - tests/ui/issues/issue-11374.stderr | 10 +- tests/ui/issues/issue-12511.rs | 8 - tests/ui/issues/issue-12511.stderr | 23 - tests/ui/issues/issue-12997-1.rs | 11 - tests/ui/issues/issue-12997-1.stderr | 14 - tests/ui/issues/issue-12997-2.rs | 9 - tests/ui/issues/issue-12997-2.stderr | 21 - tests/ui/issues/issue-14366.stderr | 4 +- tests/ui/issues/issue-15689-1.rs | 10 - tests/ui/issues/issue-15689-2.rs | 10 - tests/ui/issues/issue-17033.stderr | 11 +- tests/ui/issues/issue-18107.stderr | 12 +- tests/ui/issues/issue-1821.rs | 13 - tests/ui/issues/issue-18819.stderr | 2 +- tests/ui/issues/issue-21763.rs | 2 + tests/ui/issues/issue-21763.stderr | 13 +- tests/ui/issues/issue-22034.stderr | 2 +- tests/ui/issues/issue-22384.rs | 8 - tests/ui/issues/issue-22384.stderr | 9 - tests/ui/issues/issue-22644.rs | 12 +- tests/ui/issues/issue-22644.stderr | 51 +- tests/ui/issues/issue-22872.stderr | 2 +- tests/ui/issues/issue-25901.rs | 2 +- tests/ui/issues/issue-25901.stderr | 23 +- tests/ui/issues/issue-26094.rs | 12 - tests/ui/issues/issue-26094.stderr | 18 - tests/ui/issues/issue-2748-a.rs | 17 - tests/ui/issues/issue-27901.rs | 11 - tests/ui/issues/issue-2804-2.rs | 12 - tests/ui/issues/issue-30438-a.rs | 23 - tests/ui/issues/issue-30438-a.stderr | 12 - tests/ui/issues/issue-30438-b.rs | 24 - tests/ui/issues/issue-30438-b.stderr | 12 - tests/ui/issues/issue-30438-c.rs | 20 - tests/ui/issues/issue-30438-c.stderr | 9 - tests/ui/issues/issue-3099-a.rs | 5 - tests/ui/issues/issue-3099-a.stderr | 14 - tests/ui/issues/issue-3099-b.rs | 5 - tests/ui/issues/issue-3099-b.stderr | 14 - tests/ui/issues/issue-3099.rs | 11 - tests/ui/issues/issue-3099.stderr | 14 - tests/ui/issues/issue-3136-b.rs | 2 +- tests/ui/issues/issue-32709.stderr | 13 +- tests/ui/issues/issue-33287.rs | 1 + tests/ui/issues/issue-3344.stderr | 2 +- tests/ui/issues/issue-34932.rs | 11 - tests/ui/issues/issue-36744-without-calls.rs | 13 - tests/ui/issues/issue-36792.rs | 7 - tests/ui/issues/issue-41394-rpass.rs | 8 - tests/ui/issues/issue-41394.rs | 11 - tests/ui/issues/issue-41394.stderr | 17 - tests/ui/issues/issue-46302.stderr | 10 +- ...46756-consider-borrowing-cast-or-binexpr.stderr | 20 +- tests/ui/issues/issue-47646.rs | 13 - tests/ui/issues/issue-47646.stderr | 20 - tests/ui/issues/issue-49298.rs | 2 +- ...on-shorthand-field-patterns-in-pattern-macro.rs | 16 - tests/ui/issues/issue-50582.stderr | 4 +- tests/ui/issues/issue-51515.rs | 1 - tests/ui/issues/issue-51515.stderr | 6 +- tests/ui/issues/issue-54302-cases.rs | 85 -- tests/ui/issues/issue-54302-cases.stderr | 38 - tests/ui/issues/issue-54302.rs | 19 - tests/ui/issues/issue-54302.stderr | 11 - tests/ui/issues/issue-58857.stderr | 4 +- tests/ui/issues/issue-59756.rs | 2 +- tests/ui/issues/issue-61106.stderr | 10 +- tests/ui/issues/issue-61623.stderr | 2 +- tests/ui/issues/issue-62375.stderr | 8 +- tests/ui/issues/issue-6458-1.rs | 8 - tests/ui/issues/issue-6458-2.rs | 5 - tests/ui/issues/issue-6458-2.stderr | 14 - tests/ui/issues/issue-6458-3.rs | 6 - tests/ui/issues/issue-6458-3.stderr | 14 - tests/ui/issues/issue-6458-4.rs | 7 - tests/ui/issues/issue-6458-4.stderr | 16 - tests/ui/issues/issue-6458.rs | 14 - tests/ui/issues/issue-6458.stderr | 14 - .../issues/issue-69396-const-no-type-in-macro.rs | 17 - .../issue-69396-const-no-type-in-macro.stderr | 50 -- tests/ui/issues/issue-71584.rs | 6 - tests/ui/issues/issue-71584.stderr | 17 - tests/ui/issues/issue-7364.stderr | 3 +- tests/ui/issues/issue-868.rs | 18 - tests/ui/issues/issue-948.rs | 15 - tests/ui/issues/issue-979.rs | 29 - tests/ui/iterators/collect-into-slice.rs | 6 + tests/ui/iterators/collect-into-slice.stderr | 12 +- tests/ui/kindck/kindck-impl-type-params.stderr | 12 +- .../kindck/kindck-inherited-copy-bound.curr.stderr | 3 +- ...ited-copy-bound.object_safe_for_dispatch.stderr | 3 +- tests/ui/kindck/kindck-send-object.stderr | 3 +- tests/ui/kindck/kindck-send-object1.stderr | 3 +- tests/ui/kindck/kindck-send-object2.stderr | 3 +- tests/ui/kindck/kindck-send-owned.stderr | 3 +- tests/ui/kindck/kindck-send-unsafe.rs | 10 +- .../kindck/kindck-send-unsafe.rs~rust-lang_master | 12 - tests/ui/kindck/kindck-send-unsafe.stderr | 23 +- tests/ui/layout/debug.rs | 48 +- tests/ui/layout/debug.stderr | 220 ++++- .../ui/layout/issue-112048-unsizing-field-order.rs | 25 + tests/ui/layout/issue-112048-unsizing-niche.rs | 30 + ...96158-scalarpair-payload-might-be-uninit.stderr | 40 +- .../ui/lifetimes/elided-lifetime-in-anon-const.rs | 20 + tests/ui/lifetimes/issue-105675.rs | 14 + tests/ui/lifetimes/issue-105675.stderr | 109 +++ tests/ui/lifetimes/issue-36744-without-calls.rs | 13 + tests/ui/lifetimes/issue-64173-unused-lifetimes.rs | 2 +- .../lifetimes/issue-64173-unused-lifetimes.stderr | 11 +- tests/ui/lifetimes/issue-69314.stderr | 2 + tests/ui/lifetimes/issue-79187-2.stderr | 4 + tests/ui/lifetimes/issue-79187.stderr | 4 + tests/ui/lifetimes/unusual-rib-combinations.rs | 2 +- tests/ui/lifetimes/unusual-rib-combinations.stderr | 8 +- tests/ui/lint-group-denied-lint-allowed.rs | 6 + tests/ui/lint-group-forbid-always-trumps-cli.rs | 6 + .../ui/lint-group-forbid-always-trumps-cli.stderr | 10 + tests/ui/lint/auxiliary/missing_docs.rs | 1 + tests/ui/lint/dead-code/closure-bang.rs | 4 +- tests/ui/lint/dead-code/closure-bang.stderr | 17 + .../lint/dead-code/offset-of-correct-param-env.rs | 42 + tests/ui/lint/dead-code/offset-of.rs | 44 + tests/ui/lint/dead-code/offset-of.stderr | 50 ++ tests/ui/lint/dropping_copy_types.rs | 98 +++ tests/ui/lint/dropping_copy_types.stderr | 108 +++ tests/ui/lint/dropping_references.rs | 118 +++ tests/ui/lint/dropping_references.stderr | 127 +++ tests/ui/lint/forgetting_copy_types.rs | 56 ++ tests/ui/lint/forgetting_copy_types.stderr | 88 ++ tests/ui/lint/forgetting_references.rs | 39 + tests/ui/lint/forgetting_references.stderr | 97 ++ tests/ui/lint/internal/trivial-diagnostics.rs | 8 + tests/ui/lint/internal/trivial-diagnostics.stderr | 15 + tests/ui/lint/invalid_value-polymorphic.rs | 2 +- tests/ui/lint/issue-110573.rs | 12 + tests/ui/lint/issue-111359.rs | 27 + tests/ui/lint/issue-111359.stderr | 26 + tests/ui/lint/issue-112489.rs | 17 + ...on-shorthand-field-patterns-in-pattern-macro.rs | 16 + tests/ui/lint/lint-attr-everywhere-early.rs | 8 + tests/ui/lint/lint-attr-everywhere-early.stderr | 48 +- tests/ui/lint/lint-attr-everywhere-late.rs | 5 + tests/ui/lint/lint-attr-everywhere-late.stderr | 56 +- tests/ui/lint/lint-match-arms-2.rs | 24 + tests/ui/lint/lint-match-arms-2.stderr | 29 + tests/ui/lint/lint-missing-doc.rs | 7 + tests/ui/lint/lint-missing-doc.stderr | 58 +- .../lint/lint-non-uppercase-trait-assoc-const.rs | 15 + .../lint-non-uppercase-trait-assoc-const.stderr | 14 + tests/ui/lint/lint-uppercase-variables.stderr | 12 +- tests/ui/lint/must_not_suspend/boxed.stderr | 2 +- .../must_not_suspend/dedup.drop_tracking.stderr | 2 +- .../dedup.drop_tracking_mir.stderr | 2 +- .../must_not_suspend/dedup.no_drop_tracking.stderr | 4 +- tests/ui/lint/must_not_suspend/dedup.stderr | 19 - tests/ui/lint/must_not_suspend/mutex.stderr | 2 +- .../lint/must_not_suspend/ref-drop-tracking.stderr | 2 +- .../lint/must_not_suspend/ref.drop_tracking.stderr | 2 +- .../must_not_suspend/ref.drop_tracking_mir.stderr | 2 +- .../must_not_suspend/ref.no_drop_tracking.stderr | 2 +- .../must_not_suspend/trait.drop_tracking.stderr | 4 +- .../trait.drop_tracking_mir.stderr | 4 +- .../must_not_suspend/trait.no_drop_tracking.stderr | 4 +- tests/ui/lint/must_not_suspend/trait.stderr | 37 - .../must_not_suspend/unit.drop_tracking.stderr | 2 +- .../must_not_suspend/unit.drop_tracking_mir.stderr | 2 +- .../must_not_suspend/unit.no_drop_tracking.stderr | 2 +- tests/ui/lint/must_not_suspend/unit.stderr | 26 - .../must_not_suspend/warn.drop_tracking.stderr | 2 +- .../must_not_suspend/warn.drop_tracking_mir.stderr | 2 +- .../must_not_suspend/warn.no_drop_tracking.stderr | 2 +- tests/ui/lint/must_not_suspend/warn.stderr | 26 - tests/ui/lint/noop-method-call.rs | 8 +- tests/ui/lint/noop-method-call.stderr | 26 +- .../expect_nested_lint_levels.stderr | 24 +- .../force_warn_expected_lints_fulfilled.stderr | 12 +- .../root-attribute-confusion.rs | 7 + tests/ui/lint/suspicious-double-ref-op.rs | 30 + tests/ui/lint/suspicious-double-ref-op.stderr | 35 + tests/ui/lint/unaligned_references.stderr | 30 +- .../unaligned_references_external_macro.stderr | 3 +- .../unused/issue-54538-unused-parens-lint.fixed | 19 +- .../lint/unused/issue-54538-unused-parens-lint.rs | 19 +- .../unused/issue-54538-unused-parens-lint.stderr | 62 +- tests/ui/lint/unused/lint-unused-mut-variables.rs | 8 + .../lint/unused/lint-unused-mut-variables.stderr | 10 +- tests/ui/lint/unused/lint-unused-variables.stderr | 12 +- .../liveness-assign-imm-local-with-drop.rs | 1 - tests/ui/liveness/liveness-consts.stderr | 53 +- tests/ui/liveness/liveness-unused.rs | 2 +- .../ui/macros/builtin-prelude-no-accidents.stderr | 15 +- tests/ui/macros/issue-111749.rs | 12 + tests/ui/macros/issue-111749.stderr | 18 + tests/ui/macros/issue-26094.rs | 12 + tests/ui/macros/issue-26094.stderr | 18 + tests/ui/macros/issue-2804-2.rs | 12 + .../macros/issue-69396-const-no-type-in-macro.rs | 17 + .../issue-69396-const-no-type-in-macro.stderr | 50 ++ tests/ui/macros/macro-expanded-include/foo/mod.rs | 2 +- tests/ui/macros/macro-local-data-key-priv.stderr | 2 +- tests/ui/macros/missing-bang-in-decl.stderr | 14 +- tests/ui/macros/panic-temporaries-2018.rs | 55 ++ tests/ui/macros/panic-temporaries.rs | 43 + tests/ui/macros/parse-complex-macro-invoc-op.rs | 1 + .../all-expr-kinds.rs | 85 +- .../all-not-available-cases.rs | 2 +- ...stom-errors-does-not-create-unnecessary-code.rs | 2 +- ...ut-captures-does-not-create-unnecessary-code.rs | 2 +- .../feature-gate-generic_assert.rs | 2 +- ...non-consuming-methods-have-optimized-codegen.rs | 2 +- ...consuming-methods-have-optimized-codegen.stdout | 20 +- tests/ui/macros/stringify.rs | 3 +- tests/ui/macros/user-defined-macro-rules.rs | 9 + tests/ui/match/issue-26996.rs | 2 +- tests/ui/match/issue-27021.rs | 2 +- tests/ui/meta/no_std-extern-libc.rs | 7 + tests/ui/methods/call_method_unknown_pointee.rs | 28 + .../ui/methods/call_method_unknown_pointee.stderr | 27 + .../method-not-found-generic-arg-elision.rs | 4 +- .../method-not-found-generic-arg-elision.stderr | 6 +- tests/ui/methods/method-self-arg-1.stderr | 10 +- tests/ui/mir/mir_alignment_check.rs | 1 + .../mir_alignment_check_i686-pc-windows-msvc.rs | 21 + tests/ui/mir/validate/storage-live.stderr | 4 +- .../assignment-operator-unimplemented.stderr | 4 +- tests/ui/mismatched_types/cast-rfc0401.stderr | 12 +- tests/ui/mismatched_types/closure-mismatch.rs | 3 + tests/ui/mismatched_types/closure-mismatch.stderr | 38 +- .../dont-point-return-on-E0308.stderr | 10 +- tests/ui/missing/missing-items/m2.stderr | 2 +- tests/ui/mut/mut-cross-borrowing.stderr | 10 +- .../msvc-non-utf8-output.rs | 5 + .../msvc-non-utf8-output.stderr | 1 + tests/ui/never_type/exhaustive_patterns.stderr | 1 + .../fallback-closure-wrap.fallback.stderr | 2 +- tests/ui/never_type/issue-52443.rs | 1 - tests/ui/never_type/issue-52443.stderr | 17 +- tests/ui/never_type/never-assign-dead-code.rs | 1 + tests/ui/never_type/never-assign-dead-code.stderr | 8 +- .../escape-argument-callee.stderr | 2 +- .../escape-upvar-nested.stderr | 8 +- .../closure-requirements/escape-upvar-ref.stderr | 4 +- .../propagate-approximated-fail-no-postdom.stderr | 12 +- .../propagate-approximated-ref.stderr | 8 +- ...shorter-to-static-comparing-against-free.stderr | 6 +- ...-approximated-shorter-to-static-no-bound.stderr | 10 +- ...proximated-shorter-to-static-wrong-bound.stderr | 10 +- .../propagate-approximated-val.stderr | 8 +- .../propagate-despite-same-free-region.stderr | 6 +- ...ate-fail-to-approximate-longer-no-bounds.stderr | 10 +- ...-fail-to-approximate-longer-wrong-bounds.stderr | 10 +- .../propagate-from-trait-match.stderr | 6 +- tests/ui/nll/issue-30438-a.rs | 23 + tests/ui/nll/issue-30438-a.stderr | 12 + tests/ui/nll/issue-30438-b.rs | 24 + tests/ui/nll/issue-30438-b.stderr | 12 + tests/ui/nll/issue-30438-c.rs | 20 + tests/ui/nll/issue-30438-c.stderr | 9 + tests/ui/nll/issue-47388.stderr | 2 +- tests/ui/nll/issue-51244.stderr | 2 +- tests/ui/nll/issue-54302-cases.rs | 85 ++ tests/ui/nll/issue-54302-cases.stderr | 38 + tests/ui/nll/issue-54302.rs | 19 + tests/ui/nll/issue-54302.stderr | 11 + tests/ui/nll/issue-57989.stderr | 2 +- tests/ui/nll/member-constraints/min-choice.rs | 4 +- .../member-constraints/nested-impl-trait-fail.rs | 6 +- .../member-constraints/nested-impl-trait-pass.rs | 6 +- tests/ui/nll/relate_tys/hr-fn-aba-as-aaa.rs | 2 + tests/ui/nll/ty-outlives/projection-body.rs | 2 + .../projection-no-regions-closure.stderr | 32 +- .../projection-one-region-closure.stderr | 40 +- ...rojection-one-region-trait-bound-closure.stderr | 42 +- ...on-one-region-trait-bound-static-closure.stderr | 32 +- ...rojection-two-region-trait-bound-closure.stderr | 82 +- ...ty-param-closure-approximate-lower-bound.stderr | 10 +- .../ty-param-closure-outlives-from-return-type.rs | 4 +- ...-param-closure-outlives-from-return-type.stderr | 8 +- ...param-closure-outlives-from-where-clause.stderr | 32 +- .../ui/nll/user-annotations/adt-brace-enums.stderr | 4 +- .../nll/user-annotations/adt-brace-structs.stderr | 4 +- .../nll/user-annotations/adt-nullary-enums.stderr | 5 +- .../ui/nll/user-annotations/adt-tuple-enums.stderr | 4 +- .../user-annotations/adt-tuple-struct-calls.stderr | 9 +- .../nll/user-annotations/adt-tuple-struct.stderr | 4 +- tests/ui/nll/user-annotations/fns.stderr | 4 +- tests/ui/nll/user-annotations/method-call.stderr | 2 + tests/ui/nll/user-annotations/method-ufcs-3.stderr | 2 + tests/ui/not-panic/not-panic-safe-2.stderr | 9 +- tests/ui/not-panic/not-panic-safe-3.stderr | 9 +- tests/ui/not-panic/not-panic-safe-4.stderr | 9 +- tests/ui/not-panic/not-panic-safe-6.stderr | 9 +- .../overflow-attribute-works-1.rs | 19 + .../overflow-attribute-works-2.rs | 19 + .../numbers-arithmetic/overflowing-neg-nonzero.rs | 12 + .../saturating-float-casts-impl.rs | 2 +- tests/ui/object-safety/assoc_const_bounds.rs | 13 + tests/ui/object-safety/assoc_const_bounds.stderr | 15 + tests/ui/object-safety/assoc_const_bounds_sized.rs | 9 + .../object-safety/assoc_const_bounds_sized.stderr | 15 + tests/ui/object-safety/assoc_type_bounds.rs | 13 + tests/ui/object-safety/assoc_type_bounds.stderr | 21 + tests/ui/object-safety/assoc_type_bounds2.rs | 13 + tests/ui/object-safety/assoc_type_bounds2.stderr | 21 + tests/ui/object-safety/assoc_type_bounds_sized.rs | 9 + .../object-safety/assoc_type_bounds_sized.stderr | 12 + tests/ui/object-safety/issue-19538.stderr | 3 +- ...sociated-consts.object_safe_for_dispatch.stderr | 3 +- ...safety-generics.object_safe_for_dispatch.stderr | 6 +- ...y-mentions-Self.object_safe_for_dispatch.stderr | 6 +- ...afety-no-static.object_safe_for_dispatch.stderr | 3 +- ...-safety-sized-2.object_safe_for_dispatch.stderr | 3 +- ...ct-safety-sized.object_safe_for_dispatch.stderr | 3 +- .../ui/offset-of/auxiliary/offset-of-staged-api.rs | 33 + tests/ui/offset-of/offset-of-arg-count.rs | 22 + tests/ui/offset-of/offset-of-arg-count.stderr | 59 ++ tests/ui/offset-of/offset-of-builtin.rs | 44 + tests/ui/offset-of/offset-of-builtin.stderr | 65 ++ tests/ui/offset-of/offset-of-dst-field.rs | 49 ++ tests/ui/offset-of/offset-of-dst-field.stderr | 77 ++ tests/ui/offset-of/offset-of-enum.rs | 13 + tests/ui/offset-of/offset-of-enum.stderr | 19 + tests/ui/offset-of/offset-of-inference.rs | 11 + tests/ui/offset-of/offset-of-inference.stderr | 9 + tests/ui/offset-of/offset-of-output-type.rs | 20 + tests/ui/offset-of/offset-of-output-type.stderr | 64 ++ tests/ui/offset-of/offset-of-private.rs | 28 + tests/ui/offset-of/offset-of-private.stderr | 46 + tests/ui/offset-of/offset-of-self.rs | 58 ++ tests/ui/offset-of/offset-of-self.stderr | 79 ++ .../offset-of/offset-of-unstable-with-feature.rs | 20 + tests/ui/offset-of/offset-of-unstable.rs | 31 + tests/ui/offset-of/offset-of-unstable.stderr | 84 ++ tests/ui/optimization-remark.rs | 2 +- .../or-patterns-default-binding-modes.rs | 2 + tests/ui/or-patterns/or-patterns-syntactic-fail.rs | 5 +- .../or-patterns/or-patterns-syntactic-fail.stderr | 33 +- tests/ui/packed/issue-27060.stderr | 12 +- .../packed-struct-borrow-element-64bit.stderr | 3 +- .../ui/packed/packed-struct-borrow-element.stderr | 6 +- tests/ui/panic-runtime/auxiliary/needs-unwind.rs | 1 - tests/ui/panics/default-backtrace-ice.rs | 14 +- tests/ui/panics/default-backtrace-ice.stderr | 7 + tests/ui/panics/fmt-only-once.rs | 21 + tests/ui/panics/fmt-only-once.run.stderr | 3 + tests/ui/panics/nested_panic_caught.rs | 24 + .../panics/panic-short-backtrace-windows-x86_64.rs | 2 +- .../ui/panics/short-ice-remove-middle-frames-2.rs | 61 ++ .../short-ice-remove-middle-frames-2.run.stderr | 11 + tests/ui/panics/short-ice-remove-middle-frames.rs | 57 ++ .../short-ice-remove-middle-frames.run.stderr | 12 + tests/ui/parser/attr-stmt-expr-attr-bad.rs | 1 + tests/ui/parser/attr-stmt-expr-attr-bad.stderr | 107 +-- tests/ui/parser/builtin-syntax.rs | 9 + tests/ui/parser/builtin-syntax.stderr | 14 + tests/ui/parser/dyn-trait-compatibility.stderr | 12 +- tests/ui/parser/eq-less-to-less-eq.rs | 33 + tests/ui/parser/eq-less-to-less-eq.stderr | 34 + tests/ui/parser/impl-on-unsized-typo.rs | 6 + tests/ui/parser/impl-on-unsized-typo.stderr | 8 + tests/ui/parser/issue-103869.rs | 9 - tests/ui/parser/issue-103869.stderr | 16 - tests/ui/parser/issues/issue-111148.rs | 2 + tests/ui/parser/issues/issue-111148.stderr | 8 + tests/ui/parser/issues/issue-111416.rs | 3 + tests/ui/parser/issues/issue-111416.stderr | 18 + tests/ui/parser/issues/issue-33418.fixed | 19 - tests/ui/parser/issues/issue-33418.rs | 8 +- tests/ui/parser/issues/issue-33418.stderr | 38 +- .../issues/issue-35813-postfix-after-cast.rs | 78 +- .../issues/issue-35813-postfix-after-cast.stderr | 338 +++---- tests/ui/parser/issues/issue-44406.rs | 1 - tests/ui/parser/issues/issue-44406.stderr | 13 +- tests/ui/parser/issues/issue-62913.rs | 2 +- ...46-negative-outlives-bound-syntactic-fail.fixed | 9 +- ...67146-negative-outlives-bound-syntactic-fail.rs | 3 + ...6-negative-outlives-bound-syntactic-fail.stderr | 32 +- tests/ui/parser/issues/issue-91461.rs | 5 +- tests/ui/parser/issues/issue-91461.stderr | 25 +- tests/ui/parser/item-kw-case-mismatch.fixed | 28 +- tests/ui/parser/item-kw-case-mismatch.rs | 28 +- tests/ui/parser/item-kw-case-mismatch.stderr | 28 +- tests/ui/parser/recover-unticked-labels.stderr | 8 +- tests/ui/parser/use-colon-as-mod-sep.stderr | 6 + .../borrowck-pat-at-and-box-pass.rs | 3 + .../borrowck-pat-at-and-box.stderr | 16 +- .../borrowck-pat-by-copy-bindings-in-at.rs | 2 + .../borrowck-pat-by-move-and-ref-inverse.stderr | 144 +-- .../borrowck-pat-by-move-and-ref.stderr | 84 +- .../borrowck-pat-ref-mut-and-ref.stderr | 82 +- .../borrowck-pat-ref-mut-twice.stderr | 88 +- ...nested-type-ascription-syntactically-invalid.rs | 3 +- ...ed-type-ascription-syntactically-invalid.stderr | 10 +- .../borrowck-move-ref-pattern-pass.rs | 2 + .../borrowck-move-ref-pattern.stderr | 4 +- .../move-ref-patterns-closure-captures-pass.rs | 2 + tests/ui/pattern/pattern-error-continue.stderr | 15 +- tests/ui/pattern/usefulness/consts-opaque.rs | 18 +- tests/ui/pattern/usefulness/consts-opaque.stderr | 75 +- .../empty-match.exhaustive_patterns.stderr | 94 +- .../pattern/usefulness/empty-match.normal.stderr | 93 +- tests/ui/pattern/usefulness/empty-match.rs | 66 ++ tests/ui/phantom-auto-trait.stderr | 6 +- tests/ui/polymorphization/generators.stderr | 12 - tests/ui/polymorphization/predicates.stderr | 18 +- .../type_parameters/closures.stderr | 30 +- tests/ui/print_type_sizes/async.rs | 2 + tests/ui/print_type_sizes/async.stdout | 16 +- tests/ui/print_type_sizes/generator.stdout | 8 +- .../print_type_sizes/generator_discr_placement.rs | 1 + .../generator_discr_placement.stdout | 2 +- ...ssue-111220-2-tuple-struct-fields-projection.rs | 33 + ...-111220-2-tuple-struct-fields-projection.stderr | 9 + .../ui/privacy/issue-111220-tuple-struct-fields.rs | 46 + .../issue-111220-tuple-struct-fields.stderr | 21 + tests/ui/privacy/privacy2.stderr | 8 +- tests/ui/privacy/privacy3.stderr | 8 +- tests/ui/proc-macro/module.rs | 2 +- tests/ui/proc-macro/module_with_attrs.rs | 2 +- tests/ui/proc-macro/outer/inner.rs | 2 +- .../allsorts-rental-0.5.6/src/lib.rs | 2 +- .../pretty-print-hack/rental-0.5.5/src/lib.rs | 2 +- .../pretty-print-hack/rental-0.5.6/src/lib.rs | 2 +- tests/ui/proc-macro/test-same-crate.rs | 16 + tests/ui/proc-macro/test-same-crate.stderr | 10 + tests/ui/process/process-sigpipe.rs | 10 +- tests/ui/range/issue-54505-no-literals.fixed | 24 +- tests/ui/range/issue-54505-no-literals.rs | 24 +- tests/ui/range/issue-54505-no-literals.stderr | 120 ++- tests/ui/range/issue-54505-no-std.rs | 12 +- tests/ui/range/issue-54505-no-std.stderr | 60 +- tests/ui/range/issue-54505.fixed | 12 +- tests/ui/range/issue-54505.rs | 12 +- tests/ui/range/issue-54505.stderr | 60 +- .../issue-73553-misinterp-range-literal.stderr | 20 +- tests/ui/reachable/auxiliary/foreign-priv-aux.rs | 21 + tests/ui/reachable/foreign-priv.rs | 12 + tests/ui/reachable/issue-948.rs | 15 + tests/ui/recursion/recursive-requirements.stderr | 3 +- .../type-param-outlives-reempty-issue-74429-2.rs | 6 +- .../type-param-outlives-reempty-issue-74429.rs | 2 + tests/ui/repr/invalid_repr_list_help.rs | 5 + tests/ui/repr/invalid_repr_list_help.stderr | 20 +- tests/ui/repr/repr-transparent.stderr | 2 +- .../repr/transparent-enum-too-many-variants.stderr | 2 + tests/ui/resolve/explicit-self-lowercase-param.rs | 8 + .../resolve/explicit-self-lowercase-param.stderr | 8 + tests/ui/resolve/issue-109250.rs | 3 + tests/ui/resolve/issue-109250.stderr | 14 + tests/ui/resolve/issue-111312.rs | 11 + tests/ui/resolve/issue-111312.stderr | 15 + tests/ui/resolve/issue-111727.rs | 5 + tests/ui/resolve/issue-111727.stderr | 9 + tests/ui/resolve/issue-3099-a.rs | 5 + tests/ui/resolve/issue-3099-a.stderr | 14 + tests/ui/resolve/issue-3099-b.rs | 5 + tests/ui/resolve/issue-3099-b.stderr | 14 + tests/ui/resolve/issue-50599.rs | 1 - tests/ui/resolve/issue-50599.stderr | 6 - tests/ui/resolve/resolve-variant-assoc-item.stderr | 14 + .../rfc-2008-non-exhaustive/borrowck-exhaustive.rs | 2 + tests/ui/rfc-2294-if-let-guard/feature-gate.rs | 12 + tests/ui/rfc-2294-if-let-guard/feature-gate.stderr | 209 ++++- .../dbg-macro-expected-behavior.rs | 2 + .../dbg-macro-expected-behavior.run.stderr | 30 +- .../rfc-2497-if-let-chains/ast-validate-guards.rs | 23 + .../ast-validate-guards.stderr | 21 + .../ui/rfc-2565-param-attrs/param-attrs-cfg.stderr | 12 +- tests/ui/rfc-2627-raw-dylib/dlltool-failed.rs | 19 + tests/ui/rfc-2627-raw-dylib/dlltool-failed.stderr | 5 + .../import-name-type-invalid-format.rs | 2 - .../import-name-type-invalid-format.stderr | 2 +- .../import-name-type-multiple.rs | 2 - .../import-name-type-multiple.stderr | 2 +- .../import-name-type-unknown-value.rs | 2 - .../import-name-type-unknown-value.stderr | 2 +- .../import-name-type-unsupported-link-kind.rs | 2 - .../import-name-type-unsupported-link-kind.stderr | 4 +- tests/ui/rfc-2627-raw-dylib/invalid-dlltool.rs | 13 + tests/ui/rfc-2627-raw-dylib/invalid-dlltool.stderr | 4 + .../ui/rfc-2627-raw-dylib/link-ordinal-and-name.rs | 2 - .../link-ordinal-and-name.stderr | 4 +- .../link-ordinal-invalid-format.rs | 2 - .../link-ordinal-invalid-format.stderr | 4 +- .../link-ordinal-missing-argument.rs | 2 - .../link-ordinal-missing-argument.stderr | 4 +- .../ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs | 2 - .../link-ordinal-multiple.stderr | 8 +- .../link-ordinal-not-foreign-fn.rs | 2 - .../link-ordinal-not-foreign-fn.stderr | 6 +- .../rfc-2627-raw-dylib/link-ordinal-too-large.rs | 2 - .../link-ordinal-too-large.stderr | 4 +- .../link-ordinal-too-many-arguments.rs | 2 - .../link-ordinal-too-many-arguments.stderr | 4 +- .../link-ordinal-unsupported-link-kind.rs | 2 - .../link-ordinal-unsupported-link-kind.stderr | 4 +- .../ui/rfc-2627-raw-dylib/multiple-declarations.rs | 1 - .../multiple-declarations.stderr | 2 +- .../rfc-2627-raw-dylib/raw-dylib-windows-only.rs | 1 - .../raw-dylib-windows-only.stderr | 2 +- tests/ui/rfc-2632-const-trait-impl/assoc-type.rs | 3 +- .../ui/rfc-2632-const-trait-impl/assoc-type.stderr | 19 +- .../call-const-trait-method-pass.rs | 2 +- .../call-const-trait-method-pass.stderr | 20 + .../call-generic-in-impl.rs | 2 +- .../call-generic-in-impl.stderr | 8 + .../call-generic-method-chain.rs | 2 +- .../call-generic-method-chain.stderr | 23 + .../call-generic-method-dup-bound.rs | 2 +- .../call-generic-method-dup-bound.stderr | 23 + .../call-generic-method-fail.rs | 3 +- .../call-generic-method-fail.stderr | 29 +- .../call-generic-method-pass.rs | 2 +- .../call-generic-method-pass.stderr | 17 + .../const-and-non-const-impl.rs | 4 +- .../const-and-non-const-impl.stderr | 27 +- .../const-closure-trait-method-fail.rs | 3 +- .../const-closure-trait-method-fail.stderr | 4 +- .../ui/rfc-2632-const-trait-impl/const-closures.rs | 2 +- .../const-drop-fail-2.precise.stderr | 54 +- .../rfc-2632-const-trait-impl/const-drop-fail-2.rs | 5 +- .../const-drop-fail-2.stderr | 50 ++ .../const-drop-fail-2.stock.stderr | 54 +- .../const-drop-fail.precise.stderr | 10 +- .../rfc-2632-const-trait-impl/const-drop-fail.rs | 4 +- .../const-drop-fail.stock.stderr | 10 +- .../rfc-2632-const-trait-impl/const-impl-trait.rs | 2 +- .../const-impl-trait.stderr | 39 + .../const_derives/derive-const-gate.rs | 1 + .../const_derives/derive-const-gate.stderr | 12 +- .../const_derives/derive-const-non-const-type.rs | 3 +- .../derive-const-non-const-type.stderr | 38 +- .../const_derives/derive-const-use.rs | 2 +- .../const_derives/derive-const-use.stderr | 53 ++ .../const_derives/derive-const-with-params.rs | 2 +- .../const_derives/derive-const-with-params.stderr | 20 + .../ui/rfc-2632-const-trait-impl/generic-bound.rs | 2 +- .../rfc-2632-const-trait-impl/generic-bound.stderr | 11 + .../non-const-op-in-closure-in-const.rs | 2 +- .../non-const-op-in-closure-in-const.stderr | 8 + ...st-default-bound-non-const-specialized-bound.rs | 24 +- ...efault-bound-non-const-specialized-bound.stderr | 4 +- .../issue-95186-specialize-on-tilde-const.rs | 24 +- ...e-95187-same-trait-bound-different-constness.rs | 24 +- .../specializing-constness.rs | 7 +- .../specializing-constness.stderr | 12 +- .../std-impl-gate.gated.stderr | 9 + .../ui/rfc-2632-const-trait-impl/std-impl-gate.rs | 2 +- .../super-traits-fail-2.nn.stderr | 8 +- .../super-traits-fail-2.ny.stderr | 8 +- .../super-traits-fail-2.rs | 1 + .../super-traits-fail-2.yn.stderr | 4 +- .../super-traits-fail-2.yy.stderr | 4 +- .../super-traits-fail-3.nn.stderr | 10 +- .../super-traits-fail-3.ny.stderr | 8 +- .../super-traits-fail-3.rs | 1 + .../super-traits-fail-3.yn.stderr | 2 +- .../trait-default-body-stability.rs | 2 +- .../trait-default-body-stability.stderr | 20 + .../trait-method-ptr-in-consts-ice.rs | 23 + tests/ui/rfcs/rfc-3348-c-string-literals/basic.rs | 9 + .../rfcs/rfc-3348-c-string-literals/basic.stderr | 25 + .../edition-2015-2018-lexing.rs | 24 + tests/ui/rfcs/rfc-3348-c-string-literals/gate.rs | 15 + .../ui/rfcs/rfc-3348-c-string-literals/gate.stderr | 32 + .../ui/rfcs/rfc-3348-c-string-literals/no-nuls.rs | Bin 0 -> 760 bytes .../rfcs/rfc-3348-c-string-literals/no-nuls.stderr | Bin 0 -> 4477 bytes .../rfcs/rfc-3348-c-string-literals/non-ascii.rs | 12 + .../rfc-3348-c-string-literals/non-ascii.stderr | 38 + tests/ui/rust-2018/remove-extern-crate.fixed | 1 + tests/ui/rust-2018/remove-extern-crate.rs | 1 + tests/ui/rust-2018/remove-extern-crate.stderr | 6 +- tests/ui/sanitize/cfg.rs | 10 + ...itizer-cfi-canonical-jump-tables-require-cfi.rs | 8 + ...er-cfi-canonical-jump-tables-require-cfi.stderr | 4 + .../sanitizer-cfi-generalize-pointers-attr-cfg.rs | 9 + ...anitizer-cfi-generalize-pointers-require-cfi.rs | 9 + ...izer-cfi-generalize-pointers-require-cfi.stderr | 4 + .../sanitizer-cfi-invalid-attr-cfi-encoding.rs | 11 + .../sanitizer-cfi-invalid-attr-cfi-encoding.stderr | 8 + ...incompatible-with-saniziter-kcfi.aarch64.stderr | 8 + ...izer-cfi-is-incompatible-with-saniziter-kcfi.rs | 12 + ...-incompatible-with-saniziter-kcfi.x86_64.stderr | 8 + .../sanitizer-cfi-normalize-integers-attr-cfg.rs | 9 + ...sanitizer-cfi-normalize-integers-require-cfi.rs | 9 + ...tizer-cfi-normalize-integers-require-cfi.stderr | 4 + tests/ui/sanitize/sanitizer-cfi-requires-lto.rs | 8 + .../ui/sanitize/sanitizer-cfi-requires-lto.stderr | 4 + tests/ui/sanitize/split-lto-unit-requires-lto.rs | 8 + .../ui/sanitize/split-lto-unit-requires-lto.stderr | 4 + tests/ui/self/arbitrary-self-from-method-substs.rs | 16 + .../self/arbitrary-self-from-method-substs.stderr | 9 + ...rbitrary-self-types-not-object-safe.curr.stderr | 3 +- ...not-object-safe.object_safe_for_dispatch.stderr | 3 +- tests/ui/self/elision/nested-item.rs | 13 + tests/ui/self/elision/nested-item.stderr | 38 + tests/ui/self/self-ctor-nongeneric.rs | 15 + tests/ui/simd/issue-105439.rs | 25 + ...orrowck-borrow-overloaded-auto-deref-mut.stderr | 8 +- .../borrowck-borrow-overloaded-deref-mut.stderr | 4 +- .../borrowck-call-is-borrow-issue-12224.stderr | 6 +- .../borrowck-call-method-from-mut-aliasable.stderr | 2 +- tests/ui/span/borrowck-fn-in-const-b.stderr | 2 +- tests/ui/span/borrowck-object-mutability.stderr | 2 +- tests/ui/span/coerce-suggestions.stderr | 11 +- tests/ui/span/issue-23729.stderr | 2 +- tests/ui/span/issue-23827.stderr | 2 +- tests/ui/span/issue-24356.stderr | 2 +- tests/ui/span/issue-39018.stderr | 14 +- tests/ui/span/mut-arg-hint.stderr | 6 +- tests/ui/span/send-is-not-static-std-sync-2.stderr | 2 - tests/ui/specialization/const_trait_impl.rs | 3 +- tests/ui/specialization/const_trait_impl.stderr | 20 + tests/ui/specialization/issue-111232.rs | 11 + tests/ui/specialization/issue-111232.stderr | 11 + tests/ui/specialization/issue-40582.rs | 35 + .../specialize-associated-type.rs | 37 + .../min_specialization/specialize_nothing.rs | 14 + .../min_specialization/specialize_nothing.stderr | 14 + .../min_specialization/specialize_on_type_error.rs | 33 + .../specialize_on_type_error.stderr | 12 + .../specialize_with_generalize_lifetimes.rs | 50 ++ .../specialize_with_generalize_lifetimes.stderr | 27 + .../specialization-default-items-drop-coherence.rs | 30 + .../stability-attribute-trait-impl.rs | 6 +- .../stability-attribute-trait-impl.stderr | 2 +- tests/ui/static/issue-18118.stderr | 2 + tests/ui/statics/issue-91050-1.rs | 2 + tests/ui/str/str-array-assignment.stderr | 21 +- tests/ui/structs-enums/issue-103869.fixed | 13 + tests/ui/structs-enums/issue-103869.rs | 13 + tests/ui/structs-enums/issue-103869.stderr | 17 + tests/ui/structs-enums/type-sizes.rs | 67 +- tests/ui/suggestions/as-ref.stderr | 88 +- .../missing-assoc-fn-applicable-suggestions.rs | 16 + .../suggestions/derive-macro-missing-bounds.stderr | 8 +- tests/ui/suggestions/invalid-bin-op.stderr | 4 +- tests/ui/suggestions/issue-109436.stderr | 2 +- tests/ui/suggestions/issue-109854.rs | 12 + tests/ui/suggestions/issue-109854.stderr | 31 + tests/ui/suggestions/issue-68049-2.stderr | 8 +- tests/ui/suggestions/issue-71394-no-from-impl.rs | 5 + .../ui/suggestions/issue-71394-no-from-impl.stderr | 13 +- tests/ui/suggestions/issue-94171.rs | 5 + tests/ui/suggestions/issue-94171.stderr | 36 + tests/ui/suggestions/issue-96555.stderr | 12 +- tests/ui/suggestions/issue-99597.rs | 15 + tests/ui/suggestions/issue-99597.stderr | 15 + tests/ui/suggestions/many-type-ascription.rs | 2 +- tests/ui/suggestions/many-type-ascription.stderr | 10 +- .../missing-assoc-fn-applicable-suggestions.fixed | 21 - .../missing-assoc-fn-applicable-suggestions.rs | 21 +- .../missing-assoc-fn-applicable-suggestions.stderr | 18 +- tests/ui/suggestions/missing-assoc-fn.stderr | 2 +- tests/ui/suggestions/path-by-value.stderr | 3 +- .../ui/suggestions/restrict-type-not-param.stderr | 4 +- .../ui/suggestions/suggest-borrow-to-dyn-object.rs | 16 - .../suggest-borrow-to-dyn-object.stderr | 17 - .../ui/suggestions/suggest-boxed-empty-block.fixed | 12 + tests/ui/suggestions/suggest-boxed-empty-block.rs | 12 + .../suggestions/suggest-boxed-empty-block.stderr | 33 + .../suggest-mut-method-for-loop-hashmap.fixed | 2 +- .../suggest-mut-method-for-loop-hashmap.rs | 2 +- .../suggest-mut-method-for-loop-hashmap.stderr | 10 +- tests/ui/suggestions/suggest-ref-macro.rs | 4 +- tests/ui/suggestions/suggest-ref-macro.stderr | 19 +- tests/ui/suggestions/suggest-ref-mut.rs | 3 - tests/ui/suggestions/suggest-ref-mut.stderr | 12 +- .../type-ascription-instead-of-let.fixed | 11 + .../suggestions/type-ascription-instead-of-let.rs | 7 +- .../type-ascription-instead-of-let.stderr | 21 +- .../type-ascription-instead-of-method.fixed | 2 +- .../type-ascription-instead-of-method.rs | 2 +- .../type-ascription-instead-of-method.stderr | 10 +- .../type-ascription-instead-of-path-2.fixed | 2 +- .../type-ascription-instead-of-path-2.rs | 2 +- .../type-ascription-instead-of-path-2.stderr | 14 +- .../suggestions/type-ascription-instead-of-path.rs | 3 +- .../type-ascription-instead-of-path.stderr | 18 +- .../type-ascription-instead-of-variant.fixed | 2 +- .../type-ascription-instead-of-variant.rs | 2 +- .../type-ascription-instead-of-variant.stderr | 10 +- tests/ui/target-feature/gate.rs | 1 + tests/ui/target-feature/gate.stderr | 2 +- tests/ui/target-feature/invalid-attribute.rs | 1 + tests/ui/target-feature/invalid-attribute.stderr | 44 +- tests/ui/test-attrs/issue-12997-1.rs | 11 + tests/ui/test-attrs/issue-12997-1.stderr | 14 + tests/ui/test-attrs/issue-12997-2.rs | 9 + tests/ui/test-attrs/issue-12997-2.stderr | 21 + tests/ui/test-attrs/issue-34932.rs | 11 + tests/ui/test-attrs/test-type.rs | 1 + ...ing-format-json-without-unstableopts.run.stderr | 2 +- .../tests-listing-format-json.run.stdout | 6 +- .../thread-local-static-ref-use-after-free.rs | 46 + tests/ui/threads-sendsync/issue-43733-2.rs | 2 +- tests/ui/threads-sendsync/issue-43733.mir.stderr | 4 +- tests/ui/threads-sendsync/issue-43733.rs | 8 +- tests/ui/threads-sendsync/issue-43733.thir.stderr | 6 +- tests/ui/track-diagnostics/track6.rs | 3 + tests/ui/track-diagnostics/track6.stderr | 4 +- tests/ui/traits/coercion-generic-bad.stderr | 2 +- tests/ui/traits/copy-guessing.rs | 4 +- tests/ui/traits/copy-guessing.stderr | 14 + tests/ui/traits/cycle-cache-err-60010.stderr | 9 +- tests/ui/traits/impl-evaluation-order.rs | 2 + tests/ui/traits/infer-from-object-issue-26952.rs | 4 +- tests/ui/traits/issue-106072.rs | 1 - tests/ui/traits/issue-106072.stderr | 12 +- tests/ui/traits/issue-20692.stderr | 3 +- tests/ui/traits/issue-22384.rs | 8 + tests/ui/traits/issue-22384.stderr | 9 + tests/ui/traits/issue-38404.rs | 1 + tests/ui/traits/issue-38404.stderr | 16 +- tests/ui/traits/issue-38604.stderr | 3 +- tests/ui/traits/issue-7013.stderr | 5 +- tests/ui/traits/map-types.stderr | 2 +- .../negative-bounds/associated-constraints.rs | 20 + .../negative-bounds/associated-constraints.stderr | 34 + tests/ui/traits/negative-bounds/simple.rs | 42 + tests/ui/traits/negative-bounds/simple.stderr | 70 ++ tests/ui/traits/negative-bounds/supertrait.rs | 9 + tests/ui/traits/negative-bounds/supertrait.stderr | 10 + .../negated-auto-traits-error.stderr | 6 +- tests/ui/traits/new-solver/alias-bound-unsound.rs | 27 + .../traits/new-solver/alias-bound-unsound.stderr | 24 + ...alias_eq_dont_use_normalizes_to_if_substs_eq.rs | 4 +- ...s_eq_dont_use_normalizes_to_if_substs_eq.stderr | 9 - .../alias_eq_substs_eq_not_intercrate.rs | 4 +- .../alias_eq_substs_eq_not_intercrate.stderr | 9 - .../auto-with-drop_tracking_mir.fail.stderr | 4 +- .../new-solver/auto-with-drop_tracking_mir.rs | 1 + tests/ui/traits/new-solver/borrowck-error.rs | 11 + tests/ui/traits/new-solver/borrowck-error.stderr | 12 + .../traits/new-solver/exponential-trait-goals.rs | 20 + .../new-solver/exponential-trait-goals.stderr | 23 + tests/ui/traits/new-solver/int-var-alias-eq.rs | 2 +- .../traits/new-solver/negative-coherence-bounds.rs | 40 + .../new-solver/negative-coherence-bounds.stderr | 12 + tests/ui/traits/new-solver/nested-alias-bound.rs | 20 + .../new-solver/normalize-rcvr-for-inherent.rs | 25 + .../traits/new-solver/structural-resolve-field.rs | 13 + tests/ui/traits/new-solver/temporary-ambiguity.rs | 2 +- ...wo-projection-param-candidates-are-ambiguous.rs | 2 +- .../non_lifetime_binders/drop-impl-pred.no.stderr | 24 + .../traits/non_lifetime_binders/drop-impl-pred.rs | 25 + .../non_lifetime_binders/drop-impl-pred.yes.stderr | 11 + .../supertrait-object-safety.stderr | 3 +- .../traits/non_lifetime_binders/universe-error1.rs | 18 + .../non_lifetime_binders/universe-error1.stderr | 27 + tests/ui/traits/object/safety.stderr | 3 +- tests/ui/traits/test-2.stderr | 3 +- .../trait-upcasting/type-checking-test-1.stderr | 2 +- .../trait-upcasting/type-checking-test-2.stderr | 4 +- tests/ui/traits/unsend-future.stderr | 4 +- tests/ui/transmutability/issue-110467.rs | 17 + tests/ui/transmutability/references.current.stderr | 4 +- tests/ui/transmutability/references.next.stderr | 4 +- tests/ui/transmutability/region-infer.rs | 22 + tests/ui/transmutability/region-infer.stderr | 23 + ...rivial-bounds-inconsistent-copy-reborrow.stderr | 4 +- .../trivial-bounds-inconsistent-copy.rs | 2 + .../trivial-bounds-inconsistent-copy.stderr | 8 +- .../enum-variant-generic-args.stderr | 12 +- .../self-in-enum-definition.stderr | 2 +- .../associated-type-impl-trait-lifetime.rs | 9 +- .../type-alias-impl-trait/closure_parent_substs.rs | 10 +- .../different_defining_uses_never_type-2.rs | 15 + .../different_defining_uses_never_type-2.stderr | 14 + .../different_defining_uses_never_type-3.rs | 15 + .../different_defining_uses_never_type-3.stderr | 14 + .../invalid_impl_trait_in_assoc_ty.rs | 16 + .../invalid_impl_trait_in_assoc_ty.stderr | 22 + tests/ui/type-alias-impl-trait/issue-65918.rs | 2 - tests/ui/type-alias-impl-trait/issue-98604.stderr | 2 +- tests/ui/type-alias-impl-trait/issue-98608.stderr | 2 +- .../multiple-def-uses-in-one-fn.rs | 1 + .../multiple-def-uses-in-one-fn.stderr | 11 +- .../wf-in-associated-type.fail.stderr | 25 + .../type-alias-impl-trait/wf-in-associated-type.rs | 45 + .../ui/type-alias-impl-trait/wf-nested.fail.stderr | 19 + .../wf-nested.pass_sound.stderr | 14 + tests/ui/type-alias-impl-trait/wf-nested.rs | 60 ++ tests/ui/type/ascription/issue-34255-1.rs | 7 +- tests/ui/type/ascription/issue-34255-1.stderr | 38 +- tests/ui/type/ascription/issue-47666.fixed | 2 +- tests/ui/type/ascription/issue-47666.rs | 2 +- tests/ui/type/ascription/issue-47666.stderr | 14 +- tests/ui/type/ascription/issue-54516.fixed | 2 +- tests/ui/type/ascription/issue-54516.rs | 2 +- tests/ui/type/ascription/issue-54516.stderr | 10 +- tests/ui/type/ascription/issue-60933.fixed | 2 +- tests/ui/type/ascription/issue-60933.rs | 2 +- tests/ui/type/ascription/issue-60933.stderr | 10 +- tests/ui/type/issue-58355.stderr | 2 +- tests/ui/type/missing-let-in-binding-2.fixed | 5 + tests/ui/type/missing-let-in-binding-2.rs | 5 + tests/ui/type/missing-let-in-binding-2.stderr | 13 + tests/ui/type/missing-let-in-binding-3.rs | 5 + tests/ui/type/missing-let-in-binding-3.stderr | 10 + tests/ui/type/missing-let-in-binding-4.rs | 5 + tests/ui/type/missing-let-in-binding-4.stderr | 10 + tests/ui/type/missing-let-in-binding.fixed | 2 +- tests/ui/type/missing-let-in-binding.rs | 2 +- tests/ui/type/missing-let-in-binding.stderr | 10 +- .../type-ascription-instead-of-statement-end.rs | 8 +- ...type-ascription-instead-of-statement-end.stderr | 22 +- tests/ui/type/type-ascription-precedence.rs | 48 +- tests/ui/type/type-ascription-precedence.stderr | 73 +- tests/ui/type/type-ascription-with-fn-call.fixed | 6 +- tests/ui/type/type-ascription-with-fn-call.rs | 6 +- tests/ui/type/type-ascription-with-fn-call.stderr | 11 +- tests/ui/type/type-dependent-def-issue-49241.rs | 1 - .../ui/type/type-dependent-def-issue-49241.stderr | 6 - tests/ui/type/type-mismatch.stderr | 20 +- tests/ui/type/type-path-err-node-types.stderr | 12 +- tests/ui/type/type-unsatisfiable.usage.stderr | 4 +- tests/ui/typeck/bad-index-due-to-nested.rs | 27 + tests/ui/typeck/bad-index-due-to-nested.stderr | 72 ++ tests/ui/typeck/bad-recursive-type-sig-infer.rs | 11 + .../ui/typeck/bad-recursive-type-sig-infer.stderr | 15 + tests/ui/typeck/bad-type-in-vec-contains.stderr | 10 +- tests/ui/typeck/derive-sugg-arg-arity.rs | 8 + tests/ui/typeck/derive-sugg-arg-arity.stderr | 31 + tests/ui/typeck/issue-13853.stderr | 10 +- .../ui/typeck/pin-unsound-issue-85099-derefmut.rs | 68 ++ tests/ui/typeck/repeat-expr-checks-wf.rs | 10 + tests/ui/typeck/repeat-expr-checks-wf.stderr | 12 + .../typeck/typeck-builtin-bound-type-parameters.rs | 1 + .../typeck-builtin-bound-type-parameters.stderr | 18 +- tests/ui/typeck/typeck_type_placeholder_item.rs | 4 +- .../ui/typeck/typeck_type_placeholder_item.stderr | 34 +- ...-sugar-wrong-number-number-type-parameters-1.rs | 2 +- ...ar-wrong-number-number-type-parameters-1.stderr | 2 +- ...ar-wrong-number-number-type-parameters-3.stderr | 2 +- tests/ui/underscore-imports/issue-110164.rs | 19 + tests/ui/underscore-imports/issue-110164.stderr | 71 ++ tests/ui/uninhabited/uninhabited-irrefutable.rs | 7 + .../ui/uninhabited/uninhabited-irrefutable.stderr | 4 +- tests/ui/union/union-sized-field.stderr | 9 +- tests/ui/unsized-locals/align.rs | 30 + tests/ui/unsized-locals/issue-67981.rs | 9 + tests/ui/unsized-locals/issue-67981.stderr | 15 + tests/ui/unsized-locals/suggest-borrow.stderr | 11 +- tests/ui/unsized/box-instead-of-dyn-fn.rs | 1 - tests/ui/unsized/box-instead-of-dyn-fn.stderr | 43 +- tests/ui/unsized/issue-91801.stderr | 7 +- tests/ui/unsized/issue-91803.stderr | 9 +- tests/ui/unsized/unsized-fn-param.stderr | 16 +- .../unwind-abis/feature-gate-c-unwind-enabled.rs | 12 - tests/ui/unwind-abis/feature-gate-c-unwind.rs | 13 - tests/ui/unwind-abis/feature-gate-c-unwind.stderr | 33 - tests/ui/unwind-abis/feature-gate-c_unwind.rs | 4 + .../ui/unwind-abis/feature-gate-stdcall-unwind.rs | 30 - .../unwind-abis/feature-gate-stdcall-unwind.stderr | 66 -- tests/ui/unwind-abis/feature-gate-system-unwind.rs | 9 - .../unwind-abis/feature-gate-system-unwind.stderr | 12 - .../ui/unwind-abis/feature-gate-thiscall-unwind.rs | 39 - .../feature-gate-thiscall-unwind.stderr | 122 --- tests/ui/unwind-abis/ffi-unwind-calls-lint.rs | 1 - tests/ui/unwind-abis/ffi-unwind-calls-lint.stderr | 6 +- tests/ui/use/use-self-type.stderr | 2 +- tests/ui/user-defined-macro-rules.rs | 9 - tests/ui/weird-exprs.rs | 30 + tests/ui/wf/wf-convert-unsafe-trait-obj-box.stderr | 9 +- tests/ui/wf/wf-convert-unsafe-trait-obj.stderr | 9 +- tests/ui/wf/wf-in-fn-type-implicit.rs | 37 + tests/ui/wf/wf-in-where-clause-static.rs | 23 + tests/ui/wf/wf-normalization-sized.rs | 19 + tests/ui/wf/wf-unsafe-trait-obj-match.stderr | 6 +- 2712 files changed, 38658 insertions(+), 17736 deletions(-) create mode 100644 tests/assembly/asm/inline-asm-avx.rs create mode 100644 tests/assembly/asm/loongarch-type.rs create mode 100644 tests/assembly/option-nonzero-eq.rs create mode 100644 tests/assembly/slice-is_ascii.rs create mode 100644 tests/codegen/addr-of-mutate.rs create mode 100644 tests/codegen/align-offset.rs create mode 100644 tests/codegen/ascii-char.rs create mode 100644 tests/codegen/debuginfo-constant-locals.rs create mode 100644 tests/codegen/drop-in-place-noalias.rs create mode 100644 tests/codegen/enable-lto-unit-splitting.rs create mode 100644 tests/codegen/intrinsics/offset.rs create mode 100644 tests/codegen/intrinsics/transmute-niched.rs create mode 100644 tests/codegen/issues/issue-111603.rs create mode 100644 tests/codegen/loongarch-abi/call-llvm-intrinsics.rs create mode 100644 tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs delete mode 100644 tests/codegen/mem-replace-direct-memcpy.rs create mode 100644 tests/codegen/mem-replace-simple-type.rs create mode 100644 tests/codegen/sanitizer-cfi-add-enable-split-lto-unit-flag.rs create mode 100644 tests/codegen/sanitizer-cfi-emit-type-checks-attr-no-sanitize.rs create mode 100644 tests/codegen/sanitizer-cfi-emit-type-metadata-attr-cfi-encoding.rs create mode 100644 tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi-generalized.rs create mode 100644 tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs create mode 100644 tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi-normalized.rs create mode 100644 tests/codegen/sanitizer-cfi-emit-type-metadata-trait-objects.rs create mode 100644 tests/codegen/sanitizer-cfi-generalize-pointers.rs create mode 100644 tests/codegen/sanitizer-cfi-normalize-integers.rs create mode 100644 tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-attr-no-sanitize.rs create mode 100644 tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs create mode 100644 tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs create mode 100644 tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs create mode 100644 tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle.rs create mode 100644 tests/codegen/sanitizer-kcfi-emit-type-metadata-trait-objects.rs create mode 100644 tests/codegen/slice-iter-nonnull.rs create mode 100644 tests/codegen/split-lto-unit.rs create mode 100644 tests/codegen/tied-features-strength.rs create mode 100644 tests/codegen/transmute-optimized.rs create mode 100644 tests/debuginfo/reference-debuginfo.rs create mode 100644 tests/incremental/const-generic-type-cycle.rs create mode 100644 tests/incremental/const-generics/change-const-param-gat.rs create mode 100644 tests/incremental/const-generics/change-const-param-type.rs delete mode 100644 tests/mir-opt/bool_compare.opt1.InstCombine.diff create mode 100644 tests/mir-opt/bool_compare.opt1.InstSimplify.diff delete mode 100644 tests/mir-opt/bool_compare.opt2.InstCombine.diff create mode 100644 tests/mir-opt/bool_compare.opt2.InstSimplify.diff delete mode 100644 tests/mir-opt/bool_compare.opt3.InstCombine.diff create mode 100644 tests/mir-opt/bool_compare.opt3.InstSimplify.diff delete mode 100644 tests/mir-opt/bool_compare.opt4.InstCombine.diff create mode 100644 tests/mir-opt/bool_compare.opt4.InstSimplify.diff create mode 100644 tests/mir-opt/building/custom/projections.copy_for_deref.built.after.mir create mode 100644 tests/mir-opt/building/enum_cast.far.built.after.mir create mode 100644 tests/mir-opt/building/enum_cast.offsetty.built.after.mir create mode 100644 tests/mir-opt/building/enum_cast.signy.built.after.mir create mode 100644 tests/mir-opt/building/enum_cast.unsigny.built.after.mir delete mode 100644 tests/mir-opt/casts.redundant.InstCombine.diff create mode 100644 tests/mir-opt/casts.redundant.InstSimplify.diff delete mode 100644 tests/mir-opt/combine_array_len.norm2.InstCombine.diff create mode 100644 tests/mir-opt/combine_array_len.norm2.InstSimplify.diff delete mode 100644 tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstCombine.diff create mode 100644 tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff delete mode 100644 tests/mir-opt/combine_transmutes.adt_transmutes.InstCombine.diff create mode 100644 tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff delete mode 100644 tests/mir-opt/combine_transmutes.identity_transmutes.InstCombine.diff create mode 100644 tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff delete mode 100644 tests/mir-opt/combine_transmutes.integer_transmutes.InstCombine.diff create mode 100644 tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff create mode 100644 tests/mir-opt/const_prop/address_of_pair.fn0.ConstProp.diff create mode 100644 tests/mir-opt/const_prop/address_of_pair.rs create mode 100644 tests/mir-opt/const_prop/offset_of.concrete.ConstProp.diff create mode 100644 tests/mir-opt/const_prop/offset_of.generic.ConstProp.diff create mode 100644 tests/mir-opt/const_prop/offset_of.rs delete mode 100644 tests/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.32bit.diff delete mode 100644 tests/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.64bit.diff delete mode 100644 tests/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.32bit.mir delete mode 100644 tests/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.64bit.mir delete mode 100644 tests/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff delete mode 100644 tests/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff delete mode 100644 tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir delete mode 100644 tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir delete mode 100644 tests/mir-opt/const_prop/optimizes_into_variable.rs create mode 100644 tests/mir-opt/const_prop/transmute.from_char.ConstProp.32bit.diff create mode 100644 tests/mir-opt/const_prop/transmute.from_char.ConstProp.64bit.diff delete mode 100644 tests/mir-opt/const_prop/transmute.from_char.ConstProp.diff create mode 100644 tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.32bit.diff create mode 100644 tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.64bit.diff delete mode 100644 tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.diff create mode 100644 tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.32bit.diff create mode 100644 tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.64bit.diff delete mode 100644 tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.diff create mode 100644 tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.32bit.diff create mode 100644 tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.64bit.diff delete mode 100644 tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.diff create mode 100644 tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.32bit.diff create mode 100644 tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.64bit.diff delete mode 100644 tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.diff create mode 100644 tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff create mode 100644 tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff delete mode 100644 tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.diff create mode 100644 tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.32bit.diff create mode 100644 tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.64bit.diff delete mode 100644 tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.diff create mode 100644 tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.32bit.diff create mode 100644 tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.64bit.diff delete mode 100644 tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.diff create mode 100644 tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.32bit.diff create mode 100644 tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.64bit.diff delete mode 100644 tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.diff create mode 100644 tests/mir-opt/const_prop/transmute.valid_char.ConstProp.32bit.diff create mode 100644 tests/mir-opt/const_prop/transmute.valid_char.ConstProp.64bit.diff delete mode 100644 tests/mir-opt/const_prop/transmute.valid_char.ConstProp.diff create mode 100644 tests/mir-opt/const_prop/while_let_loops.change_loop_body.ConstProp.diff create mode 100644 tests/mir-opt/const_prop/while_let_loops.rs create mode 100644 tests/mir-opt/copy-prop/partial_init.main.CopyProp.diff create mode 100644 tests/mir-opt/copy-prop/partial_init.rs create mode 100644 tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination.diff create mode 100644 tests/mir-opt/dead-store-elimination/place_mention.rs delete mode 100644 tests/mir-opt/dont_yeet_assert.generic.InstCombine.diff create mode 100644 tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff delete mode 100644 tests/mir-opt/equal_true.opt.InstCombine.diff create mode 100644 tests/mir-opt/equal_true.opt.InstSimplify.diff create mode 100644 tests/mir-opt/inline/unsized_argument.caller.Inline.diff create mode 100644 tests/mir-opt/inline/unsized_argument.rs delete mode 100644 tests/mir-opt/instcombine_duplicate_switch_targets.assert_zero.InstCombine.diff delete mode 100644 tests/mir-opt/instcombine_duplicate_switch_targets.rs create mode 100644 tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff create mode 100644 tests/mir-opt/instsimplify_duplicate_switch_targets.rs delete mode 100644 tests/mir-opt/intrinsic_asserts.generic.InstCombine.diff create mode 100644 tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff delete mode 100644 tests/mir-opt/intrinsic_asserts.panics.InstCombine.diff create mode 100644 tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff delete mode 100644 tests/mir-opt/intrinsic_asserts.removable.InstCombine.diff create mode 100644 tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff delete mode 100644 tests/mir-opt/issue_78192.f.InstCombine.diff create mode 100644 tests/mir-opt/issue_78192.f.InstSimplify.diff create mode 100644 tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.diff create mode 100644 tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.diff delete mode 100644 tests/mir-opt/lower_intrinsics_e2e.f_u64.PreCodegen.after.mir delete mode 100644 tests/mir-opt/lower_intrinsics_e2e.f_unit.PreCodegen.after.mir delete mode 100644 tests/mir-opt/lower_intrinsics_e2e.rs delete mode 100644 tests/mir-opt/not_equal_false.opt.InstCombine.diff create mode 100644 tests/mir-opt/not_equal_false.opt.InstSimplify.diff create mode 100644 tests/mir-opt/nrvo_miscompile_111005.rs create mode 100644 tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff create mode 100644 tests/mir-opt/pre-codegen/README.md create mode 100644 tests/mir-opt/pre-codegen/duplicate_switch_targets.rs create mode 100644 tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/intrinsics.f_u64.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/intrinsics.f_unit.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/intrinsics.rs create mode 100644 tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/mem_replace.rs create mode 100644 tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.diff create mode 100644 tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.diff create mode 100644 tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.mir create mode 100644 tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.mir create mode 100644 tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff create mode 100644 tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff create mode 100644 tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir create mode 100644 tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir create mode 100644 tests/mir-opt/pre-codegen/optimizes_into_variable.rs create mode 100644 tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/range_iter.rs create mode 100644 tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/simple_option_map.rs create mode 100644 tests/mir-opt/pre-codegen/slice_index.rs create mode 100644 tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/slice_iter.rs create mode 100644 tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/try_identity.rs create mode 100644 tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff create mode 100644 tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff create mode 100644 tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff create mode 100644 tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff create mode 100644 tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff create mode 100644 tests/mir-opt/reference_prop.read_through_raw.ReferencePropagation.diff create mode 100644 tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff create mode 100644 tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff create mode 100644 tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff create mode 100644 tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff create mode 100644 tests/mir-opt/reference_prop.rs create mode 100644 tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff delete mode 100644 tests/mir-opt/simple_option_map_e2e.ezmap.PreCodegen.after.mir delete mode 100644 tests/mir-opt/simple_option_map_e2e.rs create mode 100644 tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff create mode 100644 tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff delete mode 100644 tests/mir-opt/try_identity_e2e.new.PreCodegen.after.mir delete mode 100644 tests/mir-opt/try_identity_e2e.old.PreCodegen.after.mir delete mode 100644 tests/mir-opt/try_identity_e2e.rs delete mode 100644 tests/mir-opt/while_let_loops.change_loop_body.ConstProp.diff delete mode 100644 tests/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.mir delete mode 100644 tests/mir-opt/while_let_loops.rs create mode 100644 tests/pretty/offset_of.rs create mode 100644 tests/run-make/CURRENT_RUSTC_VERSION/Makefile create mode 100644 tests/run-make/CURRENT_RUSTC_VERSION/main.rs create mode 100644 tests/run-make/CURRENT_RUSTC_VERSION/stable.rs create mode 100644 tests/run-make/allocator-shim-circular-deps/Makefile create mode 100644 tests/run-make/allocator-shim-circular-deps/main.rs create mode 100644 tests/run-make/allocator-shim-circular-deps/my_lib.rs create mode 100644 tests/run-make/branch-protection-check-IBT/Makefile create mode 100644 tests/run-make/branch-protection-check-IBT/main.rs create mode 100644 tests/run-make/const-prop-lint/Makefile create mode 100644 tests/run-make/const-prop-lint/input.rs create mode 100644 tests/run-make/core-no-oom-handling/Makefile create mode 100644 tests/run-make/coverage-reports/expected_show_coverage.sort_groups.txt create mode 100644 tests/run-make/coverage-reports/expected_show_coverage.test_harness.txt create mode 100644 tests/run-make/coverage-reports/sort_subviews.py create mode 100644 tests/run-make/coverage/sort_groups.rs create mode 100644 tests/run-make/coverage/test_harness.rs create mode 100644 tests/run-make/debugger-visualizer-dep-info/Makefile create mode 100644 tests/run-make/debugger-visualizer-dep-info/foo.py create mode 100644 tests/run-make/debugger-visualizer-dep-info/main.rs create mode 100644 tests/run-make/debugger-visualizer-dep-info/my_visualizers/bar.natvis create mode 100644 tests/run-make/forced-unwind-terminate-pof/Makefile create mode 100644 tests/run-make/forced-unwind-terminate-pof/foo.rs create mode 100644 tests/run-make/inaccessible-temp-dir/Makefile create mode 100644 tests/run-make/inaccessible-temp-dir/program.rs create mode 100644 tests/run-make/incremental-debugger-visualizer/Makefile create mode 100644 tests/run-make/incremental-debugger-visualizer/foo.rs create mode 100644 tests/run-make/issue-107094/Makefile create mode 100644 tests/run-make/libtest-junit/Makefile create mode 100644 tests/run-make/libtest-junit/f.rs create mode 100644 tests/run-make/libtest-junit/output-default.xml create mode 100644 tests/run-make/libtest-junit/output-stdout-success.xml create mode 100755 tests/run-make/libtest-junit/validate_junit.py create mode 100644 tests/run-make/no-alloc-shim/Makefile create mode 100644 tests/run-make/no-alloc-shim/foo.rs create mode 100644 tests/run-make/print-native-static-libs/Makefile create mode 100644 tests/run-make/print-native-static-libs/bar.rs create mode 100644 tests/run-make/print-native-static-libs/foo.rs create mode 100644 tests/run-make/raw-dylib-custom-dlltool/Makefile create mode 100644 tests/run-make/raw-dylib-custom-dlltool/lib.rs create mode 100644 tests/run-make/raw-dylib-custom-dlltool/output.txt create mode 100644 tests/run-make/raw-dylib-custom-dlltool/script.cmd create mode 100644 tests/run-make/short-ice/Makefile create mode 100644 tests/run-make/short-ice/check.sh create mode 100644 tests/run-make/short-ice/src/lib.rs create mode 100644 tests/run-make/staticlib-dylib-linkage/Makefile create mode 100644 tests/run-make/staticlib-dylib-linkage/bar.rs create mode 100644 tests/run-make/staticlib-dylib-linkage/foo.c create mode 100644 tests/run-make/staticlib-dylib-linkage/foo.rs create mode 100644 tests/rustdoc-gui/search-corrections.goml create mode 100644 tests/rustdoc-js/slice-array.js create mode 100644 tests/rustdoc-js/slice-array.rs create mode 100644 tests/rustdoc-json/impls/impl_item_visibility.rs create mode 100644 tests/rustdoc-json/impls/impl_item_visibility_show_hidden.rs create mode 100644 tests/rustdoc-json/impls/impl_item_visibility_show_private.rs create mode 100644 tests/rustdoc-json/reexport/auxiliary/enum_with_discriminant.rs create mode 100644 tests/rustdoc-json/reexport/doc_inline_external_crate.rs create mode 100644 tests/rustdoc-json/reexport/extern_crate_glob.rs create mode 100644 tests/rustdoc-json/type/inherent_associated_type.rs create mode 100644 tests/rustdoc-json/type/inherent_associated_type_bound.rs create mode 100644 tests/rustdoc-json/type/inherent_associated_type_projections.rs delete mode 100644 tests/rustdoc-ui/assoc-item-not-in-scope.rs delete mode 100644 tests/rustdoc-ui/assoc-item-not-in-scope.stderr delete mode 100644 tests/rustdoc-ui/auxiliary/empty-fn.rs delete mode 100644 tests/rustdoc-ui/auxiliary/extern_macros.rs delete mode 100644 tests/rustdoc-ui/auxiliary/issue-61592.rs delete mode 100644 tests/rustdoc-ui/auxiliary/panic-handler.rs delete mode 100644 tests/rustdoc-ui/bare-urls.fixed delete mode 100644 tests/rustdoc-ui/bare-urls.rs delete mode 100644 tests/rustdoc-ui/bare-urls.stderr delete mode 100644 tests/rustdoc-ui/block-doc-comment.rs delete mode 100644 tests/rustdoc-ui/block-doc-comment.stdout delete mode 100644 tests/rustdoc-ui/cfg-test.rs delete mode 100644 tests/rustdoc-ui/cfg-test.stdout delete mode 100644 tests/rustdoc-ui/check-attr-test.rs delete mode 100644 tests/rustdoc-ui/check-attr-test.stderr delete mode 100644 tests/rustdoc-ui/check-attr.rs delete mode 100644 tests/rustdoc-ui/check-attr.stderr delete mode 100644 tests/rustdoc-ui/check-cfg-test.rs delete mode 100644 tests/rustdoc-ui/check-cfg-test.stderr delete mode 100644 tests/rustdoc-ui/check-cfg-test.stdout delete mode 100644 tests/rustdoc-ui/check-cfg-unstable.rs delete mode 100644 tests/rustdoc-ui/check-cfg-unstable.stderr delete mode 100644 tests/rustdoc-ui/check-cfg.rs delete mode 100644 tests/rustdoc-ui/check-cfg.stderr create mode 100644 tests/rustdoc-ui/check-cfg/check-cfg-test.stderr create mode 100644 tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs create mode 100644 tests/rustdoc-ui/check-cfg/check-cfg-unstable.stderr create mode 100644 tests/rustdoc-ui/check-cfg/check-cfg.rs create mode 100644 tests/rustdoc-ui/check-cfg/check-cfg.stderr delete mode 100644 tests/rustdoc-ui/check-fail.rs delete mode 100644 tests/rustdoc-ui/check-fail.stderr delete mode 100644 tests/rustdoc-ui/check.rs delete mode 100644 tests/rustdoc-ui/check.stderr delete mode 100644 tests/rustdoc-ui/deny-intra-link-resolution-failure.rs delete mode 100644 tests/rustdoc-ui/deny-intra-link-resolution-failure.stderr delete mode 100644 tests/rustdoc-ui/deny-missing-docs-crate.rs delete mode 100644 tests/rustdoc-ui/deny-missing-docs-crate.stderr delete mode 100644 tests/rustdoc-ui/deny-missing-docs-macro.rs delete mode 100644 tests/rustdoc-ui/deny-missing-docs-macro.stderr delete mode 100644 tests/rustdoc-ui/display-output.rs delete mode 100644 tests/rustdoc-ui/display-output.stdout delete mode 100644 tests/rustdoc-ui/doc-attr.rs delete mode 100644 tests/rustdoc-ui/doc-attr.stderr delete mode 100644 tests/rustdoc-ui/doc-comment-multi-line-attr.rs delete mode 100644 tests/rustdoc-ui/doc-comment-multi-line-attr.stdout delete mode 100644 tests/rustdoc-ui/doc-comment-multi-line-cfg-attr.rs delete mode 100644 tests/rustdoc-ui/doc-comment-multi-line-cfg-attr.stdout delete mode 100644 tests/rustdoc-ui/doc-spotlight.fixed delete mode 100644 tests/rustdoc-ui/doc-spotlight.rs delete mode 100644 tests/rustdoc-ui/doc-spotlight.stderr delete mode 100644 tests/rustdoc-ui/doc-test-attr-pass.rs delete mode 100644 tests/rustdoc-ui/doc-test-attr.rs delete mode 100644 tests/rustdoc-ui/doc-test-attr.stderr delete mode 100644 tests/rustdoc-ui/doc-test-doctest-feature.rs delete mode 100644 tests/rustdoc-ui/doc-test-doctest-feature.stdout delete mode 100644 tests/rustdoc-ui/doc-test-rustdoc-feature.rs delete mode 100644 tests/rustdoc-ui/doc-test-rustdoc-feature.stdout delete mode 100644 tests/rustdoc-ui/doc-without-codeblock.rs delete mode 100644 tests/rustdoc-ui/doc-without-codeblock.stderr delete mode 100644 tests/rustdoc-ui/doc_cfg_hide.rs delete mode 100644 tests/rustdoc-ui/doc_cfg_hide.stderr delete mode 100644 tests/rustdoc-ui/doctest-edition.rs delete mode 100644 tests/rustdoc-ui/doctest-edition.stderr delete mode 100644 tests/rustdoc-ui/doctest-multiline-crate-attribute.rs delete mode 100644 tests/rustdoc-ui/doctest-multiline-crate-attribute.stdout delete mode 100644 tests/rustdoc-ui/doctest-output.rs delete mode 100644 tests/rustdoc-ui/doctest-output.stdout create mode 100644 tests/rustdoc-ui/doctest/auxiliary/extern_macros.rs create mode 100644 tests/rustdoc-ui/doctest/block-doc-comment.rs create mode 100644 tests/rustdoc-ui/doctest/block-doc-comment.stdout create mode 100644 tests/rustdoc-ui/doctest/cfg-test.rs create mode 100644 tests/rustdoc-ui/doctest/cfg-test.stdout create mode 100644 tests/rustdoc-ui/doctest/check-attr-test.rs create mode 100644 tests/rustdoc-ui/doctest/check-attr-test.stderr create mode 100644 tests/rustdoc-ui/doctest/check-cfg-test.rs create mode 100644 tests/rustdoc-ui/doctest/check-cfg-test.stderr create mode 100644 tests/rustdoc-ui/doctest/check-cfg-test.stdout create mode 100644 tests/rustdoc-ui/doctest/display-output.rs create mode 100644 tests/rustdoc-ui/doctest/display-output.stdout create mode 100644 tests/rustdoc-ui/doctest/doc-comment-multi-line-attr.rs create mode 100644 tests/rustdoc-ui/doctest/doc-comment-multi-line-attr.stdout create mode 100644 tests/rustdoc-ui/doctest/doc-comment-multi-line-cfg-attr.rs create mode 100644 tests/rustdoc-ui/doctest/doc-comment-multi-line-cfg-attr.stdout create mode 100644 tests/rustdoc-ui/doctest/doc-test-attr-pass.rs create mode 100644 tests/rustdoc-ui/doctest/doc-test-attr.rs create mode 100644 tests/rustdoc-ui/doctest/doc-test-attr.stderr create mode 100644 tests/rustdoc-ui/doctest/doc-test-doctest-feature.rs create mode 100644 tests/rustdoc-ui/doctest/doc-test-doctest-feature.stdout create mode 100644 tests/rustdoc-ui/doctest/doc-test-rustdoc-feature.rs create mode 100644 tests/rustdoc-ui/doctest/doc-test-rustdoc-feature.stdout create mode 100644 tests/rustdoc-ui/doctest/doctest-edition.rs create mode 100644 tests/rustdoc-ui/doctest/doctest-edition.stderr create mode 100644 tests/rustdoc-ui/doctest/doctest-multiline-crate-attribute.rs create mode 100644 tests/rustdoc-ui/doctest/doctest-multiline-crate-attribute.stdout create mode 100644 tests/rustdoc-ui/doctest/doctest-output.rs create mode 100644 tests/rustdoc-ui/doctest/doctest-output.stdout create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-compile-fail.rs create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-compile-fail.stdout create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.rs create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.stdout create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-missing-codes.rs create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-missing-codes.stdout create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-output-windows.rs create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-output-windows.stdout create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-output.rs create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-output.stdout create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-should-panic.rs create mode 100644 tests/rustdoc-ui/doctest/failed-doctest-should-panic.stdout create mode 100644 tests/rustdoc-ui/doctest/no-run-flag-error.rs create mode 100644 tests/rustdoc-ui/doctest/no-run-flag-error.stderr create mode 100644 tests/rustdoc-ui/doctest/no-run-flag.rs create mode 100644 tests/rustdoc-ui/doctest/no-run-flag.stdout create mode 100644 tests/rustdoc-ui/doctest/nocapture-fail.rs create mode 100644 tests/rustdoc-ui/doctest/nocapture-fail.stderr create mode 100644 tests/rustdoc-ui/doctest/nocapture-fail.stdout create mode 100644 tests/rustdoc-ui/doctest/nocapture.rs create mode 100644 tests/rustdoc-ui/doctest/nocapture.stderr create mode 100644 tests/rustdoc-ui/doctest/nocapture.stdout create mode 100644 tests/rustdoc-ui/doctest/private-doc-test.rs create mode 100644 tests/rustdoc-ui/doctest/private-item-doc-test.rs create mode 100644 tests/rustdoc-ui/doctest/private-item-doc-test.stderr create mode 100644 tests/rustdoc-ui/doctest/private-public-item-doc-test.rs create mode 100644 tests/rustdoc-ui/doctest/private-public-item-doc-test.stderr create mode 100644 tests/rustdoc-ui/doctest/public-reexported-item-doc-test.rs create mode 100644 tests/rustdoc-ui/doctest/run-directory.correct.stdout create mode 100644 tests/rustdoc-ui/doctest/run-directory.incorrect.stdout create mode 100644 tests/rustdoc-ui/doctest/run-directory.rs create mode 100644 tests/rustdoc-ui/doctest/test-compile-fail1.rs create mode 100644 tests/rustdoc-ui/doctest/test-compile-fail1.stderr create mode 100644 tests/rustdoc-ui/doctest/test-compile-fail2.rs create mode 100644 tests/rustdoc-ui/doctest/test-compile-fail2.stderr create mode 100644 tests/rustdoc-ui/doctest/test-compile-fail3.rs create mode 100644 tests/rustdoc-ui/doctest/test-compile-fail3.stderr create mode 100644 tests/rustdoc-ui/doctest/test-no_std.rs create mode 100644 tests/rustdoc-ui/doctest/test-no_std.stdout create mode 100644 tests/rustdoc-ui/doctest/test-type.rs create mode 100644 tests/rustdoc-ui/doctest/test-type.stdout create mode 100644 tests/rustdoc-ui/doctest/unparseable-doc-test.rs create mode 100644 tests/rustdoc-ui/doctest/unparseable-doc-test.stdout create mode 100644 tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-2.rs create mode 100644 tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-impl-trait-return.rs create mode 100644 tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-impl-trait-return.stderr create mode 100644 tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type.rs delete mode 100644 tests/rustdoc-ui/expect-tool-lint-rfc-2383.rs delete mode 100644 tests/rustdoc-ui/expect-tool-lint-rfc-2383.stderr delete mode 100644 tests/rustdoc-ui/failed-doctest-compile-fail.rs delete mode 100644 tests/rustdoc-ui/failed-doctest-compile-fail.stdout delete mode 100644 tests/rustdoc-ui/failed-doctest-extra-semicolon-on-item.rs delete mode 100644 tests/rustdoc-ui/failed-doctest-extra-semicolon-on-item.stdout delete mode 100644 tests/rustdoc-ui/failed-doctest-missing-codes.rs delete mode 100644 tests/rustdoc-ui/failed-doctest-missing-codes.stdout delete mode 100644 tests/rustdoc-ui/failed-doctest-output-windows.rs delete mode 100644 tests/rustdoc-ui/failed-doctest-output-windows.stdout delete mode 100644 tests/rustdoc-ui/failed-doctest-output.rs delete mode 100644 tests/rustdoc-ui/failed-doctest-output.stdout delete mode 100644 tests/rustdoc-ui/failed-doctest-should-panic.rs delete mode 100644 tests/rustdoc-ui/failed-doctest-should-panic.stdout delete mode 100644 tests/rustdoc-ui/feature-gate-rustdoc_missing_doc_code_examples.rs delete mode 100644 tests/rustdoc-ui/feature-gate-rustdoc_missing_doc_code_examples.stderr delete mode 100644 tests/rustdoc-ui/generate-link-to-definition-opt-unstable.rs delete mode 100644 tests/rustdoc-ui/generate-link-to-definition-opt-unstable.stderr delete mode 100644 tests/rustdoc-ui/generate-link-to-definition-opt.rs delete mode 100644 tests/rustdoc-ui/generate-link-to-definition-opt.stderr delete mode 100644 tests/rustdoc-ui/generate-link-to-definition-opt2.rs delete mode 100644 tests/rustdoc-ui/generate-link-to-definition-opt2.stderr create mode 100644 tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt-unstable.rs create mode 100644 tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt-unstable.stderr create mode 100644 tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.rs create mode 100644 tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.stderr create mode 100644 tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.rs create mode 100644 tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.stderr create mode 100644 tests/rustdoc-ui/ice-bug-report-url.rs create mode 100644 tests/rustdoc-ui/ice-bug-report-url.stderr delete mode 100644 tests/rustdoc-ui/infinite-recursive-type-impl-trait-return.rs delete mode 100644 tests/rustdoc-ui/infinite-recursive-type-impl-trait-return.stderr delete mode 100644 tests/rustdoc-ui/infinite-recursive-type-impl-trait.rs delete mode 100644 tests/rustdoc-ui/infinite-recursive-type-impl-trait.stderr create mode 100644 tests/rustdoc-ui/intra-doc/assoc-item-not-in-scope.rs create mode 100644 tests/rustdoc-ui/intra-doc/assoc-item-not-in-scope.stderr delete mode 100644 tests/rustdoc-ui/intra-doc/auxiliary/inner-crate-enum.rs create mode 100644 tests/rustdoc-ui/intra-doc/deny-intra-link-resolution-failure.rs create mode 100644 tests/rustdoc-ui/intra-doc/deny-intra-link-resolution-failure.stderr delete mode 100644 tests/rustdoc-ui/intra-doc/inline-external-enum.rs create mode 100644 tests/rustdoc-ui/intra-doc/issue-110495-suffix-with-space.rs create mode 100644 tests/rustdoc-ui/intra-doc/issue-110495-suffix-with-space.stderr create mode 100644 tests/rustdoc-ui/intra-doc/issue-111189-resolution-ice.rs create mode 100644 tests/rustdoc-ui/intra-doc/issue-111189-resolution-ice.stderr create mode 100644 tests/rustdoc-ui/intra-doc/pub-export-lint.rs create mode 100644 tests/rustdoc-ui/intra-doc/pub-export-lint.stderr create mode 100644 tests/rustdoc-ui/intra-doc/reference-link-reports-error-once.rs create mode 100644 tests/rustdoc-ui/intra-doc/reference-link-reports-error-once.stderr create mode 100644 tests/rustdoc-ui/intra-doc/reference-links.rs create mode 100644 tests/rustdoc-ui/intra-doc/reference-links.stderr create mode 100644 tests/rustdoc-ui/intra-doc/weird-syntax.rs create mode 100644 tests/rustdoc-ui/intra-doc/weird-syntax.stderr delete mode 100644 tests/rustdoc-ui/invalid-doc-attr.rs delete mode 100644 tests/rustdoc-ui/invalid-doc-attr.stderr delete mode 100644 tests/rustdoc-ui/invalid-html-self-closing-tag.rs delete mode 100644 tests/rustdoc-ui/invalid-html-self-closing-tag.stderr delete mode 100644 tests/rustdoc-ui/invalid-html-tags.rs delete mode 100644 tests/rustdoc-ui/invalid-html-tags.stderr delete mode 100644 tests/rustdoc-ui/issue-101076.rs delete mode 100644 tests/rustdoc-ui/issue-102986.rs delete mode 100644 tests/rustdoc-ui/issue-102986.stderr delete mode 100644 tests/rustdoc-ui/issue-103997.rs delete mode 100644 tests/rustdoc-ui/issue-103997.stderr delete mode 100644 tests/rustdoc-ui/issue-105334.rs delete mode 100644 tests/rustdoc-ui/issue-105334.stderr delete mode 100644 tests/rustdoc-ui/issue-105737.rs delete mode 100644 tests/rustdoc-ui/issue-105737.stderr delete mode 100644 tests/rustdoc-ui/issue-105742.rs delete mode 100644 tests/rustdoc-ui/issue-105742.stderr delete mode 100644 tests/rustdoc-ui/issue-106213.rs delete mode 100644 tests/rustdoc-ui/issue-106213.stderr delete mode 100644 tests/rustdoc-ui/issue-106226.rs delete mode 100644 tests/rustdoc-ui/issue-106226.stderr delete mode 100644 tests/rustdoc-ui/issue-107918.rs delete mode 100644 tests/rustdoc-ui/issue-109282-import-inline-merge.rs create mode 100644 tests/rustdoc-ui/issue-110629-private-type-cycle-dyn.rs create mode 100644 tests/rustdoc-ui/issue-110629-private-type-cycle-dyn.stderr create mode 100644 tests/rustdoc-ui/issue-110629-private-type-cycle.rs delete mode 100644 tests/rustdoc-ui/issue-58473-2.rs delete mode 100644 tests/rustdoc-ui/issue-58473.rs delete mode 100644 tests/rustdoc-ui/issue-61592-2.rs delete mode 100644 tests/rustdoc-ui/issue-61592-2.stderr delete mode 100644 tests/rustdoc-ui/issue-61592.rs delete mode 100644 tests/rustdoc-ui/issue-61592.stderr delete mode 100644 tests/rustdoc-ui/issue-61732.rs delete mode 100644 tests/rustdoc-ui/issue-61732.stderr delete mode 100644 tests/rustdoc-ui/issue-74134.private.stderr delete mode 100644 tests/rustdoc-ui/issue-74134.public.stderr delete mode 100644 tests/rustdoc-ui/issue-74134.rs delete mode 100644 tests/rustdoc-ui/issue-79465.rs delete mode 100644 tests/rustdoc-ui/issue-79465.stderr delete mode 100644 tests/rustdoc-ui/issue-79467.rs delete mode 100644 tests/rustdoc-ui/issue-79467.stderr delete mode 100644 tests/rustdoc-ui/issue-79494.rs delete mode 100644 tests/rustdoc-ui/issue-79494.stderr delete mode 100644 tests/rustdoc-ui/issue-80992.rs delete mode 100644 tests/rustdoc-ui/issue-80992.stdout delete mode 100644 tests/rustdoc-ui/issue-81662-shortness.rs delete mode 100644 tests/rustdoc-ui/issue-81662-shortness.stdout delete mode 100644 tests/rustdoc-ui/issue-83883-describe-lints.rs delete mode 100644 tests/rustdoc-ui/issue-83883-describe-lints.stdout delete mode 100644 tests/rustdoc-ui/issue-91134.rs delete mode 100644 tests/rustdoc-ui/issue-91134.stdout delete mode 100644 tests/rustdoc-ui/issue-91713.rs delete mode 100644 tests/rustdoc-ui/issue-91713.stderr delete mode 100644 tests/rustdoc-ui/issue-91713.stdout delete mode 100644 tests/rustdoc-ui/issue-96287.rs delete mode 100644 tests/rustdoc-ui/issue-96287.stderr delete mode 100644 tests/rustdoc-ui/issue-98690.rs delete mode 100644 tests/rustdoc-ui/issue-98690.stderr create mode 100644 tests/rustdoc-ui/issues/auxiliary/empty-fn.rs create mode 100644 tests/rustdoc-ui/issues/auxiliary/issue-61592.rs create mode 100644 tests/rustdoc-ui/issues/auxiliary/panic-handler.rs create mode 100644 tests/rustdoc-ui/issues/issue-101076.rs create mode 100644 tests/rustdoc-ui/issues/issue-102986.rs create mode 100644 tests/rustdoc-ui/issues/issue-102986.stderr create mode 100644 tests/rustdoc-ui/issues/issue-103997.rs create mode 100644 tests/rustdoc-ui/issues/issue-103997.stderr create mode 100644 tests/rustdoc-ui/issues/issue-105334.rs create mode 100644 tests/rustdoc-ui/issues/issue-105334.stderr create mode 100644 tests/rustdoc-ui/issues/issue-105737.rs create mode 100644 tests/rustdoc-ui/issues/issue-105737.stderr create mode 100644 tests/rustdoc-ui/issues/issue-105742.rs create mode 100644 tests/rustdoc-ui/issues/issue-105742.stderr create mode 100644 tests/rustdoc-ui/issues/issue-106213.rs create mode 100644 tests/rustdoc-ui/issues/issue-106213.stderr create mode 100644 tests/rustdoc-ui/issues/issue-106226.rs create mode 100644 tests/rustdoc-ui/issues/issue-106226.stderr create mode 100644 tests/rustdoc-ui/issues/issue-107918.rs create mode 100644 tests/rustdoc-ui/issues/issue-109282-import-inline-merge.rs create mode 100644 tests/rustdoc-ui/issues/issue-110900.rs create mode 100644 tests/rustdoc-ui/issues/issue-58473-2.rs create mode 100644 tests/rustdoc-ui/issues/issue-58473.rs create mode 100644 tests/rustdoc-ui/issues/issue-61592-2.rs create mode 100644 tests/rustdoc-ui/issues/issue-61592-2.stderr create mode 100644 tests/rustdoc-ui/issues/issue-61592.rs create mode 100644 tests/rustdoc-ui/issues/issue-61592.stderr create mode 100644 tests/rustdoc-ui/issues/issue-61732.rs create mode 100644 tests/rustdoc-ui/issues/issue-61732.stderr create mode 100644 tests/rustdoc-ui/issues/issue-74134.private.stderr create mode 100644 tests/rustdoc-ui/issues/issue-74134.public.stderr create mode 100644 tests/rustdoc-ui/issues/issue-74134.rs create mode 100644 tests/rustdoc-ui/issues/issue-79465.rs create mode 100644 tests/rustdoc-ui/issues/issue-79465.stderr create mode 100644 tests/rustdoc-ui/issues/issue-79467.rs create mode 100644 tests/rustdoc-ui/issues/issue-79467.stderr create mode 100644 tests/rustdoc-ui/issues/issue-79494.rs create mode 100644 tests/rustdoc-ui/issues/issue-79494.stderr create mode 100644 tests/rustdoc-ui/issues/issue-80992.rs create mode 100644 tests/rustdoc-ui/issues/issue-80992.stdout create mode 100644 tests/rustdoc-ui/issues/issue-81662-shortness.rs create mode 100644 tests/rustdoc-ui/issues/issue-81662-shortness.stdout create mode 100644 tests/rustdoc-ui/issues/issue-83883-describe-lints.rs create mode 100644 tests/rustdoc-ui/issues/issue-83883-describe-lints.stdout create mode 100644 tests/rustdoc-ui/issues/issue-91134.rs create mode 100644 tests/rustdoc-ui/issues/issue-91134.stdout create mode 100644 tests/rustdoc-ui/issues/issue-91713.rs create mode 100644 tests/rustdoc-ui/issues/issue-91713.stderr create mode 100644 tests/rustdoc-ui/issues/issue-91713.stdout create mode 100644 tests/rustdoc-ui/issues/issue-96287.rs create mode 100644 tests/rustdoc-ui/issues/issue-96287.stderr create mode 100644 tests/rustdoc-ui/issues/issue-98690.rs create mode 100644 tests/rustdoc-ui/issues/issue-98690.stderr delete mode 100644 tests/rustdoc-ui/lint-group.rs delete mode 100644 tests/rustdoc-ui/lint-group.stderr delete mode 100644 tests/rustdoc-ui/lint-missing-doc-code-example.rs delete mode 100644 tests/rustdoc-ui/lint-missing-doc-code-example.stderr create mode 100644 tests/rustdoc-ui/lints/bare-urls.fixed create mode 100644 tests/rustdoc-ui/lints/bare-urls.rs create mode 100644 tests/rustdoc-ui/lints/bare-urls.stderr create mode 100644 tests/rustdoc-ui/lints/check-attr.rs create mode 100644 tests/rustdoc-ui/lints/check-attr.stderr create mode 100644 tests/rustdoc-ui/lints/check-fail.rs create mode 100644 tests/rustdoc-ui/lints/check-fail.stderr create mode 100644 tests/rustdoc-ui/lints/check.rs create mode 100644 tests/rustdoc-ui/lints/check.stderr create mode 100644 tests/rustdoc-ui/lints/deny-missing-docs-crate.rs create mode 100644 tests/rustdoc-ui/lints/deny-missing-docs-crate.stderr create mode 100644 tests/rustdoc-ui/lints/deny-missing-docs-macro.rs create mode 100644 tests/rustdoc-ui/lints/deny-missing-docs-macro.stderr create mode 100644 tests/rustdoc-ui/lints/doc-attr.rs create mode 100644 tests/rustdoc-ui/lints/doc-attr.stderr create mode 100644 tests/rustdoc-ui/lints/doc-spotlight.fixed create mode 100644 tests/rustdoc-ui/lints/doc-spotlight.rs create mode 100644 tests/rustdoc-ui/lints/doc-spotlight.stderr create mode 100644 tests/rustdoc-ui/lints/doc-without-codeblock.rs create mode 100644 tests/rustdoc-ui/lints/doc-without-codeblock.stderr create mode 100644 tests/rustdoc-ui/lints/doc_cfg_hide.rs create mode 100644 tests/rustdoc-ui/lints/doc_cfg_hide.stderr create mode 100644 tests/rustdoc-ui/lints/expect-tool-lint-rfc-2383.rs create mode 100644 tests/rustdoc-ui/lints/expect-tool-lint-rfc-2383.stderr create mode 100644 tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.rs create mode 100644 tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.stderr create mode 100644 tests/rustdoc-ui/lints/invalid-doc-attr.rs create mode 100644 tests/rustdoc-ui/lints/invalid-doc-attr.stderr create mode 100644 tests/rustdoc-ui/lints/invalid-html-self-closing-tag.rs create mode 100644 tests/rustdoc-ui/lints/invalid-html-self-closing-tag.stderr create mode 100644 tests/rustdoc-ui/lints/invalid-html-tags.rs create mode 100644 tests/rustdoc-ui/lints/invalid-html-tags.stderr create mode 100644 tests/rustdoc-ui/lints/lint-group.rs create mode 100644 tests/rustdoc-ui/lints/lint-group.stderr create mode 100644 tests/rustdoc-ui/lints/lint-missing-doc-code-example.rs create mode 100644 tests/rustdoc-ui/lints/lint-missing-doc-code-example.stderr create mode 100644 tests/rustdoc-ui/lints/no-crate-level-doc-lint.rs create mode 100644 tests/rustdoc-ui/lints/no-crate-level-doc-lint.stderr create mode 100644 tests/rustdoc-ui/lints/renamed-lint-still-applies.rs create mode 100644 tests/rustdoc-ui/lints/renamed-lint-still-applies.stderr create mode 100644 tests/rustdoc-ui/lints/rustdoc-all-only-stable-lints.rs create mode 100644 tests/rustdoc-ui/lints/unknown-renamed-lints.rs create mode 100644 tests/rustdoc-ui/lints/unknown-renamed-lints.stderr create mode 100644 tests/rustdoc-ui/lints/unused-braces-lint.rs create mode 100644 tests/rustdoc-ui/lints/unused.rs delete mode 100644 tests/rustdoc-ui/no-crate-level-doc-lint.rs delete mode 100644 tests/rustdoc-ui/no-crate-level-doc-lint.stderr delete mode 100644 tests/rustdoc-ui/no-run-flag-error.rs delete mode 100644 tests/rustdoc-ui/no-run-flag-error.stderr delete mode 100644 tests/rustdoc-ui/no-run-flag.rs delete mode 100644 tests/rustdoc-ui/no-run-flag.stdout delete mode 100644 tests/rustdoc-ui/nocapture-fail.rs delete mode 100644 tests/rustdoc-ui/nocapture-fail.stderr delete mode 100644 tests/rustdoc-ui/nocapture-fail.stdout delete mode 100644 tests/rustdoc-ui/nocapture.rs delete mode 100644 tests/rustdoc-ui/nocapture.stderr delete mode 100644 tests/rustdoc-ui/nocapture.stdout delete mode 100644 tests/rustdoc-ui/private-doc-test.rs delete mode 100644 tests/rustdoc-ui/private-item-doc-test.rs delete mode 100644 tests/rustdoc-ui/private-item-doc-test.stderr delete mode 100644 tests/rustdoc-ui/private-public-item-doc-test.rs delete mode 100644 tests/rustdoc-ui/private-public-item-doc-test.stderr delete mode 100644 tests/rustdoc-ui/pub-export-lint.rs delete mode 100644 tests/rustdoc-ui/pub-export-lint.stderr delete mode 100644 tests/rustdoc-ui/public-reexported-item-doc-test.rs delete mode 100644 tests/rustdoc-ui/reference-link-reports-error-once.rs delete mode 100644 tests/rustdoc-ui/reference-link-reports-error-once.stderr delete mode 100644 tests/rustdoc-ui/reference-links.rs delete mode 100644 tests/rustdoc-ui/reference-links.stderr delete mode 100644 tests/rustdoc-ui/renamed-lint-still-applies.rs delete mode 100644 tests/rustdoc-ui/renamed-lint-still-applies.stderr delete mode 100644 tests/rustdoc-ui/run-directory.correct.stdout delete mode 100644 tests/rustdoc-ui/run-directory.incorrect.stdout delete mode 100644 tests/rustdoc-ui/run-directory.rs delete mode 100644 tests/rustdoc-ui/rustdoc-all-only-stable-lints.rs delete mode 100644 tests/rustdoc-ui/scrape-examples-fail-if-type-error.rs delete mode 100644 tests/rustdoc-ui/scrape-examples-fail-if-type-error.stderr delete mode 100644 tests/rustdoc-ui/scrape-examples-ice.rs delete mode 100644 tests/rustdoc-ui/scrape-examples-wrong-options-1.rs delete mode 100644 tests/rustdoc-ui/scrape-examples-wrong-options-1.stderr delete mode 100644 tests/rustdoc-ui/scrape-examples-wrong-options-2.rs delete mode 100644 tests/rustdoc-ui/scrape-examples-wrong-options-2.stderr create mode 100644 tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.rs create mode 100644 tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.stderr create mode 100644 tests/rustdoc-ui/scrape-examples/scrape-examples-ice.rs create mode 100644 tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-1.rs create mode 100644 tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-1.stderr create mode 100644 tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-2.rs create mode 100644 tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-2.stderr delete mode 100644 tests/rustdoc-ui/test-compile-fail1.rs delete mode 100644 tests/rustdoc-ui/test-compile-fail1.stderr delete mode 100644 tests/rustdoc-ui/test-compile-fail2.rs delete mode 100644 tests/rustdoc-ui/test-compile-fail2.stderr delete mode 100644 tests/rustdoc-ui/test-compile-fail3.rs delete mode 100644 tests/rustdoc-ui/test-compile-fail3.stderr delete mode 100644 tests/rustdoc-ui/test-no_std.rs delete mode 100644 tests/rustdoc-ui/test-no_std.stdout delete mode 100644 tests/rustdoc-ui/test-type.rs delete mode 100644 tests/rustdoc-ui/test-type.stdout create mode 100644 tests/rustdoc-ui/unescaped_backticks.rs create mode 100644 tests/rustdoc-ui/unescaped_backticks.stderr delete mode 100644 tests/rustdoc-ui/unknown-renamed-lints.rs delete mode 100644 tests/rustdoc-ui/unknown-renamed-lints.stderr delete mode 100644 tests/rustdoc-ui/unparseable-doc-test.rs delete mode 100644 tests/rustdoc-ui/unparseable-doc-test.stdout delete mode 100644 tests/rustdoc-ui/unused-braces-lint.rs delete mode 100644 tests/rustdoc-ui/unused.rs delete mode 100644 tests/rustdoc/deref-const-fn.rs delete mode 100644 tests/rustdoc/deref-mut-methods.rs delete mode 100644 tests/rustdoc/deref-recursive-pathbuf.rs delete mode 100644 tests/rustdoc/deref-recursive.rs delete mode 100644 tests/rustdoc/deref-slice-core.rs delete mode 100644 tests/rustdoc/deref-to-primitive.rs delete mode 100644 tests/rustdoc/deref-typedef.rs create mode 100644 tests/rustdoc/deref/deref-const-fn.rs create mode 100644 tests/rustdoc/deref/deref-multiple-impl-blocks.rs create mode 100644 tests/rustdoc/deref/deref-mut-methods.rs create mode 100644 tests/rustdoc/deref/deref-recursive-pathbuf.rs create mode 100644 tests/rustdoc/deref/deref-recursive.rs create mode 100644 tests/rustdoc/deref/deref-slice-core.rs create mode 100644 tests/rustdoc/deref/deref-to-primitive.rs create mode 100644 tests/rustdoc/deref/deref-typedef.rs create mode 100644 tests/rustdoc/deref/escape-deref-methods.rs create mode 100644 tests/rustdoc/deref/issue-100679-sidebar-links-deref.rs create mode 100644 tests/rustdoc/deref/recursive-deref-sidebar.rs create mode 100644 tests/rustdoc/deref/recursive-deref.rs delete mode 100644 tests/rustdoc/escape-deref-methods.rs create mode 100644 tests/rustdoc/impl-alias-substituted.rs create mode 100644 tests/rustdoc/inherent-projections.rs create mode 100644 tests/rustdoc/inline_cross/auxiliary/repr.rs create mode 100644 tests/rustdoc/inline_cross/repr.rs create mode 100644 tests/rustdoc/intra-doc/inherent-associated-types.rs delete mode 100644 tests/rustdoc/issue-100679-sidebar-links-deref.rs create mode 100644 tests/rustdoc/issue-106142.rs create mode 100644 tests/rustdoc/issue-110422-inner-private.rs create mode 100644 tests/rustdoc/issue-110629-private-type-cycle.rs create mode 100644 tests/rustdoc/issue-111064-reexport-trait-from-hidden-2.rs create mode 100644 tests/rustdoc/issue-111064-reexport-trait-from-hidden.rs create mode 100644 tests/rustdoc/issue-46506-pub-reexport-of-pub-reexport.rs create mode 100644 tests/rustdoc/issue-60522-duplicated-glob-reexport.rs create mode 100644 tests/rustdoc/issue-94183-blanket-impl-reexported-trait.rs create mode 100644 tests/rustdoc/nested-items-issue-111415.rs delete mode 100644 tests/rustdoc/recursive-deref-sidebar.rs delete mode 100644 tests/rustdoc/recursive-deref.rs create mode 100644 tests/rustdoc/reexport-of-doc-hidden.rs delete mode 100644 tests/ui-fulldeps/auxiliary/empty-plugin.rs delete mode 100644 tests/ui-fulldeps/auxiliary/issue-40001-plugin.rs delete mode 100644 tests/ui-fulldeps/auxiliary/lint-for-crate.rs delete mode 100644 tests/ui-fulldeps/auxiliary/lint-group-plugin-test.rs delete mode 100644 tests/ui-fulldeps/auxiliary/lint-plugin-test.rs delete mode 100644 tests/ui-fulldeps/auxiliary/lint-tool-test.rs delete mode 100644 tests/ui-fulldeps/auxiliary/lto-syntax-extension-lib.rs delete mode 100644 tests/ui-fulldeps/auxiliary/lto-syntax-extension-plugin.rs delete mode 100644 tests/ui-fulldeps/auxiliary/multiple-plugins-1.rs delete mode 100644 tests/ui-fulldeps/auxiliary/multiple-plugins-2.rs delete mode 100644 tests/ui-fulldeps/auxiliary/outlive-expansion-phase.rs delete mode 100644 tests/ui-fulldeps/auxiliary/rlib-crate-test.rs delete mode 100644 tests/ui-fulldeps/deriving-encodable-decodable-box.rs delete mode 100644 tests/ui-fulldeps/deriving-encodable-decodable-cell-refcell.rs delete mode 100644 tests/ui-fulldeps/feature-gate-plugin.rs delete mode 100644 tests/ui-fulldeps/feature-gate-plugin.stderr delete mode 100644 tests/ui-fulldeps/gated-plugin.rs delete mode 100644 tests/ui-fulldeps/gated-plugin.stderr delete mode 100644 tests/ui-fulldeps/issue-14021.rs delete mode 100644 tests/ui-fulldeps/issue-15778-fail.rs delete mode 100644 tests/ui-fulldeps/issue-15778-fail.stderr delete mode 100644 tests/ui-fulldeps/issue-40001.rs delete mode 100644 tests/ui-fulldeps/issue-40001.stderr delete mode 100644 tests/ui-fulldeps/lint-group-denied-lint-allowed.rs delete mode 100644 tests/ui-fulldeps/lint-group-forbid-always-trumps-cli.rs delete mode 100644 tests/ui-fulldeps/lint-group-forbid-always-trumps-cli.stderr delete mode 100644 tests/ui-fulldeps/lint-group-plugin-deny-cmdline.rs delete mode 100644 tests/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr delete mode 100644 tests/ui-fulldeps/lint-group-plugin.rs delete mode 100644 tests/ui-fulldeps/lint-group-plugin.stderr delete mode 100644 tests/ui-fulldeps/lint-plugin-cmdline-allow.rs delete mode 100644 tests/ui-fulldeps/lint-plugin-cmdline-allow.stderr delete mode 100644 tests/ui-fulldeps/lint-plugin-cmdline-load.rs delete mode 100644 tests/ui-fulldeps/lint-plugin-cmdline-load.stderr delete mode 100644 tests/ui-fulldeps/lint-plugin-deny-attr.rs delete mode 100644 tests/ui-fulldeps/lint-plugin-deny-attr.stderr delete mode 100644 tests/ui-fulldeps/lint-plugin-deny-cmdline.rs delete mode 100644 tests/ui-fulldeps/lint-plugin-deny-cmdline.stderr delete mode 100644 tests/ui-fulldeps/lint-plugin-forbid-attrs.rs delete mode 100644 tests/ui-fulldeps/lint-plugin-forbid-attrs.stderr delete mode 100644 tests/ui-fulldeps/lint-plugin-forbid-cmdline.rs delete mode 100644 tests/ui-fulldeps/lint-plugin-forbid-cmdline.stderr delete mode 100644 tests/ui-fulldeps/lint-plugin.rs delete mode 100644 tests/ui-fulldeps/lint-plugin.stderr delete mode 100644 tests/ui-fulldeps/lint-tool-cmdline-allow.rs delete mode 100644 tests/ui-fulldeps/lint-tool-cmdline-allow.stderr delete mode 100644 tests/ui-fulldeps/lint-tool-test.rs delete mode 100644 tests/ui-fulldeps/lint-tool-test.stderr delete mode 100644 tests/ui-fulldeps/lto-syntax-extension.rs delete mode 100644 tests/ui-fulldeps/lto-syntax-extension.stderr delete mode 100644 tests/ui-fulldeps/macro-crate-rlib.rs delete mode 100644 tests/ui-fulldeps/macro-crate-rlib.stderr delete mode 100644 tests/ui-fulldeps/multiple-plugins.rs delete mode 100644 tests/ui-fulldeps/multiple-plugins.stderr delete mode 100644 tests/ui-fulldeps/outlive-expansion-phase.rs delete mode 100644 tests/ui-fulldeps/outlive-expansion-phase.stderr delete mode 100644 tests/ui-fulldeps/plugin-args.rs delete mode 100644 tests/ui-fulldeps/plugin-args.stderr delete mode 100644 tests/ui-fulldeps/plugin-as-extern-crate.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/empty-plugin.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/issue-40001-plugin.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/lint-for-crate.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/lint-group-plugin-test.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/lint-plugin-test.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/lint-tool-test.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-lib.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/lto-syntax-extension-plugin.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-1.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/multiple-plugins-2.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/outlive-expansion-phase.rs create mode 100644 tests/ui-fulldeps/plugin/auxiliary/rlib-crate-test.rs create mode 100644 tests/ui-fulldeps/plugin/feature-gate-plugin.rs create mode 100644 tests/ui-fulldeps/plugin/feature-gate-plugin.stderr create mode 100644 tests/ui-fulldeps/plugin/gated-plugin.rs create mode 100644 tests/ui-fulldeps/plugin/gated-plugin.stderr create mode 100644 tests/ui-fulldeps/plugin/issue-15778-fail.rs create mode 100644 tests/ui-fulldeps/plugin/issue-15778-fail.stderr create mode 100644 tests/ui-fulldeps/plugin/issue-40001.rs create mode 100644 tests/ui-fulldeps/plugin/issue-40001.stderr create mode 100644 tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.rs create mode 100644 tests/ui-fulldeps/plugin/lint-group-plugin-deny-cmdline.stderr create mode 100644 tests/ui-fulldeps/plugin/lint-group-plugin.rs create mode 100644 tests/ui-fulldeps/plugin/lint-group-plugin.stderr create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.rs create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-cmdline-allow.stderr create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.rs create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-cmdline-load.stderr create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-deny-attr.rs create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-deny-attr.stderr create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.rs create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-deny-cmdline.stderr create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.rs create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-forbid-attrs.stderr create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.rs create mode 100644 tests/ui-fulldeps/plugin/lint-plugin-forbid-cmdline.stderr create mode 100644 tests/ui-fulldeps/plugin/lint-plugin.rs create mode 100644 tests/ui-fulldeps/plugin/lint-plugin.stderr create mode 100644 tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.rs create mode 100644 tests/ui-fulldeps/plugin/lint-tool-cmdline-allow.stderr create mode 100644 tests/ui-fulldeps/plugin/lint-tool-test.rs create mode 100644 tests/ui-fulldeps/plugin/lint-tool-test.stderr create mode 100644 tests/ui-fulldeps/plugin/lto-syntax-extension.rs create mode 100644 tests/ui-fulldeps/plugin/lto-syntax-extension.stderr create mode 100644 tests/ui-fulldeps/plugin/macro-crate-rlib.rs create mode 100644 tests/ui-fulldeps/plugin/macro-crate-rlib.stderr create mode 100644 tests/ui-fulldeps/plugin/multiple-plugins.rs create mode 100644 tests/ui-fulldeps/plugin/multiple-plugins.stderr create mode 100644 tests/ui-fulldeps/plugin/outlive-expansion-phase.rs create mode 100644 tests/ui-fulldeps/plugin/outlive-expansion-phase.stderr create mode 100644 tests/ui-fulldeps/plugin/plugin-args.rs create mode 100644 tests/ui-fulldeps/plugin/plugin-args.stderr create mode 100644 tests/ui-fulldeps/plugin/plugin-as-extern-crate.rs create mode 100644 tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs create mode 100644 tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr create mode 100644 tests/ui/associated-consts/projection-unspecified-but-bounded.rs create mode 100644 tests/ui/associated-consts/projection-unspecified-but-bounded.stderr create mode 100644 tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.rs create mode 100644 tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr create mode 100644 tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.rs create mode 100644 tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.stderr delete mode 100644 tests/ui/associated-inherent-types/bugs/ice-substitution.rs delete mode 100644 tests/ui/associated-inherent-types/bugs/ice-substitution.stderr delete mode 100644 tests/ui/associated-inherent-types/bugs/inference-fail.rs delete mode 100644 tests/ui/associated-inherent-types/bugs/inference-fail.stderr delete mode 100644 tests/ui/associated-inherent-types/bugs/lack-of-regionck.rs create mode 100644 tests/ui/associated-inherent-types/bugs/wf-check-skipped.rs create mode 100644 tests/ui/associated-inherent-types/const-generics.rs create mode 100644 tests/ui/associated-inherent-types/former-subst-ice.rs create mode 100644 tests/ui/associated-inherent-types/generic-associated-types-bad.item.stderr create mode 100644 tests/ui/associated-inherent-types/generic-associated-types-bad.local.stderr create mode 100644 tests/ui/associated-inherent-types/generic-associated-types-bad.region.stderr create mode 100644 tests/ui/associated-inherent-types/generic-associated-types-bad.rs create mode 100644 tests/ui/associated-inherent-types/generic-const-exprs.rs create mode 100644 tests/ui/associated-inherent-types/inference-fail.rs create mode 100644 tests/ui/associated-inherent-types/inference-fail.stderr create mode 100644 tests/ui/associated-inherent-types/inference.rs create mode 100644 tests/ui/associated-inherent-types/issue-109768.rs create mode 100644 tests/ui/associated-inherent-types/issue-109768.stderr create mode 100644 tests/ui/associated-inherent-types/issue-109789.rs create mode 100644 tests/ui/associated-inherent-types/issue-109789.stderr create mode 100644 tests/ui/associated-inherent-types/issue-109790.rs create mode 100644 tests/ui/associated-inherent-types/issue-111879-0.rs create mode 100644 tests/ui/associated-inherent-types/issue-111879-0.stderr create mode 100644 tests/ui/associated-inherent-types/issue-111879-1.rs create mode 100644 tests/ui/associated-inherent-types/issue-111879-1.stderr create mode 100644 tests/ui/associated-inherent-types/late-bound-regions.rs create mode 100644 tests/ui/associated-inherent-types/late-bound-regions.stderr create mode 100644 tests/ui/associated-inherent-types/normalization-overflow.rs create mode 100644 tests/ui/associated-inherent-types/normalization-overflow.stderr create mode 100644 tests/ui/associated-inherent-types/private-in-public.rs create mode 100644 tests/ui/associated-inherent-types/private-in-public.stderr create mode 100644 tests/ui/associated-inherent-types/regionck-0.rs create mode 100644 tests/ui/associated-inherent-types/regionck-0.stderr create mode 100644 tests/ui/associated-inherent-types/regionck-1.rs create mode 100644 tests/ui/associated-inherent-types/regionck-1.stderr create mode 100644 tests/ui/associated-inherent-types/regionck-2.rs create mode 100644 tests/ui/associated-inherent-types/regionck-2.stderr create mode 100644 tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.rs create mode 100644 tests/ui/associated-inherent-types/unsatisfied-bounds-inferred-type.rs create mode 100644 tests/ui/associated-inherent-types/unsatisfied-bounds-inferred-type.stderr create mode 100644 tests/ui/associated-inherent-types/unsatisfied-bounds-where-clause-on-assoc-ty.rs create mode 100644 tests/ui/associated-inherent-types/unsatisfied-bounds-where-clause-on-assoc-ty.stderr create mode 100644 tests/ui/associated-type-bounds/supertrait-defines-ty.rs create mode 100644 tests/ui/associated-types/issue-27901.rs delete mode 100644 tests/ui/async-await/async-fn-nonsend.stderr create mode 100644 tests/ui/async-await/clone-suggestion.fixed create mode 100644 tests/ui/async-await/clone-suggestion.rs create mode 100644 tests/ui/async-await/clone-suggestion.stderr delete mode 100644 tests/ui/async-await/in-trait/async-default-fn-overridden.current.stderr delete mode 100644 tests/ui/async-await/in-trait/async-default-fn-overridden.next.stderr delete mode 100644 tests/ui/async-await/issue-64130-1-sync.stderr delete mode 100644 tests/ui/async-await/issue-64130-2-send.stderr delete mode 100644 tests/ui/async-await/issue-64130-3-other.stderr delete mode 100644 tests/ui/async-await/issue-70818.stderr delete mode 100644 tests/ui/async-await/issue-73741-type-err-drop-tracking.stderr create mode 100644 tests/ui/async-await/issues/issue-112225-1.rs create mode 100644 tests/ui/async-await/issues/issue-112225-2.rs create mode 100644 tests/ui/async-await/issues/issue-112225-2.stderr delete mode 100644 tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr delete mode 100644 tests/ui/async-await/recursive-async-impl-trait-type.stderr create mode 100644 tests/ui/async-await/return-type-notation/issue-110963-early.rs create mode 100644 tests/ui/async-await/return-type-notation/issue-110963-early.stderr create mode 100644 tests/ui/async-await/return-type-notation/issue-110963-late.rs create mode 100644 tests/ui/async-await/return-type-notation/issue-110963-late.stderr create mode 100644 tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs create mode 100644 tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr create mode 100644 tests/ui/async-await/return-type-notation/super-method-bound.rs create mode 100644 tests/ui/async-await/return-type-notation/super-method-bound.stderr create mode 100644 tests/ui/async-await/return-type-notation/supertrait-bound.rs create mode 100644 tests/ui/async-await/return-type-notation/supertrait-bound.stderr delete mode 100644 tests/ui/async-await/unresolved_type_param.stderr delete mode 100644 tests/ui/attr-bad-crate-attr.rc create mode 100644 tests/ui/attr-bad-crate-attr.rs create mode 100644 tests/ui/attr-bad-crate-attr.stderr create mode 100644 tests/ui/attributes/invalid-repr.rs create mode 100644 tests/ui/attributes/invalid-repr.stderr create mode 100644 tests/ui/attributes/invalid_macro_export_argument.deny.stderr delete mode 100644 tests/ui/attributes/invalid_macro_export_argument.stderr create mode 100644 tests/ui/binop/eq-arr.rs create mode 100644 tests/ui/binop/eq-arr.stderr create mode 100644 tests/ui/binop/eq-vec.rs create mode 100644 tests/ui/binop/eq-vec.stderr create mode 100644 tests/ui/borrowck/borrowck-block-uninit.rs create mode 100644 tests/ui/borrowck/borrowck-block-uninit.stderr delete mode 100644 tests/ui/borrowck/borrowck-block-unint.rs delete mode 100644 tests/ui/borrowck/borrowck-block-unint.stderr create mode 100644 tests/ui/borrowck/erase-error-in-mir-drop-tracking.rs create mode 100644 tests/ui/borrowck/erase-error-in-mir-drop-tracking.stderr create mode 100644 tests/ui/borrowck/issue-109271-pass-self-into-closure.fixed create mode 100644 tests/ui/borrowck/issue-109271-pass-self-into-closure.rs create mode 100644 tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr create mode 100644 tests/ui/borrowck/issue-47646.rs create mode 100644 tests/ui/borrowck/issue-47646.stderr create mode 100644 tests/ui/borrowck/let_underscore_temporary.stderr create mode 100644 tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.rs create mode 100644 tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.stderr create mode 100644 tests/ui/borrowck/tainted-promoteds.rs create mode 100644 tests/ui/borrowck/tainted-promoteds.stderr create mode 100644 tests/ui/cfg/cfg-stmt-recovery.rs create mode 100644 tests/ui/cfg/cfg-stmt-recovery.stderr create mode 100644 tests/ui/check-cfg/diagnotics.rs create mode 100644 tests/ui/check-cfg/diagnotics.stderr create mode 100644 tests/ui/check-cfg/order-independant.names_after.stderr create mode 100644 tests/ui/check-cfg/order-independant.names_before.stderr create mode 100644 tests/ui/check-cfg/order-independant.rs create mode 100644 tests/ui/closures/2229_closure_analysis/bad-pattern.rs create mode 100644 tests/ui/closures/2229_closure_analysis/bad-pattern.stderr create mode 100644 tests/ui/closures/2229_closure_analysis/run_pass/multivariant.rs create mode 100644 tests/ui/closures/issue-868.rs create mode 100644 tests/ui/closures/static-closures-with-nonstatic-return.rs create mode 100644 tests/ui/codegen/freeze-on-polymorphic-projection.rs create mode 100644 tests/ui/codegen/freeze-on-polymorphic-projection.stderr create mode 100644 tests/ui/coherence/coherence-overlap-negative-impls.rs create mode 100644 tests/ui/coherence/indirect-impl-for-trait-obj-coherence.rs create mode 100644 tests/ui/const-generics/adt_const_params/const_param_ty_bad.rs create mode 100644 tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr create mode 100644 tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.rs create mode 100644 tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.stderr create mode 100644 tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.rs create mode 100644 tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.stderr create mode 100644 tests/ui/const-generics/adt_const_params/const_param_ty_good.rs create mode 100644 tests/ui/const-generics/adt_const_params/const_param_ty_impl_bad_field.rs create mode 100644 tests/ui/const-generics/adt_const_params/const_param_ty_impl_bad_field.stderr create mode 100644 tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs create mode 100644 tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr create mode 100644 tests/ui/const-generics/adt_const_params/const_param_ty_impl_union.rs create mode 100644 tests/ui/const-generics/adt_const_params/const_param_ty_impl_union.stderr create mode 100644 tests/ui/const-generics/assoc_const_as_type_argument.rs create mode 100644 tests/ui/const-generics/assoc_const_as_type_argument.stderr delete mode 100644 tests/ui/const-generics/const-arg-in-const-arg.full.stderr create mode 100644 tests/ui/const-generics/generic_const_exprs/typeid-equality-by-subtyping.stderr create mode 100644 tests/ui/const-generics/generic_const_exprs/unresolved_lifetimes_error.rs create mode 100644 tests/ui/const-generics/generic_const_exprs/unresolved_lifetimes_error.stderr delete mode 100644 tests/ui/const-generics/issues/issue-77357.rs delete mode 100644 tests/ui/const-generics/issues/issue-77357.stderr delete mode 100644 tests/ui/const-generics/issues/issue-83993.rs create mode 100644 tests/ui/const-generics/late-bound-vars/in_closure.stderr create mode 100644 tests/ui/const-generics/late-bound-vars/simple.stderr create mode 100644 tests/ui/const-generics/variant-discrimiant-no-generics.full.stderr create mode 100644 tests/ui/const-generics/variant-discrimiant-no-generics.min.stderr create mode 100644 tests/ui/const-generics/variant-discrimiant-no-generics.rs create mode 100644 tests/ui/const_prop/const-prop-ice.rs create mode 100644 tests/ui/const_prop/const-prop-ice.stderr create mode 100644 tests/ui/const_prop/const-prop-ice2.rs create mode 100644 tests/ui/const_prop/const-prop-ice2.stderr create mode 100644 tests/ui/const_prop/const-prop-ice3.rs create mode 100644 tests/ui/const_prop/const-prop-overflowing-casts.rs create mode 100644 tests/ui/const_prop/const-prop-read-static-in-const.rs create mode 100644 tests/ui/const_prop/const-prop-read-static-in-const.stderr create mode 100644 tests/ui/const_prop/unsized-local-ice.rs delete mode 100644 tests/ui/consts/const-prop-ice.rs delete mode 100644 tests/ui/consts/const-prop-ice.stderr delete mode 100644 tests/ui/consts/const-prop-ice2.rs delete mode 100644 tests/ui/consts/const-prop-ice2.stderr delete mode 100644 tests/ui/consts/const-prop-ice3.rs delete mode 100644 tests/ui/consts/const-prop-overflowing-casts.rs delete mode 100644 tests/ui/consts/const-prop-read-static-in-const.rs delete mode 100644 tests/ui/consts/const-prop-read-static-in-const.stderr create mode 100644 tests/ui/consts/const-try.stderr create mode 100644 tests/ui/consts/const_cmp_type_id.stderr create mode 100644 tests/ui/consts/fn_trait_refs.stderr create mode 100644 tests/ui/consts/issue-73976-monomorphic.stderr create mode 100644 tests/ui/consts/non-sync-references-in-const.rs create mode 100644 tests/ui/consts/rustc-impl-const-stability.stderr create mode 100644 tests/ui/consts/try-operator.stderr create mode 100644 tests/ui/cycle-trait/issue-12511.rs create mode 100644 tests/ui/cycle-trait/issue-12511.stderr create mode 100644 tests/ui/deployment-target/invalid-target.rs create mode 100644 tests/ui/deployment-target/invalid-target.stderr create mode 100644 tests/ui/deployment-target/macos-target.rs create mode 100644 tests/ui/deployment-target/macos-target.stdout create mode 100644 tests/ui/deriving/issue-15689-1.rs create mode 100644 tests/ui/deriving/issue-15689-2.rs create mode 100644 tests/ui/drop/dropck-eyepatch-manuallydrop.rs create mode 100644 tests/ui/drop/issue-110682.rs create mode 100644 tests/ui/drop/issue-979.rs create mode 100644 tests/ui/dropck/explicit-drop-bounds.bad1.stderr create mode 100644 tests/ui/dropck/explicit-drop-bounds.bad2.stderr create mode 100644 tests/ui/dropck/explicit-drop-bounds.rs create mode 100644 tests/ui/dropck/explicit-implied-outlives.bad1.stderr create mode 100644 tests/ui/dropck/explicit-implied-outlives.bad2.stderr create mode 100644 tests/ui/dropck/explicit-implied-outlives.rs create mode 100644 tests/ui/dropck/negative.rs create mode 100644 tests/ui/dropck/negative.stderr create mode 100644 tests/ui/dropck/reservation.rs create mode 100644 tests/ui/dropck/reservation.stderr create mode 100644 tests/ui/dropck/transitive-outlives-2.rs create mode 100644 tests/ui/dropck/transitive-outlives.bad.stderr create mode 100644 tests/ui/dropck/transitive-outlives.rs create mode 100644 tests/ui/dropck/trivial-impl-bounds.rs delete mode 100644 tests/ui/dupe-first-attr.rc create mode 100644 tests/ui/dupe-first-attr.rs create mode 100644 tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.current.stderr create mode 100644 tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.next.stderr delete mode 100644 tests/ui/dyn-star/check-size-at-cast-polymorphic-bad.stderr create mode 100644 tests/ui/dyn-star/param-env-infer.current.stderr create mode 100644 tests/ui/dyn-star/param-env-infer.next.stderr create mode 100644 tests/ui/dyn-star/param-env-infer.rs create mode 100644 tests/ui/enum-discriminant/auxiliary/issue-41394.rs create mode 100644 tests/ui/enum-discriminant/issue-41394-rpass.rs create mode 100644 tests/ui/enum-discriminant/issue-41394.rs create mode 100644 tests/ui/enum-discriminant/issue-41394.stderr create mode 100644 tests/ui/enum/issue-1821.rs delete mode 100644 tests/ui/error-codes/E0746.fixed create mode 100644 tests/ui/extenv/extenv-escaped-var.rs create mode 100644 tests/ui/extenv/extenv-escaped-var.stderr create mode 100644 tests/ui/extenv/issue-110547.rs create mode 100644 tests/ui/extenv/issue-110547.stderr create mode 100644 tests/ui/extern-flag/auxiliary/panic_handler.rs create mode 100644 tests/ui/extern-flag/force-extern.rs create mode 100644 tests/ui/extern-flag/no-force-extern.rs create mode 100644 tests/ui/extern-flag/redundant-force-extern.rs delete mode 100644 tests/ui/extern/auxiliary/invalid-utf8.txt delete mode 100644 tests/ui/feature-gates/auxiliary/debugger-visualizer.natvis create mode 100644 tests/ui/feature-gates/feature-gate-builtin_syntax.rs create mode 100644 tests/ui/feature-gates/feature-gate-builtin_syntax.stderr create mode 100644 tests/ui/feature-gates/feature-gate-cfg_overflow_checks.rs create mode 100644 tests/ui/feature-gates/feature-gate-cfg_overflow_checks.stderr create mode 100644 tests/ui/feature-gates/feature-gate-cfi_encoding.rs create mode 100644 tests/ui/feature-gates/feature-gate-cfi_encoding.stderr delete mode 100644 tests/ui/feature-gates/feature-gate-debugger-visualizer.rs delete mode 100644 tests/ui/feature-gates/feature-gate-debugger-visualizer.stderr create mode 100644 tests/ui/feature-gates/feature-gate-negative_bounds.rs create mode 100644 tests/ui/feature-gates/feature-gate-negative_bounds.stderr delete mode 100644 tests/ui/feature-gates/feature-gate-raw-dylib-2.rs delete mode 100644 tests/ui/feature-gates/feature-gate-raw-dylib-2.stderr delete mode 100644 tests/ui/feature-gates/feature-gate-raw-dylib-import-name-type.rs delete mode 100644 tests/ui/feature-gates/feature-gate-raw-dylib-import-name-type.stderr delete mode 100644 tests/ui/feature-gates/feature-gate-raw-dylib.rs delete mode 100644 tests/ui/feature-gates/feature-gate-raw-dylib.stderr create mode 100644 tests/ui/feature-gates/feature-gate-thiscall.rs create mode 100644 tests/ui/feature-gates/feature-gate-thiscall.stderr create mode 100644 tests/ui/fn/fn-item-lifetime-bounds.rs create mode 100644 tests/ui/fn/implied-bounds-impl-header-projections.rs create mode 100644 tests/ui/fn/issue-3099.rs create mode 100644 tests/ui/fn/issue-3099.stderr delete mode 100644 tests/ui/generator/auto-trait-regions.stderr delete mode 100644 tests/ui/generator/borrowing.stderr create mode 100644 tests/ui/generator/drop-tracking-error-body.rs create mode 100644 tests/ui/generator/drop-tracking-error-body.stderr create mode 100644 tests/ui/generator/issue-110929-generator-conflict-error-ice.rs create mode 100644 tests/ui/generator/issue-110929-generator-conflict-error-ice.stderr delete mode 100644 tests/ui/generator/retain-resume-ref.stderr create mode 100644 tests/ui/generic-associated-types/auxiliary/missing-item-sugg.rs create mode 100644 tests/ui/generic-associated-types/missing-item-sugg.rs create mode 100644 tests/ui/generic-associated-types/missing-item-sugg.stderr create mode 100644 tests/ui/generics/issue-79605.rs create mode 100644 tests/ui/generics/issue-79605.stderr create mode 100644 tests/ui/impl-trait/arg-position-impl-trait-too-long.rs create mode 100644 tests/ui/impl-trait/arg-position-impl-trait-too-long.stderr create mode 100644 tests/ui/impl-trait/extra-impl-in-trait-impl.fixed create mode 100644 tests/ui/impl-trait/extra-impl-in-trait-impl.rs create mode 100644 tests/ui/impl-trait/extra-impl-in-trait-impl.stderr create mode 100644 tests/ui/impl-trait/in-assoc-type-unconstrained.rs create mode 100644 tests/ui/impl-trait/in-assoc-type-unconstrained.stderr create mode 100644 tests/ui/impl-trait/in-assoc-type.rs create mode 100644 tests/ui/impl-trait/in-assoc-type.stderr delete mode 100644 tests/ui/impl-trait/in-trait/box-coerce-span-in-default.current.stderr delete mode 100644 tests/ui/impl-trait/in-trait/box-coerce-span-in-default.next.stderr delete mode 100644 tests/ui/impl-trait/in-trait/default-method-binder-shifting.current.stderr delete mode 100644 tests/ui/impl-trait/in-trait/default-method-binder-shifting.next.stderr delete mode 100644 tests/ui/impl-trait/in-trait/default-method-constraint.current.stderr delete mode 100644 tests/ui/impl-trait/in-trait/default-method-constraint.next.stderr create mode 100644 tests/ui/impl-trait/in-trait/foreign-dyn-error.rs create mode 100644 tests/ui/impl-trait/in-trait/foreign-dyn-error.stderr create mode 100644 tests/ui/impl-trait/issue-103181-1.current.stderr create mode 100644 tests/ui/impl-trait/issue-103181-1.next.stderr delete mode 100644 tests/ui/impl-trait/issue-103181-1.stderr create mode 100644 tests/ui/impl-trait/issue-108591.rs create mode 100644 tests/ui/impl-trait/issue-108592.rs create mode 100644 tests/ui/impl-trait/issue-36792.rs create mode 100644 tests/ui/impl-trait/multiple-defining-usages-in-body.rs create mode 100644 tests/ui/impl-trait/multiple-defining-usages-in-body.stderr create mode 100644 tests/ui/implied-bounds/implied-bounds-on-nested-references-plus-variance.rs create mode 100644 tests/ui/implied-bounds/implied-bounds-on-trait-hierarchy.rs create mode 100644 tests/ui/implied-bounds/issue-110161.rs create mode 100644 tests/ui/implied-bounds/issue-110161.stderr create mode 100644 tests/ui/imports/issue-109148.rs create mode 100644 tests/ui/imports/issue-109148.stderr create mode 100644 tests/ui/imports/issue-109343.rs create mode 100644 tests/ui/imports/issue-109343.stderr create mode 100644 tests/ui/inference/issue-70082.rs create mode 100644 tests/ui/inference/issue-70082.stderr create mode 100644 tests/ui/inference/issue-71584.rs create mode 100644 tests/ui/inference/issue-71584.stderr create mode 100644 tests/ui/invalid/foo.natvis.xml delete mode 100644 tests/ui/io-checks/inaccessbile-temp-dir.rs delete mode 100644 tests/ui/io-checks/inaccessbile-temp-dir.stderr create mode 100644 tests/ui/issues/auxiliary/issue-111011.rs create mode 100644 tests/ui/issues/auxiliary/issue-111011.stderr delete mode 100644 tests/ui/issues/auxiliary/issue-3136-a.rc delete mode 100644 tests/ui/issues/auxiliary/issue-41394.rs delete mode 100644 tests/ui/issues/issue-12511.rs delete mode 100644 tests/ui/issues/issue-12511.stderr delete mode 100644 tests/ui/issues/issue-12997-1.rs delete mode 100644 tests/ui/issues/issue-12997-1.stderr delete mode 100644 tests/ui/issues/issue-12997-2.rs delete mode 100644 tests/ui/issues/issue-12997-2.stderr delete mode 100644 tests/ui/issues/issue-15689-1.rs delete mode 100644 tests/ui/issues/issue-15689-2.rs delete mode 100644 tests/ui/issues/issue-1821.rs delete mode 100644 tests/ui/issues/issue-22384.rs delete mode 100644 tests/ui/issues/issue-22384.stderr delete mode 100644 tests/ui/issues/issue-26094.rs delete mode 100644 tests/ui/issues/issue-26094.stderr delete mode 100644 tests/ui/issues/issue-2748-a.rs delete mode 100644 tests/ui/issues/issue-27901.rs delete mode 100644 tests/ui/issues/issue-2804-2.rs delete mode 100644 tests/ui/issues/issue-30438-a.rs delete mode 100644 tests/ui/issues/issue-30438-a.stderr delete mode 100644 tests/ui/issues/issue-30438-b.rs delete mode 100644 tests/ui/issues/issue-30438-b.stderr delete mode 100644 tests/ui/issues/issue-30438-c.rs delete mode 100644 tests/ui/issues/issue-30438-c.stderr delete mode 100644 tests/ui/issues/issue-3099-a.rs delete mode 100644 tests/ui/issues/issue-3099-a.stderr delete mode 100644 tests/ui/issues/issue-3099-b.rs delete mode 100644 tests/ui/issues/issue-3099-b.stderr delete mode 100644 tests/ui/issues/issue-3099.rs delete mode 100644 tests/ui/issues/issue-3099.stderr delete mode 100644 tests/ui/issues/issue-34932.rs delete mode 100644 tests/ui/issues/issue-36744-without-calls.rs delete mode 100644 tests/ui/issues/issue-36792.rs delete mode 100644 tests/ui/issues/issue-41394-rpass.rs delete mode 100644 tests/ui/issues/issue-41394.rs delete mode 100644 tests/ui/issues/issue-41394.stderr delete mode 100644 tests/ui/issues/issue-47646.rs delete mode 100644 tests/ui/issues/issue-47646.stderr delete mode 100644 tests/ui/issues/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs delete mode 100644 tests/ui/issues/issue-54302-cases.rs delete mode 100644 tests/ui/issues/issue-54302-cases.stderr delete mode 100644 tests/ui/issues/issue-54302.rs delete mode 100644 tests/ui/issues/issue-54302.stderr delete mode 100644 tests/ui/issues/issue-6458-1.rs delete mode 100644 tests/ui/issues/issue-6458-2.rs delete mode 100644 tests/ui/issues/issue-6458-2.stderr delete mode 100644 tests/ui/issues/issue-6458-3.rs delete mode 100644 tests/ui/issues/issue-6458-3.stderr delete mode 100644 tests/ui/issues/issue-6458-4.rs delete mode 100644 tests/ui/issues/issue-6458-4.stderr delete mode 100644 tests/ui/issues/issue-6458.rs delete mode 100644 tests/ui/issues/issue-6458.stderr delete mode 100644 tests/ui/issues/issue-69396-const-no-type-in-macro.rs delete mode 100644 tests/ui/issues/issue-69396-const-no-type-in-macro.stderr delete mode 100644 tests/ui/issues/issue-71584.rs delete mode 100644 tests/ui/issues/issue-71584.stderr delete mode 100644 tests/ui/issues/issue-868.rs delete mode 100644 tests/ui/issues/issue-948.rs delete mode 100644 tests/ui/issues/issue-979.rs delete mode 100644 tests/ui/kindck/kindck-send-unsafe.rs~rust-lang_master create mode 100644 tests/ui/layout/issue-112048-unsizing-field-order.rs create mode 100644 tests/ui/layout/issue-112048-unsizing-niche.rs create mode 100644 tests/ui/lifetimes/elided-lifetime-in-anon-const.rs create mode 100644 tests/ui/lifetimes/issue-105675.rs create mode 100644 tests/ui/lifetimes/issue-105675.stderr create mode 100644 tests/ui/lifetimes/issue-36744-without-calls.rs create mode 100644 tests/ui/lint-group-denied-lint-allowed.rs create mode 100644 tests/ui/lint-group-forbid-always-trumps-cli.rs create mode 100644 tests/ui/lint-group-forbid-always-trumps-cli.stderr create mode 100644 tests/ui/lint/auxiliary/missing_docs.rs create mode 100644 tests/ui/lint/dead-code/closure-bang.stderr create mode 100644 tests/ui/lint/dead-code/offset-of-correct-param-env.rs create mode 100644 tests/ui/lint/dead-code/offset-of.rs create mode 100644 tests/ui/lint/dead-code/offset-of.stderr create mode 100644 tests/ui/lint/dropping_copy_types.rs create mode 100644 tests/ui/lint/dropping_copy_types.stderr create mode 100644 tests/ui/lint/dropping_references.rs create mode 100644 tests/ui/lint/dropping_references.stderr create mode 100644 tests/ui/lint/forgetting_copy_types.rs create mode 100644 tests/ui/lint/forgetting_copy_types.stderr create mode 100644 tests/ui/lint/forgetting_references.rs create mode 100644 tests/ui/lint/forgetting_references.stderr create mode 100644 tests/ui/lint/internal/trivial-diagnostics.rs create mode 100644 tests/ui/lint/internal/trivial-diagnostics.stderr create mode 100644 tests/ui/lint/issue-110573.rs create mode 100644 tests/ui/lint/issue-111359.rs create mode 100644 tests/ui/lint/issue-111359.stderr create mode 100644 tests/ui/lint/issue-112489.rs create mode 100644 tests/ui/lint/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs create mode 100644 tests/ui/lint/lint-match-arms-2.rs create mode 100644 tests/ui/lint/lint-match-arms-2.stderr create mode 100644 tests/ui/lint/lint-non-uppercase-trait-assoc-const.rs create mode 100644 tests/ui/lint/lint-non-uppercase-trait-assoc-const.stderr delete mode 100644 tests/ui/lint/must_not_suspend/dedup.stderr delete mode 100644 tests/ui/lint/must_not_suspend/trait.stderr delete mode 100644 tests/ui/lint/must_not_suspend/unit.stderr delete mode 100644 tests/ui/lint/must_not_suspend/warn.stderr create mode 100644 tests/ui/lint/rfc-2383-lint-reason/root-attribute-confusion.rs create mode 100644 tests/ui/lint/suspicious-double-ref-op.rs create mode 100644 tests/ui/lint/suspicious-double-ref-op.stderr create mode 100644 tests/ui/macros/issue-111749.rs create mode 100644 tests/ui/macros/issue-111749.stderr create mode 100644 tests/ui/macros/issue-26094.rs create mode 100644 tests/ui/macros/issue-26094.stderr create mode 100644 tests/ui/macros/issue-2804-2.rs create mode 100644 tests/ui/macros/issue-69396-const-no-type-in-macro.rs create mode 100644 tests/ui/macros/issue-69396-const-no-type-in-macro.stderr create mode 100644 tests/ui/macros/panic-temporaries-2018.rs create mode 100644 tests/ui/macros/panic-temporaries.rs create mode 100644 tests/ui/macros/user-defined-macro-rules.rs create mode 100644 tests/ui/meta/no_std-extern-libc.rs create mode 100644 tests/ui/methods/call_method_unknown_pointee.rs create mode 100644 tests/ui/methods/call_method_unknown_pointee.stderr create mode 100644 tests/ui/mir/mir_alignment_check_i686-pc-windows-msvc.rs create mode 100644 tests/ui/native-library-link-flags/msvc-non-utf8-output.rs create mode 100644 tests/ui/native-library-link-flags/msvc-non-utf8-output.stderr create mode 100644 tests/ui/nll/issue-30438-a.rs create mode 100644 tests/ui/nll/issue-30438-a.stderr create mode 100644 tests/ui/nll/issue-30438-b.rs create mode 100644 tests/ui/nll/issue-30438-b.stderr create mode 100644 tests/ui/nll/issue-30438-c.rs create mode 100644 tests/ui/nll/issue-30438-c.stderr create mode 100644 tests/ui/nll/issue-54302-cases.rs create mode 100644 tests/ui/nll/issue-54302-cases.stderr create mode 100644 tests/ui/nll/issue-54302.rs create mode 100644 tests/ui/nll/issue-54302.stderr create mode 100644 tests/ui/numbers-arithmetic/overflow-attribute-works-1.rs create mode 100644 tests/ui/numbers-arithmetic/overflow-attribute-works-2.rs create mode 100644 tests/ui/numbers-arithmetic/overflowing-neg-nonzero.rs create mode 100644 tests/ui/object-safety/assoc_const_bounds.rs create mode 100644 tests/ui/object-safety/assoc_const_bounds.stderr create mode 100644 tests/ui/object-safety/assoc_const_bounds_sized.rs create mode 100644 tests/ui/object-safety/assoc_const_bounds_sized.stderr create mode 100644 tests/ui/object-safety/assoc_type_bounds.rs create mode 100644 tests/ui/object-safety/assoc_type_bounds.stderr create mode 100644 tests/ui/object-safety/assoc_type_bounds2.rs create mode 100644 tests/ui/object-safety/assoc_type_bounds2.stderr create mode 100644 tests/ui/object-safety/assoc_type_bounds_sized.rs create mode 100644 tests/ui/object-safety/assoc_type_bounds_sized.stderr create mode 100644 tests/ui/offset-of/auxiliary/offset-of-staged-api.rs create mode 100644 tests/ui/offset-of/offset-of-arg-count.rs create mode 100644 tests/ui/offset-of/offset-of-arg-count.stderr create mode 100644 tests/ui/offset-of/offset-of-builtin.rs create mode 100644 tests/ui/offset-of/offset-of-builtin.stderr create mode 100644 tests/ui/offset-of/offset-of-dst-field.rs create mode 100644 tests/ui/offset-of/offset-of-dst-field.stderr create mode 100644 tests/ui/offset-of/offset-of-enum.rs create mode 100644 tests/ui/offset-of/offset-of-enum.stderr create mode 100644 tests/ui/offset-of/offset-of-inference.rs create mode 100644 tests/ui/offset-of/offset-of-inference.stderr create mode 100644 tests/ui/offset-of/offset-of-output-type.rs create mode 100644 tests/ui/offset-of/offset-of-output-type.stderr create mode 100644 tests/ui/offset-of/offset-of-private.rs create mode 100644 tests/ui/offset-of/offset-of-private.stderr create mode 100644 tests/ui/offset-of/offset-of-self.rs create mode 100644 tests/ui/offset-of/offset-of-self.stderr create mode 100644 tests/ui/offset-of/offset-of-unstable-with-feature.rs create mode 100644 tests/ui/offset-of/offset-of-unstable.rs create mode 100644 tests/ui/offset-of/offset-of-unstable.stderr create mode 100644 tests/ui/panics/fmt-only-once.rs create mode 100644 tests/ui/panics/fmt-only-once.run.stderr create mode 100644 tests/ui/panics/nested_panic_caught.rs create mode 100644 tests/ui/panics/short-ice-remove-middle-frames-2.rs create mode 100644 tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr create mode 100644 tests/ui/panics/short-ice-remove-middle-frames.rs create mode 100644 tests/ui/panics/short-ice-remove-middle-frames.run.stderr create mode 100644 tests/ui/parser/builtin-syntax.rs create mode 100644 tests/ui/parser/builtin-syntax.stderr create mode 100644 tests/ui/parser/eq-less-to-less-eq.rs create mode 100644 tests/ui/parser/eq-less-to-less-eq.stderr create mode 100644 tests/ui/parser/impl-on-unsized-typo.rs create mode 100644 tests/ui/parser/impl-on-unsized-typo.stderr delete mode 100644 tests/ui/parser/issue-103869.rs delete mode 100644 tests/ui/parser/issue-103869.stderr create mode 100644 tests/ui/parser/issues/issue-111148.rs create mode 100644 tests/ui/parser/issues/issue-111148.stderr create mode 100644 tests/ui/parser/issues/issue-111416.rs create mode 100644 tests/ui/parser/issues/issue-111416.stderr delete mode 100644 tests/ui/parser/issues/issue-33418.fixed create mode 100644 tests/ui/privacy/issue-111220-2-tuple-struct-fields-projection.rs create mode 100644 tests/ui/privacy/issue-111220-2-tuple-struct-fields-projection.stderr create mode 100644 tests/ui/privacy/issue-111220-tuple-struct-fields.rs create mode 100644 tests/ui/privacy/issue-111220-tuple-struct-fields.stderr create mode 100644 tests/ui/proc-macro/test-same-crate.rs create mode 100644 tests/ui/proc-macro/test-same-crate.stderr create mode 100644 tests/ui/reachable/auxiliary/foreign-priv-aux.rs create mode 100644 tests/ui/reachable/foreign-priv.rs create mode 100644 tests/ui/reachable/issue-948.rs create mode 100644 tests/ui/resolve/explicit-self-lowercase-param.rs create mode 100644 tests/ui/resolve/explicit-self-lowercase-param.stderr create mode 100644 tests/ui/resolve/issue-109250.rs create mode 100644 tests/ui/resolve/issue-109250.stderr create mode 100644 tests/ui/resolve/issue-111312.rs create mode 100644 tests/ui/resolve/issue-111312.stderr create mode 100644 tests/ui/resolve/issue-111727.rs create mode 100644 tests/ui/resolve/issue-111727.stderr create mode 100644 tests/ui/resolve/issue-3099-a.rs create mode 100644 tests/ui/resolve/issue-3099-a.stderr create mode 100644 tests/ui/resolve/issue-3099-b.rs create mode 100644 tests/ui/resolve/issue-3099-b.stderr create mode 100644 tests/ui/rfc-2497-if-let-chains/ast-validate-guards.rs create mode 100644 tests/ui/rfc-2497-if-let-chains/ast-validate-guards.stderr create mode 100644 tests/ui/rfc-2627-raw-dylib/dlltool-failed.rs create mode 100644 tests/ui/rfc-2627-raw-dylib/dlltool-failed.stderr create mode 100644 tests/ui/rfc-2627-raw-dylib/invalid-dlltool.rs create mode 100644 tests/ui/rfc-2627-raw-dylib/invalid-dlltool.stderr create mode 100644 tests/ui/rfc-2632-const-trait-impl/call-const-trait-method-pass.stderr create mode 100644 tests/ui/rfc-2632-const-trait-impl/call-generic-in-impl.stderr create mode 100644 tests/ui/rfc-2632-const-trait-impl/call-generic-method-chain.stderr create mode 100644 tests/ui/rfc-2632-const-trait-impl/call-generic-method-dup-bound.stderr create mode 100644 tests/ui/rfc-2632-const-trait-impl/call-generic-method-pass.stderr create mode 100644 tests/ui/rfc-2632-const-trait-impl/const-drop-fail-2.stderr create mode 100644 tests/ui/rfc-2632-const-trait-impl/const-impl-trait.stderr create mode 100644 tests/ui/rfc-2632-const-trait-impl/const_derives/derive-const-use.stderr create mode 100644 tests/ui/rfc-2632-const-trait-impl/const_derives/derive-const-with-params.stderr create mode 100644 tests/ui/rfc-2632-const-trait-impl/generic-bound.stderr create mode 100644 tests/ui/rfc-2632-const-trait-impl/non-const-op-in-closure-in-const.stderr create mode 100644 tests/ui/rfc-2632-const-trait-impl/std-impl-gate.gated.stderr create mode 100644 tests/ui/rfc-2632-const-trait-impl/trait-default-body-stability.stderr create mode 100644 tests/ui/rfc-2632-const-trait-impl/trait-method-ptr-in-consts-ice.rs create mode 100644 tests/ui/rfcs/rfc-3348-c-string-literals/basic.rs create mode 100644 tests/ui/rfcs/rfc-3348-c-string-literals/basic.stderr create mode 100644 tests/ui/rfcs/rfc-3348-c-string-literals/edition-2015-2018-lexing.rs create mode 100644 tests/ui/rfcs/rfc-3348-c-string-literals/gate.rs create mode 100644 tests/ui/rfcs/rfc-3348-c-string-literals/gate.stderr create mode 100644 tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.rs create mode 100644 tests/ui/rfcs/rfc-3348-c-string-literals/no-nuls.stderr create mode 100644 tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.rs create mode 100644 tests/ui/rfcs/rfc-3348-c-string-literals/non-ascii.stderr create mode 100644 tests/ui/sanitize/sanitizer-cfi-canonical-jump-tables-require-cfi.rs create mode 100644 tests/ui/sanitize/sanitizer-cfi-canonical-jump-tables-require-cfi.stderr create mode 100644 tests/ui/sanitize/sanitizer-cfi-generalize-pointers-attr-cfg.rs create mode 100644 tests/ui/sanitize/sanitizer-cfi-generalize-pointers-require-cfi.rs create mode 100644 tests/ui/sanitize/sanitizer-cfi-generalize-pointers-require-cfi.stderr create mode 100644 tests/ui/sanitize/sanitizer-cfi-invalid-attr-cfi-encoding.rs create mode 100644 tests/ui/sanitize/sanitizer-cfi-invalid-attr-cfi-encoding.stderr create mode 100644 tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.aarch64.stderr create mode 100644 tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.rs create mode 100644 tests/ui/sanitize/sanitizer-cfi-is-incompatible-with-saniziter-kcfi.x86_64.stderr create mode 100644 tests/ui/sanitize/sanitizer-cfi-normalize-integers-attr-cfg.rs create mode 100644 tests/ui/sanitize/sanitizer-cfi-normalize-integers-require-cfi.rs create mode 100644 tests/ui/sanitize/sanitizer-cfi-normalize-integers-require-cfi.stderr create mode 100644 tests/ui/sanitize/sanitizer-cfi-requires-lto.rs create mode 100644 tests/ui/sanitize/sanitizer-cfi-requires-lto.stderr create mode 100644 tests/ui/sanitize/split-lto-unit-requires-lto.rs create mode 100644 tests/ui/sanitize/split-lto-unit-requires-lto.stderr create mode 100644 tests/ui/self/arbitrary-self-from-method-substs.rs create mode 100644 tests/ui/self/arbitrary-self-from-method-substs.stderr create mode 100644 tests/ui/self/elision/nested-item.rs create mode 100644 tests/ui/self/elision/nested-item.stderr create mode 100644 tests/ui/self/self-ctor-nongeneric.rs create mode 100644 tests/ui/simd/issue-105439.rs create mode 100644 tests/ui/specialization/const_trait_impl.stderr create mode 100644 tests/ui/specialization/issue-111232.rs create mode 100644 tests/ui/specialization/issue-111232.stderr create mode 100644 tests/ui/specialization/issue-40582.rs create mode 100644 tests/ui/specialization/min_specialization/specialize-associated-type.rs create mode 100644 tests/ui/specialization/min_specialization/specialize_nothing.rs create mode 100644 tests/ui/specialization/min_specialization/specialize_nothing.stderr create mode 100644 tests/ui/specialization/min_specialization/specialize_on_type_error.rs create mode 100644 tests/ui/specialization/min_specialization/specialize_on_type_error.stderr create mode 100644 tests/ui/specialization/min_specialization/specialize_with_generalize_lifetimes.rs create mode 100644 tests/ui/specialization/min_specialization/specialize_with_generalize_lifetimes.stderr create mode 100644 tests/ui/specialization/specialization-default-items-drop-coherence.rs create mode 100644 tests/ui/structs-enums/issue-103869.fixed create mode 100644 tests/ui/structs-enums/issue-103869.rs create mode 100644 tests/ui/structs-enums/issue-103869.stderr create mode 100644 tests/ui/suggestions/auxiliary/missing-assoc-fn-applicable-suggestions.rs create mode 100644 tests/ui/suggestions/issue-109854.rs create mode 100644 tests/ui/suggestions/issue-109854.stderr create mode 100644 tests/ui/suggestions/issue-94171.rs create mode 100644 tests/ui/suggestions/issue-94171.stderr create mode 100644 tests/ui/suggestions/issue-99597.rs create mode 100644 tests/ui/suggestions/issue-99597.stderr delete mode 100644 tests/ui/suggestions/missing-assoc-fn-applicable-suggestions.fixed delete mode 100644 tests/ui/suggestions/suggest-borrow-to-dyn-object.rs delete mode 100644 tests/ui/suggestions/suggest-borrow-to-dyn-object.stderr create mode 100644 tests/ui/suggestions/suggest-boxed-empty-block.fixed create mode 100644 tests/ui/suggestions/suggest-boxed-empty-block.rs create mode 100644 tests/ui/suggestions/suggest-boxed-empty-block.stderr create mode 100644 tests/ui/suggestions/type-ascription-instead-of-let.fixed create mode 100644 tests/ui/test-attrs/issue-12997-1.rs create mode 100644 tests/ui/test-attrs/issue-12997-1.stderr create mode 100644 tests/ui/test-attrs/issue-12997-2.rs create mode 100644 tests/ui/test-attrs/issue-12997-2.stderr create mode 100644 tests/ui/test-attrs/issue-34932.rs create mode 100644 tests/ui/thread-local/thread-local-static-ref-use-after-free.rs create mode 100644 tests/ui/traits/copy-guessing.stderr create mode 100644 tests/ui/traits/issue-22384.rs create mode 100644 tests/ui/traits/issue-22384.stderr create mode 100644 tests/ui/traits/negative-bounds/associated-constraints.rs create mode 100644 tests/ui/traits/negative-bounds/associated-constraints.stderr create mode 100644 tests/ui/traits/negative-bounds/simple.rs create mode 100644 tests/ui/traits/negative-bounds/simple.stderr create mode 100644 tests/ui/traits/negative-bounds/supertrait.rs create mode 100644 tests/ui/traits/negative-bounds/supertrait.stderr create mode 100644 tests/ui/traits/new-solver/alias-bound-unsound.rs create mode 100644 tests/ui/traits/new-solver/alias-bound-unsound.stderr delete mode 100644 tests/ui/traits/new-solver/alias_eq_dont_use_normalizes_to_if_substs_eq.stderr delete mode 100644 tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr create mode 100644 tests/ui/traits/new-solver/borrowck-error.rs create mode 100644 tests/ui/traits/new-solver/borrowck-error.stderr create mode 100644 tests/ui/traits/new-solver/exponential-trait-goals.rs create mode 100644 tests/ui/traits/new-solver/exponential-trait-goals.stderr create mode 100644 tests/ui/traits/new-solver/negative-coherence-bounds.rs create mode 100644 tests/ui/traits/new-solver/negative-coherence-bounds.stderr create mode 100644 tests/ui/traits/new-solver/nested-alias-bound.rs create mode 100644 tests/ui/traits/new-solver/normalize-rcvr-for-inherent.rs create mode 100644 tests/ui/traits/new-solver/structural-resolve-field.rs create mode 100644 tests/ui/traits/non_lifetime_binders/drop-impl-pred.no.stderr create mode 100644 tests/ui/traits/non_lifetime_binders/drop-impl-pred.rs create mode 100644 tests/ui/traits/non_lifetime_binders/drop-impl-pred.yes.stderr create mode 100644 tests/ui/traits/non_lifetime_binders/universe-error1.rs create mode 100644 tests/ui/traits/non_lifetime_binders/universe-error1.stderr create mode 100644 tests/ui/transmutability/issue-110467.rs create mode 100644 tests/ui/transmutability/region-infer.rs create mode 100644 tests/ui/transmutability/region-infer.stderr create mode 100644 tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.rs create mode 100644 tests/ui/type-alias-impl-trait/different_defining_uses_never_type-2.stderr create mode 100644 tests/ui/type-alias-impl-trait/different_defining_uses_never_type-3.rs create mode 100644 tests/ui/type-alias-impl-trait/different_defining_uses_never_type-3.stderr create mode 100644 tests/ui/type-alias-impl-trait/invalid_impl_trait_in_assoc_ty.rs create mode 100644 tests/ui/type-alias-impl-trait/invalid_impl_trait_in_assoc_ty.stderr create mode 100644 tests/ui/type-alias-impl-trait/wf-in-associated-type.fail.stderr create mode 100644 tests/ui/type-alias-impl-trait/wf-in-associated-type.rs create mode 100644 tests/ui/type-alias-impl-trait/wf-nested.fail.stderr create mode 100644 tests/ui/type-alias-impl-trait/wf-nested.pass_sound.stderr create mode 100644 tests/ui/type-alias-impl-trait/wf-nested.rs create mode 100644 tests/ui/type/missing-let-in-binding-2.fixed create mode 100644 tests/ui/type/missing-let-in-binding-2.rs create mode 100644 tests/ui/type/missing-let-in-binding-2.stderr create mode 100644 tests/ui/type/missing-let-in-binding-3.rs create mode 100644 tests/ui/type/missing-let-in-binding-3.stderr create mode 100644 tests/ui/type/missing-let-in-binding-4.rs create mode 100644 tests/ui/type/missing-let-in-binding-4.stderr create mode 100644 tests/ui/typeck/bad-index-due-to-nested.rs create mode 100644 tests/ui/typeck/bad-index-due-to-nested.stderr create mode 100644 tests/ui/typeck/bad-recursive-type-sig-infer.rs create mode 100644 tests/ui/typeck/bad-recursive-type-sig-infer.stderr create mode 100644 tests/ui/typeck/derive-sugg-arg-arity.rs create mode 100644 tests/ui/typeck/derive-sugg-arg-arity.stderr create mode 100644 tests/ui/typeck/pin-unsound-issue-85099-derefmut.rs create mode 100644 tests/ui/typeck/repeat-expr-checks-wf.rs create mode 100644 tests/ui/typeck/repeat-expr-checks-wf.stderr create mode 100644 tests/ui/underscore-imports/issue-110164.rs create mode 100644 tests/ui/underscore-imports/issue-110164.stderr create mode 100644 tests/ui/unsized-locals/align.rs create mode 100644 tests/ui/unsized-locals/issue-67981.rs create mode 100644 tests/ui/unsized-locals/issue-67981.stderr delete mode 100644 tests/ui/unwind-abis/feature-gate-c-unwind-enabled.rs delete mode 100644 tests/ui/unwind-abis/feature-gate-c-unwind.rs delete mode 100644 tests/ui/unwind-abis/feature-gate-c-unwind.stderr create mode 100644 tests/ui/unwind-abis/feature-gate-c_unwind.rs delete mode 100644 tests/ui/unwind-abis/feature-gate-stdcall-unwind.rs delete mode 100644 tests/ui/unwind-abis/feature-gate-stdcall-unwind.stderr delete mode 100644 tests/ui/unwind-abis/feature-gate-system-unwind.rs delete mode 100644 tests/ui/unwind-abis/feature-gate-system-unwind.stderr delete mode 100644 tests/ui/unwind-abis/feature-gate-thiscall-unwind.rs delete mode 100644 tests/ui/unwind-abis/feature-gate-thiscall-unwind.stderr delete mode 100644 tests/ui/user-defined-macro-rules.rs create mode 100644 tests/ui/wf/wf-in-fn-type-implicit.rs create mode 100644 tests/ui/wf/wf-in-where-clause-static.rs create mode 100644 tests/ui/wf/wf-normalization-sized.rs (limited to 'tests') diff --git a/tests/assembly/asm/inline-asm-avx.rs b/tests/assembly/asm/inline-asm-avx.rs new file mode 100644 index 000000000..c2875f3e0 --- /dev/null +++ b/tests/assembly/asm/inline-asm-avx.rs @@ -0,0 +1,25 @@ +// assembly-output: emit-asm +// compile-flags: --crate-type=lib +// only-x86_64 +// ignore-sgx + +#![feature(portable_simd)] + +use std::simd::Simd; +use std::arch::asm; + +#[target_feature(enable = "avx")] +#[no_mangle] +// CHECK-LABEL: convert: +pub unsafe fn convert(a: *const f32) -> Simd { + // CHECK: vbroadcastss (%{{[er][a-ds0-9][xpi0-9]?}}), {{%ymm[0-7]}} + let b: Simd; + unsafe { + asm!( + "vbroadcastss {b}, [{a}]", + a = in(reg) a, + b = out(ymm_reg) b, + ); + } + b +} diff --git a/tests/assembly/asm/loongarch-type.rs b/tests/assembly/asm/loongarch-type.rs new file mode 100644 index 000000000..4e296f3ad --- /dev/null +++ b/tests/assembly/asm/loongarch-type.rs @@ -0,0 +1,196 @@ +// min-llvm-version: 16.0 +// assembly-output: emit-asm +// compile-flags: --target loongarch64-unknown-linux-gnu +// needs-llvm-components: loongarch + +#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)] +#![crate_type = "rlib"] +#![no_core] +#![allow(asm_sub_register, non_camel_case_types)] + +#[rustc_builtin_macro] +macro_rules! asm { + () => {}; +} +#[rustc_builtin_macro] +macro_rules! concat { + () => {}; +} +#[rustc_builtin_macro] +macro_rules! stringify { + () => {}; +} + +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} + +type ptr = *const i32; + +impl Copy for i8 {} +impl Copy for i16 {} +impl Copy for i32 {} +impl Copy for i64 {} +impl Copy for f32 {} +impl Copy for f64 {} +impl Copy for ptr {} +extern "C" { + fn extern_func(); + static extern_static: u8; +} + +// Hack to avoid function merging +extern "Rust" { + fn dont_merge(s: &str); +} + +// CHECK-LABEL: sym_fn: +// CHECK: #APP +// CHECK: pcalau12i $t0, %got_pc_hi20(extern_func) +// CHECK: ld.d $t0, $t0, %got_pc_lo12(extern_func) +// CHECK: #NO_APP +#[no_mangle] +pub unsafe fn sym_fn() { + asm!("la.got $r12, {}", sym extern_func); +} + +// CHECK-LABEL: sym_static: +// CHECK: #APP +// CHECK: pcalau12i $t0, %got_pc_hi20(extern_static) +// CHECK: ld.d $t0, $t0, %got_pc_lo12(extern_static) +// CHECK: #NO_APP +#[no_mangle] +pub unsafe fn sym_static() { + asm!("la.got $r12, {}", sym extern_static); +} + +macro_rules! check { ($func:ident, $ty:ty, $class:ident, $mov:literal) => { + #[no_mangle] + pub unsafe fn $func(x: $ty) -> $ty { + dont_merge(stringify!($func)); + + let y; + asm!(concat!($mov," {}, {}"), out($class) y, in($class) x); + y + } +};} + +macro_rules! check_reg { ($func:ident, $ty:ty, $reg:tt, $mov:literal) => { + #[no_mangle] + pub unsafe fn $func(x: $ty) -> $ty { + dont_merge(stringify!($func)); + + let y; + asm!(concat!($mov, " ", $reg, ", ", $reg), lateout($reg) y, in($reg) x); + y + } +};} + +// CHECK-LABEL: reg_i8: +// CHECK: #APP +// CHECK: move ${{[a-z0-9]+}}, ${{[a-z0-9]+}} +// CHECK: #NO_APP +check!(reg_i8, i8, reg, "move"); + +// CHECK-LABEL: reg_i16: +// CHECK: #APP +// CHECK: move ${{[a-z0-9]+}}, ${{[a-z0-9]+}} +// CHECK: #NO_APP +check!(reg_i16, i16, reg, "move"); + +// CHECK-LABEL: reg_i32: +// CHECK: #APP +// CHECK: move ${{[a-z0-9]+}}, ${{[a-z0-9]+}} +// CHECK: #NO_APP +check!(reg_i32, i32, reg, "move"); + +// CHECK-LABEL: reg_f32: +// CHECK: #APP +// CHECK: move ${{[a-z0-9]+}}, ${{[a-z0-9]+}} +// CHECK: #NO_APP +check!(reg_f32, f32, reg, "move"); + +// CHECK-LABEL: reg_i64: +// CHECK: #APP +// CHECK: move ${{[a-z0-9]+}}, ${{[a-z0-9]+}} +// CHECK: #NO_APP +check!(reg_i64, i64, reg, "move"); + +// CHECK-LABEL: reg_f64: +// CHECK: #APP +// CHECK: move ${{[a-z0-9]+}}, ${{[a-z0-9]+}} +// CHECK: #NO_APP +check!(reg_f64, f64, reg, "move"); + +// CHECK-LABEL: reg_ptr: +// CHECK: #APP +// CHECK: move ${{[a-z0-9]+}}, ${{[a-z0-9]+}} +// CHECK: #NO_APP +check!(reg_ptr, ptr, reg, "move"); + +// CHECK-LABEL: freg_f32: +// CHECK: #APP +// CHECK: fmov.s $f{{[a-z0-9]+}}, $f{{[a-z0-9]+}} +// CHECK: #NO_APP +check!(freg_f32, f32, freg, "fmov.s"); + +// CHECK-LABEL: freg_f64: +// CHECK: #APP +// CHECK: fmov.d $f{{[a-z0-9]+}}, $f{{[a-z0-9]+}} +// CHECK: #NO_APP +check!(freg_f64, f64, freg, "fmov.d"); + +// CHECK-LABEL: r4_i8: +// CHECK: #APP +// CHECK: move $a0, $a0 +// CHECK: #NO_APP +check_reg!(r4_i8, i8, "$r4", "move"); + +// CHECK-LABEL: r4_i16: +// CHECK: #APP +// CHECK: move $a0, $a0 +// CHECK: #NO_APP +check_reg!(r4_i16, i16, "$r4", "move"); + +// CHECK-LABEL: r4_i32: +// CHECK: #APP +// CHECK: move $a0, $a0 +// CHECK: #NO_APP +check_reg!(r4_i32, i32, "$r4", "move"); + +// CHECK-LABEL: r4_f32: +// CHECK: #APP +// CHECK: move $a0, $a0 +// CHECK: #NO_APP +check_reg!(r4_f32, f32, "$r4", "move"); + +// CHECK-LABEL: r4_i64: +// CHECK: #APP +// CHECK: move $a0, $a0 +// CHECK: #NO_APP +check_reg!(r4_i64, i64, "$r4", "move"); + +// CHECK-LABEL: r4_f64: +// CHECK: #APP +// CHECK: move $a0, $a0 +// CHECK: #NO_APP +check_reg!(r4_f64, f64, "$r4", "move"); + +// CHECK-LABEL: r4_ptr: +// CHECK: #APP +// CHECK: move $a0, $a0 +// CHECK: #NO_APP +check_reg!(r4_ptr, ptr, "$r4", "move"); + +// CHECK-LABEL: f0_f32: +// CHECK: #APP +// CHECK: fmov.s $f{{[a-z0-9]+}}, $f{{[a-z0-9]+}} +// CHECK: #NO_APP +check_reg!(f0_f32, f32, "$f0", "fmov.s"); + +// CHECK-LABEL: f0_f64: +// CHECK: #APP +// CHECK: fmov.d $f{{[a-z0-9]+}}, $f{{[a-z0-9]+}} +// CHECK: #NO_APP +check_reg!(f0_f64, f64, "$f0", "fmov.d"); diff --git a/tests/assembly/option-nonzero-eq.rs b/tests/assembly/option-nonzero-eq.rs new file mode 100644 index 000000000..f5d88de76 --- /dev/null +++ b/tests/assembly/option-nonzero-eq.rs @@ -0,0 +1,28 @@ +// revisions: WIN LIN +// [WIN] only-windows +// [LIN] only-linux +// assembly-output: emit-asm +// compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel +// only-x86_64 +// ignore-sgx +// ignore-debug + +use std::cmp::Ordering; + +// CHECK-lABEL: ordering_eq: +#[no_mangle] +pub fn ordering_eq(l: Option, r: Option) -> bool { + // Linux (System V): first two arguments are rdi then rsi + // Windows: first two arguments are rcx then rdx + // Both use rax for the return value. + + // CHECK-NOT: mov + // CHECK-NOT: test + // CHECK-NOT: cmp + + // LIN: cmp dil, sil + // WIN: cmp cl, dl + // CHECK-NEXT: sete al + // CHECK-NEXT: ret + l == r +} diff --git a/tests/assembly/slice-is_ascii.rs b/tests/assembly/slice-is_ascii.rs new file mode 100644 index 000000000..b3e1fee15 --- /dev/null +++ b/tests/assembly/slice-is_ascii.rs @@ -0,0 +1,35 @@ +// revisions: WIN LIN +// [WIN] only-windows +// [LIN] only-linux +// assembly-output: emit-asm +// compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel +// min-llvm-version: 14 +// only-x86_64 +// ignore-sgx +// ignore-debug + +#![feature(str_internals)] + +// CHECK-LABEL: is_ascii_simple_demo: +#[no_mangle] +pub fn is_ascii_simple_demo(bytes: &[u8]) -> bool { + // Linux (System V): pointer is rdi; length is rsi + // Windows: pointer is rcx; length is rdx. + + // CHECK-NOT: mov + // CHECK-NOT: test + // CHECK-NOT: cmp + + // CHECK: .[[LOOPHEAD:.+]]: + // CHECK-NEXT: mov [[TEMP:.+]], [[LEN:rsi|rdx]] + // CHECK-NEXT: sub [[LEN]], 1 + // CHECK-NEXT: jb .[[LOOPEXIT:.+]] + // CHECK-NEXT: cmp byte ptr [{{rdi|rcx}} + [[TEMP]] - 1], 0 + // CHECK-NEXT: jns .[[LOOPHEAD]] + + // CHECK-NEXT: .[[LOOPEXIT]]: + // CHECK-NEXT: test [[TEMP]], [[TEMP]] + // CHECK-NEXT: sete al + // CHECK-NEXT: ret + core::slice::is_ascii_simple(bytes) +} diff --git a/tests/codegen-units/item-collection/cross-crate-trait-method.rs b/tests/codegen-units/item-collection/cross-crate-trait-method.rs index dc0984c8a..b7216a143 100644 --- a/tests/codegen-units/item-collection/cross-crate-trait-method.rs +++ b/tests/codegen-units/item-collection/cross-crate-trait-method.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=eager +// compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/function-as-argument.rs b/tests/codegen-units/item-collection/function-as-argument.rs index ea500c311..d951cbfac 100644 --- a/tests/codegen-units/item-collection/function-as-argument.rs +++ b/tests/codegen-units/item-collection/function-as-argument.rs @@ -1,5 +1,4 @@ -// -// compile-flags:-Zprint-mono-items=eager +// compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/generic-functions.rs b/tests/codegen-units/item-collection/generic-functions.rs index 04383bb8e..f790cd0da 100644 --- a/tests/codegen-units/item-collection/generic-functions.rs +++ b/tests/codegen-units/item-collection/generic-functions.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=eager +// compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/generic-impl.rs b/tests/codegen-units/item-collection/generic-impl.rs index 4260230c2..e19eec36b 100644 --- a/tests/codegen-units/item-collection/generic-impl.rs +++ b/tests/codegen-units/item-collection/generic-impl.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=eager +// compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/trait-implementations.rs b/tests/codegen-units/item-collection/trait-implementations.rs index a816cb032..ad0ed7da2 100644 --- a/tests/codegen-units/item-collection/trait-implementations.rs +++ b/tests/codegen-units/item-collection/trait-implementations.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=eager +// compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/trait-method-as-argument.rs b/tests/codegen-units/item-collection/trait-method-as-argument.rs index 235569728..164ef794c 100644 --- a/tests/codegen-units/item-collection/trait-method-as-argument.rs +++ b/tests/codegen-units/item-collection/trait-method-as-argument.rs @@ -1,5 +1,4 @@ -// -// compile-flags:-Zprint-mono-items=eager +// compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/trait-method-default-impl.rs b/tests/codegen-units/item-collection/trait-method-default-impl.rs index bfcdb6fa1..d953582cc 100644 --- a/tests/codegen-units/item-collection/trait-method-default-impl.rs +++ b/tests/codegen-units/item-collection/trait-method-default-impl.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=eager -Zpolymorphize=on +// compile-flags:-Zprint-mono-items=eager -Zpolymorphize=on -Zinline-mir=no #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen/abi-main-signature-16bit-c-int.rs b/tests/codegen/abi-main-signature-16bit-c-int.rs index 3548cc06a..353e7489b 100644 --- a/tests/codegen/abi-main-signature-16bit-c-int.rs +++ b/tests/codegen/abi-main-signature-16bit-c-int.rs @@ -17,6 +17,7 @@ // ignore-wasm32 // ignore-x86 // ignore-x86_64 +// ignore-loongarch64 fn main() { } diff --git a/tests/codegen/addr-of-mutate.rs b/tests/codegen/addr-of-mutate.rs new file mode 100644 index 000000000..bea1aad23 --- /dev/null +++ b/tests/codegen/addr-of-mutate.rs @@ -0,0 +1,34 @@ +// compile-flags: -C opt-level=3 -C no-prepopulate-passes +// min-llvm-version: 15.0 (for opaque pointers) + +#![crate_type = "lib"] + +// Test for the absence of `readonly` on the argument when it is mutated via `&raw const`. +// See . + +// CHECK: i8 @foo(ptr noalias nocapture noundef dereferenceable(128) %x) +#[no_mangle] +pub fn foo(x: [u8; 128]) -> u8 { + let ptr = core::ptr::addr_of!(x).cast_mut(); + unsafe { + (*ptr)[0] = 1; + } + x[0] +} + +// CHECK: i1 @second(ptr noalias nocapture noundef dereferenceable({{[0-9]+}}) %a_ptr_and_b) +#[no_mangle] +pub unsafe fn second(a_ptr_and_b: (*mut (i32, bool), (i64, bool))) -> bool { + let b_bool_ptr = core::ptr::addr_of!(a_ptr_and_b.1.1).cast_mut(); + (*b_bool_ptr) = true; + a_ptr_and_b.1.1 +} + +// If going through a deref (and there are no other mutating accesses), then `readonly` is fine. +// CHECK: i1 @third(ptr noalias nocapture noundef readonly dereferenceable({{[0-9]+}}) %a_ptr_and_b) +#[no_mangle] +pub unsafe fn third(a_ptr_and_b: (*mut (i32, bool), (i64, bool))) -> bool { + let b_bool_ptr = core::ptr::addr_of!((*a_ptr_and_b.0).1).cast_mut(); + (*b_bool_ptr) = true; + a_ptr_and_b.1.1 +} diff --git a/tests/codegen/align-fn.rs b/tests/codegen/align-fn.rs index c5886cf28..f3cf614e1 100644 --- a/tests/codegen/align-fn.rs +++ b/tests/codegen/align-fn.rs @@ -7,3 +7,43 @@ #[no_mangle] #[repr(align(16))] pub fn fn_align() {} + +pub struct A; + +impl A { + // CHECK: align 16 + #[no_mangle] + #[repr(align(16))] + pub fn method_align(self) {} + + // CHECK: align 16 + #[no_mangle] + #[repr(align(16))] + pub fn associated_fn() {} +} + +trait T: Sized { + fn trait_fn() {} + + // CHECK: align 32 + #[repr(align(32))] + fn trait_method(self) {} +} + +impl T for A { + // CHECK: align 16 + #[no_mangle] + #[repr(align(16))] + fn trait_fn() {} + + // CHECK: align 16 + #[no_mangle] + #[repr(align(16))] + fn trait_method(self) {} +} + +impl T for () {} + +pub fn foo() { + ().trait_method(); +} diff --git a/tests/codegen/align-offset.rs b/tests/codegen/align-offset.rs new file mode 100644 index 000000000..7c7660c5a --- /dev/null +++ b/tests/codegen/align-offset.rs @@ -0,0 +1,78 @@ +// compile-flags: -O +// min-llvm-version: 15.0 (because we're using opaque pointers) +// ignore-debug (debug assertions in `slice::from_raw_parts` block optimizations) + +#![crate_type = "lib"] + +// CHECK-LABEL: @align8 +#[no_mangle] +pub fn align8(p: *const u8) -> bool { + // CHECK: ret i1 true + p.align_offset(8) < 8 +} + +#[repr(align(4))] +pub struct Align4([u8; 4]); + +// CHECK-LABEL: @align_to4 +#[no_mangle] +pub fn align_to4(x: &[u8]) -> bool { + // CHECK: ret i1 true + let (prefix, _middle, suffix) = unsafe { x.align_to::() }; + prefix.len() < 4 && suffix.len() < 4 +} + +// CHECK-LABEL: @align_offset_byte_ptr(ptr{{.+}}%ptr) +#[no_mangle] +pub fn align_offset_byte_ptr(ptr: *const u8) -> usize { + // CHECK: %[[ADDR:.+]] = ptrtoint ptr %ptr to [[USIZE:i[0-9]+]] + // CHECK: %[[UP:.+]] = add [[USIZE]] %[[ADDR]], 31 + // CHECK: %[[ALIGNED:.+]] = and [[USIZE]] %[[UP]], -32 + // CHECK: %[[OFFSET:.+]] = sub [[USIZE]] %[[ALIGNED]], %[[ADDR]] + + // Since we're offsetting a byte pointer, there's no further fixups + // CHECK-NOT: shr + // CHECK-NOT: div + // CHECK-NOT: select + + // CHECK: ret [[USIZE]] %[[OFFSET]] + ptr.align_offset(32) +} + +// CHECK-LABEL: @align_offset_word_slice(ptr{{.+}}align 4{{.+}}%slice.0 +#[no_mangle] +pub fn align_offset_word_slice(slice: &[Align4]) -> usize { + // CHECK: %[[ADDR:.+]] = ptrtoint ptr %slice.0 to [[USIZE]] + // CHECK: %[[UP:.+]] = add [[USIZE]] %[[ADDR]], 31 + // CHECK: %[[ALIGNED:.+]] = and [[USIZE]] %[[UP]], -32 + // CHECK: %[[BOFFSET:.+]] = sub [[USIZE]] %[[ALIGNED]], %[[ADDR]] + // CHECK: %[[OFFSET:.+]] = lshr exact [[USIZE]] %[[BOFFSET]], 2 + + // Slices are known to be aligned, so we don't need the "maybe -1" path + // CHECK-NOT: select + + // CHECK: ret [[USIZE]] %[[OFFSET]] + slice.as_ptr().align_offset(32) +} + + +// CHECK-LABEL: @align_offset_word_ptr(ptr{{.+}}%ptr +#[no_mangle] +pub fn align_offset_word_ptr(ptr: *const Align4) -> usize { + // CHECK: %[[ADDR:.+]] = ptrtoint ptr %ptr to [[USIZE]] + // CHECK: %[[UP:.+]] = add [[USIZE]] %[[ADDR]], 31 + // CHECK: %[[ALIGNED:.+]] = and [[USIZE]] %[[UP]], -32 + // CHECK: %[[BOFFSET:.+]] = sub [[USIZE]] %[[ALIGNED]], %[[ADDR]] + + // While we can always get a *byte* offset that will work, if the original + // pointer is unaligned it might be impossible to return an *element* offset + // that will make it aligned. We want it to be a `select`, not a `br`, so + // that the assembly will be branchless. + // CHECK: %[[LOW:.+]] = and [[USIZE]] %[[ADDR]], 3 + // CHECK: %[[ORIGINAL_ALIGNED:.+]] = icmp eq [[USIZE]] %[[LOW]], 0 + // CHECK: %[[OFFSET:.+]] = lshr exact [[USIZE]] %[[BOFFSET]], 2 + // CHECK: %[[R:.+]] = select i1 %[[ORIGINAL_ALIGNED]], [[USIZE]] %[[OFFSET]], [[USIZE]] -1 + + // CHECK: ret [[USIZE]] %[[R]] + ptr.align_offset(32) +} diff --git a/tests/codegen/alloc-optimisation.rs b/tests/codegen/alloc-optimisation.rs index c3ffaeb95..f88d695d8 100644 --- a/tests/codegen/alloc-optimisation.rs +++ b/tests/codegen/alloc-optimisation.rs @@ -1,12 +1,13 @@ // // no-system-llvm // compile-flags: -O -#![crate_type="lib"] +#![crate_type = "lib"] #[no_mangle] pub fn alloc_test(data: u32) { // CHECK-LABEL: @alloc_test // CHECK-NEXT: start: + // CHECK-NEXT: {{.*}} load volatile i8, ptr @__rust_no_alloc_shim_is_unstable, align 1 // CHECK-NEXT: ret void let x = Box::new(data); drop(x); diff --git a/tests/codegen/array-map.rs b/tests/codegen/array-map.rs index 7b8ab2c79..3706ddf99 100644 --- a/tests/codegen/array-map.rs +++ b/tests/codegen/array-map.rs @@ -21,7 +21,7 @@ pub fn short_integer_map(x: [u32; 8]) -> [u32; 8] { pub fn short_integer_zip_map(x: [u32; 8], y: [u32; 8]) -> [u32; 8] { // CHECK: %[[A:.+]] = load <8 x i32> // CHECK: %[[B:.+]] = load <8 x i32> - // CHECK: sub <8 x i32> %[[A]], %[[B]] + // CHECK: sub <8 x i32> %[[B]], %[[A]] // CHECK: store <8 x i32> x.zip(y).map(|(x, y)| x - y) } diff --git a/tests/codegen/ascii-char.rs b/tests/codegen/ascii-char.rs new file mode 100644 index 000000000..4167becf5 --- /dev/null +++ b/tests/codegen/ascii-char.rs @@ -0,0 +1,37 @@ +// compile-flags: -C opt-level=1 +// ignore-debug (the extra assertions get in the way) + +#![crate_type = "lib"] +#![feature(ascii_char)] + +use std::ascii::Char as AsciiChar; + +// CHECK-LABEL: i8 @unwrap_digit_from_remainder(i32 +#[no_mangle] +pub fn unwrap_digit_from_remainder(v: u32) -> AsciiChar { + // CHECK-NOT: icmp + // CHECK-NOT: panic + + // CHECK: %[[R:.+]] = urem i32 %v, 10 + // CHECK-NEXT: %[[T:.+]] = trunc i32 %[[R]] to i8 + // CHECK-NEXT: %[[D:.+]] = or i8 %[[T]], 48 + // CHECK-NEXT: ret i8 %[[D]] + + // CHECK-NOT: icmp + // CHECK-NOT: panic + AsciiChar::digit((v % 10) as u8).unwrap() +} + +// CHECK-LABEL: i8 @unwrap_from_masked(i8 +#[no_mangle] +pub fn unwrap_from_masked(b: u8) -> AsciiChar { + // CHECK-NOT: icmp + // CHECK-NOT: panic + + // CHECK: %[[M:.+]] = and i8 %b, 127 + // CHECK-NEXT: ret i8 %[[M]] + + // CHECK-NOT: icmp + // CHECK-NOT: panic + AsciiChar::from_u8(b & 0x7f).unwrap() +} diff --git a/tests/codegen/binary-search-index-no-bound-check.rs b/tests/codegen/binary-search-index-no-bound-check.rs index c1766a4a4..595969a89 100644 --- a/tests/codegen/binary-search-index-no-bound-check.rs +++ b/tests/codegen/binary-search-index-no-bound-check.rs @@ -9,7 +9,9 @@ #[no_mangle] pub fn binary_search_index_no_bounds_check(s: &[u8]) -> u8 { // CHECK-NOT: panic - // CHECK-NOT: slice_index_len_fail + // CHECK-NOT: slice_start_index_len_fail + // CHECK-NOT: slice_end_index_len_fail + // CHECK-NOT: panic_bounds_check if let Ok(idx) = s.binary_search(&b'\\') { s[idx] } else { diff --git a/tests/codegen/call-llvm-intrinsics.rs b/tests/codegen/call-llvm-intrinsics.rs index cb8abae19..11f291771 100644 --- a/tests/codegen/call-llvm-intrinsics.rs +++ b/tests/codegen/call-llvm-intrinsics.rs @@ -1,6 +1,7 @@ // compile-flags: -C no-prepopulate-passes -Copt-level=0 // ignore-riscv64 +// ignore-loongarch64 #![feature(link_llvm_intrinsics)] #![crate_type = "lib"] diff --git a/tests/codegen/catch-unwind.rs b/tests/codegen/catch-unwind.rs index b90ef104c..6b63b83ef 100644 --- a/tests/codegen/catch-unwind.rs +++ b/tests/codegen/catch-unwind.rs @@ -10,6 +10,8 @@ // ignore-riscv64 FIXME // On s390x the closure is also in another function // ignore-s390x FIXME +// On loongarch64 the closure is also in another function +// ignore-loongarch64 FIXME #![crate_type = "lib"] #![feature(c_unwind)] diff --git a/tests/codegen/debug-vtable.rs b/tests/codegen/debug-vtable.rs index d82b737de..e52392b26 100644 --- a/tests/codegen/debug-vtable.rs +++ b/tests/codegen/debug-vtable.rs @@ -11,8 +11,6 @@ // Make sure that vtables don't have the unnamed_addr attribute when debuginfo is enabled. // This helps debuggers more reliably map from dyn pointer to concrete type. -// CHECK: @vtable.0 = private constant <{ -// CHECK: @vtable.1 = private constant <{ // CHECK: @vtable.2 = private constant <{ // CHECK: @vtable.3 = private constant <{ // CHECK: @vtable.4 = private constant <{ diff --git a/tests/codegen/debuginfo-constant-locals.rs b/tests/codegen/debuginfo-constant-locals.rs new file mode 100644 index 000000000..95a1b8c9d --- /dev/null +++ b/tests/codegen/debuginfo-constant-locals.rs @@ -0,0 +1,28 @@ +// compile-flags: -g -O + +// Check that simple constant values are preserved in debuginfo across both MIR opts and LLVM opts + +#![crate_type = "lib"] + +#[no_mangle] +pub fn check_it() { + let a = 1; + let b = 42; + + foo(a + b); +} + +#[inline(never)] +fn foo(x: i32) { + std::process::exit(x); +} + +// CHECK-LABEL: @check_it +// CHECK: call void @llvm.dbg.value(metadata i32 1, metadata ![[a_metadata:[0-9]+]], metadata !DIExpression()) +// CHECK: call void @llvm.dbg.value(metadata i32 42, metadata ![[b_metadata:[0-9]+]], metadata !DIExpression()) + +// CHECK: ![[a_metadata]] = !DILocalVariable(name: "a" +// CHECK-SAME: line: 9 + +// CHECK: ![[b_metadata]] = !DILocalVariable(name: "b" +// CHECK-SAME: line: 10 diff --git a/tests/codegen/drop-in-place-noalias.rs b/tests/codegen/drop-in-place-noalias.rs new file mode 100644 index 000000000..725e6fc04 --- /dev/null +++ b/tests/codegen/drop-in-place-noalias.rs @@ -0,0 +1,38 @@ +// compile-flags: -O -C no-prepopulate-passes + +// Tests that the compiler can apply `noalias` and other &mut attributes to `drop_in_place`. +// Note that non-Unpin types should not get `noalias`, matching &mut behavior. + +#![crate_type="lib"] + +use std::marker::PhantomPinned; + +// CHECK: define internal void @{{.*}}core{{.*}}ptr{{.*}}drop_in_place{{.*}}StructUnpin{{.*}}({{.*\*|ptr}} noalias noundef align 4 dereferenceable(12) %{{.+}}) + +// CHECK: define internal void @{{.*}}core{{.*}}ptr{{.*}}drop_in_place{{.*}}StructNotUnpin{{.*}}({{.*\*|ptr}} noundef nonnull align 4 %{{.+}}) + +pub struct StructUnpin { + a: i32, + b: i32, + c: i32, +} + +impl Drop for StructUnpin { + fn drop(&mut self) {} +} + +pub struct StructNotUnpin { + a: i32, + b: i32, + c: i32, + p: PhantomPinned, +} + +impl Drop for StructNotUnpin { + fn drop(&mut self) {} +} + +pub unsafe fn main(x: StructUnpin, y: StructNotUnpin) { + drop(x); + drop(y); +} diff --git a/tests/codegen/enable-lto-unit-splitting.rs b/tests/codegen/enable-lto-unit-splitting.rs new file mode 100644 index 000000000..7daa05f69 --- /dev/null +++ b/tests/codegen/enable-lto-unit-splitting.rs @@ -0,0 +1,10 @@ +// Verifies that "EnableSplitLTOUnit" module flag is added. +// +// compile-flags: -Clto -Ctarget-feature=-crt-static -Zsplit-lto-unit + +#![crate_type="lib"] + +pub fn foo() { +} + +// CHECK: !{{[0-9]+}} = !{i32 4, !"EnableSplitLTOUnit", i32 1} diff --git a/tests/codegen/fewer-names.rs b/tests/codegen/fewer-names.rs index 7f383a5c1..a09c79592 100644 --- a/tests/codegen/fewer-names.rs +++ b/tests/codegen/fewer-names.rs @@ -7,14 +7,14 @@ #[no_mangle] pub fn sum(x: u32, y: u32) -> u32 { -// YES-LABEL: define{{.*}}i32 @sum(i32 noundef %0, i32 noundef %1) -// YES-NEXT: %3 = add i32 %1, %0 -// YES-NEXT: ret i32 %3 + // YES-LABEL: define{{.*}}i32 @sum(i32 noundef %0, i32 noundef %1) + // YES-NEXT: %3 = add i32 %1, %0 + // YES-NEXT: ret i32 %3 -// NO-LABEL: define{{.*}}i32 @sum(i32 noundef %x, i32 noundef %y) -// NO-NEXT: start: -// NO-NEXT: %0 = add i32 %y, %x -// NO-NEXT: ret i32 %0 + // NO-LABEL: define{{.*}}i32 @sum(i32 noundef %x, i32 noundef %y) + // NO-NEXT: start: + // NO-NEXT: %0 = add i32 %y, %x + // NO-NEXT: ret i32 %0 let z = x + y; z } diff --git a/tests/codegen/global_asm.rs b/tests/codegen/global_asm.rs index 9912b1e75..41a99530a 100644 --- a/tests/codegen/global_asm.rs +++ b/tests/codegen/global_asm.rs @@ -18,6 +18,7 @@ // ignore-wasm32 // ignore-wasm64 // ignore-emscripten +// ignore-loongarch64 // compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/global_asm_include.rs b/tests/codegen/global_asm_include.rs index b68c5ad3b..e25c164f4 100644 --- a/tests/codegen/global_asm_include.rs +++ b/tests/codegen/global_asm_include.rs @@ -18,6 +18,7 @@ // ignore-wasm32 // ignore-wasm64 // ignore-emscripten +// ignore-loongarch64 // compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/global_asm_x2.rs b/tests/codegen/global_asm_x2.rs index d87e02bef..71ecef124 100644 --- a/tests/codegen/global_asm_x2.rs +++ b/tests/codegen/global_asm_x2.rs @@ -18,6 +18,7 @@ // ignore-wasm32 // ignore-wasm64 // ignore-emscripten +// ignore-loongarch64 // compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen/inline-hint.rs b/tests/codegen/inline-hint.rs index d3ea1915a..bb2a8e6a6 100644 --- a/tests/codegen/inline-hint.rs +++ b/tests/codegen/inline-hint.rs @@ -1,7 +1,7 @@ // Checks that closures, constructors, and shims except // for a drop glue receive inline hint by default. // -// compile-flags: -Cno-prepopulate-passes -Csymbol-mangling-version=v0 +// compile-flags: -Cno-prepopulate-passes -Csymbol-mangling-version=v0 -Zinline-mir=no #![crate_type = "lib"] pub fn f() { diff --git a/tests/codegen/intrinsics/offset.rs b/tests/codegen/intrinsics/offset.rs new file mode 100644 index 000000000..7fc4f4498 --- /dev/null +++ b/tests/codegen/intrinsics/offset.rs @@ -0,0 +1,34 @@ +// compile-flags: -O -C no-prepopulate-passes +// min-llvm-version: 15.0 (because we're using opaque pointers) + +#![crate_type = "lib"] +#![feature(core_intrinsics)] + +use std::intrinsics::offset; + +// CHECK-LABEL: ptr @offset_zst +// CHECK-SAME: (ptr noundef %p, [[SIZE:i[0-9]+]] noundef %d) +#[no_mangle] +pub unsafe fn offset_zst(p: *const (), d: usize) -> *const () { + // CHECK-NOT: getelementptr + // CHECK: ret ptr %p + offset(p, d) +} + +// CHECK-LABEL: ptr @offset_isize +// CHECK-SAME: (ptr noundef %p, [[SIZE]] noundef %d) +#[no_mangle] +pub unsafe fn offset_isize(p: *const u32, d: isize) -> *const u32 { + // CHECK: %[[R:.*]] = getelementptr inbounds i32, ptr %p, [[SIZE]] %d + // CHECK-NEXT: ret ptr %[[R]] + offset(p, d) +} + +// CHECK-LABEL: ptr @offset_usize +// CHECK-SAME: (ptr noundef %p, [[SIZE]] noundef %d) +#[no_mangle] +pub unsafe fn offset_usize(p: *const u64, d: usize) -> *const u64 { + // CHECK: %[[R:.*]] = getelementptr inbounds i64, ptr %p, [[SIZE]] %d + // CHECK-NEXT: ret ptr %[[R]] + offset(p, d) +} diff --git a/tests/codegen/intrinsics/transmute-niched.rs b/tests/codegen/intrinsics/transmute-niched.rs new file mode 100644 index 000000000..69e9b1d12 --- /dev/null +++ b/tests/codegen/intrinsics/transmute-niched.rs @@ -0,0 +1,184 @@ +// revisions: OPT DBG +// [OPT] compile-flags: -C opt-level=3 -C no-prepopulate-passes +// [DBG] compile-flags: -C opt-level=0 -C no-prepopulate-passes +// only-64bit (so I don't need to worry about usize) +// min-llvm-version: 15.0 # this test assumes `ptr`s + +#![crate_type = "lib"] + +use std::mem::transmute; +use std::num::NonZeroU32; + +#[repr(u8)] +pub enum SmallEnum { + A = 10, + B = 11, + C = 12, +} + +// CHECK-LABEL: @check_to_enum( +#[no_mangle] +pub unsafe fn check_to_enum(x: i8) -> SmallEnum { + // OPT: %0 = icmp uge i8 %x, 10 + // OPT: call void @llvm.assume(i1 %0) + // OPT: %1 = icmp ule i8 %x, 12 + // OPT: call void @llvm.assume(i1 %1) + // DBG-NOT: icmp + // DBG-NOT: assume + // CHECK: ret i8 %x + + transmute(x) +} + +// CHECK-LABEL: @check_from_enum( +#[no_mangle] +pub unsafe fn check_from_enum(x: SmallEnum) -> i8 { + // OPT: %0 = icmp uge i8 %x, 10 + // OPT: call void @llvm.assume(i1 %0) + // OPT: %1 = icmp ule i8 %x, 12 + // OPT: call void @llvm.assume(i1 %1) + // DBG-NOT: icmp + // DBG-NOT: assume + // CHECK: ret i8 %x + + transmute(x) +} + +// CHECK-LABEL: @check_to_ordering( +#[no_mangle] +pub unsafe fn check_to_ordering(x: u8) -> std::cmp::Ordering { + // OPT: %0 = icmp uge i8 %x, -1 + // OPT: %1 = icmp ule i8 %x, 1 + // OPT: %2 = or i1 %0, %1 + // OPT: call void @llvm.assume(i1 %2) + // DBG-NOT: icmp + // DBG-NOT: assume + // CHECK: ret i8 %x + + transmute(x) +} + +// CHECK-LABEL: @check_from_ordering( +#[no_mangle] +pub unsafe fn check_from_ordering(x: std::cmp::Ordering) -> u8 { + // OPT: %0 = icmp uge i8 %x, -1 + // OPT: %1 = icmp ule i8 %x, 1 + // OPT: %2 = or i1 %0, %1 + // OPT: call void @llvm.assume(i1 %2) + // DBG-NOT: icmp + // DBG-NOT: assume + // CHECK: ret i8 %x + + transmute(x) +} + +#[repr(i32)] +pub enum Minus100ToPlus100 { + A = -100, + B = -90, + C = -80, + D = -70, + E = -60, + F = -50, + G = -40, + H = -30, + I = -20, + J = -10, + K = 0, + L = 10, + M = 20, + N = 30, + O = 40, + P = 50, + Q = 60, + R = 70, + S = 80, + T = 90, + U = 100, +} + +// CHECK-LABEL: @check_enum_from_char( +#[no_mangle] +pub unsafe fn check_enum_from_char(x: char) -> Minus100ToPlus100 { + // OPT: %0 = icmp ule i32 %x, 1114111 + // OPT: call void @llvm.assume(i1 %0) + // OPT: %1 = icmp uge i32 %x, -100 + // OPT: %2 = icmp ule i32 %x, 100 + // OPT: %3 = or i1 %1, %2 + // OPT: call void @llvm.assume(i1 %3) + // DBG-NOT: icmp + // DBG-NOT: assume + // CHECK: ret i32 %x + + transmute(x) +} + +// CHECK-LABEL: @check_enum_to_char( +#[no_mangle] +pub unsafe fn check_enum_to_char(x: Minus100ToPlus100) -> char { + // OPT: %0 = icmp uge i32 %x, -100 + // OPT: %1 = icmp ule i32 %x, 100 + // OPT: %2 = or i1 %0, %1 + // OPT: call void @llvm.assume(i1 %2) + // OPT: %3 = icmp ule i32 %x, 1114111 + // OPT: call void @llvm.assume(i1 %3) + // DBG-NOT: icmp + // DBG-NOT: assume + // CHECK: ret i32 %x + + transmute(x) +} + +// CHECK-LABEL: @check_swap_pair( +#[no_mangle] +pub unsafe fn check_swap_pair(x: (char, NonZeroU32)) -> (NonZeroU32, char) { + // OPT: %0 = icmp ule i32 %x.0, 1114111 + // OPT: call void @llvm.assume(i1 %0) + // OPT: %1 = icmp uge i32 %x.0, 1 + // OPT: call void @llvm.assume(i1 %1) + // OPT: %2 = icmp uge i32 %x.1, 1 + // OPT: call void @llvm.assume(i1 %2) + // OPT: %3 = icmp ule i32 %x.1, 1114111 + // OPT: call void @llvm.assume(i1 %3) + // DBG-NOT: icmp + // DBG-NOT: assume + // CHECK: %[[P1:.+]] = insertvalue { i32, i32 } poison, i32 %x.0, 0 + // CHECK: %[[P2:.+]] = insertvalue { i32, i32 } %[[P1]], i32 %x.1, 1 + // CHECK: ret { i32, i32 } %[[P2]] + + transmute(x) +} + +// CHECK-LABEL: @check_bool_from_ordering( +#[no_mangle] +pub unsafe fn check_bool_from_ordering(x: std::cmp::Ordering) -> bool { + // OPT: %0 = icmp uge i8 %x, -1 + // OPT: %1 = icmp ule i8 %x, 1 + // OPT: %2 = or i1 %0, %1 + // OPT: call void @llvm.assume(i1 %2) + // OPT: %3 = icmp ule i8 %x, 1 + // OPT: call void @llvm.assume(i1 %3) + // DBG-NOT: icmp + // DBG-NOT: assume + // CHECK: %[[R:.+]] = trunc i8 %x to i1 + // CHECK: ret i1 %[[R]] + + transmute(x) +} + +// CHECK-LABEL: @check_bool_to_ordering( +#[no_mangle] +pub unsafe fn check_bool_to_ordering(x: bool) -> std::cmp::Ordering { + // CHECK: %0 = zext i1 %x to i8 + // OPT: %1 = icmp ule i8 %0, 1 + // OPT: call void @llvm.assume(i1 %1) + // OPT: %2 = icmp uge i8 %0, -1 + // OPT: %3 = icmp ule i8 %0, 1 + // OPT: %4 = or i1 %2, %3 + // OPT: call void @llvm.assume(i1 %4) + // DBG-NOT: icmp + // DBG-NOT: assume + // CHECK: ret i8 %0 + + transmute(x) +} diff --git a/tests/codegen/intrinsics/transmute.rs b/tests/codegen/intrinsics/transmute.rs index 57f901c67..664e697c2 100644 --- a/tests/codegen/intrinsics/transmute.rs +++ b/tests/codegen/intrinsics/transmute.rs @@ -8,10 +8,10 @@ #![feature(inline_const)] #![allow(unreachable_code)] -use std::mem::{transmute, MaybeUninit}; +use std::mem::MaybeUninit; +use std::intrinsics::{transmute, transmute_unchecked}; -// Some of the cases here are statically rejected by `mem::transmute`, so -// we need to generate custom MIR for those cases to get to codegen. +// Some of these need custom MIR to not get removed by MIR optimizations. use std::intrinsics::mir::*; enum Never {} @@ -30,59 +30,35 @@ pub struct Aggregate8(u8); // CHECK-LABEL: @check_bigger_size( #[no_mangle] -#[custom_mir(dialect = "runtime", phase = "initial")] pub unsafe fn check_bigger_size(x: u16) -> u32 { // CHECK: call void @llvm.trap - mir!{ - { - RET = CastTransmute(x); - Return() - } - } + transmute_unchecked(x) } // CHECK-LABEL: @check_smaller_size( #[no_mangle] -#[custom_mir(dialect = "runtime", phase = "initial")] pub unsafe fn check_smaller_size(x: u32) -> u16 { // CHECK: call void @llvm.trap - mir!{ - { - RET = CastTransmute(x); - Return() - } - } + transmute_unchecked(x) } // CHECK-LABEL: @check_smaller_array( #[no_mangle] -#[custom_mir(dialect = "runtime", phase = "initial")] pub unsafe fn check_smaller_array(x: [u32; 7]) -> [u32; 3] { // CHECK: call void @llvm.trap - mir!{ - { - RET = CastTransmute(x); - Return() - } - } + transmute_unchecked(x) } // CHECK-LABEL: @check_bigger_array( #[no_mangle] -#[custom_mir(dialect = "runtime", phase = "initial")] pub unsafe fn check_bigger_array(x: [u32; 3]) -> [u32; 7] { // CHECK: call void @llvm.trap - mir!{ - { - RET = CastTransmute(x); - Return() - } - } + transmute_unchecked(x) } // CHECK-LABEL: @check_to_uninhabited( #[no_mangle] -#[custom_mir(dialect = "runtime", phase = "initial")] +#[custom_mir(dialect = "runtime", phase = "optimized")] pub unsafe fn check_to_uninhabited(x: u16) -> BigNever { // CHECK: call void @llvm.trap mir!{ @@ -95,7 +71,7 @@ pub unsafe fn check_to_uninhabited(x: u16) -> BigNever { // CHECK-LABEL: @check_from_uninhabited( #[no_mangle] -#[custom_mir(dialect = "runtime", phase = "initial")] +#[custom_mir(dialect = "runtime", phase = "optimized")] pub unsafe fn check_from_uninhabited(x: BigNever) -> u16 { // CHECK: ret i16 poison mir!{ @@ -169,8 +145,8 @@ pub unsafe fn check_aggregate_from_bool(x: bool) -> Aggregate8 { #[no_mangle] pub unsafe fn check_byte_to_bool(x: u8) -> bool { // CHECK-NOT: alloca - // CHECK: %0 = trunc i8 %x to i1 - // CHECK: ret i1 %0 + // CHECK: %[[R:.+]] = trunc i8 %x to i1 + // CHECK: ret i1 %[[R]] transmute(x) } @@ -178,8 +154,8 @@ pub unsafe fn check_byte_to_bool(x: u8) -> bool { #[no_mangle] pub unsafe fn check_byte_from_bool(x: bool) -> u8 { // CHECK-NOT: alloca - // CHECK: %0 = zext i1 %x to i8 - // CHECK: ret i8 %0 + // CHECK: %[[R:.+]] = zext i1 %x to i8 + // CHECK: ret i8 %[[R:.+]] transmute(x) } diff --git a/tests/codegen/issues/issue-103840.rs b/tests/codegen/issues/issue-103840.rs index f19d7031b..da64692d2 100644 --- a/tests/codegen/issues/issue-103840.rs +++ b/tests/codegen/issues/issue-103840.rs @@ -1,4 +1,5 @@ // compile-flags: -O +// min-llvm-version: 16.0 #![crate_type = "lib"] pub fn foo(t: &mut Vec) { diff --git a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs index d54ac9e33..2ee4d7cca 100644 --- a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs +++ b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs @@ -19,4 +19,5 @@ pub fn outer_function(x: S, y: S) -> usize { // CHECK-NOT: [[ptr_tmp:%.*]] = getelementptr inbounds %"[closure@{{.*.rs}}:9:23: 9:25]", ptr [[spill]] // CHECK-NOT: [[load:%.*]] = load ptr, ptr // CHECK: call void @llvm.lifetime.start{{.*}}({{.*}}, ptr [[spill]]) -// CHECK: call void @llvm.memcpy{{.*}}(ptr {{align .*}} [[spill]], ptr {{align .*}} %x +// CHECK: [[inner:%.*]] = getelementptr inbounds %"{{.*}}", ptr [[spill]] +// CHECK: call void @llvm.memcpy{{.*}}(ptr {{align .*}} [[inner]], ptr {{align .*}} %x diff --git a/tests/codegen/issues/issue-111603.rs b/tests/codegen/issues/issue-111603.rs new file mode 100644 index 000000000..90b3c314d --- /dev/null +++ b/tests/codegen/issues/issue-111603.rs @@ -0,0 +1,28 @@ +// compile-flags: -O + +#![crate_type = "lib"] +#![feature(get_mut_unchecked, new_uninit)] + +use std::sync::Arc; + +// CHECK-LABEL: @new_uninit +#[no_mangle] +pub fn new_uninit(x: u64) -> Arc<[u64; 1000]> { + // CHECK: call alloc::sync::arcinner_layout_for_value_layout + // CHECK-NOT: call alloc::sync::arcinner_layout_for_value_layout + let mut arc = Arc::new_uninit(); + unsafe { Arc::get_mut_unchecked(&mut arc) }.write([x; 1000]); + unsafe { arc.assume_init() } +} + +// CHECK-LABEL: @new_uninit_slice +#[no_mangle] +pub fn new_uninit_slice(x: u64) -> Arc<[u64]> { + // CHECK: call alloc::sync::arcinner_layout_for_value_layout + // CHECK-NOT: call alloc::sync::arcinner_layout_for_value_layout + let mut arc = Arc::new_uninit_slice(1000); + for elem in unsafe { Arc::get_mut_unchecked(&mut arc) } { + elem.write(x); + } + unsafe { arc.assume_init() } +} diff --git a/tests/codegen/issues/issue-73396-bounds-check-after-position.rs b/tests/codegen/issues/issue-73396-bounds-check-after-position.rs index 8d07a67a1..2d7797887 100644 --- a/tests/codegen/issues/issue-73396-bounds-check-after-position.rs +++ b/tests/codegen/issues/issue-73396-bounds-check-after-position.rs @@ -9,7 +9,10 @@ #[no_mangle] pub fn position_slice_to_no_bounds_check(s: &[u8]) -> &[u8] { // CHECK-NOT: panic - // CHECK-NOT: slice_index_len_fail + // CHECK-NOT: slice_start_index_len_fail + // CHECK-NOT: slice_end_index_len_fail + // CHECK-NOT: panic_bounds_check + // CHECK-NOT: unreachable if let Some(idx) = s.iter().position(|b| *b == b'\\') { &s[..idx] } else { @@ -21,7 +24,10 @@ pub fn position_slice_to_no_bounds_check(s: &[u8]) -> &[u8] { #[no_mangle] pub fn position_slice_from_no_bounds_check(s: &[u8]) -> &[u8] { // CHECK-NOT: panic - // CHECK-NOT: slice_index_len_fail + // CHECK-NOT: slice_start_index_len_fail + // CHECK-NOT: slice_end_index_len_fail + // CHECK-NOT: panic_bounds_check + // CHECK-NOT: unreachable if let Some(idx) = s.iter().position(|b| *b == b'\\') { &s[idx..] } else { @@ -33,7 +39,10 @@ pub fn position_slice_from_no_bounds_check(s: &[u8]) -> &[u8] { #[no_mangle] pub fn position_index_no_bounds_check(s: &[u8]) -> u8 { // CHECK-NOT: panic - // CHECK-NOT: slice_index_len_fail + // CHECK-NOT: slice_start_index_len_fail + // CHECK-NOT: slice_end_index_len_fail + // CHECK-NOT: panic_bounds_check + // CHECK-NOT: unreachable if let Some(idx) = s.iter().position(|b| *b == b'\\') { s[idx] } else { @@ -44,7 +53,10 @@ pub fn position_index_no_bounds_check(s: &[u8]) -> u8 { #[no_mangle] pub fn rposition_slice_to_no_bounds_check(s: &[u8]) -> &[u8] { // CHECK-NOT: panic - // CHECK-NOT: slice_index_len_fail + // CHECK-NOT: slice_start_index_len_fail + // CHECK-NOT: slice_end_index_len_fail + // CHECK-NOT: panic_bounds_check + // CHECK-NOT: unreachable if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { &s[..idx] } else { @@ -56,7 +68,10 @@ pub fn rposition_slice_to_no_bounds_check(s: &[u8]) -> &[u8] { #[no_mangle] pub fn rposition_slice_from_no_bounds_check(s: &[u8]) -> &[u8] { // CHECK-NOT: panic - // CHECK-NOT: slice_index_len_fail + // CHECK-NOT: slice_start_index_len_fail + // CHECK-NOT: slice_end_index_len_fail + // CHECK-NOT: panic_bounds_check + // CHECK-NOT: unreachable if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { &s[idx..] } else { @@ -68,7 +83,10 @@ pub fn rposition_slice_from_no_bounds_check(s: &[u8]) -> &[u8] { #[no_mangle] pub fn rposition_index_no_bounds_check(s: &[u8]) -> u8 { // CHECK-NOT: panic - // CHECK-NOT: slice_index_len_fail + // CHECK-NOT: slice_start_index_len_fail + // CHECK-NOT: slice_end_index_len_fail + // CHECK-NOT: panic_bounds_check + // CHECK-NOT: unreachable if let Some(idx) = s.iter().rposition(|b| *b == b'\\') { s[idx] } else { diff --git a/tests/codegen/issues/issue-86106.rs b/tests/codegen/issues/issue-86106.rs index 9ccbcb24f..c0be7fab2 100644 --- a/tests/codegen/issues/issue-86106.rs +++ b/tests/codegen/issues/issue-86106.rs @@ -1,4 +1,5 @@ // min-llvm-version: 15.0 +// only-64bit llvm appears to use stores instead of memset on 32bit // compile-flags: -C opt-level=3 -Z merge-functions=disabled // The below two functions ensure that both `String::new()` and `"".to_string()` @@ -9,12 +10,9 @@ // CHECK-LABEL: define void @string_new #[no_mangle] pub fn string_new() -> String { - // CHECK-NOT: load i8 - // CHECK: store i{{32|64}} + // CHECK: store ptr inttoptr // CHECK-NEXT: getelementptr - // CHECK-NEXT: store ptr - // CHECK-NEXT: getelementptr - // CHECK-NEXT: store i{{32|64}} + // CHECK-NEXT: call void @llvm.memset // CHECK-NEXT: ret void String::new() } @@ -22,12 +20,9 @@ pub fn string_new() -> String { // CHECK-LABEL: define void @empty_to_string #[no_mangle] pub fn empty_to_string() -> String { - // CHECK-NOT: load i8 - // CHECK: store i{{32|64}} - // CHECK-NEXT: getelementptr - // CHECK-NEXT: store ptr + // CHECK: store ptr inttoptr // CHECK-NEXT: getelementptr - // CHECK-NEXT: store i{{32|64}} + // CHECK-NEXT: call void @llvm.memset // CHECK-NEXT: ret void "".to_string() } @@ -38,12 +33,9 @@ pub fn empty_to_string() -> String { // CHECK-LABEL: @empty_vec #[no_mangle] pub fn empty_vec() -> Vec { - // CHECK: store i{{32|64}} - // CHECK-NOT: load i8 + // CHECK: store ptr inttoptr // CHECK-NEXT: getelementptr - // CHECK-NEXT: store ptr - // CHECK-NEXT: getelementptr - // CHECK-NEXT: store i{{32|64}} + // CHECK-NEXT: call void @llvm.memset // CHECK-NEXT: ret void vec![] } @@ -51,12 +43,9 @@ pub fn empty_vec() -> Vec { // CHECK-LABEL: @empty_vec_clone #[no_mangle] pub fn empty_vec_clone() -> Vec { - // CHECK: store i{{32|64}} - // CHECK-NOT: load i8 - // CHECK-NEXT: getelementptr - // CHECK-NEXT: store ptr + // CHECK: store ptr inttoptr // CHECK-NEXT: getelementptr - // CHECK-NEXT: store i{{32|64}} + // CHECK-NEXT: call void @llvm.memset // CHECK-NEXT: ret void vec![].clone() } diff --git a/tests/codegen/local-generics-in-exe-internalized.rs b/tests/codegen/local-generics-in-exe-internalized.rs index e5430fbf1..449c5ca75 100644 --- a/tests/codegen/local-generics-in-exe-internalized.rs +++ b/tests/codegen/local-generics-in-exe-internalized.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes -Zshare-generics=yes +// compile-flags: -C no-prepopulate-passes -Zshare-generics=yes -Zinline-mir=no // Check that local generics are internalized if they are in the same CGU diff --git a/tests/codegen/loongarch-abi/call-llvm-intrinsics.rs b/tests/codegen/loongarch-abi/call-llvm-intrinsics.rs new file mode 100644 index 000000000..4b78f6e24 --- /dev/null +++ b/tests/codegen/loongarch-abi/call-llvm-intrinsics.rs @@ -0,0 +1,31 @@ +// compile-flags: -C no-prepopulate-passes + +// only-loongarch64 + +#![feature(link_llvm_intrinsics)] +#![crate_type = "lib"] + +struct A; + +impl Drop for A { + fn drop(&mut self) { + println!("A"); + } +} + +extern "C" { + #[link_name = "llvm.sqrt.f32"] + fn sqrt(x: f32) -> f32; +} + +pub fn do_call() { + let _a = A; + + unsafe { + // Ensure that we `call` LLVM intrinsics instead of trying to `invoke` them + // CHECK: store float 4.000000e+00, ptr %{{.}}, align 4 + // CHECK: load float, ptr %{{.}}, align 4 + // CHECK: call float @llvm.sqrt.f32(float %{{.}} + sqrt(4.0); + } +} diff --git a/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs b/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs new file mode 100644 index 000000000..7555553c2 --- /dev/null +++ b/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs @@ -0,0 +1,293 @@ +// compile-flags: -C no-prepopulate-passes +// only-loongarch64 +// only-linux + +#![crate_type = "lib"] + +// CHECK: define void @f_fpr_tracking(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, i8 noundef zeroext %i) +#[no_mangle] +pub extern "C" fn f_fpr_tracking( + a: f64, + b: f64, + c: f64, + d: f64, + e: f64, + f: f64, + g: f64, + h: f64, + i: u8, +) { +} + +#[repr(C)] +pub struct Double { + f: f64, +} + +#[repr(C)] +pub struct DoubleDouble { + f: f64, + g: f64, +} + +#[repr(C)] +pub struct DoubleFloat { + f: f64, + g: f32, +} + +// CHECK: define void @f_double_s_arg(double %0) +#[no_mangle] +pub extern "C" fn f_double_s_arg(a: Double) {} + +// CHECK: define double @f_ret_double_s() +#[no_mangle] +pub extern "C" fn f_ret_double_s() -> Double { + Double { f: 1. } +} + +// CHECK: define void @f_double_double_s_arg({ double, double } %0) +#[no_mangle] +pub extern "C" fn f_double_double_s_arg(a: DoubleDouble) {} + +// CHECK: define { double, double } @f_ret_double_double_s() +#[no_mangle] +pub extern "C" fn f_ret_double_double_s() -> DoubleDouble { + DoubleDouble { f: 1., g: 2. } +} + +// CHECK: define void @f_double_float_s_arg({ double, float } %0) +#[no_mangle] +pub extern "C" fn f_double_float_s_arg(a: DoubleFloat) {} + +// CHECK: define { double, float } @f_ret_double_float_s() +#[no_mangle] +pub extern "C" fn f_ret_double_float_s() -> DoubleFloat { + DoubleFloat { f: 1., g: 2. } +} + +// CHECK: define void @f_double_double_s_arg_insufficient_fprs(double %0, double %1, double %2, double %3, double %4, double %5, double %6, [2 x i64] %7) +#[no_mangle] +pub extern "C" fn f_double_double_s_arg_insufficient_fprs( + a: f64, + b: f64, + c: f64, + d: f64, + e: f64, + f: f64, + g: f64, + h: DoubleDouble, +) { +} + +#[repr(C)] +pub struct DoubleInt8 { + f: f64, + i: i8, +} + +#[repr(C)] +pub struct DoubleUInt8 { + f: f64, + i: u8, +} + +#[repr(C)] +pub struct DoubleInt32 { + f: f64, + i: i32, +} + +#[repr(C)] +pub struct DoubleInt64 { + f: f64, + i: i64, +} + +// CHECK: define void @f_double_int8_s_arg({ double, i8 } %0) +#[no_mangle] +pub extern "C" fn f_double_int8_s_arg(a: DoubleInt8) {} + +// CHECK: define { double, i8 } @f_ret_double_int8_s() +#[no_mangle] +pub extern "C" fn f_ret_double_int8_s() -> DoubleInt8 { + DoubleInt8 { f: 1., i: 2 } +} + +// CHECK: define void @f_double_int32_s_arg({ double, i32 } %0) +#[no_mangle] +pub extern "C" fn f_double_int32_s_arg(a: DoubleInt32) {} + +// CHECK: define { double, i32 } @f_ret_double_int32_s() +#[no_mangle] +pub extern "C" fn f_ret_double_int32_s() -> DoubleInt32 { + DoubleInt32 { f: 1., i: 2 } +} + +// CHECK: define void @f_double_uint8_s_arg({ double, i8 } %0) +#[no_mangle] +pub extern "C" fn f_double_uint8_s_arg(a: DoubleUInt8) {} + +// CHECK: define { double, i8 } @f_ret_double_uint8_s() +#[no_mangle] +pub extern "C" fn f_ret_double_uint8_s() -> DoubleUInt8 { + DoubleUInt8 { f: 1., i: 2 } +} + +// CHECK: define void @f_double_int64_s_arg({ double, i64 } %0) +#[no_mangle] +pub extern "C" fn f_double_int64_s_arg(a: DoubleInt64) {} + +// CHECK: define { double, i64 } @f_ret_double_int64_s() +#[no_mangle] +pub extern "C" fn f_ret_double_int64_s() -> DoubleInt64 { + DoubleInt64 { f: 1., i: 2 } +} + +// CHECK: define void @f_double_int8_s_arg_insufficient_gprs(i32 noundef signext %a, i32 noundef signext %b, i32 noundef signext %c, i32 noundef signext %d, i32 noundef signext %e, i32 noundef signext %f, i32 noundef signext %g, i32 noundef signext %h, [2 x i64] %0) +#[no_mangle] +pub extern "C" fn f_double_int8_s_arg_insufficient_gprs( + a: i32, + b: i32, + c: i32, + d: i32, + e: i32, + f: i32, + g: i32, + h: i32, + i: DoubleInt8, +) { +} + +// CHECK: define void @f_struct_double_int8_insufficient_fprs(float %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, [2 x i64] %8) +#[no_mangle] +pub extern "C" fn f_struct_double_int8_insufficient_fprs( + a: f32, + b: f64, + c: f64, + d: f64, + e: f64, + f: f64, + g: f64, + h: f64, + i: DoubleInt8, +) { +} + +#[repr(C)] +pub struct DoubleArr1 { + a: [f64; 1], +} + +// CHECK: define void @f_doublearr1_s_arg(double %0) +#[no_mangle] +pub extern "C" fn f_doublearr1_s_arg(a: DoubleArr1) {} + +// CHECK: define double @f_ret_doublearr1_s() +#[no_mangle] +pub extern "C" fn f_ret_doublearr1_s() -> DoubleArr1 { + DoubleArr1 { a: [1.] } +} + +#[repr(C)] +pub struct DoubleArr2 { + a: [f64; 2], +} + +// CHECK: define void @f_doublearr2_s_arg({ double, double } %0) +#[no_mangle] +pub extern "C" fn f_doublearr2_s_arg(a: DoubleArr2) {} + +// CHECK: define { double, double } @f_ret_doublearr2_s() +#[no_mangle] +pub extern "C" fn f_ret_doublearr2_s() -> DoubleArr2 { + DoubleArr2 { a: [1., 2.] } +} + +#[repr(C)] +pub struct Tricky1 { + f: [f64; 1], +} + +#[repr(C)] +pub struct DoubleArr2Tricky1 { + g: [Tricky1; 2], +} + +// CHECK: define void @f_doublearr2_tricky1_s_arg({ double, double } %0) +#[no_mangle] +pub extern "C" fn f_doublearr2_tricky1_s_arg(a: DoubleArr2Tricky1) {} + +// CHECK: define { double, double } @f_ret_doublearr2_tricky1_s() +#[no_mangle] +pub extern "C" fn f_ret_doublearr2_tricky1_s() -> DoubleArr2Tricky1 { + DoubleArr2Tricky1 { g: [Tricky1 { f: [1.] }, Tricky1 { f: [2.] }] } +} + +#[repr(C)] +pub struct EmptyStruct {} + +#[repr(C)] +pub struct DoubleArr2Tricky2 { + s: EmptyStruct, + g: [Tricky1; 2], +} + +// CHECK: define void @f_doublearr2_tricky2_s_arg({ double, double } %0) +#[no_mangle] +pub extern "C" fn f_doublearr2_tricky2_s_arg(a: DoubleArr2Tricky2) {} + +// CHECK: define { double, double } @f_ret_doublearr2_tricky2_s() +#[no_mangle] +pub extern "C" fn f_ret_doublearr2_tricky2_s() -> DoubleArr2Tricky2 { + DoubleArr2Tricky2 { s: EmptyStruct {}, g: [Tricky1 { f: [1.] }, Tricky1 { f: [2.] }] } +} + +#[repr(C)] +pub struct IntDoubleInt { + a: i32, + b: f64, + c: i32, +} + +// CHECK: define void @f_int_double_int_s_arg(ptr noalias nocapture noundef dereferenceable(24) %a) +#[no_mangle] +pub extern "C" fn f_int_double_int_s_arg(a: IntDoubleInt) {} + +// CHECK: define void @f_ret_int_double_int_s(ptr noalias nocapture noundef sret(%IntDoubleInt) dereferenceable(24) %0) +#[no_mangle] +pub extern "C" fn f_ret_int_double_int_s() -> IntDoubleInt { + IntDoubleInt { a: 1, b: 2., c: 3 } +} + +#[repr(C)] +pub struct CharCharDouble { + a: u8, + b: u8, + c: f64, +} + +// CHECK: define void @f_char_char_double_s_arg([2 x i64] %0) +#[no_mangle] +pub extern "C" fn f_char_char_double_s_arg(a: CharCharDouble) {} + +// CHECK: define [2 x i64] @f_ret_char_char_double_s() +#[no_mangle] +pub extern "C" fn f_ret_char_char_double_s() -> CharCharDouble { + CharCharDouble { a: 1, b: 2, c: 3. } +} + +#[repr(C)] +pub union DoubleU { + a: f64, +} + +// CHECK: define void @f_double_u_arg(i64 %0) +#[no_mangle] +pub extern "C" fn f_double_u_arg(a: DoubleU) {} + +// CHECK: define i64 @f_ret_double_u() +#[no_mangle] +pub extern "C" fn f_ret_double_u() -> DoubleU { + unsafe { DoubleU { a: 1. } } +} diff --git a/tests/codegen/mem-replace-big-type.rs b/tests/codegen/mem-replace-big-type.rs index f6898e2f7..c6b920cf5 100644 --- a/tests/codegen/mem-replace-big-type.rs +++ b/tests/codegen/mem-replace-big-type.rs @@ -11,7 +11,9 @@ #[repr(C, align(8))] pub struct Big([u64; 7]); pub fn replace_big(dst: &mut Big, src: Big) -> Big { - // Before the `read_via_copy` intrinsic, this emitted six `memcpy`s. + // Back in 1.68, this emitted six `memcpy`s. + // `read_via_copy` in 1.69 got that down to three. + // `write_via_move` and nvro get this down to the essential two. std::mem::replace(dst, src) } @@ -22,15 +24,10 @@ pub fn replace_big(dst: &mut Big, src: Big) -> Big { // For a large type, we expect exactly three `memcpy`s // CHECK-LABEL: define internal void @{{.+}}mem{{.+}}replace{{.+}}sret(%Big) - // CHECK-NOT: alloca - // CHECK: alloca %Big - // CHECK-NOT: alloca - // CHECK-NOT: call void @llvm.memcpy - // CHECK: call void @llvm.memcpy.{{.+}}({{i8\*|ptr}} align 8 %{{.*}}, {{i8\*|ptr}} align 8 %{{.*}}, i{{.*}} 56, i1 false) - // CHECK-NOT: call void @llvm.memcpy - // CHECK: call void @llvm.memcpy.{{.+}}({{i8\*|ptr}} align 8 %{{.*}}, {{i8\*|ptr}} align 8 %{{.*}}, i{{.*}} 56, i1 false) - // CHECK-NOT: call void @llvm.memcpy - // CHECK: call void @llvm.memcpy.{{.+}}({{i8\*|ptr}} align 8 %{{.*}}, {{i8\*|ptr}} align 8 %{{.*}}, i{{.*}} 56, i1 false) - // CHECK-NOT: call void @llvm.memcpy +// CHECK-NOT: call void @llvm.memcpy +// CHECK: call void @llvm.memcpy.{{.+}}({{i8\*|ptr}} align 8 %0, {{i8\*|ptr}} align 8 %dest, i{{.*}} 56, i1 false) +// CHECK-NOT: call void @llvm.memcpy +// CHECK: call void @llvm.memcpy.{{.+}}({{i8\*|ptr}} align 8 %dest, {{i8\*|ptr}} align 8 %src, i{{.*}} 56, i1 false) +// CHECK-NOT: call void @llvm.memcpy // CHECK-NOT: call void @llvm.memcpy diff --git a/tests/codegen/mem-replace-direct-memcpy.rs b/tests/codegen/mem-replace-direct-memcpy.rs deleted file mode 100644 index 83babab4f..000000000 --- a/tests/codegen/mem-replace-direct-memcpy.rs +++ /dev/null @@ -1,33 +0,0 @@ -// This test ensures that `mem::replace::` only ever calls `@llvm.memcpy` -// with `size_of::()` as the size, and never goes through any wrapper that -// may e.g. multiply `size_of::()` with a variable "count" (which is only -// known to be `1` after inlining). - -// compile-flags: -C no-prepopulate-passes -Zinline-mir=no -// ignore-debug: the debug assertions get in the way - -#![crate_type = "lib"] - -pub fn replace_byte(dst: &mut u8, src: u8) -> u8 { - std::mem::replace(dst, src) -} - -// NOTE(eddyb) the `CHECK-NOT`s ensure that the only calls of `@llvm.memcpy` in -// the entire output, are the direct calls we want, from `ptr::replace`. - -// CHECK-NOT: call void @llvm.memcpy - -// For a small type, we expect one each of `load`/`store`/`memcpy` instead -// CHECK-LABEL: define internal noundef i8 @{{.+}}mem{{.+}}replace - // CHECK-NOT: alloca - // CHECK: alloca i8 - // CHECK-NOT: alloca - // CHECK-NOT: call void @llvm.memcpy - // CHECK: load i8 - // CHECK-NOT: call void @llvm.memcpy - // CHECK: store i8 - // CHECK-NOT: call void @llvm.memcpy - // CHECK: call void @llvm.memcpy.{{.+}}({{i8\*|ptr}} align 1 %{{.*}}, {{i8\*|ptr}} align 1 %{{.*}}, i{{.*}} 1, i1 false) - // CHECK-NOT: call void @llvm.memcpy - -// CHECK-NOT: call void @llvm.memcpy diff --git a/tests/codegen/mem-replace-simple-type.rs b/tests/codegen/mem-replace-simple-type.rs new file mode 100644 index 000000000..4253ef136 --- /dev/null +++ b/tests/codegen/mem-replace-simple-type.rs @@ -0,0 +1,34 @@ +// compile-flags: -O -C no-prepopulate-passes +// min-llvm-version: 15.0 (for opaque pointers) +// only-x86_64 (to not worry about usize differing) +// ignore-debug (the debug assertions get in the way) + +#![crate_type = "lib"] + +#[no_mangle] +// CHECK-LABEL: @replace_usize( +pub fn replace_usize(r: &mut usize, v: usize) -> usize { + // CHECK-NOT: alloca + // CHECK: %[[R:.+]] = load i64, ptr %r + // CHECK: store i64 %v, ptr %r + // CHECK: ret i64 %[[R]] + std::mem::replace(r, v) +} + +#[no_mangle] +// CHECK-LABEL: @replace_ref_str( +pub fn replace_ref_str<'a>(r: &mut &'a str, v: &'a str) -> &'a str { + // CHECK-NOT: alloca + // CHECK: %[[A:.+]] = load ptr + // CHECK: %[[B:.+]] = load i64 + // CHECK-NOT: store + // CHECK-NOT: load + // CHECK: store ptr + // CHECK: store i64 + // CHECK-NOT: load + // CHECK-NOT: store + // CHECK: %[[P1:.+]] = insertvalue { ptr, i64 } poison, ptr %[[A]], 0 + // CHECK: %[[P2:.+]] = insertvalue { ptr, i64 } %[[P1]], i64 %[[B]], 1 + // CHECK: ret { ptr, i64 } %[[P2]] + std::mem::replace(r, v) +} diff --git a/tests/codegen/noalias-box-off.rs b/tests/codegen/noalias-box-off.rs index afd17c7c1..c82c53b2a 100644 --- a/tests/codegen/noalias-box-off.rs +++ b/tests/codegen/noalias-box-off.rs @@ -4,5 +4,8 @@ // CHECK-LABEL: @box_should_not_have_noalias_if_disabled( // CHECK-NOT: noalias +// CHECK-SAME: %foo) #[no_mangle] -pub fn box_should_not_have_noalias_if_disabled(_b: Box) {} +pub fn box_should_not_have_noalias_if_disabled(foo: Box) { + drop(foo); +} diff --git a/tests/codegen/nrvo.rs b/tests/codegen/nrvo.rs index fddb0d1fb..b2ae99f37 100644 --- a/tests/codegen/nrvo.rs +++ b/tests/codegen/nrvo.rs @@ -8,7 +8,7 @@ pub fn nrvo(init: fn(&mut [u8; 4096])) -> [u8; 4096] { // CHECK-LABEL: nrvo // CHECK: @llvm.memset - // CHECK-NOT: @llvm.memcpy + // FIXME: turn on nrvo then check-not: @llvm.memcpy // CHECK: ret // CHECK-EMPTY let mut buf = [0; 4096]; diff --git a/tests/codegen/optimize-attr-1.rs b/tests/codegen/optimize-attr-1.rs index 1d1f0a386..d95ba8530 100644 --- a/tests/codegen/optimize-attr-1.rs +++ b/tests/codegen/optimize-attr-1.rs @@ -9,7 +9,7 @@ // CHECK-LABEL: define{{.*}}i32 @nothing // CHECK-SAME: [[NOTHING_ATTRS:#[0-9]+]] // SIZE-OPT: ret i32 4 -// SPEEC-OPT: ret i32 4 +// SPEED-OPT: ret i32 4 #[no_mangle] pub fn nothing() -> i32 { 2 + 2 diff --git a/tests/codegen/option-as-slice.rs b/tests/codegen/option-as-slice.rs index d735d5583..1edd9ba9f 100644 --- a/tests/codegen/option-as-slice.rs +++ b/tests/codegen/option-as-slice.rs @@ -1,5 +1,7 @@ // compile-flags: -O -Z randomize-layout=no // only-x86_64 +// ignore-llvm-version: 16.0.0 +// ^ needs https://reviews.llvm.org/D146149 in 16.0.1 #![crate_type = "lib"] #![feature(option_as_slice)] diff --git a/tests/codegen/option-nonzero-eq.rs b/tests/codegen/option-nonzero-eq.rs index 835decd3e..a394695f3 100644 --- a/tests/codegen/option-nonzero-eq.rs +++ b/tests/codegen/option-nonzero-eq.rs @@ -7,6 +7,9 @@ use core::cmp::Ordering; use core::num::{NonZeroU32, NonZeroI64}; use core::ptr::NonNull; +// See also tests/assembly/option-nonzero-eq.rs, for cases with `assume`s in the +// LLVM and thus don't optimize down clearly here, but do in assembly. + // CHECK-lABEL: @non_zero_eq #[no_mangle] pub fn non_zero_eq(l: Option, r: Option) -> bool { @@ -33,12 +36,3 @@ pub fn non_null_eq(l: Option>, r: Option>) -> bool { // CHECK-NEXT: ret i1 l == r } - -// CHECK-lABEL: @ordering_eq -#[no_mangle] -pub fn ordering_eq(l: Option, r: Option) -> bool { - // CHECK: start: - // CHECK-NEXT: icmp eq i8 - // CHECK-NEXT: ret i1 - l == r -} diff --git a/tests/codegen/remap_path_prefix/auxiliary/xcrate-generic.rs b/tests/codegen/remap_path_prefix/auxiliary/xcrate-generic.rs index 59092dbf6..15bd0f174 100644 --- a/tests/codegen/remap_path_prefix/auxiliary/xcrate-generic.rs +++ b/tests/codegen/remap_path_prefix/auxiliary/xcrate-generic.rs @@ -3,4 +3,6 @@ #![crate_type = "lib"] -pub fn foo() {} +pub fn foo() -> T { + T::default() +} diff --git a/tests/codegen/remap_path_prefix/xcrate-generic.rs b/tests/codegen/remap_path_prefix/xcrate-generic.rs index 7a9d2ca9b..399deec1f 100644 --- a/tests/codegen/remap_path_prefix/xcrate-generic.rs +++ b/tests/codegen/remap_path_prefix/xcrate-generic.rs @@ -7,7 +7,7 @@ extern crate xcrate_generic; pub fn foo() { - xcrate_generic::foo::(); + println!("{}", xcrate_generic::foo::()); } // Here we check that local debuginfo is mapped correctly. diff --git a/tests/codegen/repr-transparent-aggregates-1.rs b/tests/codegen/repr-transparent-aggregates-1.rs index f733de12b..9c4b0e58e 100644 --- a/tests/codegen/repr-transparent-aggregates-1.rs +++ b/tests/codegen/repr-transparent-aggregates-1.rs @@ -10,6 +10,7 @@ // ignore-riscv64 see codegen/riscv-abi // ignore-s390x // ignore-windows +// ignore-loongarch64 // See repr-transparent.rs #![feature(transparent_unions)] diff --git a/tests/codegen/repr-transparent-aggregates-2.rs b/tests/codegen/repr-transparent-aggregates-2.rs index e9fa5143b..a7bde2d05 100644 --- a/tests/codegen/repr-transparent-aggregates-2.rs +++ b/tests/codegen/repr-transparent-aggregates-2.rs @@ -12,6 +12,7 @@ // ignore-sparc64 // ignore-x86 // ignore-x86_64 +// ignore-loongarch64 // See repr-transparent.rs #![feature(transparent_unions)] diff --git a/tests/codegen/repr-transparent.rs b/tests/codegen/repr-transparent.rs index 311cbfbaa..759ddea67 100644 --- a/tests/codegen/repr-transparent.rs +++ b/tests/codegen/repr-transparent.rs @@ -3,6 +3,7 @@ // ignore-riscv64 riscv64 has an i128 type used with test_Vector // see codegen/riscv-abi for riscv functiona call tests // ignore-s390x s390x with default march passes vector types per reference +// ignore-loongarch64 see codegen/loongarch-abi for loongarch function call tests #![crate_type="lib"] #![feature(repr_simd, transparent_unions)] diff --git a/tests/codegen/sanitizer-cfi-add-canonical-jump-tables-flag.rs b/tests/codegen/sanitizer-cfi-add-canonical-jump-tables-flag.rs index c42fbba74..1ee8bdfc3 100644 --- a/tests/codegen/sanitizer-cfi-add-canonical-jump-tables-flag.rs +++ b/tests/codegen/sanitizer-cfi-add-canonical-jump-tables-flag.rs @@ -8,4 +8,4 @@ pub fn foo() { } -// CHECK: !{{[0-9]+}} = !{i32 2, !"CFI Canonical Jump Tables", i32 1} +// CHECK: !{{[0-9]+}} = !{i32 4, !"CFI Canonical Jump Tables", i32 1} diff --git a/tests/codegen/sanitizer-cfi-add-enable-split-lto-unit-flag.rs b/tests/codegen/sanitizer-cfi-add-enable-split-lto-unit-flag.rs new file mode 100644 index 000000000..68c91384b --- /dev/null +++ b/tests/codegen/sanitizer-cfi-add-enable-split-lto-unit-flag.rs @@ -0,0 +1,11 @@ +// Verifies that "EnableSplitLTOUnit" module flag is added. +// +// needs-sanitizer-cfi +// compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi + +#![crate_type="lib"] + +pub fn foo() { +} + +// CHECK: !{{[0-9]+}} = !{i32 4, !"EnableSplitLTOUnit", i32 1} diff --git a/tests/codegen/sanitizer-cfi-emit-type-checks-attr-no-sanitize.rs b/tests/codegen/sanitizer-cfi-emit-type-checks-attr-no-sanitize.rs new file mode 100644 index 000000000..2b61c9078 --- /dev/null +++ b/tests/codegen/sanitizer-cfi-emit-type-checks-attr-no-sanitize.rs @@ -0,0 +1,18 @@ +// Verifies that pointer type membership tests for indirect calls are omitted. +// +// needs-sanitizer-cfi +// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 + +#![crate_type="lib"] +#![feature(no_sanitize)] + +#[no_sanitize(cfi)] +pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { + // CHECK-LABEL: sanitizer_cfi_emit_type_checks_attr_no_sanitize::foo + // CHECK: Function Attrs: {{.*}} + // CHECK-LABEL: define{{.*}}foo{{.*}}!type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} + // CHECK: start: + // CHECK-NEXT: {{%.+}} = call i32 %f(i32 %arg) + // CHECK-NEXT: ret i32 {{%.+}} + f(arg) +} diff --git a/tests/codegen/sanitizer-cfi-emit-type-checks.rs b/tests/codegen/sanitizer-cfi-emit-type-checks.rs index 597b867eb..cea6aac8b 100644 --- a/tests/codegen/sanitizer-cfi-emit-type-checks.rs +++ b/tests/codegen/sanitizer-cfi-emit-type-checks.rs @@ -6,13 +6,12 @@ #![crate_type="lib"] pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { - // CHECK-LABEL: define{{.*}}foo{{.*}}!type !{{[0-9]+}} + // CHECK-LABEL: define{{.*}}foo{{.*}}!type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} // CHECK: start: // CHECK: [[TT:%.+]] = call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%0}}, metadata !"{{[[:print:]]+}}") // CHECK-NEXT: br i1 [[TT]], label %type_test.pass, label %type_test.fail // CHECK: type_test.pass: // CHECK-NEXT: {{%.+}} = call i32 %f(i32 %arg) - // CHECK-NEXT: br label %bb1 // CHECK: type_test.fail: // CHECK-NEXT: call void @llvm.trap() // CHECK-NEXT: unreachable diff --git a/tests/codegen/sanitizer-cfi-emit-type-metadata-attr-cfi-encoding.rs b/tests/codegen/sanitizer-cfi-emit-type-metadata-attr-cfi-encoding.rs new file mode 100644 index 000000000..084d8bf80 --- /dev/null +++ b/tests/codegen/sanitizer-cfi-emit-type-metadata-attr-cfi-encoding.rs @@ -0,0 +1,48 @@ +// Verifies that user-defined CFI encoding for types are emitted. +// +// needs-sanitizer-cfi +// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi + +#![crate_type="lib"] +#![feature(cfi_encoding, extern_types)] + +#[cfi_encoding = "3Foo"] +pub struct Type1(i32); + +extern { + #[cfi_encoding = "3Bar"] + type Type2; +} + +#[cfi_encoding = "3Baz"] +#[repr(transparent)] +pub struct Type3(i32); + +pub fn foo0(_: Type1) { } +// CHECK: define{{.*}}foo0{{.*}}!type ![[TYPE0:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo1(_: Type1, _: Type1) { } +// CHECK: define{{.*}}foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo2(_: Type1, _: Type1, _: Type1) { } +// CHECK: define{{.*}}foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo3(_: *mut Type2) { } +// CHECK: define{{.*}}foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo4(_: *mut Type2, _: *mut Type2) { } +// CHECK: define{{.*}}foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo5(_: *mut Type2, _: *mut Type2, _: *mut Type2) { } +// CHECK: define{{.*}}foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo6(_: *mut Type3) { } +// CHECK: define{{.*}}foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo7(_: *mut Type3, _: *mut Type3) { } +// CHECK: define{{.*}}foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo8(_: *mut Type3, _: *mut Type3, _: *mut Type3) { } +// CHECK: define{{.*}}foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} + +// CHECK: ![[TYPE0]] = !{i64 0, !"_ZTSFv3FooE"} +// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFv3FooS_E"} +// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFv3FooS_S_E"} +// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFvP3BarE"} +// CHECK: ![[TYPE4]] = !{i64 0, !"_ZTSFvP3BarS0_E"} +// CHECK: ![[TYPE5]] = !{i64 0, !"_ZTSFvP3BarS0_S0_E"} +// CHECK: ![[TYPE6]] = !{i64 0, !"_ZTSFvP3BazE"} +// CHECK: ![[TYPE7]] = !{i64 0, !"_ZTSFvP3BazS0_E"} +// CHECK: ![[TYPE8]] = !{i64 0, !"_ZTSFvP3BazS0_S0_E"} diff --git a/tests/codegen/sanitizer-cfi-emit-type-metadata-id-itanium-cxx-abi.rs b/tests/codegen/sanitizer-cfi-emit-type-metadata-id-itanium-cxx-abi.rs index b9c339143..ebb26cd35 100644 --- a/tests/codegen/sanitizer-cfi-emit-type-metadata-id-itanium-cxx-abi.rs +++ b/tests/codegen/sanitizer-cfi-emit-type-metadata-id-itanium-cxx-abi.rs @@ -10,7 +10,7 @@ #![feature(adt_const_params, extern_types, inline_const, type_alias_impl_trait)] extern crate core; -use core::ffi::c_void; +use core::ffi::*; use std::marker::PhantomData; // User-defined type (structure) @@ -44,7 +44,7 @@ impl Trait1 for i32 { } // Trait implementation -impl Trait1 for Struct1 { +impl Trait1 for Struct1 { fn foo(&self) { } } @@ -113,9 +113,10 @@ pub fn fn1<'a>() { let _: Type11 = Quuux; } -// repr(transparent) user-defined type +// Helper type to make Type12 have an unique id struct Foo(i32); +// repr(transparent) user-defined type #[repr(transparent)] pub struct Type12 { member1: (), @@ -131,313 +132,313 @@ pub struct Type13<'a> { member3: &'a Type13<'a>, } -// Helper type to allow `Type14` to be a unique ID +// Helper type to make Type14 have an unique id pub struct Bar; -// repr(transparent) parameterized type +// repr(transparent) user-defined generic type #[repr(transparent)] pub struct Type14(T); pub fn foo0(_: ()) { } -// CHECK: define{{.*}}foo0{{.*}}!type ![[TYPE0:[0-9]+]] -pub fn foo1(_: c_void, _: ()) { } -// CHECK: define{{.*}}foo1{{.*}}!type ![[TYPE1:[0-9]+]] +// CHECK: define{{.*}}foo0{{.*}}!type ![[TYPE0:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo1(_: (), _: c_void) { } +// CHECK: define{{.*}}foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo2(_: (), _: c_void, _: c_void) { } -// CHECK: define{{.*}}foo2{{.*}}!type ![[TYPE2:[0-9]+]] -pub fn foo3(_: *mut c_void) { } -// CHECK: define{{.*}}foo3{{.*}}!type ![[TYPE3:[0-9]+]] -pub fn foo4(_: *mut c_void, _: *mut ()) { } -// CHECK: define{{.*}}foo4{{.*}}!type ![[TYPE4:[0-9]+]] +// CHECK: define{{.*}}foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo3(_: *mut ()) { } +// CHECK: define{{.*}}foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo4(_: *mut (), _: *mut c_void) { } +// CHECK: define{{.*}}foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo5(_: *mut (), _: *mut c_void, _: *mut c_void) { } -// CHECK: define{{.*}}foo5{{.*}}!type ![[TYPE5:[0-9]+]] -pub fn foo6(_: *const c_void) { } -// CHECK: define{{.*}}foo6{{.*}}!type ![[TYPE6:[0-9]+]] -pub fn foo7(_: *const c_void, _: *const ()) { } -// CHECK: define{{.*}}foo7{{.*}}!type ![[TYPE7:[0-9]+]] +// CHECK: define{{.*}}foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo6(_: *const ()) { } +// CHECK: define{{.*}}foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo7(_: *const (), _: *const c_void) { } +// CHECK: define{{.*}}foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo8(_: *const (), _: *const c_void, _: *const c_void) { } -// CHECK: define{{.*}}foo8{{.*}}!type ![[TYPE8:[0-9]+]] +// CHECK: define{{.*}}foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo9(_: bool) { } -// CHECK: define{{.*}}foo9{{.*}}!type ![[TYPE9:[0-9]+]] +// CHECK: define{{.*}}foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo10(_: bool, _: bool) { } -// CHECK: define{{.*}}foo10{{.*}}!type ![[TYPE10:[0-9]+]] +// CHECK: define{{.*}}foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo11(_: bool, _: bool, _: bool) { } -// CHECK: define{{.*}}foo11{{.*}}!type ![[TYPE11:[0-9]+]] +// CHECK: define{{.*}}foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo12(_: i8) { } -// CHECK: define{{.*}}foo12{{.*}}!type ![[TYPE12:[0-9]+]] +// CHECK: define{{.*}}foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo13(_: i8, _: i8) { } -// CHECK: define{{.*}}foo13{{.*}}!type ![[TYPE13:[0-9]+]] +// CHECK: define{{.*}}foo13{{.*}}!type ![[TYPE13:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo14(_: i8, _: i8, _: i8) { } -// CHECK: define{{.*}}foo14{{.*}}!type ![[TYPE14:[0-9]+]] +// CHECK: define{{.*}}foo14{{.*}}!type ![[TYPE14:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo15(_: i16) { } -// CHECK: define{{.*}}foo15{{.*}}!type ![[TYPE15:[0-9]+]] +// CHECK: define{{.*}}foo15{{.*}}!type ![[TYPE15:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo16(_: i16, _: i16) { } -// CHECK: define{{.*}}foo16{{.*}}!type ![[TYPE16:[0-9]+]] +// CHECK: define{{.*}}foo16{{.*}}!type ![[TYPE16:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo17(_: i16, _: i16, _: i16) { } -// CHECK: define{{.*}}foo17{{.*}}!type ![[TYPE17:[0-9]+]] +// CHECK: define{{.*}}foo17{{.*}}!type ![[TYPE17:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo18(_: i32) { } -// CHECK: define{{.*}}foo18{{.*}}!type ![[TYPE18:[0-9]+]] +// CHECK: define{{.*}}foo18{{.*}}!type ![[TYPE18:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo19(_: i32, _: i32) { } -// CHECK: define{{.*}}foo19{{.*}}!type ![[TYPE19:[0-9]+]] +// CHECK: define{{.*}}foo19{{.*}}!type ![[TYPE19:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo20(_: i32, _: i32, _: i32) { } -// CHECK: define{{.*}}foo20{{.*}}!type ![[TYPE20:[0-9]+]] +// CHECK: define{{.*}}foo20{{.*}}!type ![[TYPE20:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo21(_: i64) { } -// CHECK: define{{.*}}foo21{{.*}}!type ![[TYPE21:[0-9]+]] +// CHECK: define{{.*}}foo21{{.*}}!type ![[TYPE21:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo22(_: i64, _: i64) { } -// CHECK: define{{.*}}foo22{{.*}}!type ![[TYPE22:[0-9]+]] +// CHECK: define{{.*}}foo22{{.*}}!type ![[TYPE22:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo23(_: i64, _: i64, _: i64) { } -// CHECK: define{{.*}}foo23{{.*}}!type ![[TYPE23:[0-9]+]] +// CHECK: define{{.*}}foo23{{.*}}!type ![[TYPE23:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo24(_: i128) { } -// CHECK: define{{.*}}foo24{{.*}}!type ![[TYPE24:[0-9]+]] +// CHECK: define{{.*}}foo24{{.*}}!type ![[TYPE24:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo25(_: i128, _: i128) { } -// CHECK: define{{.*}}foo25{{.*}}!type ![[TYPE25:[0-9]+]] +// CHECK: define{{.*}}foo25{{.*}}!type ![[TYPE25:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo26(_: i128, _: i128, _: i128) { } -// CHECK: define{{.*}}foo26{{.*}}!type ![[TYPE26:[0-9]+]] +// CHECK: define{{.*}}foo26{{.*}}!type ![[TYPE26:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo27(_: isize) { } -// CHECK: define{{.*}}foo27{{.*}}!type ![[TYPE27:[0-9]+]] +// CHECK: define{{.*}}foo27{{.*}}!type ![[TYPE27:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo28(_: isize, _: isize) { } -// CHECK: define{{.*}}foo28{{.*}}!type ![[TYPE28:[0-9]+]] +// CHECK: define{{.*}}foo28{{.*}}!type ![[TYPE28:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo29(_: isize, _: isize, _: isize) { } -// CHECK: define{{.*}}foo29{{.*}}!type ![[TYPE29:[0-9]+]] +// CHECK: define{{.*}}foo29{{.*}}!type ![[TYPE29:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo30(_: u8) { } -// CHECK: define{{.*}}foo30{{.*}}!type ![[TYPE30:[0-9]+]] +// CHECK: define{{.*}}foo30{{.*}}!type ![[TYPE30:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo31(_: u8, _: u8) { } -// CHECK: define{{.*}}foo31{{.*}}!type ![[TYPE31:[0-9]+]] +// CHECK: define{{.*}}foo31{{.*}}!type ![[TYPE31:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo32(_: u8, _: u8, _: u8) { } -// CHECK: define{{.*}}foo32{{.*}}!type ![[TYPE32:[0-9]+]] +// CHECK: define{{.*}}foo32{{.*}}!type ![[TYPE32:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo33(_: u16) { } -// CHECK: define{{.*}}foo33{{.*}}!type ![[TYPE33:[0-9]+]] +// CHECK: define{{.*}}foo33{{.*}}!type ![[TYPE33:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo34(_: u16, _: u16) { } -// CHECK: define{{.*}}foo34{{.*}}!type ![[TYPE34:[0-9]+]] +// CHECK: define{{.*}}foo34{{.*}}!type ![[TYPE34:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo35(_: u16, _: u16, _: u16) { } -// CHECK: define{{.*}}foo35{{.*}}!type ![[TYPE35:[0-9]+]] +// CHECK: define{{.*}}foo35{{.*}}!type ![[TYPE35:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo36(_: u32) { } -// CHECK: define{{.*}}foo36{{.*}}!type ![[TYPE36:[0-9]+]] +// CHECK: define{{.*}}foo36{{.*}}!type ![[TYPE36:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo37(_: u32, _: u32) { } -// CHECK: define{{.*}}foo37{{.*}}!type ![[TYPE37:[0-9]+]] +// CHECK: define{{.*}}foo37{{.*}}!type ![[TYPE37:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo38(_: u32, _: u32, _: u32) { } -// CHECK: define{{.*}}foo38{{.*}}!type ![[TYPE38:[0-9]+]] +// CHECK: define{{.*}}foo38{{.*}}!type ![[TYPE38:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo39(_: u64) { } -// CHECK: define{{.*}}foo39{{.*}}!type ![[TYPE39:[0-9]+]] +// CHECK: define{{.*}}foo39{{.*}}!type ![[TYPE39:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo40(_: u64, _: u64) { } -// CHECK: define{{.*}}foo40{{.*}}!type ![[TYPE40:[0-9]+]] +// CHECK: define{{.*}}foo40{{.*}}!type ![[TYPE40:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo41(_: u64, _: u64, _: u64) { } -// CHECK: define{{.*}}foo41{{.*}}!type ![[TYPE41:[0-9]+]] +// CHECK: define{{.*}}foo41{{.*}}!type ![[TYPE41:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo42(_: u128) { } -// CHECK: define{{.*}}foo42{{.*}}!type ![[TYPE42:[0-9]+]] +// CHECK: define{{.*}}foo42{{.*}}!type ![[TYPE42:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo43(_: u128, _: u128) { } -// CHECK: define{{.*}}foo43{{.*}}!type ![[TYPE43:[0-9]+]] +// CHECK: define{{.*}}foo43{{.*}}!type ![[TYPE43:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo44(_: u128, _: u128, _: u128) { } -// CHECK: define{{.*}}foo44{{.*}}!type ![[TYPE44:[0-9]+]] +// CHECK: define{{.*}}foo44{{.*}}!type ![[TYPE44:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo45(_: usize) { } -// CHECK: define{{.*}}foo45{{.*}}!type ![[TYPE45:[0-9]+]] +// CHECK: define{{.*}}foo45{{.*}}!type ![[TYPE45:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo46(_: usize, _: usize) { } -// CHECK: define{{.*}}foo46{{.*}}!type ![[TYPE46:[0-9]+]] +// CHECK: define{{.*}}foo46{{.*}}!type ![[TYPE46:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo47(_: usize, _: usize, _: usize) { } -// CHECK: define{{.*}}foo47{{.*}}!type ![[TYPE47:[0-9]+]] +// CHECK: define{{.*}}foo47{{.*}}!type ![[TYPE47:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo48(_: f32) { } -// CHECK: define{{.*}}foo48{{.*}}!type ![[TYPE48:[0-9]+]] +// CHECK: define{{.*}}foo48{{.*}}!type ![[TYPE48:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo49(_: f32, _: f32) { } -// CHECK: define{{.*}}foo49{{.*}}!type ![[TYPE49:[0-9]+]] +// CHECK: define{{.*}}foo49{{.*}}!type ![[TYPE49:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo50(_: f32, _: f32, _: f32) { } -// CHECK: define{{.*}}foo50{{.*}}!type ![[TYPE50:[0-9]+]] +// CHECK: define{{.*}}foo50{{.*}}!type ![[TYPE50:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo51(_: f64) { } -// CHECK: define{{.*}}foo51{{.*}}!type ![[TYPE51:[0-9]+]] +// CHECK: define{{.*}}foo51{{.*}}!type ![[TYPE51:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo52(_: f64, _: f64) { } -// CHECK: define{{.*}}foo52{{.*}}!type ![[TYPE52:[0-9]+]] +// CHECK: define{{.*}}foo52{{.*}}!type ![[TYPE52:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo53(_: f64, _: f64, _: f64) { } -// CHECK: define{{.*}}foo53{{.*}}!type ![[TYPE53:[0-9]+]] +// CHECK: define{{.*}}foo53{{.*}}!type ![[TYPE53:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo54(_: char) { } -// CHECK: define{{.*}}foo54{{.*}}!type ![[TYPE54:[0-9]+]] +// CHECK: define{{.*}}foo54{{.*}}!type ![[TYPE54:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo55(_: char, _: char) { } -// CHECK: define{{.*}}foo55{{.*}}!type ![[TYPE55:[0-9]+]] +// CHECK: define{{.*}}foo55{{.*}}!type ![[TYPE55:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo56(_: char, _: char, _: char) { } -// CHECK: define{{.*}}foo56{{.*}}!type ![[TYPE56:[0-9]+]] +// CHECK: define{{.*}}foo56{{.*}}!type ![[TYPE56:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo57(_: &str) { } -// CHECK: define{{.*}}foo57{{.*}}!type ![[TYPE57:[0-9]+]] +// CHECK: define{{.*}}foo57{{.*}}!type ![[TYPE57:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo58(_: &str, _: &str) { } -// CHECK: define{{.*}}foo58{{.*}}!type ![[TYPE58:[0-9]+]] +// CHECK: define{{.*}}foo58{{.*}}!type ![[TYPE58:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo59(_: &str, _: &str, _: &str) { } -// CHECK: define{{.*}}foo59{{.*}}!type ![[TYPE59:[0-9]+]] +// CHECK: define{{.*}}foo59{{.*}}!type ![[TYPE59:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo60(_: (i32, i32)) { } -// CHECK: define{{.*}}foo60{{.*}}!type ![[TYPE60:[0-9]+]] +// CHECK: define{{.*}}foo60{{.*}}!type ![[TYPE60:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo61(_: (i32, i32), _: (i32, i32)) { } -// CHECK: define{{.*}}foo61{{.*}}!type ![[TYPE61:[0-9]+]] +// CHECK: define{{.*}}foo61{{.*}}!type ![[TYPE61:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo62(_: (i32, i32), _: (i32, i32), _: (i32, i32)) { } -// CHECK: define{{.*}}foo62{{.*}}!type ![[TYPE62:[0-9]+]] +// CHECK: define{{.*}}foo62{{.*}}!type ![[TYPE62:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo63(_: [i32; 32]) { } -// CHECK: define{{.*}}foo63{{.*}}!type ![[TYPE63:[0-9]+]] +// CHECK: define{{.*}}foo63{{.*}}!type ![[TYPE63:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo64(_: [i32; 32], _: [i32; 32]) { } -// CHECK: define{{.*}}foo64{{.*}}!type ![[TYPE64:[0-9]+]] +// CHECK: define{{.*}}foo64{{.*}}!type ![[TYPE64:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo65(_: [i32; 32], _: [i32; 32], _: [i32; 32]) { } -// CHECK: define{{.*}}foo65{{.*}}!type ![[TYPE65:[0-9]+]] +// CHECK: define{{.*}}foo65{{.*}}!type ![[TYPE65:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo66(_: &[i32]) { } -// CHECK: define{{.*}}foo66{{.*}}!type ![[TYPE66:[0-9]+]] +// CHECK: define{{.*}}foo66{{.*}}!type ![[TYPE66:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo67(_: &[i32], _: &[i32]) { } -// CHECK: define{{.*}}foo67{{.*}}!type ![[TYPE67:[0-9]+]] +// CHECK: define{{.*}}foo67{{.*}}!type ![[TYPE67:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo68(_: &[i32], _: &[i32], _: &[i32]) { } -// CHECK: define{{.*}}foo68{{.*}}!type ![[TYPE68:[0-9]+]] +// CHECK: define{{.*}}foo68{{.*}}!type ![[TYPE68:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo69(_: &Struct1::) { } -// CHECK: define{{.*}}foo69{{.*}}!type ![[TYPE69:[0-9]+]] +// CHECK: define{{.*}}foo69{{.*}}!type ![[TYPE69:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo70(_: &Struct1::, _: &Struct1::) { } -// CHECK: define{{.*}}foo70{{.*}}!type ![[TYPE70:[0-9]+]] +// CHECK: define{{.*}}foo70{{.*}}!type ![[TYPE70:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo71(_: &Struct1::, _: &Struct1::, _: &Struct1::) { } -// CHECK: define{{.*}}foo71{{.*}}!type ![[TYPE71:[0-9]+]] +// CHECK: define{{.*}}foo71{{.*}}!type ![[TYPE71:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo72(_: &Enum1::) { } -// CHECK: define{{.*}}foo72{{.*}}!type ![[TYPE72:[0-9]+]] +// CHECK: define{{.*}}foo72{{.*}}!type ![[TYPE72:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo73(_: &Enum1::, _: &Enum1::) { } -// CHECK: define{{.*}}foo73{{.*}}!type ![[TYPE73:[0-9]+]] +// CHECK: define{{.*}}foo73{{.*}}!type ![[TYPE73:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo74(_: &Enum1::, _: &Enum1::, _: &Enum1::) { } -// CHECK: define{{.*}}foo74{{.*}}!type ![[TYPE74:[0-9]+]] +// CHECK: define{{.*}}foo74{{.*}}!type ![[TYPE74:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo75(_: &Union1::) { } -// CHECK: define{{.*}}foo75{{.*}}!type ![[TYPE75:[0-9]+]] +// CHECK: define{{.*}}foo75{{.*}}!type ![[TYPE75:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo76(_: &Union1::, _: &Union1::) { } -// CHECK: define{{.*}}foo76{{.*}}!type ![[TYPE76:[0-9]+]] +// CHECK: define{{.*}}foo76{{.*}}!type ![[TYPE76:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo77(_: &Union1::, _: &Union1::, _: &Union1::) { } -// CHECK: define{{.*}}foo77{{.*}}!type ![[TYPE77:[0-9]+]] +// CHECK: define{{.*}}foo77{{.*}}!type ![[TYPE77:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo78(_: *mut type1) { } -// CHECK: define{{.*}}foo78{{.*}}!type ![[TYPE78:[0-9]+]] +// CHECK: define{{.*}}foo78{{.*}}!type ![[TYPE78:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo79(_: *mut type1, _: *mut type1) { } -// CHECK: define{{.*}}foo79{{.*}}!type ![[TYPE79:[0-9]+]] +// CHECK: define{{.*}}foo79{{.*}}!type ![[TYPE79:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo80(_: *mut type1, _: *mut type1, _: *mut type1) { } -// CHECK: define{{.*}}foo80{{.*}}!type ![[TYPE80:[0-9]+]] +// CHECK: define{{.*}}foo80{{.*}}!type ![[TYPE80:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo81(_: &mut i32) { } -// CHECK: define{{.*}}foo81{{.*}}!type ![[TYPE81:[0-9]+]] +// CHECK: define{{.*}}foo81{{.*}}!type ![[TYPE81:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo82(_: &mut i32, _: &i32) { } -// CHECK: define{{.*}}foo82{{.*}}!type ![[TYPE82:[0-9]+]] +// CHECK: define{{.*}}foo82{{.*}}!type ![[TYPE82:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo83(_: &mut i32, _: &i32, _: &i32) { } -// CHECK: define{{.*}}foo83{{.*}}!type ![[TYPE83:[0-9]+]] +// CHECK: define{{.*}}foo83{{.*}}!type ![[TYPE83:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo84(_: &i32) { } -// CHECK: define{{.*}}foo84{{.*}}!type ![[TYPE84:[0-9]+]] +// CHECK: define{{.*}}foo84{{.*}}!type ![[TYPE84:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo85(_: &i32, _: &mut i32) { } -// CHECK: define{{.*}}foo85{{.*}}!type ![[TYPE85:[0-9]+]] +// CHECK: define{{.*}}foo85{{.*}}!type ![[TYPE85:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo86(_: &i32, _: &mut i32, _: &mut i32) { } -// CHECK: define{{.*}}foo86{{.*}}!type ![[TYPE86:[0-9]+]] +// CHECK: define{{.*}}foo86{{.*}}!type ![[TYPE86:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo87(_: *mut i32) { } -// CHECK: define{{.*}}foo87{{.*}}!type ![[TYPE87:[0-9]+]] +// CHECK: define{{.*}}foo87{{.*}}!type ![[TYPE87:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo88(_: *mut i32, _: *const i32) { } -// CHECK: define{{.*}}foo88{{.*}}!type ![[TYPE88:[0-9]+]] +// CHECK: define{{.*}}foo88{{.*}}!type ![[TYPE88:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo89(_: *mut i32, _: *const i32, _: *const i32) { } -// CHECK: define{{.*}}foo89{{.*}}!type ![[TYPE89:[0-9]+]] +// CHECK: define{{.*}}foo89{{.*}}!type ![[TYPE89:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo90(_: *const i32) { } -// CHECK: define{{.*}}foo90{{.*}}!type ![[TYPE90:[0-9]+]] +// CHECK: define{{.*}}foo90{{.*}}!type ![[TYPE90:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo91(_: *const i32, _: *mut i32) { } -// CHECK: define{{.*}}foo91{{.*}}!type ![[TYPE91:[0-9]+]] +// CHECK: define{{.*}}foo91{{.*}}!type ![[TYPE91:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo92(_: *const i32, _: *mut i32, _: *mut i32) { } -// CHECK: define{{.*}}foo92{{.*}}!type ![[TYPE92:[0-9]+]] +// CHECK: define{{.*}}foo92{{.*}}!type ![[TYPE92:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo93(_: fn(i32) -> i32) { } -// CHECK: define{{.*}}foo93{{.*}}!type ![[TYPE93:[0-9]+]] +// CHECK: define{{.*}}foo93{{.*}}!type ![[TYPE93:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo94(_: fn(i32) -> i32, _: fn(i32) -> i32) { } -// CHECK: define{{.*}}foo94{{.*}}!type ![[TYPE94:[0-9]+]] +// CHECK: define{{.*}}foo94{{.*}}!type ![[TYPE94:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo95(_: fn(i32) -> i32, _: fn(i32) -> i32, _: fn(i32) -> i32) { } -// CHECK: define{{.*}}foo95{{.*}}!type ![[TYPE95:[0-9]+]] +// CHECK: define{{.*}}foo95{{.*}}!type ![[TYPE95:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo96(_: &dyn Fn(i32) -> i32) { } -// CHECK: define{{.*}}foo96{{.*}}!type ![[TYPE96:[0-9]+]] +// CHECK: define{{.*}}foo96{{.*}}!type ![[TYPE96:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo97(_: &dyn Fn(i32) -> i32, _: &dyn Fn(i32) -> i32) { } -// CHECK: define{{.*}}foo97{{.*}}!type ![[TYPE97:[0-9]+]] +// CHECK: define{{.*}}foo97{{.*}}!type ![[TYPE97:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo98(_: &dyn Fn(i32) -> i32, _: &dyn Fn(i32) -> i32, _: &dyn Fn(i32) -> i32) { } -// CHECK: define{{.*}}foo98{{.*}}!type ![[TYPE98:[0-9]+]] +// CHECK: define{{.*}}foo98{{.*}}!type ![[TYPE98:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo99(_: &dyn FnMut(i32) -> i32) { } -// CHECK: define{{.*}}foo99{{.*}}!type ![[TYPE99:[0-9]+]] +// CHECK: define{{.*}}foo99{{.*}}!type ![[TYPE99:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo100(_: &dyn FnMut(i32) -> i32, _: &dyn FnMut(i32) -> i32) { } -// CHECK: define{{.*}}foo100{{.*}}!type ![[TYPE100:[0-9]+]] +// CHECK: define{{.*}}foo100{{.*}}!type ![[TYPE100:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo101(_: &dyn FnMut(i32) -> i32, _: &dyn FnMut(i32) -> i32, _: &dyn FnMut(i32) -> i32) { } -// CHECK: define{{.*}}foo101{{.*}}!type ![[TYPE101:[0-9]+]] +// CHECK: define{{.*}}foo101{{.*}}!type ![[TYPE101:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo102(_: &dyn FnOnce(i32) -> i32) { } -// CHECK: define{{.*}}foo102{{.*}}!type ![[TYPE102:[0-9]+]] +// CHECK: define{{.*}}foo102{{.*}}!type ![[TYPE102:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo103(_: &dyn FnOnce(i32) -> i32, _: &dyn FnOnce(i32) -> i32) { } -// CHECK: define{{.*}}foo103{{.*}}!type ![[TYPE103:[0-9]+]] +// CHECK: define{{.*}}foo103{{.*}}!type ![[TYPE103:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo104(_: &dyn FnOnce(i32) -> i32, _: &dyn FnOnce(i32) -> i32, _: &dyn FnOnce(i32) -> i32) {} -// CHECK: define{{.*}}foo104{{.*}}!type ![[TYPE104:[0-9]+]] +// CHECK: define{{.*}}foo104{{.*}}!type ![[TYPE104:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo105(_: &dyn Send) { } -// CHECK: define{{.*}}foo105{{.*}}!type ![[TYPE105:[0-9]+]] +// CHECK: define{{.*}}foo105{{.*}}!type ![[TYPE105:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo106(_: &dyn Send, _: &dyn Send) { } -// CHECK: define{{.*}}foo106{{.*}}!type ![[TYPE106:[0-9]+]] +// CHECK: define{{.*}}foo106{{.*}}!type ![[TYPE106:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo107(_: &dyn Send, _: &dyn Send, _: &dyn Send) { } -// CHECK: define{{.*}}foo107{{.*}}!type ![[TYPE107:[0-9]+]] +// CHECK: define{{.*}}foo107{{.*}}!type ![[TYPE107:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo108(_: Type1) { } -// CHECK: define{{.*}}foo108{{.*}}!type ![[TYPE108:[0-9]+]] +// CHECK: define{{.*}}foo108{{.*}}!type ![[TYPE108:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo109(_: Type1, _: Type1) { } -// CHECK: define{{.*}}foo109{{.*}}!type ![[TYPE109:[0-9]+]] +// CHECK: define{{.*}}foo109{{.*}}!type ![[TYPE109:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo110(_: Type1, _: Type1, _: Type1) { } -// CHECK: define{{.*}}foo110{{.*}}!type ![[TYPE110:[0-9]+]] +// CHECK: define{{.*}}foo110{{.*}}!type ![[TYPE110:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo111(_: Type2) { } -// CHECK: define{{.*}}foo111{{.*}}!type ![[TYPE111:[0-9]+]] +// CHECK: define{{.*}}foo111{{.*}}!type ![[TYPE111:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo112(_: Type2, _: Type2) { } -// CHECK: define{{.*}}foo112{{.*}}!type ![[TYPE112:[0-9]+]] +// CHECK: define{{.*}}foo112{{.*}}!type ![[TYPE112:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo113(_: Type2, _: Type2, _: Type2) { } -// CHECK: define{{.*}}foo113{{.*}}!type ![[TYPE113:[0-9]+]] +// CHECK: define{{.*}}foo113{{.*}}!type ![[TYPE113:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo114(_: Type3) { } -// CHECK: define{{.*}}foo114{{.*}}!type ![[TYPE114:[0-9]+]] +// CHECK: define{{.*}}foo114{{.*}}!type ![[TYPE114:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo115(_: Type3, _: Type3) { } -// CHECK: define{{.*}}foo115{{.*}}!type ![[TYPE115:[0-9]+]] +// CHECK: define{{.*}}foo115{{.*}}!type ![[TYPE115:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo116(_: Type3, _: Type3, _: Type3) { } -// CHECK: define{{.*}}foo116{{.*}}!type ![[TYPE116:[0-9]+]] +// CHECK: define{{.*}}foo116{{.*}}!type ![[TYPE116:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo117(_: Type4) { } -// CHECK: define{{.*}}foo117{{.*}}!type ![[TYPE117:[0-9]+]] +// CHECK: define{{.*}}foo117{{.*}}!type ![[TYPE117:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo118(_: Type4, _: Type4) { } -// CHECK: define{{.*}}foo118{{.*}}!type ![[TYPE118:[0-9]+]] +// CHECK: define{{.*}}foo118{{.*}}!type ![[TYPE118:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo119(_: Type4, _: Type4, _: Type4) { } -// CHECK: define{{.*}}foo119{{.*}}!type ![[TYPE119:[0-9]+]] +// CHECK: define{{.*}}foo119{{.*}}!type ![[TYPE119:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo120(_: Type5) { } -// CHECK: define{{.*}}foo120{{.*}}!type ![[TYPE120:[0-9]+]] +// CHECK: define{{.*}}foo120{{.*}}!type ![[TYPE120:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo121(_: Type5, _: Type5) { } -// CHECK: define{{.*}}foo121{{.*}}!type ![[TYPE121:[0-9]+]] +// CHECK: define{{.*}}foo121{{.*}}!type ![[TYPE121:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo122(_: Type5, _: Type5, _: Type5) { } -// CHECK: define{{.*}}foo122{{.*}}!type ![[TYPE122:[0-9]+]] +// CHECK: define{{.*}}foo122{{.*}}!type ![[TYPE122:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo123(_: Type6) { } -// CHECK: define{{.*}}foo123{{.*}}!type ![[TYPE123:[0-9]+]] +// CHECK: define{{.*}}foo123{{.*}}!type ![[TYPE123:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo124(_: Type6, _: Type6) { } -// CHECK: define{{.*}}foo124{{.*}}!type ![[TYPE124:[0-9]+]] +// CHECK: define{{.*}}foo124{{.*}}!type ![[TYPE124:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo125(_: Type6, _: Type6, _: Type6) { } -// CHECK: define{{.*}}foo125{{.*}}!type ![[TYPE125:[0-9]+]] +// CHECK: define{{.*}}foo125{{.*}}!type ![[TYPE125:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo126(_: Type7) { } -// CHECK: define{{.*}}foo126{{.*}}!type ![[TYPE126:[0-9]+]] +// CHECK: define{{.*}}foo126{{.*}}!type ![[TYPE126:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo127(_: Type7, _: Type7) { } -// CHECK: define{{.*}}foo127{{.*}}!type ![[TYPE127:[0-9]+]] +// CHECK: define{{.*}}foo127{{.*}}!type ![[TYPE127:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo128(_: Type7, _: Type7, _: Type7) { } -// CHECK: define{{.*}}foo128{{.*}}!type ![[TYPE128:[0-9]+]] +// CHECK: define{{.*}}foo128{{.*}}!type ![[TYPE128:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo129(_: Type8) { } -// CHECK: define{{.*}}foo129{{.*}}!type ![[TYPE129:[0-9]+]] +// CHECK: define{{.*}}foo129{{.*}}!type ![[TYPE129:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo130(_: Type8, _: Type8) { } -// CHECK: define{{.*}}foo130{{.*}}!type ![[TYPE130:[0-9]+]] +// CHECK: define{{.*}}foo130{{.*}}!type ![[TYPE130:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo131(_: Type8, _: Type8, _: Type8) { } -// CHECK: define{{.*}}foo131{{.*}}!type ![[TYPE131:[0-9]+]] +// CHECK: define{{.*}}foo131{{.*}}!type ![[TYPE131:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo132(_: Type9) { } -// CHECK: define{{.*}}foo132{{.*}}!type ![[TYPE132:[0-9]+]] +// CHECK: define{{.*}}foo132{{.*}}!type ![[TYPE132:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo133(_: Type9, _: Type9) { } -// CHECK: define{{.*}}foo133{{.*}}!type ![[TYPE133:[0-9]+]] +// CHECK: define{{.*}}foo133{{.*}}!type ![[TYPE133:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo134(_: Type9, _: Type9, _: Type9) { } -// CHECK: define{{.*}}foo134{{.*}}!type ![[TYPE134:[0-9]+]] +// CHECK: define{{.*}}foo134{{.*}}!type ![[TYPE134:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo135(_: Type10) { } -// CHECK: define{{.*}}foo135{{.*}}!type ![[TYPE135:[0-9]+]] +// CHECK: define{{.*}}foo135{{.*}}!type ![[TYPE135:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo136(_: Type10, _: Type10) { } -// CHECK: define{{.*}}foo136{{.*}}!type ![[TYPE136:[0-9]+]] +// CHECK: define{{.*}}foo136{{.*}}!type ![[TYPE136:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo137(_: Type10, _: Type10, _: Type10) { } -// CHECK: define{{.*}}foo137{{.*}}!type ![[TYPE137:[0-9]+]] +// CHECK: define{{.*}}foo137{{.*}}!type ![[TYPE137:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo138(_: Type11) { } -// CHECK: define{{.*}}foo138{{.*}}!type ![[TYPE138:[0-9]+]] +// CHECK: define{{.*}}foo138{{.*}}!type ![[TYPE138:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo139(_: Type11, _: Type11) { } -// CHECK: define{{.*}}foo139{{.*}}!type ![[TYPE139:[0-9]+]] +// CHECK: define{{.*}}foo139{{.*}}!type ![[TYPE139:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo140(_: Type11, _: Type11, _: Type11) { } -// CHECK: define{{.*}}foo140{{.*}}!type ![[TYPE140:[0-9]+]] +// CHECK: define{{.*}}foo140{{.*}}!type ![[TYPE140:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo141(_: Type12) { } -// CHECK: define{{.*}}foo141{{.*}}!type ![[TYPE141:[0-9]+]] +// CHECK: define{{.*}}foo141{{.*}}!type ![[TYPE141:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo142(_: Type12, _: Type12) { } -// CHECK: define{{.*}}foo142{{.*}}!type ![[TYPE142:[0-9]+]] +// CHECK: define{{.*}}foo142{{.*}}!type ![[TYPE142:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo143(_: Type12, _: Type12, _: Type12) { } -// CHECK: define{{.*}}foo143{{.*}}!type ![[TYPE143:[0-9]+]] +// CHECK: define{{.*}}foo143{{.*}}!type ![[TYPE143:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo144(_: Type13) { } -// CHECK: define{{.*}}foo144{{.*}}!type ![[TYPE144:[0-9]+]] +// CHECK: define{{.*}}foo144{{.*}}!type ![[TYPE144:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo145(_: Type13, _: Type13) { } -// CHECK: define{{.*}}foo145{{.*}}!type ![[TYPE145:[0-9]+]] +// CHECK: define{{.*}}foo145{{.*}}!type ![[TYPE145:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo146(_: Type13, _: Type13, _: Type13) { } -// CHECK: define{{.*}}foo146{{.*}}!type ![[TYPE146:[0-9]+]] +// CHECK: define{{.*}}foo146{{.*}}!type ![[TYPE146:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo147(_: Type14) { } -// CHECK: define{{.*}}foo147{{.*}}!type ![[TYPE147:[0-9]+]] +// CHECK: define{{.*}}foo147{{.*}}!type ![[TYPE147:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo148(_: Type14, _: Type14) { } -// CHECK: define{{.*}}foo148{{.*}}!type ![[TYPE148:[0-9]+]] +// CHECK: define{{.*}}foo148{{.*}}!type ![[TYPE148:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} pub fn foo149(_: Type14, _: Type14, _: Type14) { } -// CHECK: define{{.*}}foo149{{.*}}!type ![[TYPE149:[0-9]+]] +// CHECK: define{{.*}}foo149{{.*}}!type ![[TYPE149:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} // CHECK: ![[TYPE0]] = !{i64 0, !"_ZTSFvvE"} // CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvvvE"} @@ -535,15 +536,15 @@ pub fn foo149(_: Type14, _: Type14, _: Type14) { } // CHECK: ![[TYPE93]] = !{i64 0, !"_ZTSFvPFu3i32S_EE"} // CHECK: ![[TYPE94]] = !{i64 0, !"_ZTSFvPFu3i32S_ES0_E"} // CHECK: ![[TYPE95]] = !{i64 0, !"_ZTSFvPFu3i32S_ES0_S0_E"} -// CHECK: ![[TYPE96]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function2FnIu5tupleIu3i32EEu{{[0-9]+}}NtNtNtNtC{{[[:print:]]+}}_4core3ops8function6FnOnce6OutputIS0_ES_u6regionEEE"} -// CHECK: ![[TYPE97]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function2FnIu5tupleIu3i32EEu{{[0-9]+}}NtNtNtNtC{{[[:print:]]+}}_4core3ops8function6FnOnce6OutputIS0_ES_u6regionEES5_E"} -// CHECK: ![[TYPE98]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function2FnIu5tupleIu3i32EEu{{[0-9]+}}NtNtNtNtC{{[[:print:]]+}}_4core3ops8function6FnOnce6OutputIS0_ES_u6regionEES5_S5_E"} -// CHECK: ![[TYPE99]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function5FnMutIu5tupleIu3i32EEu{{[0-9]+}}NtNtNtNtC{{[[:print:]]+}}_4core3ops8function6FnOnce6OutputIS0_ES_u6regionEEE"} -// CHECK: ![[TYPE100]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function5FnMutIu5tupleIu3i32EEu{{[0-9]+}}NtNtNtNtC{{[[:print:]]+}}_4core3ops8function6FnOnce6OutputIS0_ES_u6regionEES5_E"} -// CHECK: ![[TYPE101]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function5FnMutIu5tupleIu3i32EEu{{[0-9]+}}NtNtNtNtC{{[[:print:]]+}}_4core3ops8function6FnOnce6OutputIS0_ES_u6regionEES5_S5_E"} -// CHECK: ![[TYPE102]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function6FnOnceIu5tupleIu3i32EEu{{[0-9]+}}NtNtNtNtC{{[[:print:]]+}}_4core3ops8function6FnOnce6OutputIS0_ES_u6regionEEE"} -// CHECK: ![[TYPE103]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function6FnOnceIu5tupleIu3i32EEu{{[0-9]+}}NtNtNtNtC{{[[:print:]]+}}_4core3ops8function6FnOnce6OutputIS0_ES_u6regionEES5_E"} -// CHECK: ![[TYPE104]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function6FnOnceIu5tupleIu3i32EEu{{[0-9]+}}NtNtNtNtC{{[[:print:]]+}}_4core3ops8function6FnOnce6OutputIS0_ES_u6regionEES5_S5_E"} +// CHECK: ![[TYPE96]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function2FnIu5paramEu6regionEEE"} +// CHECK: ![[TYPE97]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function2FnIu5paramEu6regionEES3_E"} +// CHECK: ![[TYPE98]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function2FnIu5paramEu6regionEES3_S3_E"} +// CHECK: ![[TYPE99]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function5FnMutIu5paramEu6regionEEE"} +// CHECK: ![[TYPE100]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function5FnMutIu5paramEu6regionEES3_E"} +// CHECK: ![[TYPE101]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function5FnMutIu5paramEu6regionEES3_S3_E"} +// CHECK: ![[TYPE102]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function6FnOnceIu5paramEu6regionEEE"} +// CHECK: ![[TYPE103]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function6FnOnceIu5paramEu6regionEES3_E"} +// CHECK: ![[TYPE104]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtNtC{{[[:print:]]+}}_4core3ops8function6FnOnceIu5paramEu6regionEES3_S3_E"} // CHECK: ![[TYPE105]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker4Sendu6regionEEE"} // CHECK: ![[TYPE106]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker4Sendu6regionEES2_E"} // CHECK: ![[TYPE107]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtNtC{{[[:print:]]+}}_4core6marker4Sendu6regionEES2_S2_E"} @@ -565,9 +566,9 @@ pub fn foo149(_: Type14, _: Type14, _: Type14) { } // CHECK: ![[TYPE123]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn18{{[{}][{}]}}impl{{[}][}]}}3fooIu3i32EE"} // CHECK: ![[TYPE124]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn18{{[{}][{}]}}impl{{[}][}]}}3fooIu3i32ES0_E"} // CHECK: ![[TYPE125]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi3fn18{{[{}][{}]}}impl{{[}][}]}}3fooIu3i32ES0_S0_E"} -// CHECK: ![[TYPE126]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait13fooIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait1Iu3i32Eu6regionES_EE"} -// CHECK: ![[TYPE127]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait13fooIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait1Iu3i32Eu6regionES_ES3_E"} -// CHECK: ![[TYPE128]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait13fooIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait1Iu3i32Eu6regionES_ES3_S3_E"} +// CHECK: ![[TYPE126]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait13fooIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait1Iu5paramEu6regionEu3i32EE"} +// CHECK: ![[TYPE127]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait13fooIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait1Iu5paramEu6regionEu3i32ES4_E"} +// CHECK: ![[TYPE128]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait13fooIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait1Iu5paramEu6regionEu3i32ES4_S4_E"} // CHECK: ![[TYPE129]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait13fooIu3i32S_EE"} // CHECK: ![[TYPE130]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait13fooIu3i32S_ES0_E"} // CHECK: ![[TYPE131]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNtC{{[[:print:]]+}}_51sanitizer_cfi_emit_type_metadata_id_itanium_cxx_abi6Trait13fooIu3i32S_ES0_S0_E"} diff --git a/tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi-generalized.rs b/tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi-generalized.rs new file mode 100644 index 000000000..78ef0c2c7 --- /dev/null +++ b/tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi-generalized.rs @@ -0,0 +1,31 @@ +// Verifies that generalized type metadata for functions are emitted. +// +// needs-sanitizer-cfi +// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-generalize-pointers + +#![crate_type="lib"] + +pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { + // CHECK-LABEL: define{{.*}}foo + // CHECK-SAME: {{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} + // CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%0}}, metadata !"_ZTSFu3i32S_E.generalized") + f(arg) +} + +pub fn bar(f: fn(i32, i32) -> i32, arg1: i32, arg2: i32) -> i32 { + // CHECK-LABEL: define{{.*}}bar + // CHECK-SAME: {{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} + // CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%0}}, metadata !"_ZTSFu3i32S_S_E.generalized") + f(arg1, arg2) +} + +pub fn baz(f: fn(i32, i32, i32) -> i32, arg1: i32, arg2: i32, arg3: i32) -> i32 { + // CHECK-LABEL: define{{.*}}baz + // CHECK-SAME: {{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} + // CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%0}}, metadata !"_ZTSFu3i32S_S_S_E.generalized") + f(arg1, arg2, arg3) +} + +// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFu3i32PKvS_E.generalized"} +// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFu3i32PKvS_S_E.generalized"} +// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFu3i32PKvS_S_S_E.generalized"} diff --git a/tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs b/tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs new file mode 100644 index 000000000..3b72459c4 --- /dev/null +++ b/tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs @@ -0,0 +1,31 @@ +// Verifies that normalized and generalized type metadata for functions are emitted. +// +// needs-sanitizer-cfi +// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -Zsanitizer-cfi-generalize-pointers + +#![crate_type="lib"] + +pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { + // CHECK-LABEL: define{{.*}}foo + // CHECK-SAME: {{.*}}![[TYPE1:[0-9]+]] + // CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%0}}, metadata !"_ZTSFu3i32S_E.normalized.generalized") + f(arg) +} + +pub fn bar(f: fn(i32, i32) -> i32, arg1: i32, arg2: i32) -> i32 { + // CHECK-LABEL: define{{.*}}bar + // CHECK-SAME: {{.*}}![[TYPE2:[0-9]+]] + // CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%0}}, metadata !"_ZTSFu3i32S_S_E.normalized.generalized") + f(arg1, arg2) +} + +pub fn baz(f: fn(i32, i32, i32) -> i32, arg1: i32, arg2: i32, arg3: i32) -> i32 { + // CHECK-LABEL: define{{.*}}baz + // CHECK-SAME: {{.*}}![[TYPE3:[0-9]+]] + // CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%0}}, metadata !"_ZTSFu3i32S_S_S_E.normalized.generalized") + f(arg1, arg2, arg3) +} + +// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFu3i32PKvS_E.normalized.generalized"} +// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFu3i32PKvS_S_E.normalized.generalized"} +// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFu3i32PKvS_S_S_E.normalized.generalized"} diff --git a/tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi-normalized.rs b/tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi-normalized.rs new file mode 100644 index 000000000..9218e9947 --- /dev/null +++ b/tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi-normalized.rs @@ -0,0 +1,31 @@ +// Verifies that normalized type metadata for functions are emitted. +// +// needs-sanitizer-cfi +// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers + +#![crate_type="lib"] + +pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { + // CHECK-LABEL: define{{.*}}foo + // CHECK-SAME: {{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} + // CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%0}}, metadata !"_ZTSFu3i32S_E.normalized") + f(arg) +} + +pub fn bar(f: fn(i32, i32) -> i32, arg1: i32, arg2: i32) -> i32 { + // CHECK-LABEL: define{{.*}}bar + // CHECK-SAME: {{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} + // CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%0}}, metadata !"_ZTSFu3i32S_S_E.normalized") + f(arg1, arg2) +} + +pub fn baz(f: fn(i32, i32, i32) -> i32, arg1: i32, arg2: i32, arg3: i32) -> i32 { + // CHECK-LABEL: define{{.*}}baz + // CHECK-SAME: {{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} + // CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%0}}, metadata !"_ZTSFu3i32S_S_S_E.normalized") + f(arg1, arg2, arg3) +} + +// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFu3i32PFS_S_ES_E.normalized"} +// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFu3i32PFS_S_S_ES_S_E.normalized"} +// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFu3i32PFS_S_S_S_ES_S_S_E.normalized"} diff --git a/tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi.rs b/tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi.rs index bafc4c659..f9fd816de 100644 --- a/tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi.rs +++ b/tests/codegen/sanitizer-cfi-emit-type-metadata-itanium-cxx-abi.rs @@ -7,21 +7,21 @@ pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { // CHECK-LABEL: define{{.*}}foo - // CHECK-SAME: {{.*}}!type ![[TYPE1:[0-9]+]] + // CHECK-SAME: {{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} // CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%0}}, metadata !"_ZTSFu3i32S_E") f(arg) } pub fn bar(f: fn(i32, i32) -> i32, arg1: i32, arg2: i32) -> i32 { // CHECK-LABEL: define{{.*}}bar - // CHECK-SAME: {{.*}}!type ![[TYPE2:[0-9]+]] + // CHECK-SAME: {{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} // CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%0}}, metadata !"_ZTSFu3i32S_S_E") f(arg1, arg2) } pub fn baz(f: fn(i32, i32, i32) -> i32, arg1: i32, arg2: i32, arg3: i32) -> i32 { // CHECK-LABEL: define{{.*}}baz - // CHECK-SAME: {{.*}}!type ![[TYPE3:[0-9]+]] + // CHECK-SAME: {{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} // CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%0}}, metadata !"_ZTSFu3i32S_S_S_E") f(arg1, arg2, arg3) } diff --git a/tests/codegen/sanitizer-cfi-emit-type-metadata-trait-objects.rs b/tests/codegen/sanitizer-cfi-emit-type-metadata-trait-objects.rs new file mode 100644 index 000000000..0f79adab7 --- /dev/null +++ b/tests/codegen/sanitizer-cfi-emit-type-metadata-trait-objects.rs @@ -0,0 +1,120 @@ +// Verifies that type metadata identifiers for trait objects are emitted correctly. +// +// needs-sanitizer-cfi +// compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Ctarget-feature=-crt-static -Zsanitizer=cfi + +#![crate_type="lib"] + +pub trait Trait1 { + fn foo(&self); +} + +#[derive(Clone, Copy)] +pub struct Type1; + +impl Trait1 for Type1 { + fn foo(&self) { + } +} + +pub trait Trait2 { + fn bar(&self); +} + +pub struct Type2; + +impl Trait2 for Type2 { + fn bar(&self) { + } +} + +pub trait Trait3 { + fn baz(&self, _: &T); +} + +pub struct Type3; + +impl Trait3 for T { + fn baz(&self, _: &U) { + } +} + +pub trait Trait4<'a, T> { + type Output: 'a; + fn qux(&self, _: &T) -> Self::Output; +} + +pub struct Type4; + +impl<'a, T, U> Trait4<'a, U> for T { + type Output = &'a i32; + fn qux(&self, _: &U) -> Self::Output { + &0 + } +} + +pub fn foo1(a: &dyn Trait1) { + a.foo(); + // CHECK-LABEL: define{{.*}}4foo1{{.*}}!type !{{[0-9]+}} + // CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%[0-9]}}, metadata !"[[TYPE1:[[:print:]]+]]") +} + +pub fn bar1() { + let a = Type1; + let b = &a as &dyn Trait1; + b.foo(); + // CHECK-LABEL: define{{.*}}4bar1{{.*}}!type !{{[0-9]+}} + // CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%[0-9]}}, metadata !"[[TYPE2:[[:print:]]+]]") +} + +pub fn foo2(a: &dyn Trait2) { + a.bar(); + // CHECK-LABEL: define{{.*}}4foo2{{.*}}!type !{{[0-9]+}} + // CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%[0-9]}}, metadata !"[[TYPE2:[[:print:]]+]]") +} + +pub fn bar2() { + let a = Type2; + foo2(&a); + let b = &a as &dyn Trait2; + b.bar(); + // CHECK-LABEL: define{{.*}}4bar2{{.*}}!type !{{[0-9]+}} + // CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%[0-9]}}, metadata !"[[TYPE2:[[:print:]]+]]") +} + +pub fn foo3(a: &dyn Trait3) { + let b = Type3; + a.baz(&b); + // CHECK-LABEL: define{{.*}}4foo3{{.*}}!type !{{[0-9]+}} + // CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%[0-9]}}, metadata !"[[TYPE3:[[:print:]]+]]") +} + +pub fn bar3() { + let a = Type3; + foo3(&a); + let b = &a as &dyn Trait3; + b.baz(&a); + // CHECK-LABEL: define{{.*}}4bar3{{.*}}!type !{{[0-9]+}} + // CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%[0-9]}}, metadata !"[[TYPE3:[[:print:]]+]]") +} + +pub fn foo4<'a>(a: &dyn Trait4<'a, Type4, Output = &'a i32>) { + let b = Type4; + a.qux(&b); + // CHECK-LABEL: define{{.*}}4foo4{{.*}}!type !{{[0-9]+}} + // CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%[0-9]}}, metadata !"[[TYPE4:[[:print:]]+]]") +} + +pub fn bar4<'a>() { + let a = Type4; + foo4(&a); + let b = &a as &dyn Trait4<'a, Type4, Output = &'a i32>; + b.qux(&a); + // CHECK-LABEL: define{{.*}}4bar4{{.*}}!type !{{[0-9]+}} + // CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%[0-9]}}, metadata !"[[TYPE4:[[:print:]]+]]") +} + +// CHECK: !{{[0-9]+}} = !{i64 0, !"[[TYPE1]]"} +// CHECK: !{{[0-9]+}} = !{i64 0, !"[[TYPE2]]"} +// CHECK: !{{[0-9]+}} = !{i64 0, !"[[TYPE3]]"} +// CHECK: !{{[0-9]+}} = !{i64 0, !"[[TYPE4]]"} diff --git a/tests/codegen/sanitizer-cfi-generalize-pointers.rs b/tests/codegen/sanitizer-cfi-generalize-pointers.rs new file mode 100644 index 000000000..677ebdb27 --- /dev/null +++ b/tests/codegen/sanitizer-cfi-generalize-pointers.rs @@ -0,0 +1,46 @@ +// Verifies that pointer types are generalized. +// +// needs-sanitizer-cfi +// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-generalize-pointers + +#![crate_type="lib"] + +extern crate core; + +pub fn foo0(_: &mut i32) { } +// CHECK: define{{.*}}foo0{{.*}}!type ![[TYPE0:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo1(_: &mut i32, _: &mut i32) { } +// CHECK: define{{.*}}foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo2(_: &mut i32, _: &mut i32, _: &mut i32) { } +// CHECK: define{{.*}}foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo3(_: &i32) { } +// CHECK: define{{.*}}foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo4(_: &i32, _: &i32) { } +// CHECK: define{{.*}}foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo5(_: &i32, _: &i32, _: &i32) { } +// CHECK: define{{.*}}foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo6(_: *mut i32) { } +// CHECK: define{{.*}}foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo7(_: *mut i32, _: *mut i32) { } +// CHECK: define{{.*}}foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo8(_: *mut i32, _: *mut i32, _: *mut i32) { } +// CHECK: define{{.*}}foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo9(_: *const i32) { } +// CHECK: define{{.*}}foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo10(_: *const i32, _: *const i32) { } +// CHECK: define{{.*}}foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} +pub fn foo11(_: *const i32, _: *const i32, _: *const i32) { } +// CHECK: define{{.*}}foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} + +// CHECK: ![[TYPE0]] = !{i64 0, !"_ZTSFvU3mutu3refIvEE.generalized"} +// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvU3mutu3refIvES0_E.generalized"} +// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvU3mutu3refIvES0_S0_E.generalized"} +// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFvu3refIvEE.generalized"} +// CHECK: ![[TYPE4]] = !{i64 0, !"_ZTSFvu3refIvES_E.generalized"} +// CHECK: ![[TYPE5]] = !{i64 0, !"_ZTSFvu3refIvES_S_E.generalized"} +// CHECK: ![[TYPE6]] = !{i64 0, !"_ZTSFvPvE.generalized"} +// CHECK: ![[TYPE7]] = !{i64 0, !"_ZTSFvPvS_E.generalized"} +// CHECK: ![[TYPE8]] = !{i64 0, !"_ZTSFvPvS_S_E.generalized"} +// CHECK: ![[TYPE9]] = !{i64 0, !"_ZTSFvPKvE.generalized"} +// CHECK: ![[TYPE10]] = !{i64 0, !"_ZTSFvPKvS0_E.generalized"} +// CHECK: ![[TYPE11]] = !{i64 0, !"_ZTSFvPKvS0_S0_E.generalized"} diff --git a/tests/codegen/sanitizer-cfi-normalize-integers.rs b/tests/codegen/sanitizer-cfi-normalize-integers.rs new file mode 100644 index 000000000..aa3913cb8 --- /dev/null +++ b/tests/codegen/sanitizer-cfi-normalize-integers.rs @@ -0,0 +1,83 @@ +// Verifies that integer types are normalized. +// +// needs-sanitizer-cfi +// compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers + +#![crate_type="lib"] + +extern crate core; +use core::ffi::*; + +pub fn foo0(_: bool) { } +// CHECK: define{{.*}}foo0{{.*}}!type ![[TYPE0:[0-9]+]] !type !{{[0-9]+}} +pub fn foo1(_: bool, _: c_uchar) { } +// CHECK: define{{.*}}foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} +pub fn foo2(_: bool, _: c_uchar, _: c_uchar) { } +// CHECK: define{{.*}}foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} +pub fn foo3(_: isize) { } +// CHECK: define{{.*}}foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} +pub fn foo4(_: isize, _: c_long) { } +// CHECK: define{{.*}}foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} +pub fn foo5(_: isize, _: c_long, _: c_longlong) { } +// CHECK: define{{.*}}foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} +pub fn foo6(_: usize) { } +// CHECK: define{{.*}}foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} +pub fn foo7(_: usize, _: c_ulong) { } +// CHECK: define{{.*}}foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} +pub fn foo8(_: usize, _: c_ulong, _: c_ulonglong) { } +// CHECK: define{{.*}}foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} +pub fn foo9(_: c_schar) { } +// CHECK: define{{.*}}foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} +pub fn foo10(_: c_char, _: c_schar) { } +// CHECK: define{{.*}}foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} +pub fn foo11(_: c_char, _: c_schar, _: c_schar) { } +// CHECK: define{{.*}}foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} +pub fn foo12(_: c_int) { } +// CHECK: define{{.*}}foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} +pub fn foo13(_: c_int, _: c_int) { } +// CHECK: define{{.*}}foo13{{.*}}!type ![[TYPE13:[0-9]+]] !type !{{[0-9]+}} +pub fn foo14(_: c_int, _: c_int, _: c_int) { } +// CHECK: define{{.*}}foo14{{.*}}!type ![[TYPE14:[0-9]+]] !type !{{[0-9]+}} +pub fn foo15(_: c_short) { } +// CHECK: define{{.*}}foo15{{.*}}!type ![[TYPE15:[0-9]+]] !type !{{[0-9]+}} +pub fn foo16(_: c_short, _: c_short) { } +// CHECK: define{{.*}}foo16{{.*}}!type ![[TYPE16:[0-9]+]] !type !{{[0-9]+}} +pub fn foo17(_: c_short, _: c_short, _: c_short) { } +// CHECK: define{{.*}}foo17{{.*}}!type ![[TYPE17:[0-9]+]] !type !{{[0-9]+}} +pub fn foo18(_: c_uint) { } +// CHECK: define{{.*}}foo18{{.*}}!type ![[TYPE18:[0-9]+]] !type !{{[0-9]+}} +pub fn foo19(_: c_uint, _: c_uint) { } +// CHECK: define{{.*}}foo19{{.*}}!type ![[TYPE19:[0-9]+]] !type !{{[0-9]+}} +pub fn foo20(_: c_uint, _: c_uint, _: c_uint) { } +// CHECK: define{{.*}}foo20{{.*}}!type ![[TYPE20:[0-9]+]] !type !{{[0-9]+}} +pub fn foo21(_: c_ushort) { } +// CHECK: define{{.*}}foo21{{.*}}!type ![[TYPE21:[0-9]+]] !type !{{[0-9]+}} +pub fn foo22(_: c_ushort, _: c_ushort) { } +// CHECK: define{{.*}}foo22{{.*}}!type ![[TYPE22:[0-9]+]] !type !{{[0-9]+}} +pub fn foo23(_: c_ushort, _: c_ushort, _: c_ushort) { } +// CHECK: define{{.*}}foo23{{.*}}!type ![[TYPE23:[0-9]+]] !type !{{[0-9]+}} + +// CHECK: ![[TYPE0]] = !{i64 0, !"_ZTSFvu2u8E.normalized"} +// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu2u8S_E.normalized"} +// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvu2u8S_S_E.normalized"} +// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFv{{u3i16|u3i32|u3i64}}E.normalized"} +// CHECK: ![[TYPE4]] = !{i64 0, !"_ZTSFv{{u3i16|u3i32|u3i64}}{{u3i32|u3i64|S_}}E.normalized"} +// CHECK: ![[TYPE5]] = !{i64 0, !"_ZTSFv{{u3i16|u3i32|u3i64}}{{u3i32|u3i64|S_}}{{u3i64|S_|S0_}}E.normalized"} +// CHECK: ![[TYPE6]] = !{i64 0, !"_ZTSFv{{u3u16|u3u32|u3u64}}E.normalized"} +// CHECK: ![[TYPE7]] = !{i64 0, !"_ZTSFv{{u3u16|u3u32|u3u64}}{{u3u32|u3u64|S_}}E.normalized"} +// CHECK: ![[TYPE8]] = !{i64 0, !"_ZTSFv{{u3u16|u3u32|u3u64}}{{u3u32|u3u64|S_}}{{u3u64|S_|S0_}}E.normalized"} +// CHECK: ![[TYPE9]] = !{i64 0, !"_ZTSFvu2i8E.normalized"} +// CHECK: ![[TYPE10]] = !{i64 0, !"_ZTSFv{{u2i8S_|u2u8u2i8}}E.normalized"} +// CHECK: ![[TYPE11]] = !{i64 0, !"_ZTSFv{{u2i8S_S_|u2u8u2i8S0_}}E.normalized"} +// CHECK: ![[TYPE12]] = !{i64 0, !"_ZTSFv{{u3i16|u3i32|u3i64}}E.normalized"} +// CHECK: ![[TYPE13]] = !{i64 0, !"_ZTSFv{{u3i16|u3i32|u3i64}}S_E.normalized"} +// CHECK: ![[TYPE14]] = !{i64 0, !"_ZTSFv{{u3i16|u3i32|u3i64}}S_S_E.normalized"} +// CHECK: ![[TYPE15]] = !{i64 0, !"_ZTSFvu3i16E.normalized"} +// CHECK: ![[TYPE16]] = !{i64 0, !"_ZTSFvu3i16S_E.normalized"} +// CHECK: ![[TYPE17]] = !{i64 0, !"_ZTSFvu3i16S_S_E.normalized"} +// CHECK: ![[TYPE18]] = !{i64 0, !"_ZTSFv{{u3u16|u3u32|u3u64}}E.normalized"} +// CHECK: ![[TYPE19]] = !{i64 0, !"_ZTSFv{{u3u16|u3u32|u3u64}}S_E.normalized"} +// CHECK: ![[TYPE20]] = !{i64 0, !"_ZTSFv{{u3u16|u3u32|u3u64}}S_S_E.normalized"} +// CHECK: ![[TYPE21]] = !{i64 0, !"_ZTSFvu3u16E.normalized"} +// CHECK: ![[TYPE22]] = !{i64 0, !"_ZTSFvu3u16S_E.normalized"} +// CHECK: ![[TYPE23]] = !{i64 0, !"_ZTSFvu3u16S_S_E.normalized"} diff --git a/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-attr-no-sanitize.rs b/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-attr-no-sanitize.rs new file mode 100644 index 000000000..bb317e4a2 --- /dev/null +++ b/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-attr-no-sanitize.rs @@ -0,0 +1,30 @@ +// Verifies that KCFI operand bundles are omitted. +// +// revisions: aarch64 x86_64 +// [aarch64] compile-flags: --target aarch64-unknown-none +// [aarch64] needs-llvm-components: aarch64 +// [x86_64] compile-flags: --target x86_64-unknown-none +// [x86_64] needs-llvm-components: +// compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 + +#![crate_type="lib"] +#![feature(no_core, no_sanitize, lang_items)] +#![no_core] + +#[lang="sized"] +trait Sized { } +#[lang="copy"] +trait Copy { } + +impl Copy for i32 {} + +#[no_sanitize(kcfi)] +pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { + // CHECK-LABEL: sanitizer_kcfi_emit_kcfi_operand_bundle_attr_no_sanitize::foo + // CHECK: Function Attrs: {{.*}} + // CHECK-LABEL: define{{.*}}foo{{.*}}!{{|kcfi_type}} !{{[0-9]+}} + // CHECK: start: + // CHECK-NOT: {{%.+}} = call {{(noundef )*}}i32 %f(i32 {{(noundef )*}}%arg){{.*}}[ "kcfi"(i32 {{[-0-9]+}}) ] + // CHECK: ret i32 {{%.+}} + f(arg) +} diff --git a/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs b/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs new file mode 100644 index 000000000..29e4df351 --- /dev/null +++ b/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs @@ -0,0 +1,44 @@ +// Verifies that generalized KCFI type metadata for functions are emitted. +// +// revisions: aarch64 x86_64 +// [aarch64] compile-flags: --target aarch64-unknown-none +// [aarch64] needs-llvm-components: aarch64 +// [x86_64] compile-flags: --target x86_64-unknown-none +// [x86_64] needs-llvm-components: +// compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-generalize-pointers + +#![crate_type="lib"] +#![feature(no_core, lang_items)] +#![no_core] + +#[lang="sized"] +trait Sized { } +#[lang="copy"] +trait Copy { } + +impl Copy for i32 {} + +pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { + // CHECK-LABEL: define{{.*}}foo + // CHECK-SAME: {{.*}}!{{|kcfi_type}} ![[TYPE1:[0-9]+]] + // CHECK: {{%.+}} = call {{(noundef )*}}i32 %f(i32 {{(noundef )*}}%arg){{.*}}[ "kcfi"(i32 233085384) ] + f(arg) +} + +pub fn bar(f: fn(i32, i32) -> i32, arg1: i32, arg2: i32) -> i32 { + // CHECK-LABEL: define{{.*}}bar + // CHECK-SAME: {{.*}}!{{|kcfi_type}} ![[TYPE2:[0-9]+]] + // CHECK: {{%.+}} = call {{(noundef )*}}i32 %f(i32 {{(noundef )*}}%arg1, i32 {{(noundef )*}}%arg2){{.*}}[ "kcfi"(i32 435418021) ] + f(arg1, arg2) +} + +pub fn baz(f: fn(i32, i32, i32) -> i32, arg1: i32, arg2: i32, arg3: i32) -> i32 { + // CHECK-LABEL: define{{.*}}baz + // CHECK-SAME: {{.*}}!{{|kcfi_type}} ![[TYPE3:[0-9]+]] + // CHECK: {{%.+}} = call {{(noundef )*}}i32 %f(i32 {{(noundef )*}}%arg1, i32 {{(noundef )*}}%arg2, i32 {{(noundef )*}}%arg3){{.*}}[ "kcfi"(i32 -1003721339) ] + f(arg1, arg2, arg3) +} + +// CHECK: ![[TYPE1]] = !{i32 -1741689296} +// CHECK: ![[TYPE2]] = !{i32 489439372} +// CHECK: ![[TYPE3]] = !{i32 2026563871} diff --git a/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs b/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs new file mode 100644 index 000000000..84d678a33 --- /dev/null +++ b/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs @@ -0,0 +1,44 @@ +// Verifies that normalized and generalized KCFI type metadata for functions are emitted. +// +// revisions: aarch64 x86_64 +// [aarch64] compile-flags: --target aarch64-unknown-none +// [aarch64] needs-llvm-components: aarch64 +// [x86_64] compile-flags: --target x86_64-unknown-none +// [x86_64] needs-llvm-components: +// compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers -Zsanitizer-cfi-generalize-pointers + +#![crate_type="lib"] +#![feature(no_core, lang_items)] +#![no_core] + +#[lang="sized"] +trait Sized { } +#[lang="copy"] +trait Copy { } + +impl Copy for i32 {} + +pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { + // CHECK-LABEL: define{{.*}}foo + // CHECK-SAME: {{.*}}!{{|kcfi_type}} ![[TYPE1:[0-9]+]] + // CHECK: {{%.+}} = call {{(noundef )*}}i32 %f(i32 {{(noundef )*}}%arg){{.*}}[ "kcfi"(i32 -686570305) ] + f(arg) +} + +pub fn bar(f: fn(i32, i32) -> i32, arg1: i32, arg2: i32) -> i32 { + // CHECK-LABEL: define{{.*}}bar + // CHECK-SAME: {{.*}}!{{|kcfi_type}} ![[TYPE2:[0-9]+]] + // CHECK: {{%.+}} = call {{(noundef )*}}i32 %f(i32 {{(noundef )*}}%arg1, i32 {{(noundef )*}}%arg2){{.*}}[ "kcfi"(i32 1281038450) ] + f(arg1, arg2) +} + +pub fn baz(f: fn(i32, i32, i32) -> i32, arg1: i32, arg2: i32, arg3: i32) -> i32 { + // CHECK-LABEL: define{{.*}}baz + // CHECK-SAME: {{.*}}!{{|kcfi_type}} ![[TYPE3:[0-9]+]] + // CHECK: {{%.+}} = call {{(noundef )*}}i32 %f(i32 {{(noundef )*}}%arg1, i32 {{(noundef )*}}%arg2, i32 {{(noundef )*}}%arg3){{.*}}[ "kcfi"(i32 -1751512973) ] + f(arg1, arg2, arg3) +} + +// CHECK: ![[TYPE1]] = !{i32 975484707} +// CHECK: ![[TYPE2]] = !{i32 1658833102} +// CHECK: ![[TYPE3]] = !{i32 230429758} diff --git a/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs b/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs new file mode 100644 index 000000000..761c37a9e --- /dev/null +++ b/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs @@ -0,0 +1,44 @@ +// Verifies that normalized KCFI type metadata for functions are emitted. +// +// revisions: aarch64 x86_64 +// [aarch64] compile-flags: --target aarch64-unknown-none +// [aarch64] needs-llvm-components: aarch64 +// [x86_64] compile-flags: --target x86_64-unknown-none +// [x86_64] needs-llvm-components: +// compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers + +#![crate_type="lib"] +#![feature(no_core, lang_items)] +#![no_core] + +#[lang="sized"] +trait Sized { } +#[lang="copy"] +trait Copy { } + +impl Copy for i32 {} + +pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { + // CHECK-LABEL: define{{.*}}foo + // CHECK-SAME: {{.*}}!{{|kcfi_type}} ![[TYPE1:[0-9]+]] + // CHECK: {{%.+}} = call {{(noundef )*}}i32 %f(i32 {{(noundef )*}}%arg){{.*}}[ "kcfi"(i32 -841055669) ] + f(arg) +} + +pub fn bar(f: fn(i32, i32) -> i32, arg1: i32, arg2: i32) -> i32 { + // CHECK-LABEL: define{{.*}}bar + // CHECK-SAME: {{.*}}!{{|kcfi_type}} ![[TYPE2:[0-9]+]] + // CHECK: {{%.+}} = call {{(noundef )*}}i32 %f(i32 {{(noundef )*}}%arg1, i32 {{(noundef )*}}%arg2){{.*}}[ "kcfi"(i32 1390819368) ] + f(arg1, arg2) +} + +pub fn baz(f: fn(i32, i32, i32) -> i32, arg1: i32, arg2: i32, arg3: i32) -> i32 { + // CHECK-LABEL: define{{.*}}baz + // CHECK-SAME: {{.*}}!{{|kcfi_type}} ![[TYPE3:[0-9]+]] + // CHECK: {{%.+}} = call {{(noundef )*}}i32 %f(i32 {{(noundef )*}}%arg1, i32 {{(noundef )*}}%arg2, i32 {{(noundef )*}}%arg3){{.*}}[ "kcfi"(i32 586925835) ] + f(arg1, arg2, arg3) +} + +// CHECK: ![[TYPE1]] = !{i32 -458317079} +// CHECK: ![[TYPE2]] = !{i32 1737138182} +// CHECK: ![[TYPE3]] = !{i32 197182412} diff --git a/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi.rs b/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi.rs index 2537df80a..83cda0ef1 100644 --- a/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi.rs +++ b/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-itanium-cxx-abi.rs @@ -20,22 +20,22 @@ impl Copy for i32 {} pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { // CHECK-LABEL: define{{.*}}foo - // CHECK-SAME: {{.*}}!{{|kcfi_type}} ![[TYPE1:[0-9]+]] - // CHECK: call i32 %f(i32 %arg){{.*}}[ "kcfi"(i32 -1666898348) ] + // CHECK-SAME: {{.*}}!{{|kcfi_type}} ![[TYPE1:[0-9]+]] + // CHECK: {{%.+}} = call {{(noundef )*}}i32 %f(i32 {{(noundef )*}}%arg){{.*}}[ "kcfi"(i32 -1666898348) ] f(arg) } pub fn bar(f: fn(i32, i32) -> i32, arg1: i32, arg2: i32) -> i32 { // CHECK-LABEL: define{{.*}}bar - // CHECK-SAME: {{.*}}!{{|kcfi_type}} ![[TYPE2:[0-9]+]] - // CHECK: call i32 %f(i32 %arg1, i32 %arg2){{.*}}[ "kcfi"(i32 -1789026986) ] + // CHECK-SAME: {{.*}}!{{|kcfi_type}} ![[TYPE2:[0-9]+]] + // CHECK: {{%.+}} = call {{(noundef )*}}i32 %f(i32 {{(noundef )*}}%arg1, i32 {{(noundef )*}}%arg2){{.*}}[ "kcfi"(i32 -1789026986) ] f(arg1, arg2) } pub fn baz(f: fn(i32, i32, i32) -> i32, arg1: i32, arg2: i32, arg3: i32) -> i32 { // CHECK-LABEL: define{{.*}}baz - // CHECK-SAME: {{.*}}!{{|kcfi_type}} ![[TYPE3:[0-9]+]] - // CHECK: call i32 %f(i32 %arg1, i32 %arg2, i32 %arg3){{.*}}[ "kcfi"(i32 1248878270) ] + // CHECK-SAME: {{.*}}!{{|kcfi_type}} ![[TYPE3:[0-9]+]] + // CHECK: {{%.+}} = call {{(noundef )*}}i32 %f(i32 {{(noundef )*}}%arg1, i32 {{(noundef )*}}%arg2, i32 {{(noundef )*}}%arg3){{.*}}[ "kcfi"(i32 1248878270) ] f(arg1, arg2, arg3) } diff --git a/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle.rs b/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle.rs new file mode 100644 index 000000000..e1d617b5e --- /dev/null +++ b/tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle.rs @@ -0,0 +1,27 @@ +// Verifies that KCFI operand bundles are emitted. +// +// revisions: aarch64 x86_64 +// [aarch64] compile-flags: --target aarch64-unknown-none +// [aarch64] needs-llvm-components: aarch64 +// [x86_64] compile-flags: --target x86_64-unknown-none +// [x86_64] needs-llvm-components: +// compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 + +#![crate_type="lib"] +#![feature(no_core, lang_items)] +#![no_core] + +#[lang="sized"] +trait Sized { } +#[lang="copy"] +trait Copy { } + +impl Copy for i32 {} + +pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { + // CHECK-LABEL: define{{.*}}foo{{.*}}!{{|kcfi_type}} !{{[0-9]+}} + // CHECK: start: + // CHECK-NEXT: {{%.+}} = call {{(noundef )*}}i32 %f(i32 {{(noundef )*}}%arg){{.*}}[ "kcfi"(i32 {{[-0-9]+}}) ] + // CHECK-NEXT: ret i32 {{%.+}} + f(arg) +} diff --git a/tests/codegen/sanitizer-kcfi-emit-type-metadata-trait-objects.rs b/tests/codegen/sanitizer-kcfi-emit-type-metadata-trait-objects.rs new file mode 100644 index 000000000..004a67e7d --- /dev/null +++ b/tests/codegen/sanitizer-kcfi-emit-type-metadata-trait-objects.rs @@ -0,0 +1,144 @@ +// Verifies that type metadata identifiers for trait objects are emitted correctly. +// +// revisions: aarch64 x86_64 +// [aarch64] compile-flags: --target aarch64-unknown-none +// [aarch64] needs-llvm-components: aarch64 +// [x86_64] compile-flags: --target x86_64-unknown-none +// [x86_64] needs-llvm-components: +// compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 + +#![crate_type="lib"] +#![feature(arbitrary_self_types, no_core, lang_items)] +#![no_core] + +#[lang="sized"] +trait Sized { } +#[lang="copy"] +trait Copy { } +#[lang="receiver"] +trait Receiver { } +#[lang="dispatch_from_dyn"] +trait DispatchFromDyn { } +impl<'a, T: ?Sized + Unsize, U: ?Sized> DispatchFromDyn<&'a U> for &'a T {} +#[lang = "unsize"] +trait Unsize { } +#[lang = "coerce_unsized"] +pub trait CoerceUnsized { } +impl<'a, 'b: 'a, T: ?Sized + Unsize, U: ?Sized> CoerceUnsized<&'a U> for &'b T {} +#[lang="freeze"] +trait Freeze { } +#[lang="drop_in_place"] +fn drop_in_place_fn() { } + +pub trait Trait1 { + fn foo(&self); +} + +pub struct Type1; + +impl Trait1 for Type1 { + fn foo(&self) { + } +} + +pub trait Trait2 { + fn bar(&self); +} + +pub struct Type2; + +impl Trait2 for Type2 { + fn bar(&self) { + } +} + +pub trait Trait3 { + fn baz(&self, _: &T); +} + +pub struct Type3; + +impl Trait3 for T { + fn baz(&self, _: &U) { + } +} + +pub trait Trait4<'a, T> { + type Output: 'a; + fn qux(&self, _: &T) -> Self::Output; +} + +pub struct Type4; + +impl<'a, T, U> Trait4<'a, U> for T { + type Output = &'a i32; + fn qux(&self, _: &U) -> Self::Output { + &0 + } +} + +pub fn foo1(a: &dyn Trait1) { + a.foo(); + // CHECK-LABEL: define{{.*}}4foo1{{.*}}!{{|kcfi_type}} !{{[0-9]+}} + // CHECK: call void %{{[0-9]}}({{\{\}\*|ptr}} align 1 {{%[a-z]\.0|%_[0-9]}}){{.*}}[ "kcfi"(i32 [[TYPE1:[[:print:]]+]]) ] +} + +pub fn bar1() { + let a = Type1; + let b = &a as &dyn Trait1; + b.foo(); + // CHECK-LABEL: define{{.*}}4bar1{{.*}}!{{|kcfi_type}} !{{[0-9]+}} + // CHECK: call void %{{[0-9]}}({{\{\}\*|ptr}} align 1 {{%[a-z]\.0|%_[0-9]}}){{.*}}[ "kcfi"(i32 [[TYPE1:[[:print:]]+]]) ] +} + +pub fn foo2(a: &dyn Trait2) { + a.bar(); + // CHECK-LABEL: define{{.*}}4foo2{{.*}}!{{|kcfi_type}} !{{[0-9]+}} + // CHECK: call void %{{[0-9]}}({{\{\}\*|ptr}} align 1 {{%[a-z]\.0|%_[0-9]}}){{.*}}[ "kcfi"(i32 [[TYPE2:[[:print:]]+]]) ] +} + +pub fn bar2() { + let a = Type2; + foo2(&a); + let b = &a as &dyn Trait2; + b.bar(); + // CHECK-LABEL: define{{.*}}4bar2{{.*}}!{{|kcfi_type}} !{{[0-9]+}} + // CHECK: call void %{{[0-9]}}({{\{\}\*|ptr}} align 1 {{%[a-z]\.0|%_[0-9]}}){{.*}}[ "kcfi"(i32 [[TYPE2:[[:print:]]+]]) ] +} + +pub fn foo3(a: &dyn Trait3) { + let b = Type3; + a.baz(&b); + // CHECK-LABEL: define{{.*}}4foo3{{.*}}!{{|kcfi_type}} !{{[0-9]+}} + // CHECK: call void %{{[0-9]}}({{\{\}\*|ptr}} align 1 {{%[a-z]\.0|%_[0-9]}}, {{\{\}\*|ptr|%Type3\*}} align 1 {{%[a-z]\.0|%_[0-9]}}){{.*}}[ "kcfi"(i32 [[TYPE3:[[:print:]]+]]) ] +} + +pub fn bar3() { + let a = Type3; + foo3(&a); + let b = &a as &dyn Trait3; + b.baz(&a); + // CHECK-LABEL: define{{.*}}4bar3{{.*}}!{{|kcfi_type}} !{{[0-9]+}} + // CHECK: call void %{{[0-9]}}({{\{\}\*|ptr}} align 1 {{%[a-z]\.0|%_[0-9]}}, {{\{\}\*|ptr|%Type3\*}} align 1 {{%[a-z]\.0|%_[0-9]}}){{.*}}[ "kcfi"(i32 [[TYPE3:[[:print:]]+]]) ] +} + +pub fn foo4<'a>(a: &dyn Trait4<'a, Type4, Output = &'a i32>) { + let b = Type4; + a.qux(&b); + // CHECK-LABEL: define{{.*}}4foo4{{.*}}!{{|kcfi_type}} !{{[0-9]+}} + // CHECK: call align 4 {{ptr|i32\*}} %{{[0-9]}}({{\{\}\*|ptr}} align 1 {{%[a-z]\.0|%_[0-9]}}, {{\{\}\*|ptr|%Type4\*}} align 1 {{%[a-z]\.0|%_[0-9]}}){{.*}}[ "kcfi"(i32 [[TYPE4:[[:print:]]+]]) ] +} + +pub fn bar4<'a>() { + let a = Type4; + foo4(&a); + let b = &a as &dyn Trait4<'a, Type4, Output = &'a i32>; + b.qux(&a); + // CHECK-LABEL: define{{.*}}4bar4{{.*}}!{{|kcfi_type}} !{{[0-9]+}} + // CHECK: call align 4 {{ptr|i32\*}} %{{[0-9]}}({{\{\}\*|ptr}} align 1 {{%[a-z]\.0|%_[0-9]}}, {{\{\}\*|ptr|%Type4\*}} align 1 {{%[a-z]\.0|%_[0-9]}}){{.*}}[ "kcfi"(i32 [[TYPE4:[[:print:]]+]]) ] +} + +// CHECK: !{{[0-9]+}} = !{i32 [[TYPE1]]} +// CHECK: !{{[0-9]+}} = !{i32 [[TYPE2]]} +// CHECK: !{{[0-9]+}} = !{i32 [[TYPE3]]} +// CHECK: !{{[0-9]+}} = !{i32 [[TYPE4]]} diff --git a/tests/codegen/slice-iter-nonnull.rs b/tests/codegen/slice-iter-nonnull.rs new file mode 100644 index 000000000..997bdaf56 --- /dev/null +++ b/tests/codegen/slice-iter-nonnull.rs @@ -0,0 +1,77 @@ +// no-system-llvm +// compile-flags: -O +// ignore-debug (these add extra checks that make it hard to verify) +#![crate_type = "lib"] + +// The slice iterator used to `assume` that the `start` pointer was non-null. +// That ought to be unneeded, though, since the type is `NonNull`, so this test +// confirms that the appropriate metadata is included to denote that. + +// CHECK-LABEL: @slice_iter_next( +#[no_mangle] +pub fn slice_iter_next<'a>(it: &mut std::slice::Iter<'a, u32>) -> Option<&'a u32> { + // CHECK: %[[ENDP:.+]] = getelementptr{{.+}}ptr %it,{{.+}} 1 + // CHECK: %[[END:.+]] = load ptr, ptr %[[ENDP]] + // CHECK-SAME: !nonnull + // CHECK-SAME: !noundef + // CHECK: %[[START:.+]] = load ptr, ptr %it, + // CHECK-SAME: !nonnull + // CHECK-SAME: !noundef + // CHECK: icmp eq ptr %[[START]], %[[END]] + + // CHECK: store ptr{{.+}}, ptr %it, + + it.next() +} + +// CHECK-LABEL: @slice_iter_next_back( +#[no_mangle] +pub fn slice_iter_next_back<'a>(it: &mut std::slice::Iter<'a, u32>) -> Option<&'a u32> { + // CHECK: %[[ENDP:.+]] = getelementptr{{.+}}ptr %it,{{.+}} 1 + // CHECK: %[[END:.+]] = load ptr, ptr %[[ENDP]] + // CHECK-SAME: !nonnull + // CHECK-SAME: !noundef + // CHECK: %[[START:.+]] = load ptr, ptr %it, + // CHECK-SAME: !nonnull + // CHECK-SAME: !noundef + // CHECK: icmp eq ptr %[[START]], %[[END]] + + // CHECK: store ptr{{.+}}, ptr %[[ENDP]], + + it.next_back() +} + +// The slice iterator `new` methods used to `assume` that the pointer is non-null, +// but passing slices already requires that, to the extent that LLVM actually +// removed the `call @llvm.assume` anyway. These tests just demonstrate that the +// attribute is there, and confirms adding the assume back doesn't do anything. + +// CHECK-LABEL: @slice_iter_new +// CHECK-SAME: (ptr noalias noundef nonnull {{.+}} %slice.0, {{.+}} noundef %slice.1) +#[no_mangle] +pub fn slice_iter_new(slice: &[u32]) -> std::slice::Iter<'_, u32> { + // CHECK-NOT: slice + // CHECK: %[[END:.+]] = getelementptr inbounds i32{{.+}} %slice.0{{.+}} %slice.1 + // CHECK-NOT: slice + // CHECK: insertvalue {{.+}} ptr %slice.0, 0 + // CHECK-NOT: slice + // CHECK: insertvalue {{.+}} ptr %[[END]], 1 + // CHECK-NOT: slice + // CHECK: } + slice.iter() +} + +// CHECK-LABEL: @slice_iter_mut_new +// CHECK-SAME: (ptr noalias noundef nonnull {{.+}} %slice.0, {{.+}} noundef %slice.1) +#[no_mangle] +pub fn slice_iter_mut_new(slice: &mut [u32]) -> std::slice::IterMut<'_, u32> { + // CHECK-NOT: slice + // CHECK: %[[END:.+]] = getelementptr inbounds i32{{.+}} %slice.0{{.+}} %slice.1 + // CHECK-NOT: slice + // CHECK: insertvalue {{.+}} ptr %slice.0, 0 + // CHECK-NOT: slice + // CHECK: insertvalue {{.+}} ptr %[[END]], 1 + // CHECK-NOT: slice + // CHECK: } + slice.iter_mut() +} diff --git a/tests/codegen/split-lto-unit.rs b/tests/codegen/split-lto-unit.rs new file mode 100644 index 000000000..dc6570be3 --- /dev/null +++ b/tests/codegen/split-lto-unit.rs @@ -0,0 +1,11 @@ +// Verifies that "EnableSplitLTOUnit" module flag is added. +// +// needs-sanitizer-cfi +// compile-flags: -Clto -Ctarget-feature=-crt-static -Zsplit-lto-unit + +#![crate_type="lib"] + +pub fn foo() { +} + +// CHECK: !{{[0-9]+}} = !{i32 4, !"EnableSplitLTOUnit", i32 1} diff --git a/tests/codegen/thread-local.rs b/tests/codegen/thread-local.rs index aa7fab7fb..caf0366d2 100644 --- a/tests/codegen/thread-local.rs +++ b/tests/codegen/thread-local.rs @@ -20,8 +20,8 @@ thread_local!(static A: Cell = const { Cell::new(1) }); // CHECK-LABEL: @get #[no_mangle] fn get() -> u32 { - // CHECK: %0 = load i32, {{.*}}[[TLS]]{{.*}} - // CHECK-NEXT: ret i32 %0 + // CHECK: [[RET_0:%.+]] = load i32, {{.*}}[[TLS]]{{.*}} + // CHECK-NEXT: ret i32 [[RET_0]] A.with(|a| a.get()) } @@ -36,8 +36,8 @@ fn set(v: u32) { // CHECK-LABEL: @get_aux #[no_mangle] fn get_aux() -> u64 { - // CHECK: %0 = load i64, {{.*}}[[TLS_AUX]] - // CHECK-NEXT: ret i64 %0 + // CHECK: [[RET_1:%.+]] = load i64, {{.*}}[[TLS_AUX]] + // CHECK-NEXT: ret i64 [[RET_1]] aux::A.with(|a| a.get()) } diff --git a/tests/codegen/tied-features-strength.rs b/tests/codegen/tied-features-strength.rs new file mode 100644 index 000000000..51334c121 --- /dev/null +++ b/tests/codegen/tied-features-strength.rs @@ -0,0 +1,29 @@ +// ignore-tidy-linelength +// revisions: ENABLE_SVE DISABLE_SVE DISABLE_NEON ENABLE_NEON +// compile-flags: --crate-type=rlib --target=aarch64-unknown-linux-gnu +// needs-llvm-components: aarch64 + +// The "+v8a" feature is matched as optional as it isn't added when we +// are targeting older LLVM versions. Once the min supported version +// is LLVM-14 we can remove the optional regex matching for this feature. + +// [ENABLE_SVE] compile-flags: -C target-feature=+sve +// ENABLE_SVE: attributes #0 = { {{.*}} "target-features"="{{((\+outline-atomics,?)|(\+v8a,?)?|(\+sve,?)|(\+neon,?))*}}" } + +// [DISABLE_SVE] compile-flags: -C target-feature=-sve +// DISABLE_SVE: attributes #0 = { {{.*}} "target-features"="{{((\+outline-atomics,?)|(\+v8a,?)?|(-sve,?)|(\+neon,?))*}}" } + +// [DISABLE_NEON] compile-flags: -C target-feature=-neon +// DISABLE_NEON: attributes #0 = { {{.*}} "target-features"="{{((\+outline-atomics,?)|(\+v8a,?)?|(-fp-armv8,?)|(-neon,?))*}}" } + +// [ENABLE_NEON] compile-flags: -C target-feature=+neon +// ENABLE_NEON: attributes #0 = { {{.*}} "target-features"="{{((\+outline-atomics,?)|(\+v8a,?)?|(\+fp-armv8,?)|(\+neon,?))*}}" } + + +#![feature(no_core, lang_items)] +#![no_core] + +#[lang = "sized"] +trait Sized {} + +pub fn test() {} diff --git a/tests/codegen/transmute-optimized.rs b/tests/codegen/transmute-optimized.rs new file mode 100644 index 000000000..461dd550c --- /dev/null +++ b/tests/codegen/transmute-optimized.rs @@ -0,0 +1,109 @@ +// compile-flags: -O -Z merge-functions=disabled +// min-llvm-version: 15.0 # this test uses `ptr`s +// ignore-debug + +#![crate_type = "lib"] + +// This tests that LLVM can optimize based on the niches in the source or +// destination types for transmutes. + +#[repr(u32)] +pub enum AlwaysZero32 { X = 0 } + +// CHECK-LABEL: i32 @issue_109958(i32 +#[no_mangle] +pub fn issue_109958(x: AlwaysZero32) -> i32 { + // CHECK: ret i32 0 + unsafe { std::mem::transmute(x) } +} + +// CHECK-LABEL: i1 @reference_is_null(ptr +#[no_mangle] +pub fn reference_is_null(x: &i32) -> bool { + // CHECK: ret i1 false + let p: *const i32 = unsafe { std::mem::transmute(x) }; + p.is_null() +} + +// CHECK-LABEL: i1 @non_null_is_null(ptr +#[no_mangle] +pub fn non_null_is_null(x: std::ptr::NonNull) -> bool { + // CHECK: ret i1 false + let p: *const i32 = unsafe { std::mem::transmute(x) }; + p.is_null() +} + +// CHECK-LABEL: i1 @non_zero_is_null( +#[no_mangle] +pub fn non_zero_is_null(x: std::num::NonZeroUsize) -> bool { + // CHECK: ret i1 false + let p: *const i32 = unsafe { std::mem::transmute(x) }; + p.is_null() +} + +// CHECK-LABEL: i1 @non_null_is_zero(ptr +#[no_mangle] +pub fn non_null_is_zero(x: std::ptr::NonNull) -> bool { + // CHECK: ret i1 false + let a: isize = unsafe { std::mem::transmute(x) }; + a == 0 +} + +// CHECK-LABEL: i1 @bool_ordering_is_ge(i1 +#[no_mangle] +pub fn bool_ordering_is_ge(x: bool) -> bool { + // CHECK: ret i1 true + let y: std::cmp::Ordering = unsafe { std::mem::transmute(x) }; + y.is_ge() +} + +// CHECK-LABEL: i1 @ordering_is_ge_then_transmute_to_bool(i8 +#[no_mangle] +pub fn ordering_is_ge_then_transmute_to_bool(x: std::cmp::Ordering) -> bool { + let r = x.is_ge(); + let _: bool = unsafe { std::mem::transmute(x) }; + r +} + +// CHECK-LABEL: i32 @normal_div(i32 +#[no_mangle] +pub fn normal_div(a: u32, b: u32) -> u32 { + // CHECK: call core::panicking::panic + a / b +} + +// CHECK-LABEL: i32 @div_transmute_nonzero(i32 +#[no_mangle] +pub fn div_transmute_nonzero(a: u32, b: std::num::NonZeroI32) -> u32 { + // CHECK-NOT: call core::panicking::panic + // CHECK: %[[R:.+]] = udiv i32 %a, %b + // CHECK-NEXT: ret i32 %[[R]] + // CHECK-NOT: call core::panicking::panic + let d: u32 = unsafe { std::mem::transmute(b) }; + a / d +} + +#[repr(i8)] +pub enum OneTwoThree { One = 1, Two = 2, Three = 3 } + +// CHECK-LABEL: i8 @ordering_transmute_onetwothree(i8 +#[no_mangle] +pub unsafe fn ordering_transmute_onetwothree(x: std::cmp::Ordering) -> OneTwoThree { + // CHECK: ret i8 1 + std::mem::transmute(x) +} + +// CHECK-LABEL: i8 @onetwothree_transmute_ordering(i8 +#[no_mangle] +pub unsafe fn onetwothree_transmute_ordering(x: OneTwoThree) -> std::cmp::Ordering { + // CHECK: ret i8 1 + std::mem::transmute(x) +} + +// CHECK-LABEL: i1 @char_is_negative(i32 +#[no_mangle] +pub fn char_is_negative(c: char) -> bool { + // CHECK: ret i1 false + let x: i32 = unsafe { std::mem::transmute(c) }; + x < 0 +} diff --git a/tests/codegen/transmute-scalar.rs b/tests/codegen/transmute-scalar.rs index af2cef472..a0894a505 100644 --- a/tests/codegen/transmute-scalar.rs +++ b/tests/codegen/transmute-scalar.rs @@ -1,4 +1,4 @@ -// compile-flags: -O -C no-prepopulate-passes +// compile-flags: -C opt-level=0 -C no-prepopulate-passes // min-llvm-version: 15.0 # this test assumes `ptr`s and thus no `pointercast`s #![crate_type = "lib"] @@ -10,7 +10,7 @@ // However, `bitcast`s and `ptrtoint`s and `inttoptr`s are still worth doing when // that allows us to avoid the `alloca`s entirely; see `rvalue_creates_operand`. -// CHECK-LABEL: define{{.*}}i32 @f32_to_bits(float noundef %x) +// CHECK-LABEL: define{{.*}}i32 @f32_to_bits(float %x) // CHECK: %0 = bitcast float %x to i32 // CHECK-NEXT: ret i32 %0 #[no_mangle] @@ -18,7 +18,7 @@ pub fn f32_to_bits(x: f32) -> u32 { unsafe { std::mem::transmute(x) } } -// CHECK-LABEL: define{{.*}}i8 @bool_to_byte(i1 noundef zeroext %b) +// CHECK-LABEL: define{{.*}}i8 @bool_to_byte(i1 zeroext %b) // CHECK: %0 = zext i1 %b to i8 // CHECK-NEXT: ret i8 %0 #[no_mangle] @@ -26,7 +26,7 @@ pub fn bool_to_byte(b: bool) -> u8 { unsafe { std::mem::transmute(b) } } -// CHECK-LABEL: define{{.*}}noundef zeroext i1 @byte_to_bool(i8 noundef %byte) +// CHECK-LABEL: define{{.*}}zeroext i1 @byte_to_bool(i8 %byte) // CHECK: %0 = trunc i8 %byte to i1 // CHECK-NEXT: ret i1 %0 #[no_mangle] @@ -34,14 +34,14 @@ pub unsafe fn byte_to_bool(byte: u8) -> bool { std::mem::transmute(byte) } -// CHECK-LABEL: define{{.*}}ptr @ptr_to_ptr(ptr noundef %p) +// CHECK-LABEL: define{{.*}}ptr @ptr_to_ptr(ptr %p) // CHECK: ret ptr %p #[no_mangle] pub fn ptr_to_ptr(p: *mut u16) -> *mut u8 { unsafe { std::mem::transmute(p) } } -// CHECK: define{{.*}}[[USIZE:i[0-9]+]] @ptr_to_int(ptr noundef %p) +// CHECK: define{{.*}}[[USIZE:i[0-9]+]] @ptr_to_int(ptr %p) // CHECK: %0 = ptrtoint ptr %p to [[USIZE]] // CHECK-NEXT: ret [[USIZE]] %0 #[no_mangle] @@ -49,7 +49,7 @@ pub fn ptr_to_int(p: *mut u16) -> usize { unsafe { std::mem::transmute(p) } } -// CHECK: define{{.*}}ptr @int_to_ptr([[USIZE]] noundef %i) +// CHECK: define{{.*}}ptr @int_to_ptr([[USIZE]] %i) // CHECK: %0 = inttoptr [[USIZE]] %i to ptr // CHECK-NEXT: ret ptr %0 #[no_mangle] diff --git a/tests/codegen/vec-optimizes-away.rs b/tests/codegen/vec-optimizes-away.rs index 9143fad23..6f477a796 100644 --- a/tests/codegen/vec-optimizes-away.rs +++ b/tests/codegen/vec-optimizes-away.rs @@ -1,12 +1,13 @@ // ignore-debug: the debug assertions get in the way // no-system-llvm // compile-flags: -O -#![crate_type="lib"] +#![crate_type = "lib"] #[no_mangle] pub fn sum_me() -> i32 { // CHECK-LABEL: @sum_me // CHECK-NEXT: {{^.*:$}} + // CHECK-NEXT: {{.*}} load volatile i8, ptr @__rust_no_alloc_shim_is_unstable, align 1 // CHECK-NEXT: ret i32 6 vec![1, 2, 3].iter().sum::() } diff --git a/tests/codegen/vec-shrink-panik.rs b/tests/codegen/vec-shrink-panik.rs index b3c3483fe..88b7edff2 100644 --- a/tests/codegen/vec-shrink-panik.rs +++ b/tests/codegen/vec-shrink-panik.rs @@ -25,7 +25,7 @@ pub fn issue71861(vec: Vec) -> Box<[u32]> { // Call to panic_cannot_unwind in case of double-panic is expected // on LLVM 16 and older, but other panics are not. - // CHECK: cleanup + // old: filter // old-NEXT: ; call core::panicking::panic_cannot_unwind // old-NEXT: panic_cannot_unwind @@ -40,7 +40,7 @@ pub fn issue75636<'a>(iter: &[&'a str]) -> Box<[&'a str]> { // Call to panic_cannot_unwind in case of double-panic is expected, // on LLVM 16 and older, but other panics are not. - // CHECK: cleanup + // old: filter // old-NEXT: ; call core::panicking::panic_cannot_unwind // old-NEXT: panic_cannot_unwind diff --git a/tests/debuginfo/associated-types.rs b/tests/debuginfo/associated-types.rs index 0a0ce3c67..a1735520b 100644 --- a/tests/debuginfo/associated-types.rs +++ b/tests/debuginfo/associated-types.rs @@ -1,6 +1,6 @@ // Some versions of the non-rust-enabled LLDB print the wrong generic // parameter type names in this test. -// rust-lldb +// needs-rust-lldb // compile-flags:-g diff --git a/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.rs b/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.rs index 327515b10..c187df637 100644 --- a/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.rs +++ b/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.rs @@ -2,7 +2,6 @@ // ignore-lldb // no-prefer-dynamic -#![feature(debugger_visualizer)] #![debugger_visualizer(natvis_file = "dependency-with-embedded-visualizers.natvis")] #![debugger_visualizer(gdb_script_file = "dependency-with-embedded-visualizers.py")] #![crate_type = "rlib"] diff --git a/tests/debuginfo/auxiliary/macro-stepping.rs b/tests/debuginfo/auxiliary/macro-stepping.rs index 4447dd22d..ae50e1144 100644 --- a/tests/debuginfo/auxiliary/macro-stepping.rs +++ b/tests/debuginfo/auxiliary/macro-stepping.rs @@ -5,6 +5,6 @@ #[macro_export] macro_rules! new_scope { () => { - let x = 1; + let x = 1; opaque(x); } } diff --git a/tests/debuginfo/borrowed-enum.rs b/tests/debuginfo/borrowed-enum.rs index f3e465dc6..37d458cb4 100644 --- a/tests/debuginfo/borrowed-enum.rs +++ b/tests/debuginfo/borrowed-enum.rs @@ -1,6 +1,6 @@ // Require a gdb or lldb that can read DW_TAG_variant_part. // min-gdb-version: 8.2 -// rust-lldb +// needs-rust-lldb // compile-flags:-g diff --git a/tests/debuginfo/embedded-visualizer.rs b/tests/debuginfo/embedded-visualizer.rs index 2898e75e0..ac4210928 100644 --- a/tests/debuginfo/embedded-visualizer.rs +++ b/tests/debuginfo/embedded-visualizer.rs @@ -60,7 +60,6 @@ // gdb-check:$4 = "Person A" is 10 years old. #![allow(unused_variables)] -#![feature(debugger_visualizer)] #![debugger_visualizer(natvis_file = "embedded-visualizer.natvis")] #![debugger_visualizer(gdb_script_file = "embedded-visualizer.py")] diff --git a/tests/debuginfo/generic-method-on-generic-struct.rs b/tests/debuginfo/generic-method-on-generic-struct.rs index 97609ef5d..2d54c2b07 100644 --- a/tests/debuginfo/generic-method-on-generic-struct.rs +++ b/tests/debuginfo/generic-method-on-generic-struct.rs @@ -2,7 +2,7 @@ // Some versions of the non-rust-enabled LLDB print the wrong generic // parameter type names in this test. -// rust-lldb +// needs-rust-lldb // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/generic-struct.rs b/tests/debuginfo/generic-struct.rs index 5fa5ce800..5213eebc1 100644 --- a/tests/debuginfo/generic-struct.rs +++ b/tests/debuginfo/generic-struct.rs @@ -1,6 +1,6 @@ // Some versions of the non-rust-enabled LLDB print the wrong generic // parameter type names in this test. -// rust-lldb +// needs-rust-lldb // compile-flags:-g diff --git a/tests/debuginfo/generic-tuple-style-enum.rs b/tests/debuginfo/generic-tuple-style-enum.rs index 60362e54e..a55402691 100644 --- a/tests/debuginfo/generic-tuple-style-enum.rs +++ b/tests/debuginfo/generic-tuple-style-enum.rs @@ -1,6 +1,6 @@ // Require a gdb or lldb that can read DW_TAG_variant_part. // min-gdb-version: 8.2 -// rust-lldb +// needs-rust-lldb // compile-flags:-g diff --git a/tests/debuginfo/macro-stepping.rs b/tests/debuginfo/macro-stepping.rs index e4b2b7b79..a7287cffd 100644 --- a/tests/debuginfo/macro-stepping.rs +++ b/tests/debuginfo/macro-stepping.rs @@ -79,22 +79,28 @@ extern crate macro_stepping; // exports new_scope!() // lldb-check:[...]#inc-loc2[...] // lldb-command:next // lldb-command:frame select +// lldb-check:[...]#inc-loc1[...] +// lldb-command:next +// lldb-command:frame select +// lldb-check:[...]#inc-loc2[...] +// lldb-command:next +// lldb-command:frame select // lldb-check:[...]#inc-loc3[...] macro_rules! foo { () => { - let a = 1; - let b = 2; - let c = 3; - } + let a = 1; opaque(a); + let b = 2; opaque(b); + let c = 3; opaque(c); + }; } macro_rules! foo2 { () => { foo!(); - let x = 1; + let x = 1; opaque(x); foo!(); - } + }; } fn main() { @@ -118,4 +124,6 @@ fn main() { fn zzz() {()} +fn opaque(_: u32) {} + include!("macro-stepping.inc"); diff --git a/tests/debuginfo/method-on-generic-struct.rs b/tests/debuginfo/method-on-generic-struct.rs index bf0474491..138d8391d 100644 --- a/tests/debuginfo/method-on-generic-struct.rs +++ b/tests/debuginfo/method-on-generic-struct.rs @@ -1,6 +1,6 @@ // Some versions of the non-rust-enabled LLDB print the wrong generic // parameter type names in this test. -// rust-lldb +// needs-rust-lldb // compile-flags:-g diff --git a/tests/debuginfo/pretty-std.rs b/tests/debuginfo/pretty-std.rs index 7bb2810c2..c7df7dc3c 100644 --- a/tests/debuginfo/pretty-std.rs +++ b/tests/debuginfo/pretty-std.rs @@ -130,8 +130,8 @@ // cdb-check: [+0x000] __0 : "IAMA optional string!" [Type: alloc::string::String] // cdb-command: dx linkedlist -// cdb-check:linkedlist : { len=0x2 } [Type: alloc::collections::linked_list::LinkedList] -// cdb-check: [] [Type: alloc::collections::linked_list::LinkedList] +// cdb-check:linkedlist : { len=0x2 } [Type: alloc::collections::linked_list::LinkedList] +// cdb-check: [] [Type: alloc::collections::linked_list::LinkedList] // cdb-check: [0x0] : 128 [Type: int] // cdb-check: [0x1] : 42 [Type: int] diff --git a/tests/debuginfo/reference-debuginfo.rs b/tests/debuginfo/reference-debuginfo.rs new file mode 100644 index 000000000..85ade170a --- /dev/null +++ b/tests/debuginfo/reference-debuginfo.rs @@ -0,0 +1,173 @@ +// Copy of `borrowed-basic.rs` which enables the `ReferencePropagation` MIR pass. +// That pass replaces debuginfo for `a => _x` where `_x = &b` to be `a => &b`, +// and leaves codegen to create a ladder of allocations so as `*a == b`. +// +// compile-flags:-g -Zmir-enable-passes=+ReferencePropagation,-ConstDebugInfo +// min-lldb-version: 310 + +// === GDB TESTS =================================================================================== + +// gdb-command:run +// gdb-command:print *bool_ref +// gdb-check:$1 = true + +// gdb-command:print *int_ref +// gdb-check:$2 = -1 + +// gdb-command:print/d *char_ref +// gdb-check:$3 = 97 + +// gdb-command:print *i8_ref +// gdbg-check:$4 = 68 'D' +// gdbr-check:$4 = 68 + +// gdb-command:print *i16_ref +// gdb-check:$5 = -16 + +// gdb-command:print *i32_ref +// gdb-check:$6 = -32 + +// gdb-command:print *i64_ref +// gdb-check:$7 = -64 + +// gdb-command:print *uint_ref +// gdb-check:$8 = 1 + +// gdb-command:print *u8_ref +// gdbg-check:$9 = 100 'd' +// gdbr-check:$9 = 100 + +// gdb-command:print *u16_ref +// gdb-check:$10 = 16 + +// gdb-command:print *u32_ref +// gdb-check:$11 = 32 + +// gdb-command:print *u64_ref +// gdb-check:$12 = 64 + +// gdb-command:print *f32_ref +// gdb-check:$13 = 2.5 + +// gdb-command:print *f64_ref +// gdb-check:$14 = 3.5 + +// gdb-command:print *f64_double_ref +// gdb-check:$15 = 3.5 + + +// === LLDB TESTS ================================================================================== + +// lldb-command:run +// lldb-command:print *bool_ref +// lldbg-check:[...]$0 = true +// lldbr-check:(bool) *bool_ref = true + +// lldb-command:print *int_ref +// lldbg-check:[...]$1 = -1 +// lldbr-check:(isize) *int_ref = -1 + +// NOTE: only rust-enabled lldb supports 32bit chars +// lldbr-command:print *char_ref +// lldbr-check:(char) *char_ref = 'a' + +// lldb-command:print *i8_ref +// lldbg-check:[...]$2 = 'D' +// lldbr-check:(i8) *i8_ref = 68 + +// lldb-command:print *i16_ref +// lldbg-check:[...]$3 = -16 +// lldbr-check:(i16) *i16_ref = -16 + +// lldb-command:print *i32_ref +// lldbg-check:[...]$4 = -32 +// lldbr-check:(i32) *i32_ref = -32 + +// lldb-command:print *i64_ref +// lldbg-check:[...]$5 = -64 +// lldbr-check:(i64) *i64_ref = -64 + +// lldb-command:print *uint_ref +// lldbg-check:[...]$6 = 1 +// lldbr-check:(usize) *uint_ref = 1 + +// lldb-command:print *u8_ref +// lldbg-check:[...]$7 = 'd' +// lldbr-check:(u8) *u8_ref = 100 + +// lldb-command:print *u16_ref +// lldbg-check:[...]$8 = 16 +// lldbr-check:(u16) *u16_ref = 16 + +// lldb-command:print *u32_ref +// lldbg-check:[...]$9 = 32 +// lldbr-check:(u32) *u32_ref = 32 + +// lldb-command:print *u64_ref +// lldbg-check:[...]$10 = 64 +// lldbr-check:(u64) *u64_ref = 64 + +// lldb-command:print *f32_ref +// lldbg-check:[...]$11 = 2.5 +// lldbr-check:(f32) *f32_ref = 2.5 + +// lldb-command:print *f64_ref +// lldbg-check:[...]$12 = 3.5 +// lldbr-check:(f64) *f64_ref = 3.5 + +// lldb-command:print *f64_double_ref +// lldbg-check:[...]$13 = 3.5 +// lldbr-check:(f64) **f64_double_ref = 3.5 + +#![allow(unused_variables)] +#![feature(omit_gdb_pretty_printer_section)] +#![omit_gdb_pretty_printer_section] + +fn main() { + let bool_val: bool = true; + let bool_ref: &bool = &bool_val; + + let int_val: isize = -1; + let int_ref: &isize = &int_val; + + let char_val: char = 'a'; + let char_ref: &char = &char_val; + + let i8_val: i8 = 68; + let i8_ref: &i8 = &i8_val; + + let i16_val: i16 = -16; + let i16_ref: &i16 = &i16_val; + + let i32_val: i32 = -32; + let i32_ref: &i32 = &i32_val; + + let i64_val: i64 = -64; + let i64_ref: &i64 = &i64_val; + + let uint_val: usize = 1; + let uint_ref: &usize = &uint_val; + + let u8_val: u8 = 100; + let u8_ref: &u8 = &u8_val; + + let u16_val: u16 = 16; + let u16_ref: &u16 = &u16_val; + + let u32_val: u32 = 32; + let u32_ref: &u32 = &u32_val; + + let u64_val: u64 = 64; + let u64_ref: &u64 = &u64_val; + + let f32_val: f32 = 2.5; + let f32_ref: &f32 = &f32_val; + + let f64_val: f64 = 3.5; + let f64_ref: &f64 = &f64_val; + let f64_double_ref: &f64 = &f64_ref; + + zzz(); // #break +} + +fn zzz() {()} diff --git a/tests/debuginfo/struct-style-enum.rs b/tests/debuginfo/struct-style-enum.rs index 3d819e368..0152dd9ea 100644 --- a/tests/debuginfo/struct-style-enum.rs +++ b/tests/debuginfo/struct-style-enum.rs @@ -1,6 +1,6 @@ // Require a gdb or lldb that can read DW_TAG_variant_part. // min-gdb-version: 8.2 -// rust-lldb +// needs-rust-lldb // compile-flags:-g diff --git a/tests/debuginfo/thread.rs b/tests/debuginfo/thread.rs index 388d50c5c..e7e83c7aa 100644 --- a/tests/debuginfo/thread.rs +++ b/tests/debuginfo/thread.rs @@ -1,4 +1,4 @@ -// Testing the the display of JoinHandle and Thread in cdb. +// Testing the display of JoinHandle and Thread in cdb. // cdb-only // min-cdb-version: 10.0.18317.1001 diff --git a/tests/debuginfo/tuple-style-enum.rs b/tests/debuginfo/tuple-style-enum.rs index 39ead172e..60f3ecbd2 100644 --- a/tests/debuginfo/tuple-style-enum.rs +++ b/tests/debuginfo/tuple-style-enum.rs @@ -1,6 +1,6 @@ // Require a gdb or lldb that can read DW_TAG_variant_part. // min-gdb-version: 8.2 -// rust-lldb +// needs-rust-lldb // compile-flags:-g diff --git a/tests/debuginfo/unique-enum.rs b/tests/debuginfo/unique-enum.rs index d7dfaeefe..1ff6f5d9c 100644 --- a/tests/debuginfo/unique-enum.rs +++ b/tests/debuginfo/unique-enum.rs @@ -1,6 +1,6 @@ // Require a gdb or lldb that can read DW_TAG_variant_part. // min-gdb-version: 8.2 -// rust-lldb +// needs-rust-lldb // compile-flags:-g diff --git a/tests/debuginfo/unsized.rs b/tests/debuginfo/unsized.rs index b1ec9b068..3b8280bc4 100644 --- a/tests/debuginfo/unsized.rs +++ b/tests/debuginfo/unsized.rs @@ -1,4 +1,6 @@ // compile-flags:-g +// ignore-gdb-version: 13.1 - 99.0 +// ^ https://sourceware.org/bugzilla/show_bug.cgi?id=30330 // === GDB TESTS =================================================================================== diff --git a/tests/incremental/change_crate_dep_kind.rs b/tests/incremental/change_crate_dep_kind.rs index 8c35f6ca0..f51826601 100644 --- a/tests/incremental/change_crate_dep_kind.rs +++ b/tests/incremental/change_crate_dep_kind.rs @@ -2,6 +2,7 @@ // detected then -Zincremental-verify-ich will trigger an assertion. // ignore-wasm32-bare compiled with panic=abort by default +// needs-unwind // revisions:cfail1 cfail2 // compile-flags: -Z query-dep-graph -Cpanic=unwind // build-pass (FIXME(62277): could be check-pass?) diff --git a/tests/incremental/const-generic-type-cycle.rs b/tests/incremental/const-generic-type-cycle.rs new file mode 100644 index 000000000..ca7b12e9e --- /dev/null +++ b/tests/incremental/const-generic-type-cycle.rs @@ -0,0 +1,17 @@ +// Verify that we do not ICE when we try to overwrite an anon-const's type because of a trait +// cycle. +// +// compile-flags: -Zincremental-ignore-spans +// revisions: cpass cfail +// error-pattern: cycle detected when computing type of `Bar::N` + +#![feature(trait_alias)] +#![crate_type="lib"] + +#[cfg(cpass)] +trait Bar {} + +#[cfg(cfail)] +trait Bar {} + +trait BB = Bar<{ 2 + 1 }>; diff --git a/tests/incremental/const-generics/change-const-param-gat.rs b/tests/incremental/const-generics/change-const-param-gat.rs new file mode 100644 index 000000000..f1449d568 --- /dev/null +++ b/tests/incremental/const-generics/change-const-param-gat.rs @@ -0,0 +1,29 @@ +// revisions: rpass1 rpass2 rpass3 +// compile-flags: -Zincremental-ignore-spans +#![feature(generic_associated_types)] + +// This test unsures that with_opt_const_param returns the +// def_id of the N param in the Foo::Assoc GAT. + +trait Foo { + type Assoc; + fn foo( + &self, + ) -> Self::Assoc<{ if cfg!(rpass2) { 3 } else { 2 } }>; +} + +impl Foo for () { + type Assoc = [(); N]; + fn foo( + &self, + ) -> Self::Assoc<{ if cfg!(rpass2) { 3 } else { 2 } }> { + [(); { if cfg!(rpass2) { 3 } else { 2 } }] + } +} + +fn main() { + assert_eq!( + ().foo(), + [(); { if cfg!(rpass2) { 3 } else { 2 } }] + ); +} diff --git a/tests/incremental/const-generics/change-const-param-type.rs b/tests/incremental/const-generics/change-const-param-type.rs new file mode 100644 index 000000000..1aac1bc7d --- /dev/null +++ b/tests/incremental/const-generics/change-const-param-type.rs @@ -0,0 +1,68 @@ +// revisions: rpass1 rpass2 rpass3 +// compile-flags: -Zincremental-ignore-spans + +enum Foo { + Variant, + Variant2(), + Variant3 {}, +} + +impl Foo<1> { + fn foo(&self) -> [(); N] { [(); N] } +} + +impl Foo<2> { + fn foo(self) -> usize { N as usize } +} + +struct Bar; +struct Bar2(); +struct Bar3 {} + +#[cfg(rpass1)] +struct ChangingStruct; + +#[cfg(any(rpass2, rpass3))] +struct ChangingStruct; + +struct S; + +impl S { + #[cfg(rpass1)] + fn changing_method(self) {} + + #[cfg(any(rpass2, rpass3))] + fn changing_method(self) {} +} + +// We want to verify that all goes well when the value of the const argument change. +// To avoid modifying `main`'s HIR, we use a separate constant, and use `{ FOO_ARG + 1 }` +// inside the body to keep having an `AnonConst` to compute. +const FOO_ARG: usize = if cfg!(rpass2) { 1 } else { 0 }; + +fn main() { + let foo = Foo::Variant::<{ FOO_ARG + 1 }>; + foo.foo::<{ if cfg!(rpass3) { 3 } else { 4 } }>(); + + let foo = Foo::Variant2::<{ FOO_ARG + 1 }>(); + foo.foo::<{ if cfg!(rpass3) { 3 } else { 4 } }>(); + + let foo = Foo::Variant3::<{ FOO_ARG + 1 }> {}; + foo.foo::<{ if cfg!(rpass3) { 3 } else { 4 } }>(); + + let foo = Foo::<{ FOO_ARG + 1 }>::Variant; + foo.foo::<{ if cfg!(rpass3) { 3 } else { 4 } }>(); + + let foo = Foo::<{ FOO_ARG + 1 }>::Variant2(); + foo.foo::<{ if cfg!(rpass3) { 3 } else { 4 } }>(); + + let foo = Foo::<{ FOO_ARG + 1 }>::Variant3 {}; + foo.foo::<{ if cfg!(rpass3) { 3 } else { 4 } }>(); + + let _ = Bar::<{ FOO_ARG + 1 }>; + let _ = Bar2::<{ FOO_ARG + 1 }>(); + let _ = Bar3::<{ FOO_ARG + 1 }> {}; + + let _ = ChangingStruct::<{ 5 }>; + let _ = S.changing_method::<{ 5 }>(); +} diff --git a/tests/incremental/hashes/enum_constructors.rs b/tests/incremental/hashes/enum_constructors.rs index db367d070..f685fe46d 100644 --- a/tests/incremental/hashes/enum_constructors.rs +++ b/tests/incremental/hashes/enum_constructors.rs @@ -334,9 +334,9 @@ pub fn change_constructor_variant_c_like() { } #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] +#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")] +#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir")] #[rustc_clean(cfg="cfail6")] pub fn change_constructor_variant_c_like() { let _x = Clike::C; diff --git a/tests/incremental/hashes/let_expressions.rs b/tests/incremental/hashes/let_expressions.rs index 7aca43242..a835b8eef 100644 --- a/tests/incremental/hashes/let_expressions.rs +++ b/tests/incremental/hashes/let_expressions.rs @@ -91,7 +91,7 @@ pub fn change_mutability_of_slot() { } #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")] +#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")] #[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")] #[rustc_clean(cfg="cfail6")] @@ -176,7 +176,7 @@ pub fn change_mutability_of_binding_in_pattern() { } #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")] +#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")] #[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")] #[rustc_clean(cfg="cfail6")] @@ -193,9 +193,9 @@ pub fn add_initializer() { } #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")] +#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck,optimized_mir")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck")] +#[rustc_clean(cfg="cfail5", except="hir_owner_nodes,typeck,optimized_mir")] #[rustc_clean(cfg="cfail6")] pub fn add_initializer() { let _x: i16 = 3i16; @@ -210,9 +210,9 @@ pub fn change_initializer() { } #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg="cfail2", except="hir_owner_nodes")] +#[rustc_clean(cfg="cfail2", except="hir_owner_nodes, optimized_mir")] #[rustc_clean(cfg="cfail3")] -#[rustc_clean(cfg="cfail5", except="hir_owner_nodes")] +#[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")] #[rustc_clean(cfg="cfail6")] pub fn change_initializer() { let _x = 5u16; diff --git a/tests/incremental/issue-80691-bad-eval-cache.rs b/tests/incremental/issue-80691-bad-eval-cache.rs index 1a644fd88..ad8a338a7 100644 --- a/tests/incremental/issue-80691-bad-eval-cache.rs +++ b/tests/incremental/issue-80691-bad-eval-cache.rs @@ -1,6 +1,7 @@ // revisions: rfail1 rfail2 // failure-status: 101 // error-pattern: not implemented +// needs-unwind -Cpanic=abort causes abort instead of exit(101) pub trait Interner { type InternedVariableKinds; diff --git a/tests/mir-opt/bool_compare.opt1.InstCombine.diff b/tests/mir-opt/bool_compare.opt1.InstCombine.diff deleted file mode 100644 index 0af5d82d3..000000000 --- a/tests/mir-opt/bool_compare.opt1.InstCombine.diff +++ /dev/null @@ -1,35 +0,0 @@ -- // MIR for `opt1` before InstCombine -+ // MIR for `opt1` after InstCombine - - fn opt1(_1: bool) -> u32 { - debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10 - let mut _0: u32; // return place in scope 0 at $DIR/bool_compare.rs:+0:21: +0:24 - let mut _2: bool; // in scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 - let mut _3: bool; // in scope 0 at $DIR/bool_compare.rs:+1:8: +1:9 - - bb0: { - StorageLive(_2); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 - StorageLive(_3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:9 - _3 = _1; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:9 -- _2 = Ne(move _3, const true); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 -+ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 - StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:16: +1:17 - switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 - } - - bb1: { - _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:+1:20: +1:21 - goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:34 - } - - bb2: { - _0 = const 1_u32; // scope 0 at $DIR/bool_compare.rs:+1:31: +1:32 - goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:34 - } - - bb3: { - StorageDead(_2); // scope 0 at $DIR/bool_compare.rs:+1:33: +1:34 - return; // scope 0 at $DIR/bool_compare.rs:+2:2: +2:2 - } - } - diff --git a/tests/mir-opt/bool_compare.opt1.InstSimplify.diff b/tests/mir-opt/bool_compare.opt1.InstSimplify.diff new file mode 100644 index 000000000..6c9df8f04 --- /dev/null +++ b/tests/mir-opt/bool_compare.opt1.InstSimplify.diff @@ -0,0 +1,35 @@ +- // MIR for `opt1` before InstSimplify ++ // MIR for `opt1` after InstSimplify + + fn opt1(_1: bool) -> u32 { + debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10 + let mut _0: u32; // return place in scope 0 at $DIR/bool_compare.rs:+0:21: +0:24 + let mut _2: bool; // in scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 + let mut _3: bool; // in scope 0 at $DIR/bool_compare.rs:+1:8: +1:9 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 + StorageLive(_3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:9 + _3 = _1; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:9 +- _2 = Ne(move _3, const true); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 ++ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 + StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:16: +1:17 + switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 + } + + bb1: { + _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:+1:20: +1:21 + goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:34 + } + + bb2: { + _0 = const 1_u32; // scope 0 at $DIR/bool_compare.rs:+1:31: +1:32 + goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:34 + } + + bb3: { + StorageDead(_2); // scope 0 at $DIR/bool_compare.rs:+1:33: +1:34 + return; // scope 0 at $DIR/bool_compare.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/bool_compare.opt2.InstCombine.diff b/tests/mir-opt/bool_compare.opt2.InstCombine.diff deleted file mode 100644 index f5d1febd9..000000000 --- a/tests/mir-opt/bool_compare.opt2.InstCombine.diff +++ /dev/null @@ -1,35 +0,0 @@ -- // MIR for `opt2` before InstCombine -+ // MIR for `opt2` after InstCombine - - fn opt2(_1: bool) -> u32 { - debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10 - let mut _0: u32; // return place in scope 0 at $DIR/bool_compare.rs:+0:21: +0:24 - let mut _2: bool; // in scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 - let mut _3: bool; // in scope 0 at $DIR/bool_compare.rs:+1:16: +1:17 - - bb0: { - StorageLive(_2); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 - StorageLive(_3); // scope 0 at $DIR/bool_compare.rs:+1:16: +1:17 - _3 = _1; // scope 0 at $DIR/bool_compare.rs:+1:16: +1:17 -- _2 = Ne(const true, move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 -+ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 - StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:16: +1:17 - switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 - } - - bb1: { - _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:+1:20: +1:21 - goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:34 - } - - bb2: { - _0 = const 1_u32; // scope 0 at $DIR/bool_compare.rs:+1:31: +1:32 - goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:34 - } - - bb3: { - StorageDead(_2); // scope 0 at $DIR/bool_compare.rs:+1:33: +1:34 - return; // scope 0 at $DIR/bool_compare.rs:+2:2: +2:2 - } - } - diff --git a/tests/mir-opt/bool_compare.opt2.InstSimplify.diff b/tests/mir-opt/bool_compare.opt2.InstSimplify.diff new file mode 100644 index 000000000..9fb398265 --- /dev/null +++ b/tests/mir-opt/bool_compare.opt2.InstSimplify.diff @@ -0,0 +1,35 @@ +- // MIR for `opt2` before InstSimplify ++ // MIR for `opt2` after InstSimplify + + fn opt2(_1: bool) -> u32 { + debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10 + let mut _0: u32; // return place in scope 0 at $DIR/bool_compare.rs:+0:21: +0:24 + let mut _2: bool; // in scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 + let mut _3: bool; // in scope 0 at $DIR/bool_compare.rs:+1:16: +1:17 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 + StorageLive(_3); // scope 0 at $DIR/bool_compare.rs:+1:16: +1:17 + _3 = _1; // scope 0 at $DIR/bool_compare.rs:+1:16: +1:17 +- _2 = Ne(const true, move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 ++ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 + StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:16: +1:17 + switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:17 + } + + bb1: { + _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:+1:20: +1:21 + goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:34 + } + + bb2: { + _0 = const 1_u32; // scope 0 at $DIR/bool_compare.rs:+1:31: +1:32 + goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:34 + } + + bb3: { + StorageDead(_2); // scope 0 at $DIR/bool_compare.rs:+1:33: +1:34 + return; // scope 0 at $DIR/bool_compare.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/bool_compare.opt3.InstCombine.diff b/tests/mir-opt/bool_compare.opt3.InstCombine.diff deleted file mode 100644 index e7432adac..000000000 --- a/tests/mir-opt/bool_compare.opt3.InstCombine.diff +++ /dev/null @@ -1,35 +0,0 @@ -- // MIR for `opt3` before InstCombine -+ // MIR for `opt3` after InstCombine - - fn opt3(_1: bool) -> u32 { - debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10 - let mut _0: u32; // return place in scope 0 at $DIR/bool_compare.rs:+0:21: +0:24 - let mut _2: bool; // in scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 - let mut _3: bool; // in scope 0 at $DIR/bool_compare.rs:+1:8: +1:9 - - bb0: { - StorageLive(_2); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 - StorageLive(_3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:9 - _3 = _1; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:9 -- _2 = Eq(move _3, const false); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 -+ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 - StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:17: +1:18 - switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 - } - - bb1: { - _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:+1:21: +1:22 - goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:35 - } - - bb2: { - _0 = const 1_u32; // scope 0 at $DIR/bool_compare.rs:+1:32: +1:33 - goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:35 - } - - bb3: { - StorageDead(_2); // scope 0 at $DIR/bool_compare.rs:+1:34: +1:35 - return; // scope 0 at $DIR/bool_compare.rs:+2:2: +2:2 - } - } - diff --git a/tests/mir-opt/bool_compare.opt3.InstSimplify.diff b/tests/mir-opt/bool_compare.opt3.InstSimplify.diff new file mode 100644 index 000000000..3a47da867 --- /dev/null +++ b/tests/mir-opt/bool_compare.opt3.InstSimplify.diff @@ -0,0 +1,35 @@ +- // MIR for `opt3` before InstSimplify ++ // MIR for `opt3` after InstSimplify + + fn opt3(_1: bool) -> u32 { + debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10 + let mut _0: u32; // return place in scope 0 at $DIR/bool_compare.rs:+0:21: +0:24 + let mut _2: bool; // in scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 + let mut _3: bool; // in scope 0 at $DIR/bool_compare.rs:+1:8: +1:9 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 + StorageLive(_3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:9 + _3 = _1; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:9 +- _2 = Eq(move _3, const false); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 ++ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 + StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:17: +1:18 + switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 + } + + bb1: { + _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:+1:21: +1:22 + goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:35 + } + + bb2: { + _0 = const 1_u32; // scope 0 at $DIR/bool_compare.rs:+1:32: +1:33 + goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:35 + } + + bb3: { + StorageDead(_2); // scope 0 at $DIR/bool_compare.rs:+1:34: +1:35 + return; // scope 0 at $DIR/bool_compare.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/bool_compare.opt4.InstCombine.diff b/tests/mir-opt/bool_compare.opt4.InstCombine.diff deleted file mode 100644 index 6b3e27772..000000000 --- a/tests/mir-opt/bool_compare.opt4.InstCombine.diff +++ /dev/null @@ -1,35 +0,0 @@ -- // MIR for `opt4` before InstCombine -+ // MIR for `opt4` after InstCombine - - fn opt4(_1: bool) -> u32 { - debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10 - let mut _0: u32; // return place in scope 0 at $DIR/bool_compare.rs:+0:21: +0:24 - let mut _2: bool; // in scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 - let mut _3: bool; // in scope 0 at $DIR/bool_compare.rs:+1:17: +1:18 - - bb0: { - StorageLive(_2); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 - StorageLive(_3); // scope 0 at $DIR/bool_compare.rs:+1:17: +1:18 - _3 = _1; // scope 0 at $DIR/bool_compare.rs:+1:17: +1:18 -- _2 = Eq(const false, move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 -+ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 - StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:17: +1:18 - switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 - } - - bb1: { - _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:+1:21: +1:22 - goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:35 - } - - bb2: { - _0 = const 1_u32; // scope 0 at $DIR/bool_compare.rs:+1:32: +1:33 - goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:35 - } - - bb3: { - StorageDead(_2); // scope 0 at $DIR/bool_compare.rs:+1:34: +1:35 - return; // scope 0 at $DIR/bool_compare.rs:+2:2: +2:2 - } - } - diff --git a/tests/mir-opt/bool_compare.opt4.InstSimplify.diff b/tests/mir-opt/bool_compare.opt4.InstSimplify.diff new file mode 100644 index 000000000..5319c987d --- /dev/null +++ b/tests/mir-opt/bool_compare.opt4.InstSimplify.diff @@ -0,0 +1,35 @@ +- // MIR for `opt4` before InstSimplify ++ // MIR for `opt4` after InstSimplify + + fn opt4(_1: bool) -> u32 { + debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10 + let mut _0: u32; // return place in scope 0 at $DIR/bool_compare.rs:+0:21: +0:24 + let mut _2: bool; // in scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 + let mut _3: bool; // in scope 0 at $DIR/bool_compare.rs:+1:17: +1:18 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 + StorageLive(_3); // scope 0 at $DIR/bool_compare.rs:+1:17: +1:18 + _3 = _1; // scope 0 at $DIR/bool_compare.rs:+1:17: +1:18 +- _2 = Eq(const false, move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 ++ _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 + StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:+1:17: +1:18 + switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:+1:8: +1:18 + } + + bb1: { + _0 = const 0_u32; // scope 0 at $DIR/bool_compare.rs:+1:21: +1:22 + goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:35 + } + + bb2: { + _0 = const 1_u32; // scope 0 at $DIR/bool_compare.rs:+1:32: +1:33 + goto -> bb3; // scope 0 at $DIR/bool_compare.rs:+1:5: +1:35 + } + + bb3: { + StorageDead(_2); // scope 0 at $DIR/bool_compare.rs:+1:34: +1:35 + return; // scope 0 at $DIR/bool_compare.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/bool_compare.rs b/tests/mir-opt/bool_compare.rs index 4435bf5b0..080f7f72d 100644 --- a/tests/mir-opt/bool_compare.rs +++ b/tests/mir-opt/bool_compare.rs @@ -1,21 +1,21 @@ -// unit-test: InstCombine +// unit-test: InstSimplify -// EMIT_MIR bool_compare.opt1.InstCombine.diff +// EMIT_MIR bool_compare.opt1.InstSimplify.diff fn opt1(x: bool) -> u32 { if x != true { 0 } else { 1 } } -// EMIT_MIR bool_compare.opt2.InstCombine.diff +// EMIT_MIR bool_compare.opt2.InstSimplify.diff fn opt2(x: bool) -> u32 { if true != x { 0 } else { 1 } } -// EMIT_MIR bool_compare.opt3.InstCombine.diff +// EMIT_MIR bool_compare.opt3.InstSimplify.diff fn opt3(x: bool) -> u32 { if x == false { 0 } else { 1 } } -// EMIT_MIR bool_compare.opt4.InstCombine.diff +// EMIT_MIR bool_compare.opt4.InstSimplify.diff fn opt4(x: bool) -> u32 { if false == x { 0 } else { 1 } } diff --git a/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir b/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir index 7cce3415f..a9d1477b9 100644 --- a/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir +++ b/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir @@ -4,7 +4,7 @@ _0: GeneratorSavedTy { ty: impl std::future::Future, source_info: SourceInfo { - span: $DIR/async_await.rs:15:8: 15:14 (#8), + span: $DIR/async_await.rs:15:9: 15:14 (#8), scope: scope[0], }, ignore_for_traits: false, @@ -12,7 +12,7 @@ _1: GeneratorSavedTy { ty: impl std::future::Future, source_info: SourceInfo { - span: $DIR/async_await.rs:16:8: 16:14 (#11), + span: $DIR/async_await.rs:16:9: 16:14 (#10), scope: scope[0], }, ignore_for_traits: false, @@ -35,42 +35,42 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, debug _task_context => _38; // in scope 0 at $DIR/async_await.rs:+0:18: +3:2 let mut _0: std::task::Poll<()>; // return place in scope 0 at $DIR/async_await.rs:+0:18: +3:2 let _3: (); // in scope 0 at $DIR/async_await.rs:+1:5: +1:14 - let mut _4: impl std::future::Future; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14 + let mut _4: impl std::future::Future; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14 let mut _5: impl std::future::Future; // in scope 0 at $DIR/async_await.rs:+1:5: +1:8 - let mut _6: impl std::future::Future; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14 + let mut _6: impl std::future::Future; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14 let mut _7: (); // in scope 0 at $DIR/async_await.rs:+0:18: +3:2 - let _8: (); // in scope 0 at $DIR/async_await.rs:+1:8: +1:14 - let mut _9: std::task::Poll<()>; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14 - let mut _10: std::pin::Pin<&mut impl std::future::Future>; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14 - let mut _11: &mut impl std::future::Future; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14 - let mut _12: &mut impl std::future::Future; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14 + let _8: (); // in scope 0 at $DIR/async_await.rs:+1:9: +1:14 + let mut _9: std::task::Poll<()>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14 + let mut _10: std::pin::Pin<&mut impl std::future::Future>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14 + let mut _11: &mut impl std::future::Future; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14 + let mut _12: &mut impl std::future::Future; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14 let mut _13: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+1:5: +1:14 let mut _14: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+1:5: +1:14 - let mut _15: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14 - let mut _16: isize; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14 + let mut _15: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14 + let mut _16: isize; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14 let mut _18: !; // in scope 0 at $DIR/async_await.rs:+1:5: +1:14 - let mut _19: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14 - let mut _20: (); // in scope 0 at $DIR/async_await.rs:+1:8: +1:14 - let mut _21: impl std::future::Future; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14 + let mut _19: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14 + let mut _20: (); // in scope 0 at $DIR/async_await.rs:+1:9: +1:14 + let mut _21: impl std::future::Future; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14 let mut _22: impl std::future::Future; // in scope 0 at $DIR/async_await.rs:+2:5: +2:8 - let mut _23: impl std::future::Future; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14 - let _24: (); // in scope 0 at $DIR/async_await.rs:+2:8: +2:14 - let mut _25: std::task::Poll<()>; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14 - let mut _26: std::pin::Pin<&mut impl std::future::Future>; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14 - let mut _27: &mut impl std::future::Future; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14 - let mut _28: &mut impl std::future::Future; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14 + let mut _23: impl std::future::Future; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14 + let _24: (); // in scope 0 at $DIR/async_await.rs:+2:9: +2:14 + let mut _25: std::task::Poll<()>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14 + let mut _26: std::pin::Pin<&mut impl std::future::Future>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14 + let mut _27: &mut impl std::future::Future; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14 + let mut _28: &mut impl std::future::Future; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14 let mut _29: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+2:5: +2:14 let mut _30: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+2:5: +2:14 - let mut _31: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14 - let mut _32: isize; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14 + let mut _31: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14 + let mut _32: isize; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14 let mut _34: !; // in scope 0 at $DIR/async_await.rs:+2:5: +2:14 - let mut _35: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14 - let mut _36: (); // in scope 0 at $DIR/async_await.rs:+2:8: +2:14 + let mut _35: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14 + let mut _36: (); // in scope 0 at $DIR/async_await.rs:+2:9: +2:14 let mut _37: (); // in scope 0 at $DIR/async_await.rs:+0:18: +3:2 let mut _38: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+0:18: +3:2 let mut _39: u32; // in scope 0 at $DIR/async_await.rs:+0:18: +3:2 scope 1 { - debug __awaitee => (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future); // in scope 1 at $DIR/async_await.rs:+1:8: +1:14 + debug __awaitee => (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future); // in scope 1 at $DIR/async_await.rs:+1:9: +1:14 let _17: (); // in scope 1 at $DIR/async_await.rs:+1:5: +1:14 scope 2 { } @@ -79,7 +79,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, } } scope 4 { - debug __awaitee => (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future); // in scope 4 at $DIR/async_await.rs:+2:8: +2:14 + debug __awaitee => (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future); // in scope 4 at $DIR/async_await.rs:+2:9: +2:14 let _33: (); // in scope 4 at $DIR/async_await.rs:+2:5: +2:14 scope 5 { } @@ -96,7 +96,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, bb1: { _38 = move _2; // scope 0 at $DIR/async_await.rs:+0:18: +3:2 StorageLive(_3); // scope 0 at $DIR/async_await.rs:+1:5: +1:14 - StorageLive(_4); // scope 0 at $DIR/async_await.rs:+1:8: +1:14 + StorageLive(_4); // scope 0 at $DIR/async_await.rs:+1:9: +1:14 StorageLive(_5); // scope 0 at $DIR/async_await.rs:+1:5: +1:8 _5 = a() -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+1:5: +1:8 // mir::Constant @@ -105,30 +105,30 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, } bb2: { - _4 = as IntoFuture>::into_future(move _5) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+1:8: +1:14 + _4 = as IntoFuture>::into_future(move _5) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+1:9: +1:14 // mir::Constant - // + span: $DIR/async_await.rs:15:8: 15:14 + // + span: $DIR/async_await.rs:15:9: 15:14 // + literal: Const { ty: fn(impl Future) -> as IntoFuture>::IntoFuture { as IntoFuture>::into_future}, val: Value() } } bb3: { StorageDead(_5); // scope 0 at $DIR/async_await.rs:+1:13: +1:14 - nop; // scope 0 at $DIR/async_await.rs:+1:8: +1:14 - (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future) = move _4; // scope 0 at $DIR/async_await.rs:+1:8: +1:14 - goto -> bb4; // scope 1 at $DIR/async_await.rs:+1:8: +1:14 + nop; // scope 0 at $DIR/async_await.rs:+1:9: +1:14 + (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future) = move _4; // scope 0 at $DIR/async_await.rs:+1:9: +1:14 + goto -> bb4; // scope 1 at $DIR/async_await.rs:+1:9: +1:14 } bb4: { - StorageLive(_8); // scope 1 at $DIR/async_await.rs:+1:8: +1:14 - StorageLive(_9); // scope 1 at $DIR/async_await.rs:+1:8: +1:14 - StorageLive(_10); // scope 2 at $DIR/async_await.rs:+1:8: +1:14 - StorageLive(_11); // scope 2 at $DIR/async_await.rs:+1:8: +1:14 - StorageLive(_12); // scope 2 at $DIR/async_await.rs:+1:8: +1:14 - _12 = &mut (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future); // scope 2 at $DIR/async_await.rs:+1:8: +1:14 - _11 = &mut (*_12); // scope 2 at $DIR/async_await.rs:+1:8: +1:14 - _10 = Pin::<&mut impl Future>::new_unchecked(move _11) -> [return: bb5, unwind unreachable]; // scope 2 at $DIR/async_await.rs:+1:8: +1:14 + StorageLive(_8); // scope 1 at $DIR/async_await.rs:+1:9: +1:14 + StorageLive(_9); // scope 1 at $DIR/async_await.rs:+1:9: +1:14 + StorageLive(_10); // scope 2 at $DIR/async_await.rs:+1:9: +1:14 + StorageLive(_11); // scope 2 at $DIR/async_await.rs:+1:9: +1:14 + StorageLive(_12); // scope 2 at $DIR/async_await.rs:+1:9: +1:14 + _12 = &mut (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future); // scope 2 at $DIR/async_await.rs:+1:9: +1:14 + _11 = &mut (*_12); // scope 2 at $DIR/async_await.rs:+1:9: +1:14 + _10 = Pin::<&mut impl Future>::new_unchecked(move _11) -> [return: bb5, unwind unreachable]; // scope 2 at $DIR/async_await.rs:+1:9: +1:14 // mir::Constant - // + span: $DIR/async_await.rs:15:8: 15:14 + // + span: $DIR/async_await.rs:15:9: 15:14 // + literal: Const { ty: unsafe fn(&mut impl Future) -> Pin<&mut impl Future> {Pin::<&mut impl Future>::new_unchecked}, val: Value() } } @@ -136,8 +136,8 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, StorageDead(_11); // scope 2 at $DIR/async_await.rs:+1:13: +1:14 StorageLive(_13); // scope 2 at $DIR/async_await.rs:+1:5: +1:14 StorageLive(_14); // scope 2 at $DIR/async_await.rs:+1:5: +1:14 - StorageLive(_15); // scope 2 at $DIR/async_await.rs:+1:8: +1:14 - _15 = _38; // scope 2 at $DIR/async_await.rs:+1:8: +1:14 + StorageLive(_15); // scope 2 at $DIR/async_await.rs:+1:9: +1:14 + _15 = _38; // scope 2 at $DIR/async_await.rs:+1:9: +1:14 _14 = move _15; // scope 2 at $DIR/async_await.rs:+1:5: +1:14 goto -> bb6; // scope 2 at $DIR/async_await.rs:+1:5: +1:14 } @@ -145,35 +145,35 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, bb6: { _13 = &mut (*_14); // scope 2 at $DIR/async_await.rs:+1:5: +1:14 StorageDead(_15); // scope 2 at $DIR/async_await.rs:+1:13: +1:14 - _9 = as Future>::poll(move _10, move _13) -> [return: bb7, unwind unreachable]; // scope 2 at $DIR/async_await.rs:+1:8: +1:14 + _9 = as Future>::poll(move _10, move _13) -> [return: bb7, unwind unreachable]; // scope 2 at $DIR/async_await.rs:+1:9: +1:14 // mir::Constant - // + span: $DIR/async_await.rs:15:8: 15:14 + // + span: $DIR/async_await.rs:15:9: 15:14 // + literal: Const { ty: for<'a, 'b, 'c> fn(Pin<&'a mut impl Future>, &'b mut Context<'c>) -> Poll< as Future>::Output> { as Future>::poll}, val: Value() } } bb7: { StorageDead(_13); // scope 2 at $DIR/async_await.rs:+1:13: +1:14 StorageDead(_10); // scope 2 at $DIR/async_await.rs:+1:13: +1:14 - _16 = discriminant(_9); // scope 1 at $DIR/async_await.rs:+1:8: +1:14 - switchInt(move _16) -> [0: bb10, 1: bb8, otherwise: bb9]; // scope 1 at $DIR/async_await.rs:+1:8: +1:14 + _16 = discriminant(_9); // scope 1 at $DIR/async_await.rs:+1:9: +1:14 + switchInt(move _16) -> [0: bb10, 1: bb8, otherwise: bb9]; // scope 1 at $DIR/async_await.rs:+1:9: +1:14 } bb8: { - _8 = const (); // scope 1 at $DIR/async_await.rs:+1:8: +1:14 + _8 = const (); // scope 1 at $DIR/async_await.rs:+1:9: +1:14 StorageDead(_14); // scope 1 at $DIR/async_await.rs:+1:13: +1:14 StorageDead(_12); // scope 1 at $DIR/async_await.rs:+1:13: +1:14 StorageDead(_9); // scope 1 at $DIR/async_await.rs:+1:13: +1:14 StorageDead(_8); // scope 1 at $DIR/async_await.rs:+1:13: +1:14 - StorageLive(_19); // scope 1 at $DIR/async_await.rs:+1:8: +1:14 - StorageLive(_20); // scope 1 at $DIR/async_await.rs:+1:8: +1:14 - _20 = (); // scope 1 at $DIR/async_await.rs:+1:8: +1:14 - _0 = Poll::<()>::Pending; // scope 1 at $DIR/async_await.rs:+1:8: +1:14 - discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 3; // scope 1 at $DIR/async_await.rs:+1:8: +1:14 - return; // scope 1 at $DIR/async_await.rs:+1:8: +1:14 + StorageLive(_19); // scope 1 at $DIR/async_await.rs:+1:9: +1:14 + StorageLive(_20); // scope 1 at $DIR/async_await.rs:+1:9: +1:14 + _20 = (); // scope 1 at $DIR/async_await.rs:+1:9: +1:14 + _0 = Poll::<()>::Pending; // scope 1 at $DIR/async_await.rs:+1:9: +1:14 + discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 3; // scope 1 at $DIR/async_await.rs:+1:9: +1:14 + return; // scope 1 at $DIR/async_await.rs:+1:9: +1:14 } bb9: { - unreachable; // scope 1 at $DIR/async_await.rs:+1:8: +1:14 + unreachable; // scope 1 at $DIR/async_await.rs:+1:9: +1:14 } bb10: { @@ -190,10 +190,10 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, bb11: { StorageDead(_20); // scope 1 at $DIR/async_await.rs:+1:13: +1:14 - _38 = move _19; // scope 1 at $DIR/async_await.rs:+1:8: +1:14 + _38 = move _19; // scope 1 at $DIR/async_await.rs:+1:9: +1:14 StorageDead(_19); // scope 1 at $DIR/async_await.rs:+1:13: +1:14 - _7 = const (); // scope 1 at $DIR/async_await.rs:+1:8: +1:14 - goto -> bb4; // scope 1 at $DIR/async_await.rs:+1:8: +1:14 + _7 = const (); // scope 1 at $DIR/async_await.rs:+1:9: +1:14 + goto -> bb4; // scope 1 at $DIR/async_await.rs:+1:9: +1:14 } bb12: { @@ -204,7 +204,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, bb13: { StorageDead(_4); // scope 0 at $DIR/async_await.rs:+1:14: +1:15 StorageDead(_3); // scope 0 at $DIR/async_await.rs:+1:14: +1:15 - StorageLive(_21); // scope 0 at $DIR/async_await.rs:+2:8: +2:14 + StorageLive(_21); // scope 0 at $DIR/async_await.rs:+2:9: +2:14 StorageLive(_22); // scope 0 at $DIR/async_await.rs:+2:5: +2:8 _22 = a() -> [return: bb14, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+2:5: +2:8 // mir::Constant @@ -213,30 +213,30 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, } bb14: { - _21 = as IntoFuture>::into_future(move _22) -> [return: bb15, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+2:8: +2:14 + _21 = as IntoFuture>::into_future(move _22) -> [return: bb15, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+2:9: +2:14 // mir::Constant - // + span: $DIR/async_await.rs:16:8: 16:14 + // + span: $DIR/async_await.rs:16:9: 16:14 // + literal: Const { ty: fn(impl Future) -> as IntoFuture>::IntoFuture { as IntoFuture>::into_future}, val: Value() } } bb15: { StorageDead(_22); // scope 0 at $DIR/async_await.rs:+2:13: +2:14 - nop; // scope 0 at $DIR/async_await.rs:+2:8: +2:14 - (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future) = move _21; // scope 0 at $DIR/async_await.rs:+2:8: +2:14 - goto -> bb16; // scope 4 at $DIR/async_await.rs:+2:8: +2:14 + nop; // scope 0 at $DIR/async_await.rs:+2:9: +2:14 + (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future) = move _21; // scope 0 at $DIR/async_await.rs:+2:9: +2:14 + goto -> bb16; // scope 4 at $DIR/async_await.rs:+2:9: +2:14 } bb16: { - StorageLive(_24); // scope 4 at $DIR/async_await.rs:+2:8: +2:14 - StorageLive(_25); // scope 4 at $DIR/async_await.rs:+2:8: +2:14 - StorageLive(_26); // scope 5 at $DIR/async_await.rs:+2:8: +2:14 - StorageLive(_27); // scope 5 at $DIR/async_await.rs:+2:8: +2:14 - StorageLive(_28); // scope 5 at $DIR/async_await.rs:+2:8: +2:14 - _28 = &mut (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future); // scope 5 at $DIR/async_await.rs:+2:8: +2:14 - _27 = &mut (*_28); // scope 5 at $DIR/async_await.rs:+2:8: +2:14 - _26 = Pin::<&mut impl Future>::new_unchecked(move _27) -> [return: bb17, unwind unreachable]; // scope 5 at $DIR/async_await.rs:+2:8: +2:14 + StorageLive(_24); // scope 4 at $DIR/async_await.rs:+2:9: +2:14 + StorageLive(_25); // scope 4 at $DIR/async_await.rs:+2:9: +2:14 + StorageLive(_26); // scope 5 at $DIR/async_await.rs:+2:9: +2:14 + StorageLive(_27); // scope 5 at $DIR/async_await.rs:+2:9: +2:14 + StorageLive(_28); // scope 5 at $DIR/async_await.rs:+2:9: +2:14 + _28 = &mut (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future); // scope 5 at $DIR/async_await.rs:+2:9: +2:14 + _27 = &mut (*_28); // scope 5 at $DIR/async_await.rs:+2:9: +2:14 + _26 = Pin::<&mut impl Future>::new_unchecked(move _27) -> [return: bb17, unwind unreachable]; // scope 5 at $DIR/async_await.rs:+2:9: +2:14 // mir::Constant - // + span: $DIR/async_await.rs:16:8: 16:14 + // + span: $DIR/async_await.rs:16:9: 16:14 // + literal: Const { ty: unsafe fn(&mut impl Future) -> Pin<&mut impl Future> {Pin::<&mut impl Future>::new_unchecked}, val: Value() } } @@ -244,8 +244,8 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, StorageDead(_27); // scope 5 at $DIR/async_await.rs:+2:13: +2:14 StorageLive(_29); // scope 5 at $DIR/async_await.rs:+2:5: +2:14 StorageLive(_30); // scope 5 at $DIR/async_await.rs:+2:5: +2:14 - StorageLive(_31); // scope 5 at $DIR/async_await.rs:+2:8: +2:14 - _31 = _38; // scope 5 at $DIR/async_await.rs:+2:8: +2:14 + StorageLive(_31); // scope 5 at $DIR/async_await.rs:+2:9: +2:14 + _31 = _38; // scope 5 at $DIR/async_await.rs:+2:9: +2:14 _30 = move _31; // scope 5 at $DIR/async_await.rs:+2:5: +2:14 goto -> bb18; // scope 5 at $DIR/async_await.rs:+2:5: +2:14 } @@ -253,31 +253,31 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, bb18: { _29 = &mut (*_30); // scope 5 at $DIR/async_await.rs:+2:5: +2:14 StorageDead(_31); // scope 5 at $DIR/async_await.rs:+2:13: +2:14 - _25 = as Future>::poll(move _26, move _29) -> [return: bb19, unwind unreachable]; // scope 5 at $DIR/async_await.rs:+2:8: +2:14 + _25 = as Future>::poll(move _26, move _29) -> [return: bb19, unwind unreachable]; // scope 5 at $DIR/async_await.rs:+2:9: +2:14 // mir::Constant - // + span: $DIR/async_await.rs:16:8: 16:14 + // + span: $DIR/async_await.rs:16:9: 16:14 // + literal: Const { ty: for<'a, 'b, 'c> fn(Pin<&'a mut impl Future>, &'b mut Context<'c>) -> Poll< as Future>::Output> { as Future>::poll}, val: Value() } } bb19: { StorageDead(_29); // scope 5 at $DIR/async_await.rs:+2:13: +2:14 StorageDead(_26); // scope 5 at $DIR/async_await.rs:+2:13: +2:14 - _32 = discriminant(_25); // scope 4 at $DIR/async_await.rs:+2:8: +2:14 - switchInt(move _32) -> [0: bb21, 1: bb20, otherwise: bb9]; // scope 4 at $DIR/async_await.rs:+2:8: +2:14 + _32 = discriminant(_25); // scope 4 at $DIR/async_await.rs:+2:9: +2:14 + switchInt(move _32) -> [0: bb21, 1: bb20, otherwise: bb9]; // scope 4 at $DIR/async_await.rs:+2:9: +2:14 } bb20: { - _24 = const (); // scope 4 at $DIR/async_await.rs:+2:8: +2:14 + _24 = const (); // scope 4 at $DIR/async_await.rs:+2:9: +2:14 StorageDead(_30); // scope 4 at $DIR/async_await.rs:+2:13: +2:14 StorageDead(_28); // scope 4 at $DIR/async_await.rs:+2:13: +2:14 StorageDead(_25); // scope 4 at $DIR/async_await.rs:+2:13: +2:14 StorageDead(_24); // scope 4 at $DIR/async_await.rs:+2:13: +2:14 - StorageLive(_35); // scope 4 at $DIR/async_await.rs:+2:8: +2:14 - StorageLive(_36); // scope 4 at $DIR/async_await.rs:+2:8: +2:14 - _36 = (); // scope 4 at $DIR/async_await.rs:+2:8: +2:14 - _0 = Poll::<()>::Pending; // scope 4 at $DIR/async_await.rs:+2:8: +2:14 - discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 4; // scope 4 at $DIR/async_await.rs:+2:8: +2:14 - return; // scope 4 at $DIR/async_await.rs:+2:8: +2:14 + StorageLive(_35); // scope 4 at $DIR/async_await.rs:+2:9: +2:14 + StorageLive(_36); // scope 4 at $DIR/async_await.rs:+2:9: +2:14 + _36 = (); // scope 4 at $DIR/async_await.rs:+2:9: +2:14 + _0 = Poll::<()>::Pending; // scope 4 at $DIR/async_await.rs:+2:9: +2:14 + discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 4; // scope 4 at $DIR/async_await.rs:+2:9: +2:14 + return; // scope 4 at $DIR/async_await.rs:+2:9: +2:14 } bb21: { @@ -294,10 +294,10 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, bb22: { StorageDead(_36); // scope 4 at $DIR/async_await.rs:+2:13: +2:14 - _38 = move _35; // scope 4 at $DIR/async_await.rs:+2:8: +2:14 + _38 = move _35; // scope 4 at $DIR/async_await.rs:+2:9: +2:14 StorageDead(_35); // scope 4 at $DIR/async_await.rs:+2:13: +2:14 - _7 = const (); // scope 4 at $DIR/async_await.rs:+2:8: +2:14 - goto -> bb16; // scope 4 at $DIR/async_await.rs:+2:8: +2:14 + _7 = const (); // scope 4 at $DIR/async_await.rs:+2:9: +2:14 + goto -> bb16; // scope 4 at $DIR/async_await.rs:+2:9: +2:14 } bb23: { diff --git a/tests/mir-opt/building/custom/projections.copy_for_deref.built.after.mir b/tests/mir-opt/building/custom/projections.copy_for_deref.built.after.mir new file mode 100644 index 000000000..5233d0489 --- /dev/null +++ b/tests/mir-opt/building/custom/projections.copy_for_deref.built.after.mir @@ -0,0 +1,12 @@ +// MIR for `copy_for_deref` after built + +fn copy_for_deref(_1: (&i32, i32)) -> i32 { + let mut _0: i32; // return place in scope 0 at $DIR/projections.rs:+0:38: +0:41 + let mut _2: &i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + + bb0: { + _2 = deref_copy (_1.0: &i32); // scope 0 at $DIR/projections.rs:+4:13: +4:37 + _0 = (*_2); // scope 0 at $DIR/projections.rs:+5:13: +5:24 + return; // scope 0 at $DIR/projections.rs:+6:13: +6:21 + } +} diff --git a/tests/mir-opt/building/custom/projections.rs b/tests/mir-opt/building/custom/projections.rs index 5e472e531..3c155deae 100644 --- a/tests/mir-opt/building/custom/projections.rs +++ b/tests/mir-opt/building/custom/projections.rs @@ -21,13 +21,10 @@ fn unions(u: U) -> i32 { #[custom_mir(dialect = "analysis", phase = "post-cleanup")] fn tuples(i: (u32, i32)) -> (u32, i32) { mir!( - // FIXME(JakobDegen): This is necessary because we can't give type hints for `RET` - let temp: (u32, i32); + type RET = (u32, i32); { - temp.0 = i.0; - temp.1 = i.1; - - RET = temp; + RET.0 = i.0; + RET.1 = i.1; Return() } ) @@ -71,6 +68,19 @@ fn simple_index(a: [i32; 10], b: &[i32]) -> i32 { }) } +// EMIT_MIR projections.copy_for_deref.built.after.mir +#[custom_mir(dialect = "runtime", phase = "initial")] +fn copy_for_deref(x: (&i32, i32)) -> i32 { + mir!( + let temp: &i32; + { + temp = CopyForDeref(x.0); + RET = *temp; + Return() + } + ) +} + fn main() { assert_eq!(unions(U { a: 5 }), 5); assert_eq!(tuples((5, 6)), (5, 6)); @@ -82,4 +92,7 @@ fn main() { assert_eq!(o, Some(10)); assert_eq!(simple_index([0; 10], &[0; 10]), 0); + + let one = 1; + assert_eq!(copy_for_deref((&one, one)), 1); } diff --git a/tests/mir-opt/building/custom/projections.tuples.built.after.mir b/tests/mir-opt/building/custom/projections.tuples.built.after.mir index 65487d3c9..dec575200 100644 --- a/tests/mir-opt/building/custom/projections.tuples.built.after.mir +++ b/tests/mir-opt/building/custom/projections.tuples.built.after.mir @@ -2,12 +2,10 @@ fn tuples(_1: (u32, i32)) -> (u32, i32) { let mut _0: (u32, i32); // return place in scope 0 at $DIR/projections.rs:+0:29: +0:39 - let mut _2: (u32, i32); // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL bb0: { - (_2.0: u32) = (_1.0: u32); // scope 0 at $DIR/projections.rs:+5:13: +5:25 - (_2.1: i32) = (_1.1: i32); // scope 0 at $DIR/projections.rs:+6:13: +6:25 - _0 = _2; // scope 0 at $DIR/projections.rs:+8:13: +8:23 - return; // scope 0 at $DIR/projections.rs:+9:13: +9:21 + (_0.0: u32) = (_1.0: u32); // scope 0 at $DIR/projections.rs:+4:13: +4:24 + (_0.1: i32) = (_1.1: i32); // scope 0 at $DIR/projections.rs:+5:13: +5:24 + return; // scope 0 at $DIR/projections.rs:+6:13: +6:21 } } diff --git a/tests/mir-opt/building/enum_cast.bar.built.after.mir b/tests/mir-opt/building/enum_cast.bar.built.after.mir index 0746e0b49..9f14c0284 100644 --- a/tests/mir-opt/building/enum_cast.bar.built.after.mir +++ b/tests/mir-opt/building/enum_cast.bar.built.after.mir @@ -5,17 +5,16 @@ fn bar(_1: Bar) -> usize { let mut _0: usize; // return place in scope 0 at $DIR/enum_cast.rs:+0:21: +0:26 let _2: Bar; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8 let mut _3: isize; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8 - let mut _4: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 + let mut _4: u8; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 let mut _5: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 bb0: { StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8 _2 = move _1; // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8 _3 = discriminant(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 - _4 = Ge(const 1_isize, _3); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 - assume(_4); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 - _5 = Le(const 0_isize, _3); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 - assume(_5); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 + _4 = _3 as u8 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 + _5 = Le(_4, const 1_u8); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 + assume(move _5); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 _0 = move _3 as usize (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+1:16: +1:17 return; // scope 0 at $DIR/enum_cast.rs:+2:2: +2:2 diff --git a/tests/mir-opt/building/enum_cast.boo.built.after.mir b/tests/mir-opt/building/enum_cast.boo.built.after.mir index 699c876b0..715dedcf2 100644 --- a/tests/mir-opt/building/enum_cast.boo.built.after.mir +++ b/tests/mir-opt/building/enum_cast.boo.built.after.mir @@ -5,17 +5,16 @@ fn boo(_1: Boo) -> usize { let mut _0: usize; // return place in scope 0 at $DIR/enum_cast.rs:+0:21: +0:26 let _2: Boo; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8 let mut _3: u8; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8 - let mut _4: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 + let mut _4: u8; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 let mut _5: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 bb0: { StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8 _2 = move _1; // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8 _3 = discriminant(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 - _4 = Ge(const 1_u8, _3); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 - assume(_4); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 - _5 = Le(const 0_u8, _3); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 - assume(_5); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 + _4 = _3 as u8 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 + _5 = Le(_4, const 1_u8); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 + assume(move _5); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 _0 = move _3 as usize (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+1:16: +1:17 return; // scope 0 at $DIR/enum_cast.rs:+2:2: +2:2 diff --git a/tests/mir-opt/building/enum_cast.droppy.built.after.mir b/tests/mir-opt/building/enum_cast.droppy.built.after.mir index 1112177fb..6c177c61e 100644 --- a/tests/mir-opt/building/enum_cast.droppy.built.after.mir +++ b/tests/mir-opt/building/enum_cast.droppy.built.after.mir @@ -6,7 +6,7 @@ fn droppy() -> () { let _2: Droppy; // in scope 0 at $DIR/enum_cast.rs:+2:13: +2:14 let _4: Droppy; // in scope 0 at $DIR/enum_cast.rs:+5:17: +5:18 let mut _5: isize; // in scope 0 at $DIR/enum_cast.rs:+5:17: +5:18 - let mut _6: bool; // in scope 0 at $DIR/enum_cast.rs:+5:17: +5:27 + let mut _6: u8; // in scope 0 at $DIR/enum_cast.rs:+5:17: +5:27 let mut _7: bool; // in scope 0 at $DIR/enum_cast.rs:+5:17: +5:27 let _8: Droppy; // in scope 0 at $DIR/enum_cast.rs:+7:9: +7:10 scope 1 { @@ -31,10 +31,9 @@ fn droppy() -> () { StorageLive(_4); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:18 _4 = move _2; // scope 3 at $DIR/enum_cast.rs:+5:17: +5:18 _5 = discriminant(_4); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27 - _6 = Ge(const 2_isize, _5); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27 - assume(_6); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27 - _7 = Le(const 0_isize, _5); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27 - assume(_7); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27 + _6 = _5 as u8 (IntToInt); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27 + _7 = Le(_6, const 2_u8); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27 + assume(move _7); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27 _3 = move _5 as usize (IntToInt); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27 drop(_4) -> [return: bb1, unwind: bb4]; // scope 3 at $DIR/enum_cast.rs:+5:26: +5:27 } diff --git a/tests/mir-opt/building/enum_cast.far.built.after.mir b/tests/mir-opt/building/enum_cast.far.built.after.mir new file mode 100644 index 000000000..ab8129ca0 --- /dev/null +++ b/tests/mir-opt/building/enum_cast.far.built.after.mir @@ -0,0 +1,22 @@ +// MIR for `far` after built + +fn far(_1: Far) -> isize { + debug far => _1; // in scope 0 at $DIR/enum_cast.rs:+0:8: +0:11 + let mut _0: isize; // return place in scope 0 at $DIR/enum_cast.rs:+0:21: +0:26 + let _2: Far; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8 + let mut _3: i16; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8 + let mut _4: u16; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 + let mut _5: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8 + _2 = move _1; // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8 + _3 = discriminant(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 + _4 = _3 as u16 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 + _5 = Le(_4, const 1_u16); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 + assume(move _5); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 + _0 = move _3 as isize (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17 + StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+1:16: +1:17 + return; // scope 0 at $DIR/enum_cast.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/building/enum_cast.offsetty.built.after.mir b/tests/mir-opt/building/enum_cast.offsetty.built.after.mir new file mode 100644 index 000000000..7b2b583f2 --- /dev/null +++ b/tests/mir-opt/building/enum_cast.offsetty.built.after.mir @@ -0,0 +1,26 @@ +// MIR for `offsetty` after built + +fn offsetty(_1: NotStartingAtZero) -> u32 { + debug x => _1; // in scope 0 at $DIR/enum_cast.rs:+0:13: +0:14 + let mut _0: u32; // return place in scope 0 at $DIR/enum_cast.rs:+0:38: +0:41 + let _2: NotStartingAtZero; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:6 + let mut _3: isize; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:6 + let mut _4: u8; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13 + let mut _5: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13 + let mut _6: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13 + let mut _7: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:6 + _2 = move _1; // scope 0 at $DIR/enum_cast.rs:+1:5: +1:6 + _3 = discriminant(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13 + _4 = _3 as u8 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13 + _5 = Ge(_4, const 4_u8); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13 + _6 = Le(_4, const 8_u8); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13 + _7 = BitAnd(move _5, move _6); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13 + assume(move _7); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13 + _0 = move _3 as u32 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13 + StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+1:12: +1:13 + return; // scope 0 at $DIR/enum_cast.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/building/enum_cast.rs b/tests/mir-opt/building/enum_cast.rs index 98fd5acfb..431b5c708 100644 --- a/tests/mir-opt/building/enum_cast.rs +++ b/tests/mir-opt/building/enum_cast.rs @@ -1,6 +1,7 @@ // EMIT_MIR enum_cast.foo.built.after.mir // EMIT_MIR enum_cast.bar.built.after.mir // EMIT_MIR enum_cast.boo.built.after.mir +// EMIT_MIR enum_cast.far.built.after.mir enum Foo { A @@ -15,6 +16,11 @@ enum Boo { A, B } +#[repr(i16)] +enum Far { + A, B +} + fn foo(foo: Foo) -> usize { foo as usize } @@ -27,6 +33,10 @@ fn boo(boo: Boo) -> usize { boo as usize } +fn far(far: Far) -> isize { + far as isize +} + // EMIT_MIR enum_cast.droppy.built.after.mir enum Droppy { A, B, C @@ -46,5 +56,37 @@ fn droppy() { let z = Droppy::B; } +#[repr(i16)] +enum SignedAroundZero { + A = -2, + B = 0, + C = 2, +} + +#[repr(u16)] +enum UnsignedAroundZero { + A = 65535, + B = 0, + C = 1, +} + +// EMIT_MIR enum_cast.signy.built.after.mir +fn signy(x: SignedAroundZero) -> i16 { + x as i16 +} + +// EMIT_MIR enum_cast.unsigny.built.after.mir +fn unsigny(x: UnsignedAroundZero) -> u16 { + // FIXME: This doesn't get an around-the-end range today, sadly. + x as u16 +} + +enum NotStartingAtZero { A = 4, B = 6, C = 8 } + +// EMIT_MIR enum_cast.offsetty.built.after.mir +fn offsetty(x: NotStartingAtZero) -> u32 { + x as u32 +} + fn main() { } diff --git a/tests/mir-opt/building/enum_cast.signy.built.after.mir b/tests/mir-opt/building/enum_cast.signy.built.after.mir new file mode 100644 index 000000000..ef4fea604 --- /dev/null +++ b/tests/mir-opt/building/enum_cast.signy.built.after.mir @@ -0,0 +1,26 @@ +// MIR for `signy` after built + +fn signy(_1: SignedAroundZero) -> i16 { + debug x => _1; // in scope 0 at $DIR/enum_cast.rs:+0:10: +0:11 + let mut _0: i16; // return place in scope 0 at $DIR/enum_cast.rs:+0:34: +0:37 + let _2: SignedAroundZero; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:6 + let mut _3: i16; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:6 + let mut _4: u16; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13 + let mut _5: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13 + let mut _6: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13 + let mut _7: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:13 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:6 + _2 = move _1; // scope 0 at $DIR/enum_cast.rs:+1:5: +1:6 + _3 = discriminant(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13 + _4 = _3 as u16 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13 + _5 = Ge(_4, const 65534_u16); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13 + _6 = Le(_4, const 2_u16); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13 + _7 = BitOr(move _5, move _6); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13 + assume(move _7); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13 + _0 = move _3 as i16 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:13 + StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+1:12: +1:13 + return; // scope 0 at $DIR/enum_cast.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/building/enum_cast.unsigny.built.after.mir b/tests/mir-opt/building/enum_cast.unsigny.built.after.mir new file mode 100644 index 000000000..7ca147b15 --- /dev/null +++ b/tests/mir-opt/building/enum_cast.unsigny.built.after.mir @@ -0,0 +1,17 @@ +// MIR for `unsigny` after built + +fn unsigny(_1: UnsignedAroundZero) -> u16 { + debug x => _1; // in scope 0 at $DIR/enum_cast.rs:+0:12: +0:13 + let mut _0: u16; // return place in scope 0 at $DIR/enum_cast.rs:+0:38: +0:41 + let _2: UnsignedAroundZero; // in scope 0 at $DIR/enum_cast.rs:+2:5: +2:6 + let mut _3: u16; // in scope 0 at $DIR/enum_cast.rs:+2:5: +2:6 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+2:5: +2:6 + _2 = move _1; // scope 0 at $DIR/enum_cast.rs:+2:5: +2:6 + _3 = discriminant(_2); // scope 0 at $DIR/enum_cast.rs:+2:5: +2:13 + _0 = move _3 as u16 (IntToInt); // scope 0 at $DIR/enum_cast.rs:+2:5: +2:13 + StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+2:12: +2:13 + return; // scope 0 at $DIR/enum_cast.rs:+3:2: +3:2 + } +} diff --git a/tests/mir-opt/casts.redundant.InstCombine.diff b/tests/mir-opt/casts.redundant.InstCombine.diff deleted file mode 100644 index 528a8e5a9..000000000 --- a/tests/mir-opt/casts.redundant.InstCombine.diff +++ /dev/null @@ -1,25 +0,0 @@ -- // MIR for `redundant` before InstCombine -+ // MIR for `redundant` after InstCombine - - fn redundant(_1: *const &u8) -> *const &u8 { - debug x => _1; // in scope 0 at $DIR/casts.rs:+0:30: +0:31 - let mut _0: *const &u8; // return place in scope 0 at $DIR/casts.rs:+0:51: +0:64 - let mut _2: *const &u8; // in scope 0 at $DIR/casts.rs:+1:5: +1:55 - let mut _3: *const &u8; // in scope 0 at $DIR/casts.rs:+1:36: +1:37 - scope 1 (inlined generic_cast::<&u8, &u8>) { // at $DIR/casts.rs:6:5: 6:38 - debug x => _3; // in scope 1 at $DIR/casts.rs:10:23: 10:24 - } - - bb0: { - StorageLive(_2); // scope 0 at $DIR/casts.rs:+1:5: +1:55 - StorageLive(_3); // scope 0 at $DIR/casts.rs:+1:36: +1:37 - _3 = _1; // scope 0 at $DIR/casts.rs:+1:36: +1:37 -- _2 = _3 as *const &u8 (PtrToPtr); // scope 1 at $DIR/casts.rs:11:5: 11:18 -+ _2 = _3; // scope 1 at $DIR/casts.rs:11:5: 11:18 - StorageDead(_3); // scope 0 at $DIR/casts.rs:+1:37: +1:38 - _0 = _2; // scope 0 at $DIR/casts.rs:+1:5: +1:55 - StorageDead(_2); // scope 0 at $DIR/casts.rs:+2:1: +2:2 - return; // scope 0 at $DIR/casts.rs:+2:2: +2:2 - } - } - diff --git a/tests/mir-opt/casts.redundant.InstSimplify.diff b/tests/mir-opt/casts.redundant.InstSimplify.diff new file mode 100644 index 000000000..a641b69de --- /dev/null +++ b/tests/mir-opt/casts.redundant.InstSimplify.diff @@ -0,0 +1,25 @@ +- // MIR for `redundant` before InstSimplify ++ // MIR for `redundant` after InstSimplify + + fn redundant(_1: *const &u8) -> *const &u8 { + debug x => _1; // in scope 0 at $DIR/casts.rs:+0:30: +0:31 + let mut _0: *const &u8; // return place in scope 0 at $DIR/casts.rs:+0:51: +0:64 + let mut _2: *const &u8; // in scope 0 at $DIR/casts.rs:+1:5: +1:55 + let mut _3: *const &u8; // in scope 0 at $DIR/casts.rs:+1:36: +1:37 + scope 1 (inlined generic_cast::<&u8, &u8>) { // at $DIR/casts.rs:6:5: 6:38 + debug x => _3; // in scope 1 at $DIR/casts.rs:10:23: 10:24 + } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/casts.rs:+1:5: +1:55 + StorageLive(_3); // scope 0 at $DIR/casts.rs:+1:36: +1:37 + _3 = _1; // scope 0 at $DIR/casts.rs:+1:36: +1:37 +- _2 = _3 as *const &u8 (PtrToPtr); // scope 1 at $DIR/casts.rs:11:5: 11:18 ++ _2 = _3; // scope 1 at $DIR/casts.rs:11:5: 11:18 + StorageDead(_3); // scope 0 at $DIR/casts.rs:+1:37: +1:38 + _0 = _2; // scope 0 at $DIR/casts.rs:+1:5: +1:55 + StorageDead(_2); // scope 0 at $DIR/casts.rs:+2:1: +2:2 + return; // scope 0 at $DIR/casts.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/casts.rs b/tests/mir-opt/casts.rs index 259c462da..413b0e09d 100644 --- a/tests/mir-opt/casts.rs +++ b/tests/mir-opt/casts.rs @@ -1,6 +1,6 @@ #![crate_type = "lib"] -// EMIT_MIR casts.redundant.InstCombine.diff +// EMIT_MIR casts.redundant.InstSimplify.diff // EMIT_MIR casts.redundant.PreCodegen.after.mir pub fn redundant<'a, 'b: 'a>(x: *const &'a u8) -> *const &'a u8 { generic_cast::<&'a u8, &'b u8>(x) as *const &'a u8 diff --git a/tests/mir-opt/combine_array_len.norm2.InstCombine.diff b/tests/mir-opt/combine_array_len.norm2.InstCombine.diff deleted file mode 100644 index c73150f94..000000000 --- a/tests/mir-opt/combine_array_len.norm2.InstCombine.diff +++ /dev/null @@ -1,77 +0,0 @@ -- // MIR for `norm2` before InstCombine -+ // MIR for `norm2` after InstCombine - - fn norm2(_1: [f32; 2]) -> f32 { - debug x => _1; // in scope 0 at $DIR/combine_array_len.rs:+0:10: +0:11 - let mut _0: f32; // return place in scope 0 at $DIR/combine_array_len.rs:+0:26: +0:29 - let _2: f32; // in scope 0 at $DIR/combine_array_len.rs:+1:9: +1:10 - let _3: usize; // in scope 0 at $DIR/combine_array_len.rs:+1:15: +1:16 - let mut _4: usize; // in scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17 - let mut _5: bool; // in scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17 - let _7: usize; // in scope 0 at $DIR/combine_array_len.rs:+2:15: +2:16 - let mut _8: usize; // in scope 0 at $DIR/combine_array_len.rs:+2:13: +2:17 - let mut _9: bool; // in scope 0 at $DIR/combine_array_len.rs:+2:13: +2:17 - let mut _10: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:5: +3:8 - let mut _11: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:5: +3:6 - let mut _12: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:7: +3:8 - let mut _13: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:11: +3:14 - let mut _14: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:11: +3:12 - let mut _15: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:13: +3:14 - scope 1 { - debug a => _2; // in scope 1 at $DIR/combine_array_len.rs:+1:9: +1:10 - let _6: f32; // in scope 1 at $DIR/combine_array_len.rs:+2:9: +2:10 - scope 2 { - debug b => _6; // in scope 2 at $DIR/combine_array_len.rs:+2:9: +2:10 - } - } - - bb0: { - StorageLive(_2); // scope 0 at $DIR/combine_array_len.rs:+1:9: +1:10 - StorageLive(_3); // scope 0 at $DIR/combine_array_len.rs:+1:15: +1:16 - _3 = const 0_usize; // scope 0 at $DIR/combine_array_len.rs:+1:15: +1:16 -- _4 = Len(_1); // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17 -+ _4 = const 2_usize; // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17 - _5 = Lt(_3, _4); // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17 - assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17 - } - - bb1: { - _2 = _1[_3]; // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17 - StorageDead(_3); // scope 0 at $DIR/combine_array_len.rs:+1:17: +1:18 - StorageLive(_6); // scope 1 at $DIR/combine_array_len.rs:+2:9: +2:10 - StorageLive(_7); // scope 1 at $DIR/combine_array_len.rs:+2:15: +2:16 - _7 = const 1_usize; // scope 1 at $DIR/combine_array_len.rs:+2:15: +2:16 -- _8 = Len(_1); // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17 -+ _8 = const 2_usize; // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17 - _9 = Lt(_7, _8); // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17 - assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> bb2; // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17 - } - - bb2: { - _6 = _1[_7]; // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17 - StorageDead(_7); // scope 1 at $DIR/combine_array_len.rs:+2:17: +2:18 - StorageLive(_10); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:8 - StorageLive(_11); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:6 - _11 = _2; // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:6 - StorageLive(_12); // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8 - _12 = _2; // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8 - _10 = Mul(move _11, move _12); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:8 - StorageDead(_12); // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8 - StorageDead(_11); // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8 - StorageLive(_13); // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:14 - StorageLive(_14); // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:12 - _14 = _6; // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:12 - StorageLive(_15); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14 - _15 = _6; // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14 - _13 = Mul(move _14, move _15); // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:14 - StorageDead(_15); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14 - StorageDead(_14); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14 - _0 = Add(move _10, move _13); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:14 - StorageDead(_13); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14 - StorageDead(_10); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14 - StorageDead(_6); // scope 1 at $DIR/combine_array_len.rs:+4:1: +4:2 - StorageDead(_2); // scope 0 at $DIR/combine_array_len.rs:+4:1: +4:2 - return; // scope 0 at $DIR/combine_array_len.rs:+4:2: +4:2 - } - } - diff --git a/tests/mir-opt/combine_array_len.norm2.InstSimplify.diff b/tests/mir-opt/combine_array_len.norm2.InstSimplify.diff new file mode 100644 index 000000000..0777007ce --- /dev/null +++ b/tests/mir-opt/combine_array_len.norm2.InstSimplify.diff @@ -0,0 +1,77 @@ +- // MIR for `norm2` before InstSimplify ++ // MIR for `norm2` after InstSimplify + + fn norm2(_1: [f32; 2]) -> f32 { + debug x => _1; // in scope 0 at $DIR/combine_array_len.rs:+0:10: +0:11 + let mut _0: f32; // return place in scope 0 at $DIR/combine_array_len.rs:+0:26: +0:29 + let _2: f32; // in scope 0 at $DIR/combine_array_len.rs:+1:9: +1:10 + let _3: usize; // in scope 0 at $DIR/combine_array_len.rs:+1:15: +1:16 + let mut _4: usize; // in scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17 + let mut _5: bool; // in scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17 + let _7: usize; // in scope 0 at $DIR/combine_array_len.rs:+2:15: +2:16 + let mut _8: usize; // in scope 0 at $DIR/combine_array_len.rs:+2:13: +2:17 + let mut _9: bool; // in scope 0 at $DIR/combine_array_len.rs:+2:13: +2:17 + let mut _10: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:5: +3:8 + let mut _11: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:5: +3:6 + let mut _12: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:7: +3:8 + let mut _13: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:11: +3:14 + let mut _14: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:11: +3:12 + let mut _15: f32; // in scope 0 at $DIR/combine_array_len.rs:+3:13: +3:14 + scope 1 { + debug a => _2; // in scope 1 at $DIR/combine_array_len.rs:+1:9: +1:10 + let _6: f32; // in scope 1 at $DIR/combine_array_len.rs:+2:9: +2:10 + scope 2 { + debug b => _6; // in scope 2 at $DIR/combine_array_len.rs:+2:9: +2:10 + } + } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/combine_array_len.rs:+1:9: +1:10 + StorageLive(_3); // scope 0 at $DIR/combine_array_len.rs:+1:15: +1:16 + _3 = const 0_usize; // scope 0 at $DIR/combine_array_len.rs:+1:15: +1:16 +- _4 = Len(_1); // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17 ++ _4 = const 2_usize; // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17 + _5 = Lt(_3, _4); // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17 + assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17 + } + + bb1: { + _2 = _1[_3]; // scope 0 at $DIR/combine_array_len.rs:+1:13: +1:17 + StorageDead(_3); // scope 0 at $DIR/combine_array_len.rs:+1:17: +1:18 + StorageLive(_6); // scope 1 at $DIR/combine_array_len.rs:+2:9: +2:10 + StorageLive(_7); // scope 1 at $DIR/combine_array_len.rs:+2:15: +2:16 + _7 = const 1_usize; // scope 1 at $DIR/combine_array_len.rs:+2:15: +2:16 +- _8 = Len(_1); // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17 ++ _8 = const 2_usize; // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17 + _9 = Lt(_7, _8); // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17 + assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> bb2; // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17 + } + + bb2: { + _6 = _1[_7]; // scope 1 at $DIR/combine_array_len.rs:+2:13: +2:17 + StorageDead(_7); // scope 1 at $DIR/combine_array_len.rs:+2:17: +2:18 + StorageLive(_10); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:8 + StorageLive(_11); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:6 + _11 = _2; // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:6 + StorageLive(_12); // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8 + _12 = _2; // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8 + _10 = Mul(move _11, move _12); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:8 + StorageDead(_12); // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8 + StorageDead(_11); // scope 2 at $DIR/combine_array_len.rs:+3:7: +3:8 + StorageLive(_13); // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:14 + StorageLive(_14); // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:12 + _14 = _6; // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:12 + StorageLive(_15); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14 + _15 = _6; // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14 + _13 = Mul(move _14, move _15); // scope 2 at $DIR/combine_array_len.rs:+3:11: +3:14 + StorageDead(_15); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14 + StorageDead(_14); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14 + _0 = Add(move _10, move _13); // scope 2 at $DIR/combine_array_len.rs:+3:5: +3:14 + StorageDead(_13); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14 + StorageDead(_10); // scope 2 at $DIR/combine_array_len.rs:+3:13: +3:14 + StorageDead(_6); // scope 1 at $DIR/combine_array_len.rs:+4:1: +4:2 + StorageDead(_2); // scope 0 at $DIR/combine_array_len.rs:+4:1: +4:2 + return; // scope 0 at $DIR/combine_array_len.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/combine_array_len.rs b/tests/mir-opt/combine_array_len.rs index 08c5f1a1f..970cafafc 100644 --- a/tests/mir-opt/combine_array_len.rs +++ b/tests/mir-opt/combine_array_len.rs @@ -1,6 +1,6 @@ // ignore-wasm32 compiled with panic=abort by default -// unit-test: InstCombine -// EMIT_MIR combine_array_len.norm2.InstCombine.diff +// unit-test: InstSimplify +// EMIT_MIR combine_array_len.norm2.InstSimplify.diff fn norm2(x: [f32; 2]) -> f32 { let a = x[0]; diff --git a/tests/mir-opt/combine_clone_of_primitives.rs b/tests/mir-opt/combine_clone_of_primitives.rs index 7cc50a86e..1deee9dd6 100644 --- a/tests/mir-opt/combine_clone_of_primitives.rs +++ b/tests/mir-opt/combine_clone_of_primitives.rs @@ -1,7 +1,7 @@ -// unit-test: InstCombine +// unit-test: InstSimplify // ignore-wasm32 compiled with panic=abort by default -// EMIT_MIR combine_clone_of_primitives.{impl#0}-clone.InstCombine.diff +// EMIT_MIR combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff #[derive(Clone)] struct MyThing { diff --git a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstCombine.diff b/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstCombine.diff deleted file mode 100644 index b715a544f..000000000 --- a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstCombine.diff +++ /dev/null @@ -1,82 +0,0 @@ -- // MIR for `::clone` before InstCombine -+ // MIR for `::clone` after InstCombine - - fn ::clone(_1: &MyThing) -> MyThing { - debug self => _1; // in scope 0 at $DIR/combine_clone_of_primitives.rs:+0:10: +0:15 - let mut _0: MyThing; // return place in scope 0 at $DIR/combine_clone_of_primitives.rs:+0:10: +0:15 - let mut _2: T; // in scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 - let mut _3: &T; // in scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 - let _4: &T; // in scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 - let mut _5: u64; // in scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 - let mut _6: &u64; // in scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 - let _7: &u64; // in scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 - let mut _8: [f32; 3]; // in scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 - let mut _9: &[f32; 3]; // in scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 - let _10: &[f32; 3]; // in scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 - - bb0: { - StorageLive(_2); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 - StorageLive(_3); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 - StorageLive(_4); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 - _4 = &((*_1).0: T); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 -- _3 = &(*_4); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 -+ _3 = _4; // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 - _2 = ::clone(move _3) -> bb1; // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 - // mir::Constant - // + span: $DIR/combine_clone_of_primitives.rs:8:5: 8:9 - // + literal: Const { ty: for<'a> fn(&'a T) -> T {::clone}, val: Value() } - } - - bb1: { - StorageDead(_3); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:8: 8:9 - StorageLive(_5); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 - StorageLive(_6); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 - StorageLive(_7); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 - _7 = &((*_1).1: u64); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 -- _6 = &(*_7); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 -- _5 = ::clone(move _6) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 -- // mir::Constant -- // + span: $DIR/combine_clone_of_primitives.rs:9:5: 9:11 -- // + literal: Const { ty: for<'a> fn(&'a u64) -> u64 {::clone}, val: Value() } -+ _6 = _7; // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 -+ _5 = (*_6); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 -+ goto -> bb2; // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 - } - - bb2: { - StorageDead(_6); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:10: 9:11 - StorageLive(_8); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 - StorageLive(_9); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 - StorageLive(_10); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 - _10 = &((*_1).2: [f32; 3]); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 -- _9 = &(*_10); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 -- _8 = <[f32; 3] as Clone>::clone(move _9) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 -- // mir::Constant -- // + span: $DIR/combine_clone_of_primitives.rs:10:5: 10:16 -- // + literal: Const { ty: for<'a> fn(&'a [f32; 3]) -> [f32; 3] {<[f32; 3] as Clone>::clone}, val: Value() } -+ _9 = _10; // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 -+ _8 = (*_9); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 -+ goto -> bb3; // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 - } - - bb3: { - StorageDead(_9); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:15: 10:16 - _0 = MyThing:: { v: move _2, i: move _5, a: move _8 }; // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:10: +0:15 - StorageDead(_8); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15 - StorageDead(_5); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15 - StorageDead(_2); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15 - StorageDead(_10); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15 - StorageDead(_7); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15 - StorageDead(_4); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15 - return; // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:15: +0:15 - } - - bb4 (cleanup): { - drop(_2) -> [return: bb5, unwind terminate]; // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15 - } - - bb5 (cleanup): { - resume; // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:10: +0:15 - } - } - diff --git a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff b/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff new file mode 100644 index 000000000..bb0811a7a --- /dev/null +++ b/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff @@ -0,0 +1,82 @@ +- // MIR for `::clone` before InstSimplify ++ // MIR for `::clone` after InstSimplify + + fn ::clone(_1: &MyThing) -> MyThing { + debug self => _1; // in scope 0 at $DIR/combine_clone_of_primitives.rs:+0:10: +0:15 + let mut _0: MyThing; // return place in scope 0 at $DIR/combine_clone_of_primitives.rs:+0:10: +0:15 + let mut _2: T; // in scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 + let mut _3: &T; // in scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 + let _4: &T; // in scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 + let mut _5: u64; // in scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 + let mut _6: &u64; // in scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 + let _7: &u64; // in scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 + let mut _8: [f32; 3]; // in scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 + let mut _9: &[f32; 3]; // in scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 + let _10: &[f32; 3]; // in scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 + StorageLive(_3); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 + StorageLive(_4); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 + _4 = &((*_1).0: T); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 +- _3 = &(*_4); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 ++ _3 = _4; // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 + _2 = ::clone(move _3) -> bb1; // scope 0 at $DIR/combine_clone_of_primitives.rs:8:5: 8:9 + // mir::Constant + // + span: $DIR/combine_clone_of_primitives.rs:8:5: 8:9 + // + literal: Const { ty: for<'a> fn(&'a T) -> T {::clone}, val: Value() } + } + + bb1: { + StorageDead(_3); // scope 0 at $DIR/combine_clone_of_primitives.rs:8:8: 8:9 + StorageLive(_5); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 + StorageLive(_6); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 + StorageLive(_7); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 + _7 = &((*_1).1: u64); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 +- _6 = &(*_7); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 +- _5 = ::clone(move _6) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 +- // mir::Constant +- // + span: $DIR/combine_clone_of_primitives.rs:9:5: 9:11 +- // + literal: Const { ty: for<'a> fn(&'a u64) -> u64 {::clone}, val: Value() } ++ _6 = _7; // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 ++ _5 = (*_6); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 ++ goto -> bb2; // scope 0 at $DIR/combine_clone_of_primitives.rs:9:5: 9:11 + } + + bb2: { + StorageDead(_6); // scope 0 at $DIR/combine_clone_of_primitives.rs:9:10: 9:11 + StorageLive(_8); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 + StorageLive(_9); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 + StorageLive(_10); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 + _10 = &((*_1).2: [f32; 3]); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 +- _9 = &(*_10); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 +- _8 = <[f32; 3] as Clone>::clone(move _9) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 +- // mir::Constant +- // + span: $DIR/combine_clone_of_primitives.rs:10:5: 10:16 +- // + literal: Const { ty: for<'a> fn(&'a [f32; 3]) -> [f32; 3] {<[f32; 3] as Clone>::clone}, val: Value() } ++ _9 = _10; // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 ++ _8 = (*_9); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 ++ goto -> bb3; // scope 0 at $DIR/combine_clone_of_primitives.rs:10:5: 10:16 + } + + bb3: { + StorageDead(_9); // scope 0 at $DIR/combine_clone_of_primitives.rs:10:15: 10:16 + _0 = MyThing:: { v: move _2, i: move _5, a: move _8 }; // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:10: +0:15 + StorageDead(_8); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15 + StorageDead(_5); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15 + StorageDead(_2); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15 + StorageDead(_10); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15 + StorageDead(_7); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15 + StorageDead(_4); // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15 + return; // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:15: +0:15 + } + + bb4 (cleanup): { + drop(_2) -> [return: bb5, unwind terminate]; // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:14: +0:15 + } + + bb5 (cleanup): { + resume; // scope 0 at $DIR/combine_clone_of_primitives.rs:+0:10: +0:15 + } + } + diff --git a/tests/mir-opt/combine_transmutes.adt_transmutes.InstCombine.diff b/tests/mir-opt/combine_transmutes.adt_transmutes.InstCombine.diff deleted file mode 100644 index 168e8c610..000000000 --- a/tests/mir-opt/combine_transmutes.adt_transmutes.InstCombine.diff +++ /dev/null @@ -1,158 +0,0 @@ -- // MIR for `adt_transmutes` before InstCombine -+ // MIR for `adt_transmutes` after InstCombine - - fn adt_transmutes() -> () { - let mut _0: (); // return place in scope 0 at $DIR/combine_transmutes.rs:+0:32: +0:32 - let _1: u8; // in scope 0 at $DIR/combine_transmutes.rs:+1:9: +1:11 - let mut _2: EnumNoRepr; // in scope 0 at $DIR/combine_transmutes.rs:+1:28: +1:41 - let mut _4: EnumNoRepr; // in scope 0 at $DIR/combine_transmutes.rs:+2:28: +2:41 - let mut _6: EnumReprIsize; // in scope 0 at $DIR/combine_transmutes.rs:+3:31: +3:47 - let mut _8: EnumReprIsize; // in scope 0 at $DIR/combine_transmutes.rs:+4:31: +4:47 - let mut _10: std::cmp::Ordering; // in scope 0 at $DIR/combine_transmutes.rs:+5:28: +5:52 - let mut _12: std::cmp::Ordering; // in scope 0 at $DIR/combine_transmutes.rs:+6:28: +6:52 - let mut _14: std::option::Option; // in scope 0 at $DIR/combine_transmutes.rs:+7:28: +7:58 - let mut _16: std::num::Wrapping; // in scope 0 at $DIR/combine_transmutes.rs:+8:29: +8:54 - let mut _18: std::num::Wrapping; // in scope 0 at $DIR/combine_transmutes.rs:+9:29: +9:54 - let mut _20: Union32; // in scope 0 at $DIR/combine_transmutes.rs:+10:29: +10:47 - let mut _22: Union32; // in scope 0 at $DIR/combine_transmutes.rs:+11:29: +11:47 - let mut _24: std::mem::MaybeUninit; // in scope 0 at $DIR/combine_transmutes.rs:+12:46: +12:77 - scope 1 { - debug _a => _1; // in scope 1 at $DIR/combine_transmutes.rs:+1:9: +1:11 - let _3: i8; // in scope 1 at $DIR/combine_transmutes.rs:+2:9: +2:11 - scope 2 { - debug _a => _3; // in scope 2 at $DIR/combine_transmutes.rs:+2:9: +2:11 - let _5: usize; // in scope 2 at $DIR/combine_transmutes.rs:+3:9: +3:11 - scope 3 { - debug _a => _5; // in scope 3 at $DIR/combine_transmutes.rs:+3:9: +3:11 - let _7: isize; // in scope 3 at $DIR/combine_transmutes.rs:+4:9: +4:11 - scope 4 { - debug _a => _7; // in scope 4 at $DIR/combine_transmutes.rs:+4:9: +4:11 - let _9: u8; // in scope 4 at $DIR/combine_transmutes.rs:+5:9: +5:11 - scope 5 { - debug _a => _9; // in scope 5 at $DIR/combine_transmutes.rs:+5:9: +5:11 - let _11: i8; // in scope 5 at $DIR/combine_transmutes.rs:+6:9: +6:11 - scope 6 { - debug _a => _11; // in scope 6 at $DIR/combine_transmutes.rs:+6:9: +6:11 - let _13: u8; // in scope 6 at $DIR/combine_transmutes.rs:+7:9: +7:11 - scope 7 { - debug _a => _13; // in scope 7 at $DIR/combine_transmutes.rs:+7:9: +7:11 - let _15: i16; // in scope 7 at $DIR/combine_transmutes.rs:+8:9: +8:11 - scope 8 { - debug _a => _15; // in scope 8 at $DIR/combine_transmutes.rs:+8:9: +8:11 - let _17: u16; // in scope 8 at $DIR/combine_transmutes.rs:+9:9: +9:11 - scope 9 { - debug _a => _17; // in scope 9 at $DIR/combine_transmutes.rs:+9:9: +9:11 - let _19: u32; // in scope 9 at $DIR/combine_transmutes.rs:+10:9: +10:11 - scope 10 { - debug _a => _19; // in scope 10 at $DIR/combine_transmutes.rs:+10:9: +10:11 - let _21: i32; // in scope 10 at $DIR/combine_transmutes.rs:+11:9: +11:11 - scope 11 { - debug _a => _21; // in scope 11 at $DIR/combine_transmutes.rs:+11:9: +11:11 - let _23: std::mem::ManuallyDrop; // in scope 11 at $DIR/combine_transmutes.rs:+12:9: +12:11 - scope 12 { - debug _a => _23; // in scope 12 at $DIR/combine_transmutes.rs:+12:9: +12:11 - } - } - } - } - } - } - } - } - } - } - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/combine_transmutes.rs:+1:9: +1:11 - StorageLive(_2); // scope 0 at $DIR/combine_transmutes.rs:+1:28: +1:41 - _2 = EnumNoRepr::A; // scope 0 at $DIR/combine_transmutes.rs:+1:28: +1:41 - _1 = move _2 as u8 (Transmute); // scope 0 at $DIR/combine_transmutes.rs:+1:18: +1:42 - StorageDead(_2); // scope 0 at $DIR/combine_transmutes.rs:+1:41: +1:42 - StorageLive(_3); // scope 1 at $DIR/combine_transmutes.rs:+2:9: +2:11 - StorageLive(_4); // scope 1 at $DIR/combine_transmutes.rs:+2:28: +2:41 - _4 = EnumNoRepr::B; // scope 1 at $DIR/combine_transmutes.rs:+2:28: +2:41 - _3 = move _4 as i8 (Transmute); // scope 1 at $DIR/combine_transmutes.rs:+2:18: +2:42 - StorageDead(_4); // scope 1 at $DIR/combine_transmutes.rs:+2:41: +2:42 - StorageLive(_5); // scope 2 at $DIR/combine_transmutes.rs:+3:9: +3:11 - StorageLive(_6); // scope 2 at $DIR/combine_transmutes.rs:+3:31: +3:47 - _6 = EnumReprIsize::A; // scope 2 at $DIR/combine_transmutes.rs:+3:31: +3:47 - _5 = move _6 as usize (Transmute); // scope 2 at $DIR/combine_transmutes.rs:+3:21: +3:48 - StorageDead(_6); // scope 2 at $DIR/combine_transmutes.rs:+3:47: +3:48 - StorageLive(_7); // scope 3 at $DIR/combine_transmutes.rs:+4:9: +4:11 - StorageLive(_8); // scope 3 at $DIR/combine_transmutes.rs:+4:31: +4:47 - _8 = EnumReprIsize::B; // scope 3 at $DIR/combine_transmutes.rs:+4:31: +4:47 -- _7 = move _8 as isize (Transmute); // scope 3 at $DIR/combine_transmutes.rs:+4:21: +4:48 -+ _7 = discriminant(_8); // scope 3 at $DIR/combine_transmutes.rs:+4:21: +4:48 - StorageDead(_8); // scope 3 at $DIR/combine_transmutes.rs:+4:47: +4:48 - StorageLive(_9); // scope 4 at $DIR/combine_transmutes.rs:+5:9: +5:11 - StorageLive(_10); // scope 4 at $DIR/combine_transmutes.rs:+5:28: +5:52 - _10 = Less; // scope 4 at $DIR/combine_transmutes.rs:+5:28: +5:52 - _9 = move _10 as u8 (Transmute); // scope 4 at $DIR/combine_transmutes.rs:+5:18: +5:53 - StorageDead(_10); // scope 4 at $DIR/combine_transmutes.rs:+5:52: +5:53 - StorageLive(_11); // scope 5 at $DIR/combine_transmutes.rs:+6:9: +6:11 - StorageLive(_12); // scope 5 at $DIR/combine_transmutes.rs:+6:28: +6:52 - _12 = Less; // scope 5 at $DIR/combine_transmutes.rs:+6:28: +6:52 -- _11 = move _12 as i8 (Transmute); // scope 5 at $DIR/combine_transmutes.rs:+6:18: +6:53 -+ _11 = discriminant(_12); // scope 5 at $DIR/combine_transmutes.rs:+6:18: +6:53 - StorageDead(_12); // scope 5 at $DIR/combine_transmutes.rs:+6:52: +6:53 - StorageLive(_13); // scope 6 at $DIR/combine_transmutes.rs:+7:9: +7:11 - StorageLive(_14); // scope 6 at $DIR/combine_transmutes.rs:+7:28: +7:58 - _14 = Option::::Some(const _); // scope 6 at $DIR/combine_transmutes.rs:+7:28: +7:58 - // mir::Constant - // + span: $DIR/combine_transmutes.rs:41:33: 41:57 - // + literal: Const { ty: NonZeroU8, val: Unevaluated(NonZeroU8::MAX, [], None) } - _13 = move _14 as u8 (Transmute); // scope 6 at $DIR/combine_transmutes.rs:+7:18: +7:59 - StorageDead(_14); // scope 6 at $DIR/combine_transmutes.rs:+7:58: +7:59 - StorageLive(_15); // scope 7 at $DIR/combine_transmutes.rs:+8:9: +8:11 - StorageLive(_16); // scope 7 at $DIR/combine_transmutes.rs:+8:29: +8:54 - _16 = Wrapping::(const 0_i16); // scope 7 at $DIR/combine_transmutes.rs:+8:29: +8:54 -- _15 = move _16 as i16 (Transmute); // scope 7 at $DIR/combine_transmutes.rs:+8:19: +8:55 -+ _15 = move (_16.0: i16); // scope 7 at $DIR/combine_transmutes.rs:+8:19: +8:55 - StorageDead(_16); // scope 7 at $DIR/combine_transmutes.rs:+8:54: +8:55 - StorageLive(_17); // scope 8 at $DIR/combine_transmutes.rs:+9:9: +9:11 - StorageLive(_18); // scope 8 at $DIR/combine_transmutes.rs:+9:29: +9:54 - _18 = Wrapping::(const 0_i16); // scope 8 at $DIR/combine_transmutes.rs:+9:29: +9:54 - _17 = move _18 as u16 (Transmute); // scope 8 at $DIR/combine_transmutes.rs:+9:19: +9:55 - StorageDead(_18); // scope 8 at $DIR/combine_transmutes.rs:+9:54: +9:55 - StorageLive(_19); // scope 9 at $DIR/combine_transmutes.rs:+10:9: +10:11 - StorageLive(_20); // scope 9 at $DIR/combine_transmutes.rs:+10:29: +10:47 - _20 = Union32 { u32: const 0_i32 }; // scope 9 at $DIR/combine_transmutes.rs:+10:29: +10:47 - _19 = move _20 as u32 (Transmute); // scope 9 at $DIR/combine_transmutes.rs:+10:19: +10:48 - StorageDead(_20); // scope 9 at $DIR/combine_transmutes.rs:+10:47: +10:48 - StorageLive(_21); // scope 10 at $DIR/combine_transmutes.rs:+11:9: +11:11 - StorageLive(_22); // scope 10 at $DIR/combine_transmutes.rs:+11:29: +11:47 - _22 = Union32 { u32: const 0_u32 }; // scope 10 at $DIR/combine_transmutes.rs:+11:29: +11:47 - _21 = move _22 as i32 (Transmute); // scope 10 at $DIR/combine_transmutes.rs:+11:19: +11:48 - StorageDead(_22); // scope 10 at $DIR/combine_transmutes.rs:+11:47: +11:48 - StorageLive(_23); // scope 11 at $DIR/combine_transmutes.rs:+12:9: +12:11 - StorageLive(_24); // scope 11 at $DIR/combine_transmutes.rs:+12:46: +12:77 - _24 = MaybeUninit::::uninit() -> [return: bb1, unwind unreachable]; // scope 11 at $DIR/combine_transmutes.rs:+12:46: +12:77 - // mir::Constant - // + span: $DIR/combine_transmutes.rs:46:46: 46:75 - // + user_ty: UserType(23) - // + literal: Const { ty: fn() -> MaybeUninit {MaybeUninit::::uninit}, val: Value() } - } - - bb1: { -- _23 = move _24 as std::mem::ManuallyDrop (Transmute); // scope 11 at $DIR/combine_transmutes.rs:+12:36: +12:78 -+ _23 = move (_24.1: std::mem::ManuallyDrop); // scope 11 at $DIR/combine_transmutes.rs:+12:36: +12:78 - StorageDead(_24); // scope 11 at $DIR/combine_transmutes.rs:+12:77: +12:78 - _0 = const (); // scope 0 at $DIR/combine_transmutes.rs:+0:32: +13:2 - StorageDead(_23); // scope 11 at $DIR/combine_transmutes.rs:+13:1: +13:2 - StorageDead(_21); // scope 10 at $DIR/combine_transmutes.rs:+13:1: +13:2 - StorageDead(_19); // scope 9 at $DIR/combine_transmutes.rs:+13:1: +13:2 - StorageDead(_17); // scope 8 at $DIR/combine_transmutes.rs:+13:1: +13:2 - StorageDead(_15); // scope 7 at $DIR/combine_transmutes.rs:+13:1: +13:2 - StorageDead(_13); // scope 6 at $DIR/combine_transmutes.rs:+13:1: +13:2 - StorageDead(_11); // scope 5 at $DIR/combine_transmutes.rs:+13:1: +13:2 - StorageDead(_9); // scope 4 at $DIR/combine_transmutes.rs:+13:1: +13:2 - StorageDead(_7); // scope 3 at $DIR/combine_transmutes.rs:+13:1: +13:2 - StorageDead(_5); // scope 2 at $DIR/combine_transmutes.rs:+13:1: +13:2 - StorageDead(_3); // scope 1 at $DIR/combine_transmutes.rs:+13:1: +13:2 - StorageDead(_1); // scope 0 at $DIR/combine_transmutes.rs:+13:1: +13:2 - return; // scope 0 at $DIR/combine_transmutes.rs:+13:2: +13:2 - } - } - diff --git a/tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff b/tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff new file mode 100644 index 000000000..15117ea89 --- /dev/null +++ b/tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff @@ -0,0 +1,90 @@ +- // MIR for `adt_transmutes` before InstSimplify ++ // MIR for `adt_transmutes` after InstSimplify + + fn adt_transmutes() -> () { + let mut _0: (); // return place in scope 0 at $DIR/combine_transmutes.rs:+0:32: +0:32 + let _1: u8; // in scope 0 at $DIR/combine_transmutes.rs:+1:9: +1:11 + let mut _2: std::option::Option; // in scope 0 at $DIR/combine_transmutes.rs:+1:28: +1:58 + let mut _4: std::num::Wrapping; // in scope 0 at $DIR/combine_transmutes.rs:+2:29: +2:54 + let mut _6: std::num::Wrapping; // in scope 0 at $DIR/combine_transmutes.rs:+3:29: +3:54 + let mut _8: Union32; // in scope 0 at $DIR/combine_transmutes.rs:+4:29: +4:47 + let mut _10: Union32; // in scope 0 at $DIR/combine_transmutes.rs:+5:29: +5:47 + let mut _12: std::mem::MaybeUninit; // in scope 0 at $DIR/combine_transmutes.rs:+6:46: +6:77 + scope 1 { + debug _a => _1; // in scope 1 at $DIR/combine_transmutes.rs:+1:9: +1:11 + let _3: i16; // in scope 1 at $DIR/combine_transmutes.rs:+2:9: +2:11 + scope 2 { + debug _a => _3; // in scope 2 at $DIR/combine_transmutes.rs:+2:9: +2:11 + let _5: u16; // in scope 2 at $DIR/combine_transmutes.rs:+3:9: +3:11 + scope 3 { + debug _a => _5; // in scope 3 at $DIR/combine_transmutes.rs:+3:9: +3:11 + let _7: u32; // in scope 3 at $DIR/combine_transmutes.rs:+4:9: +4:11 + scope 4 { + debug _a => _7; // in scope 4 at $DIR/combine_transmutes.rs:+4:9: +4:11 + let _9: i32; // in scope 4 at $DIR/combine_transmutes.rs:+5:9: +5:11 + scope 5 { + debug _a => _9; // in scope 5 at $DIR/combine_transmutes.rs:+5:9: +5:11 + let _11: std::mem::ManuallyDrop; // in scope 5 at $DIR/combine_transmutes.rs:+6:9: +6:11 + scope 6 { + debug _a => _11; // in scope 6 at $DIR/combine_transmutes.rs:+6:9: +6:11 + } + } + } + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/combine_transmutes.rs:+1:9: +1:11 + StorageLive(_2); // scope 0 at $DIR/combine_transmutes.rs:+1:28: +1:58 + _2 = Option::::Some(const _); // scope 0 at $DIR/combine_transmutes.rs:+1:28: +1:58 + // mir::Constant + // + span: $DIR/combine_transmutes.rs:35:33: 35:57 + // + literal: Const { ty: NonZeroU8, val: Unevaluated(NonZeroU8::MAX, [], None) } + _1 = move _2 as u8 (Transmute); // scope 0 at $DIR/combine_transmutes.rs:+1:18: +1:59 + StorageDead(_2); // scope 0 at $DIR/combine_transmutes.rs:+1:58: +1:59 + StorageLive(_3); // scope 1 at $DIR/combine_transmutes.rs:+2:9: +2:11 + StorageLive(_4); // scope 1 at $DIR/combine_transmutes.rs:+2:29: +2:54 + _4 = Wrapping::(const 0_i16); // scope 1 at $DIR/combine_transmutes.rs:+2:29: +2:54 +- _3 = move _4 as i16 (Transmute); // scope 1 at $DIR/combine_transmutes.rs:+2:19: +2:55 ++ _3 = move (_4.0: i16); // scope 1 at $DIR/combine_transmutes.rs:+2:19: +2:55 + StorageDead(_4); // scope 1 at $DIR/combine_transmutes.rs:+2:54: +2:55 + StorageLive(_5); // scope 2 at $DIR/combine_transmutes.rs:+3:9: +3:11 + StorageLive(_6); // scope 2 at $DIR/combine_transmutes.rs:+3:29: +3:54 + _6 = Wrapping::(const 0_i16); // scope 2 at $DIR/combine_transmutes.rs:+3:29: +3:54 + _5 = move _6 as u16 (Transmute); // scope 2 at $DIR/combine_transmutes.rs:+3:19: +3:55 + StorageDead(_6); // scope 2 at $DIR/combine_transmutes.rs:+3:54: +3:55 + StorageLive(_7); // scope 3 at $DIR/combine_transmutes.rs:+4:9: +4:11 + StorageLive(_8); // scope 3 at $DIR/combine_transmutes.rs:+4:29: +4:47 + _8 = Union32 { u32: const 0_i32 }; // scope 3 at $DIR/combine_transmutes.rs:+4:29: +4:47 + _7 = move _8 as u32 (Transmute); // scope 3 at $DIR/combine_transmutes.rs:+4:19: +4:48 + StorageDead(_8); // scope 3 at $DIR/combine_transmutes.rs:+4:47: +4:48 + StorageLive(_9); // scope 4 at $DIR/combine_transmutes.rs:+5:9: +5:11 + StorageLive(_10); // scope 4 at $DIR/combine_transmutes.rs:+5:29: +5:47 + _10 = Union32 { u32: const 0_u32 }; // scope 4 at $DIR/combine_transmutes.rs:+5:29: +5:47 + _9 = move _10 as i32 (Transmute); // scope 4 at $DIR/combine_transmutes.rs:+5:19: +5:48 + StorageDead(_10); // scope 4 at $DIR/combine_transmutes.rs:+5:47: +5:48 + StorageLive(_11); // scope 5 at $DIR/combine_transmutes.rs:+6:9: +6:11 + StorageLive(_12); // scope 5 at $DIR/combine_transmutes.rs:+6:46: +6:77 + _12 = MaybeUninit::::uninit() -> [return: bb1, unwind unreachable]; // scope 5 at $DIR/combine_transmutes.rs:+6:46: +6:77 + // mir::Constant + // + span: $DIR/combine_transmutes.rs:40:46: 40:75 + // + user_ty: UserType(11) + // + literal: Const { ty: fn() -> MaybeUninit {MaybeUninit::::uninit}, val: Value() } + } + + bb1: { +- _11 = move _12 as std::mem::ManuallyDrop (Transmute); // scope 5 at $DIR/combine_transmutes.rs:+6:36: +6:78 ++ _11 = move (_12.1: std::mem::ManuallyDrop); // scope 5 at $DIR/combine_transmutes.rs:+6:36: +6:78 + StorageDead(_12); // scope 5 at $DIR/combine_transmutes.rs:+6:77: +6:78 + _0 = const (); // scope 0 at $DIR/combine_transmutes.rs:+0:32: +7:2 + StorageDead(_11); // scope 5 at $DIR/combine_transmutes.rs:+7:1: +7:2 + StorageDead(_9); // scope 4 at $DIR/combine_transmutes.rs:+7:1: +7:2 + StorageDead(_7); // scope 3 at $DIR/combine_transmutes.rs:+7:1: +7:2 + StorageDead(_5); // scope 2 at $DIR/combine_transmutes.rs:+7:1: +7:2 + StorageDead(_3); // scope 1 at $DIR/combine_transmutes.rs:+7:1: +7:2 + StorageDead(_1); // scope 0 at $DIR/combine_transmutes.rs:+7:1: +7:2 + return; // scope 0 at $DIR/combine_transmutes.rs:+7:2: +7:2 + } + } + diff --git a/tests/mir-opt/combine_transmutes.identity_transmutes.InstCombine.diff b/tests/mir-opt/combine_transmutes.identity_transmutes.InstCombine.diff deleted file mode 100644 index ae1185c7f..000000000 --- a/tests/mir-opt/combine_transmutes.identity_transmutes.InstCombine.diff +++ /dev/null @@ -1,43 +0,0 @@ -- // MIR for `identity_transmutes` before InstCombine -+ // MIR for `identity_transmutes` after InstCombine - - fn identity_transmutes() -> () { - let mut _0: (); // return place in scope 0 at $DIR/combine_transmutes.rs:+0:37: +0:37 - let _1: i32; // in scope 0 at $DIR/combine_transmutes.rs:+2:9: +2:11 - let mut _3: std::vec::Vec; // in scope 0 at $DIR/combine_transmutes.rs:+3:46: +3:56 - scope 1 { - debug _a => _1; // in scope 1 at $DIR/combine_transmutes.rs:+2:9: +2:11 - let _2: std::vec::Vec; // in scope 1 at $DIR/combine_transmutes.rs:+3:9: +3:11 - scope 2 { - debug _a => _2; // in scope 2 at $DIR/combine_transmutes.rs:+3:9: +3:11 - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/combine_transmutes.rs:+2:9: +2:11 -- _1 = const 1_i32 as i32 (Transmute); // scope 0 at $DIR/combine_transmutes.rs:+2:14: +2:38 -+ _1 = const 1_i32; // scope 0 at $DIR/combine_transmutes.rs:+2:14: +2:38 - StorageLive(_2); // scope 1 at $DIR/combine_transmutes.rs:+3:9: +3:11 - StorageLive(_3); // scope 1 at $DIR/combine_transmutes.rs:+3:46: +3:56 - _3 = Vec::::new() -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/combine_transmutes.rs:+3:46: +3:56 - // mir::Constant - // + span: $DIR/combine_transmutes.rs:15:46: 15:54 - // + user_ty: UserType(0) - // + literal: Const { ty: fn() -> Vec {Vec::::new}, val: Value() } - } - - bb1: { -- _2 = move _3 as std::vec::Vec (Transmute); // scope 1 at $DIR/combine_transmutes.rs:+3:14: +3:57 -+ _2 = move _3; // scope 1 at $DIR/combine_transmutes.rs:+3:14: +3:57 - StorageDead(_3); // scope 1 at $DIR/combine_transmutes.rs:+3:56: +3:57 - _0 = const (); // scope 0 at $DIR/combine_transmutes.rs:+0:37: +4:2 - drop(_2) -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/combine_transmutes.rs:+4:1: +4:2 - } - - bb2: { - StorageDead(_2); // scope 1 at $DIR/combine_transmutes.rs:+4:1: +4:2 - StorageDead(_1); // scope 0 at $DIR/combine_transmutes.rs:+4:1: +4:2 - return; // scope 0 at $DIR/combine_transmutes.rs:+4:2: +4:2 - } - } - diff --git a/tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff b/tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff new file mode 100644 index 000000000..57d9f4b14 --- /dev/null +++ b/tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff @@ -0,0 +1,43 @@ +- // MIR for `identity_transmutes` before InstSimplify ++ // MIR for `identity_transmutes` after InstSimplify + + fn identity_transmutes() -> () { + let mut _0: (); // return place in scope 0 at $DIR/combine_transmutes.rs:+0:37: +0:37 + let _1: i32; // in scope 0 at $DIR/combine_transmutes.rs:+2:9: +2:11 + let mut _3: std::vec::Vec; // in scope 0 at $DIR/combine_transmutes.rs:+3:46: +3:56 + scope 1 { + debug _a => _1; // in scope 1 at $DIR/combine_transmutes.rs:+2:9: +2:11 + let _2: std::vec::Vec; // in scope 1 at $DIR/combine_transmutes.rs:+3:9: +3:11 + scope 2 { + debug _a => _2; // in scope 2 at $DIR/combine_transmutes.rs:+3:9: +3:11 + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/combine_transmutes.rs:+2:9: +2:11 +- _1 = const 1_i32 as i32 (Transmute); // scope 0 at $DIR/combine_transmutes.rs:+2:14: +2:38 ++ _1 = const 1_i32; // scope 0 at $DIR/combine_transmutes.rs:+2:14: +2:38 + StorageLive(_2); // scope 1 at $DIR/combine_transmutes.rs:+3:9: +3:11 + StorageLive(_3); // scope 1 at $DIR/combine_transmutes.rs:+3:46: +3:56 + _3 = Vec::::new() -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/combine_transmutes.rs:+3:46: +3:56 + // mir::Constant + // + span: $DIR/combine_transmutes.rs:15:46: 15:54 + // + user_ty: UserType(0) + // + literal: Const { ty: fn() -> Vec {Vec::::new}, val: Value() } + } + + bb1: { +- _2 = move _3 as std::vec::Vec (Transmute); // scope 1 at $DIR/combine_transmutes.rs:+3:14: +3:57 ++ _2 = move _3; // scope 1 at $DIR/combine_transmutes.rs:+3:14: +3:57 + StorageDead(_3); // scope 1 at $DIR/combine_transmutes.rs:+3:56: +3:57 + _0 = const (); // scope 0 at $DIR/combine_transmutes.rs:+0:37: +4:2 + drop(_2) -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/combine_transmutes.rs:+4:1: +4:2 + } + + bb2: { + StorageDead(_2); // scope 1 at $DIR/combine_transmutes.rs:+4:1: +4:2 + StorageDead(_1); // scope 0 at $DIR/combine_transmutes.rs:+4:1: +4:2 + return; // scope 0 at $DIR/combine_transmutes.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/combine_transmutes.integer_transmutes.InstCombine.diff b/tests/mir-opt/combine_transmutes.integer_transmutes.InstCombine.diff deleted file mode 100644 index 8de7c34e6..000000000 --- a/tests/mir-opt/combine_transmutes.integer_transmutes.InstCombine.diff +++ /dev/null @@ -1,24 +0,0 @@ -- // MIR for `integer_transmutes` before InstCombine -+ // MIR for `integer_transmutes` after InstCombine - - fn integer_transmutes() -> () { - let mut _0: (); // return place in scope 0 at $DIR/combine_transmutes.rs:+0:36: +0:36 - let mut _1: u32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL - let mut _2: i64; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL - let mut _3: i64; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL - let mut _4: u32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL - let mut _5: usize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL - - bb0: { -- _1 = const 1_i32 as u32 (Transmute); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL -+ _1 = const 1_i32 as u32 (IntToInt); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL - _2 = const 1_i32 as i64 (Transmute); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL -- _3 = const 1_u64 as i64 (Transmute); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL -+ _3 = const 1_u64 as i64 (IntToInt); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL - _4 = const 1_u64 as u32 (Transmute); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL -- _5 = const 1_isize as usize (Transmute); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL -+ _5 = const 1_isize as usize (IntToInt); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL - return; // scope 0 at $DIR/combine_transmutes.rs:+8:13: +8:21 - } - } - diff --git a/tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff b/tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff new file mode 100644 index 000000000..ec7c982c1 --- /dev/null +++ b/tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff @@ -0,0 +1,24 @@ +- // MIR for `integer_transmutes` before InstSimplify ++ // MIR for `integer_transmutes` after InstSimplify + + fn integer_transmutes() -> () { + let mut _0: (); // return place in scope 0 at $DIR/combine_transmutes.rs:+0:36: +0:36 + let mut _1: u32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _2: i64; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _3: i64; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _4: u32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _5: usize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + + bb0: { +- _1 = const 1_i32 as u32 (Transmute); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL ++ _1 = const 1_i32 as u32 (IntToInt); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + _2 = const 1_i32 as i64 (Transmute); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL +- _3 = const 1_u64 as i64 (Transmute); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL ++ _3 = const 1_u64 as i64 (IntToInt); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + _4 = const 1_u64 as u32 (Transmute); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL +- _5 = const 1_isize as usize (Transmute); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL ++ _5 = const 1_isize as usize (IntToInt); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + return; // scope 0 at $DIR/combine_transmutes.rs:+8:13: +8:21 + } + } + diff --git a/tests/mir-opt/combine_transmutes.rs b/tests/mir-opt/combine_transmutes.rs index de9b9c35c..403f9356c 100644 --- a/tests/mir-opt/combine_transmutes.rs +++ b/tests/mir-opt/combine_transmutes.rs @@ -1,4 +1,4 @@ -// unit-test: InstCombine +// unit-test: InstSimplify // compile-flags: -C panic=abort #![crate_type = "lib"] @@ -8,7 +8,7 @@ use std::intrinsics::mir::*; use std::mem::{MaybeUninit, ManuallyDrop, transmute}; -// EMIT_MIR combine_transmutes.identity_transmutes.InstCombine.diff +// EMIT_MIR combine_transmutes.identity_transmutes.InstSimplify.diff pub unsafe fn identity_transmutes() { // These are nops and should be removed let _a = transmute::(1); @@ -16,7 +16,7 @@ pub unsafe fn identity_transmutes() { } #[custom_mir(dialect = "runtime", phase = "initial")] -// EMIT_MIR combine_transmutes.integer_transmutes.InstCombine.diff +// EMIT_MIR combine_transmutes.integer_transmutes.InstSimplify.diff pub unsafe fn integer_transmutes() { mir! { { @@ -30,14 +30,8 @@ pub unsafe fn integer_transmutes() { } } -// EMIT_MIR combine_transmutes.adt_transmutes.InstCombine.diff +// EMIT_MIR combine_transmutes.adt_transmutes.InstSimplify.diff pub unsafe fn adt_transmutes() { - let _a: u8 = transmute(EnumNoRepr::A); - let _a: i8 = transmute(EnumNoRepr::B); - let _a: usize = transmute(EnumReprIsize::A); - let _a: isize = transmute(EnumReprIsize::B); - let _a: u8 = transmute(std::cmp::Ordering::Less); - let _a: i8 = transmute(std::cmp::Ordering::Less); let _a: u8 = transmute(Some(std::num::NonZeroU8::MAX)); let _a: i16 = transmute(std::num::Wrapping(0_i16)); let _a: u16 = transmute(std::num::Wrapping(0_i16)); @@ -46,20 +40,4 @@ pub unsafe fn adt_transmutes() { let _a: ManuallyDrop = transmute(MaybeUninit::::uninit()); } -#[inline(always)] -#[custom_mir(dialect = "runtime", phase = "initial")] -const unsafe fn mir_transmute(x: T) -> U { - mir!{ - { - RET = CastTransmute(x); - Return() - } - } -} - -pub enum EnumNoRepr { A, B, C } - -#[repr(isize)] -pub enum EnumReprIsize { A, B, C } - pub union Union32 { u32: u32, i32: i32 } diff --git a/tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir b/tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir index 9b69f79c2..169e99dee 100644 --- a/tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir +++ b/tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir @@ -21,42 +21,42 @@ fn main() -> () { } alloc1 (static: FOO, size: 8, align: 4) { - ╾─alloc18─╼ 03 00 00 00 │ ╾──╼.... + ╾─alloc19─╼ 03 00 00 00 │ ╾──╼.... } -alloc18 (size: 48, align: 4) { - 0x00 │ 00 00 00 00 __ __ __ __ ╾─alloc5──╼ 00 00 00 00 │ ....░░░░╾──╼.... - 0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc8──╼ 02 00 00 00 │ ....░░░░╾──╼.... - 0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc13─╼ 03 00 00 00 │ ....*...╾──╼.... +alloc19 (size: 48, align: 4) { + 0x00 │ 00 00 00 00 __ __ __ __ ╾─alloc6──╼ 00 00 00 00 │ ....░░░░╾──╼.... + 0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc9──╼ 02 00 00 00 │ ....░░░░╾──╼.... + 0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc14─╼ 03 00 00 00 │ ....*...╾──╼.... } -alloc5 (size: 0, align: 4) {} +alloc6 (size: 0, align: 4) {} -alloc8 (size: 16, align: 4) { - ╾─alloc9──╼ 03 00 00 00 ╾─alloc10─╼ 03 00 00 00 │ ╾──╼....╾──╼.... +alloc9 (size: 16, align: 4) { + ╾─alloc10─╼ 03 00 00 00 ╾─alloc11─╼ 03 00 00 00 │ ╾──╼....╾──╼.... } -alloc9 (size: 3, align: 1) { +alloc10 (size: 3, align: 1) { 66 6f 6f │ foo } -alloc10 (size: 3, align: 1) { +alloc11 (size: 3, align: 1) { 62 61 72 │ bar } -alloc13 (size: 24, align: 4) { - 0x00 │ ╾─alloc14─╼ 03 00 00 00 ╾─alloc15─╼ 03 00 00 00 │ ╾──╼....╾──╼.... - 0x10 │ ╾─alloc16─╼ 04 00 00 00 │ ╾──╼.... +alloc14 (size: 24, align: 4) { + 0x00 │ ╾─alloc15─╼ 03 00 00 00 ╾─alloc16─╼ 03 00 00 00 │ ╾──╼....╾──╼.... + 0x10 │ ╾─alloc17─╼ 04 00 00 00 │ ╾──╼.... } -alloc14 (size: 3, align: 1) { +alloc15 (size: 3, align: 1) { 6d 65 68 │ meh } -alloc15 (size: 3, align: 1) { +alloc16 (size: 3, align: 1) { 6d 6f 70 │ mop } -alloc16 (size: 4, align: 1) { +alloc17 (size: 4, align: 1) { 6d c3 b6 70 │ m..p } diff --git a/tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir b/tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir index d0f196e72..db1f96488 100644 --- a/tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir +++ b/tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir @@ -21,46 +21,46 @@ fn main() -> () { } alloc1 (static: FOO, size: 16, align: 8) { - ╾───────alloc18───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........ + ╾───────alloc19───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........ } -alloc18 (size: 72, align: 8) { - 0x00 │ 00 00 00 00 __ __ __ __ ╾───────alloc5────────╼ │ ....░░░░╾──────╼ +alloc19 (size: 72, align: 8) { + 0x00 │ 00 00 00 00 __ __ __ __ ╾───────alloc6────────╼ │ ....░░░░╾──────╼ 0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ │ ............░░░░ - 0x20 │ ╾───────alloc8────────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........ - 0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc13───────╼ │ ....*...╾──────╼ + 0x20 │ ╾───────alloc9────────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........ + 0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc14───────╼ │ ....*...╾──────╼ 0x40 │ 03 00 00 00 00 00 00 00 │ ........ } -alloc5 (size: 0, align: 8) {} +alloc6 (size: 0, align: 8) {} -alloc8 (size: 32, align: 8) { - 0x00 │ ╾───────alloc9────────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........ - 0x10 │ ╾───────alloc10───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........ +alloc9 (size: 32, align: 8) { + 0x00 │ ╾───────alloc10───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........ + 0x10 │ ╾───────alloc11───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........ } -alloc9 (size: 3, align: 1) { +alloc10 (size: 3, align: 1) { 66 6f 6f │ foo } -alloc10 (size: 3, align: 1) { +alloc11 (size: 3, align: 1) { 62 61 72 │ bar } -alloc13 (size: 48, align: 8) { - 0x00 │ ╾───────alloc14───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........ - 0x10 │ ╾───────alloc15───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........ - 0x20 │ ╾───────alloc16───────╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........ +alloc14 (size: 48, align: 8) { + 0x00 │ ╾───────alloc15───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........ + 0x10 │ ╾───────alloc16───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........ + 0x20 │ ╾───────alloc17───────╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........ } -alloc14 (size: 3, align: 1) { +alloc15 (size: 3, align: 1) { 6d 65 68 │ meh } -alloc15 (size: 3, align: 1) { +alloc16 (size: 3, align: 1) { 6d 6f 70 │ mop } -alloc16 (size: 4, align: 1) { +alloc17 (size: 4, align: 1) { 6d c3 b6 70 │ m..p } diff --git a/tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir b/tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir index aab005c52..999acb48a 100644 --- a/tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir +++ b/tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir @@ -21,41 +21,41 @@ fn main() -> () { } alloc1 (static: FOO, size: 8, align: 4) { - ╾─alloc22─╼ 03 00 00 00 │ ╾──╼.... + ╾─alloc23─╼ 03 00 00 00 │ ╾──╼.... } -alloc22 (size: 48, align: 4) { - 0x00 │ 00 00 00 00 __ __ __ __ ╾─alloc9──╼ 00 00 00 00 │ ....░░░░╾──╼.... - 0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc14─╼ 02 00 00 00 │ ....░░░░╾──╼.... - 0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc20─╼ 03 00 00 00 │ ....*...╾──╼.... +alloc23 (size: 48, align: 4) { + 0x00 │ 00 00 00 00 __ __ __ __ ╾─alloc10─╼ 00 00 00 00 │ ....░░░░╾──╼.... + 0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc15─╼ 02 00 00 00 │ ....░░░░╾──╼.... + 0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc21─╼ 03 00 00 00 │ ....*...╾──╼.... } -alloc9 (size: 0, align: 4) {} +alloc10 (size: 0, align: 4) {} -alloc14 (size: 8, align: 4) { - ╾─alloc12─╼ ╾─alloc13─╼ │ ╾──╼╾──╼ +alloc15 (size: 8, align: 4) { + ╾─alloc13─╼ ╾─alloc14─╼ │ ╾──╼╾──╼ } -alloc12 (size: 1, align: 1) { +alloc13 (size: 1, align: 1) { 05 │ . } -alloc13 (size: 1, align: 1) { +alloc14 (size: 1, align: 1) { 06 │ . } -alloc20 (size: 12, align: 4) { - ╾─a17+0x3─╼ ╾─alloc18─╼ ╾─a19+0x2─╼ │ ╾──╼╾──╼╾──╼ +alloc21 (size: 12, align: 4) { + ╾─a18+0x3─╼ ╾─alloc19─╼ ╾─a20+0x2─╼ │ ╾──╼╾──╼╾──╼ } -alloc17 (size: 4, align: 1) { +alloc18 (size: 4, align: 1) { 2a 45 15 6f │ *E.o } -alloc18 (size: 1, align: 1) { +alloc19 (size: 1, align: 1) { 2a │ * } -alloc19 (size: 4, align: 1) { +alloc20 (size: 4, align: 1) { 2a 45 15 6f │ *E.o } diff --git a/tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir b/tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir index 0eff9474c..30311890e 100644 --- a/tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir +++ b/tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir @@ -21,44 +21,44 @@ fn main() -> () { } alloc1 (static: FOO, size: 16, align: 8) { - ╾───────alloc22───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........ + ╾───────alloc23───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........ } -alloc22 (size: 72, align: 8) { - 0x00 │ 00 00 00 00 __ __ __ __ ╾───────alloc9────────╼ │ ....░░░░╾──────╼ +alloc23 (size: 72, align: 8) { + 0x00 │ 00 00 00 00 __ __ __ __ ╾───────alloc10───────╼ │ ....░░░░╾──────╼ 0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ │ ............░░░░ - 0x20 │ ╾───────alloc14───────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........ - 0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc20───────╼ │ ....*...╾──────╼ + 0x20 │ ╾───────alloc15───────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........ + 0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc21───────╼ │ ....*...╾──────╼ 0x40 │ 03 00 00 00 00 00 00 00 │ ........ } -alloc9 (size: 0, align: 8) {} +alloc10 (size: 0, align: 8) {} -alloc14 (size: 16, align: 8) { - ╾───────alloc12───────╼ ╾───────alloc13───────╼ │ ╾──────╼╾──────╼ +alloc15 (size: 16, align: 8) { + ╾───────alloc13───────╼ ╾───────alloc14───────╼ │ ╾──────╼╾──────╼ } -alloc12 (size: 1, align: 1) { +alloc13 (size: 1, align: 1) { 05 │ . } -alloc13 (size: 1, align: 1) { +alloc14 (size: 1, align: 1) { 06 │ . } -alloc20 (size: 24, align: 8) { - 0x00 │ ╾─────alloc17+0x3─────╼ ╾───────alloc18───────╼ │ ╾──────╼╾──────╼ - 0x10 │ ╾─────alloc19+0x2─────╼ │ ╾──────╼ +alloc21 (size: 24, align: 8) { + 0x00 │ ╾─────alloc18+0x3─────╼ ╾───────alloc19───────╼ │ ╾──────╼╾──────╼ + 0x10 │ ╾─────alloc20+0x2─────╼ │ ╾──────╼ } -alloc17 (size: 4, align: 1) { +alloc18 (size: 4, align: 1) { 2a 45 15 6f │ *E.o } -alloc18 (size: 1, align: 1) { +alloc19 (size: 1, align: 1) { 2a │ * } -alloc19 (size: 4, align: 1) { +alloc20 (size: 4, align: 1) { 2a 45 15 6f │ *E.o } diff --git a/tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir b/tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir index 55c6db5d0..d592e59fa 100644 --- a/tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir +++ b/tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir @@ -21,30 +21,30 @@ fn main() -> () { } alloc1 (static: FOO, size: 4, align: 4) { - ╾─alloc11─╼ │ ╾──╼ + ╾─alloc12─╼ │ ╾──╼ } -alloc11 (size: 168, align: 1) { +alloc12 (size: 168, align: 1) { 0x00 │ ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab │ ................ - 0x10 │ ab ab ab ab ab ab ab ab ab ab ab ab ╾─alloc6──╼ │ ............╾──╼ + 0x10 │ ab ab ab ab ab ab ab ab ab ab ab ab ╾─alloc7──╼ │ ............╾──╼ 0x20 │ 01 ef cd ab 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ 0x30 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ 0x40 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ 0x50 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ 0x60 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ 0x70 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ - 0x80 │ 00 00 00 00 00 00 00 00 00 00 ╾─alloc8──╼ 00 00 │ ..........╾──╼.. - 0x90 │ ╾─a9+0x63─╼ 00 00 00 00 00 00 00 00 00 00 00 00 │ ╾──╼............ + 0x80 │ 00 00 00 00 00 00 00 00 00 00 ╾─alloc9──╼ 00 00 │ ..........╾──╼.. + 0x90 │ ╾a10+0x63─╼ 00 00 00 00 00 00 00 00 00 00 00 00 │ ╾──╼............ 0xa0 │ 00 00 00 00 00 00 00 00 │ ........ } -alloc6 (size: 4, align: 4) { +alloc7 (size: 4, align: 4) { 2a 00 00 00 │ *... } -alloc8 (fn: main) +alloc9 (fn: main) -alloc9 (size: 100, align: 1) { +alloc10 (size: 100, align: 1) { 0x00 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ 0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ 0x20 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ diff --git a/tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir b/tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir index 27492a7fd..ca53b28be 100644 --- a/tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir +++ b/tests/mir-opt/const_allocation3.main.ConstProp.after.64bit.mir @@ -21,12 +21,12 @@ fn main() -> () { } alloc1 (static: FOO, size: 8, align: 8) { - ╾───────alloc11───────╼ │ ╾──────╼ + ╾───────alloc12───────╼ │ ╾──────╼ } -alloc11 (size: 180, align: 1) { +alloc12 (size: 180, align: 1) { 0x00 │ ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab │ ................ - 0x10 │ ab ab ab ab ab ab ab ab ab ab ab ab ╾──alloc6── │ ............╾─── + 0x10 │ ab ab ab ab ab ab ab ab ab ab ab ab ╾──alloc7── │ ............╾─── 0x20 │ ──────────╼ 01 ef cd ab 00 00 00 00 00 00 00 00 │ ───╼............ 0x30 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ 0x40 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ @@ -34,18 +34,18 @@ alloc11 (size: 180, align: 1) { 0x60 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ 0x70 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ 0x80 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ╾──── │ ..............╾─ - 0x90 │ ─────alloc8─────╼ 00 00 ╾─────alloc9+0x63─────╼ │ ─────╼..╾──────╼ + 0x90 │ ─────alloc9─────╼ 00 00 ╾────alloc10+0x63─────╼ │ ─────╼..╾──────╼ 0xa0 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ 0xb0 │ 00 00 00 00 │ .... } -alloc6 (size: 4, align: 4) { +alloc7 (size: 4, align: 4) { 2a 00 00 00 │ *... } -alloc8 (fn: main) +alloc9 (fn: main) -alloc9 (size: 100, align: 1) { +alloc10 (size: 100, align: 1) { 0x00 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ 0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ 0x20 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ diff --git a/tests/mir-opt/const_promotion_extern_static.FOO-promoted[0].SimplifyCfg-elaborate-drops.after.mir b/tests/mir-opt/const_promotion_extern_static.FOO-promoted[0].SimplifyCfg-elaborate-drops.after.mir index 19daae865..41657b53f 100644 --- a/tests/mir-opt/const_promotion_extern_static.FOO-promoted[0].SimplifyCfg-elaborate-drops.after.mir +++ b/tests/mir-opt/const_promotion_extern_static.FOO-promoted[0].SimplifyCfg-elaborate-drops.after.mir @@ -7,10 +7,10 @@ promoted[0] in FOO: &[&i32; 1] = { let mut _3: *const i32; // in scope 0 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43 bb0: { - _3 = const {alloc2: *const i32}; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43 + _3 = const {alloc3: *const i32}; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43 // mir::Constant // + span: $DIR/const_promotion_extern_static.rs:13:42: 13:43 - // + literal: Const { ty: *const i32, val: Value(Scalar(alloc2)) } + // + literal: Const { ty: *const i32, val: Value(Scalar(alloc3)) } _2 = &(*_3); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:41: +0:43 _1 = [move _2]; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:46 _0 = &_1; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:55 @@ -18,4 +18,4 @@ promoted[0] in FOO: &[&i32; 1] = { } } -alloc2 (extern static: X) +alloc3 (extern static: X) diff --git a/tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff b/tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff index 5b13d6005..25ba0face 100644 --- a/tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff +++ b/tests/mir-opt/const_promotion_extern_static.FOO.PromoteTemps.diff @@ -18,11 +18,11 @@ - StorageLive(_3); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:46 - StorageLive(_4); // scope 0 at $DIR/const_promotion_extern_static.rs:+0:32: +0:45 - StorageLive(_5); // scope 1 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43 -- _5 = const {alloc2: *const i32}; // scope 1 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43 +- _5 = const {alloc3: *const i32}; // scope 1 at $DIR/const_promotion_extern_static.rs:+0:42: +0:43 + _6 = const _; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:55 // mir::Constant - // + span: $DIR/const_promotion_extern_static.rs:13:42: 13:43 -- // + literal: Const { ty: *const i32, val: Value(Scalar(alloc2)) } +- // + literal: Const { ty: *const i32, val: Value(Scalar(alloc3)) } - _4 = &(*_5); // scope 1 at $DIR/const_promotion_extern_static.rs:+0:41: +0:43 - _3 = [move _4]; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:46 - _2 = &_3; // scope 0 at $DIR/const_promotion_extern_static.rs:+0:31: +0:55 @@ -50,5 +50,5 @@ } } - -- alloc2 (extern static: X) +- alloc3 (extern static: X) diff --git a/tests/mir-opt/const_prop/address_of_pair.fn0.ConstProp.diff b/tests/mir-opt/const_prop/address_of_pair.fn0.ConstProp.diff new file mode 100644 index 000000000..d50b12044 --- /dev/null +++ b/tests/mir-opt/const_prop/address_of_pair.fn0.ConstProp.diff @@ -0,0 +1,46 @@ +- // MIR for `fn0` before ConstProp ++ // MIR for `fn0` after ConstProp + + fn fn0() -> bool { + let mut _0: bool; // return place in scope 0 at $DIR/address_of_pair.rs:+0:17: +0:21 + let mut _1: !; // in scope 0 at $DIR/address_of_pair.rs:+0:22: +9:2 + let mut _2: (i32, bool); // in scope 0 at $DIR/address_of_pair.rs:+1:9: +1:17 + let _4: (); // in scope 0 at $DIR/address_of_pair.rs:+4:5: +6:6 + let mut _6: bool; // in scope 0 at $DIR/address_of_pair.rs:+7:16: +7:22 + scope 1 { + debug pair => _2; // in scope 1 at $DIR/address_of_pair.rs:+1:9: +1:17 + let _3: *mut bool; // in scope 1 at $DIR/address_of_pair.rs:+2:9: +2:12 + scope 2 { + debug ptr => _3; // in scope 2 at $DIR/address_of_pair.rs:+2:9: +2:12 + let _5: bool; // in scope 2 at $DIR/address_of_pair.rs:+7:9: +7:12 + scope 3 { + } + scope 4 { + debug ret => _5; // in scope 4 at $DIR/address_of_pair.rs:+7:9: +7:12 + } + } + } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/address_of_pair.rs:+1:9: +1:17 + _2 = (const 1_i32, const false); // scope 0 at $DIR/address_of_pair.rs:+1:20: +1:30 + StorageLive(_3); // scope 1 at $DIR/address_of_pair.rs:+2:9: +2:12 + _3 = &raw mut (_2.1: bool); // scope 1 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + _2 = (const 1_i32, const false); // scope 2 at $DIR/address_of_pair.rs:+3:5: +3:22 + StorageLive(_4); // scope 2 at $DIR/address_of_pair.rs:+4:5: +6:6 + (*_3) = const true; // scope 3 at $DIR/address_of_pair.rs:+5:9: +5:20 + _4 = const (); // scope 3 at $DIR/address_of_pair.rs:+4:5: +6:6 + StorageDead(_4); // scope 2 at $DIR/address_of_pair.rs:+6:5: +6:6 + StorageLive(_5); // scope 2 at $DIR/address_of_pair.rs:+7:9: +7:12 + StorageLive(_6); // scope 2 at $DIR/address_of_pair.rs:+7:16: +7:22 + _6 = (_2.1: bool); // scope 2 at $DIR/address_of_pair.rs:+7:16: +7:22 + _5 = Not(move _6); // scope 2 at $DIR/address_of_pair.rs:+7:15: +7:22 + StorageDead(_6); // scope 2 at $DIR/address_of_pair.rs:+7:21: +7:22 + _0 = _5; // scope 4 at $DIR/address_of_pair.rs:+8:12: +8:15 + StorageDead(_5); // scope 2 at $DIR/address_of_pair.rs:+9:1: +9:2 + StorageDead(_3); // scope 1 at $DIR/address_of_pair.rs:+9:1: +9:2 + StorageDead(_2); // scope 0 at $DIR/address_of_pair.rs:+9:1: +9:2 + return; // scope 0 at $DIR/address_of_pair.rs:+9:2: +9:2 + } + } + diff --git a/tests/mir-opt/const_prop/address_of_pair.rs b/tests/mir-opt/const_prop/address_of_pair.rs new file mode 100644 index 000000000..43dc9bae6 --- /dev/null +++ b/tests/mir-opt/const_prop/address_of_pair.rs @@ -0,0 +1,17 @@ +// unit-test: ConstProp + +// EMIT_MIR address_of_pair.fn0.ConstProp.diff +pub fn fn0() -> bool { + let mut pair = (1, false); + let ptr = core::ptr::addr_of_mut!(pair.1); + pair = (1, false); + unsafe { + *ptr = true; + } + let ret = !pair.1; + return ret; +} + +pub fn main() { + println!("{}", fn0()); +} diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.diff b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.diff index bedfa5992..85d6b5e3d 100644 --- a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.diff @@ -18,29 +18,35 @@ } bb0: { + StorageLive(_1); // scope 0 at $DIR/bad_op_mod_by_zero.rs:+1:9: +1:10 _1 = const 0_i32; // scope 0 at $DIR/bad_op_mod_by_zero.rs:+1:13: +1:14 StorageLive(_2); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:9: +2:11 -- _4 = Eq(_1, const 0_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 + StorageLive(_3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19 +- _3 = _1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19 +- _4 = Eq(_3, const 0_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 - assert(!move _4, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 ++ _3 = const 0_i32; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19 + _4 = const true; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 + assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 } bb1: { -- _5 = Eq(_1, const -1_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 +- _5 = Eq(_3, const -1_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 - _6 = Eq(const 1_i32, const i32::MIN); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 - _7 = BitAnd(move _5, move _6); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 -- assert(!move _7, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _1) -> bb2; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 +- assert(!move _7, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> bb2; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 + _5 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 + _6 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 + _7 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 -+ assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, const 0_i32) -> bb2; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 ++ assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> bb2; // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 } bb2: { -- _2 = Rem(const 1_i32, _1); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 -+ _2 = Rem(const 1_i32, const 0_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 + _2 = Rem(const 1_i32, move _3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:14: +2:19 + StorageDead(_3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+2:18: +2:19 + _0 = const (); // scope 0 at $DIR/bad_op_mod_by_zero.rs:+0:11: +3:2 StorageDead(_2); // scope 1 at $DIR/bad_op_mod_by_zero.rs:+3:1: +3:2 + StorageDead(_1); // scope 0 at $DIR/bad_op_mod_by_zero.rs:+3:1: +3:2 return; // scope 0 at $DIR/bad_op_mod_by_zero.rs:+3:2: +3:2 } } diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs b/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs index a1078472c..93d558250 100644 --- a/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs +++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.rs @@ -1,3 +1,4 @@ +// unit-test: ConstProp // ignore-wasm32 compiled with panic=abort by default // EMIT_MIR bad_op_mod_by_zero.main.ConstProp.diff #[allow(unconditional_panic)] diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff index e711babf0..d72675c2d 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff @@ -6,16 +6,17 @@ let _1: *const [i32]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10 let mut _2: *const [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 let _3: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 - let _5: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 - let mut _6: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 - let mut _7: bool; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 - let mut _8: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + let _4: [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:26: +1:35 + let _6: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 + let mut _7: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + let mut _8: bool; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + let mut _9: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 scope 1 { debug a => _1; // in scope 1 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10 scope 2 { - let _4: i32; // in scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 + let _5: i32; // in scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 scope 3 { - debug _b => _4; // in scope 3 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 + debug _b => _5; // in scope 3 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 } } } @@ -23,27 +24,32 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10 StorageLive(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 - _8 = const _; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + StorageLive(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + _9 = const _; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 // mir::Constant - // + span: $DIR/bad_op_unsafe_oob_for_slices.rs:6:25: 6:35 + // + span: $DIR/bad_op_unsafe_oob_for_slices.rs:9:25: 9:35 // + literal: Const { ty: &[i32; 3], val: Unevaluated(main, [], Some(promoted[0])) } - _2 = &raw const (*_8); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + _3 = &(*_9); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + _2 = &raw const (*_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 _1 = move _2 as *const [i32] (Pointer(Unsize)); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 StorageDead(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:34: +1:35 - StorageLive(_4); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 - StorageLive(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 - _5 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 - _6 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 -- _7 = Lt(_5, _6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 -- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 -+ _7 = const false; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 -+ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + StorageDead(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:35: +1:36 + StorageLive(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 + StorageLive(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 + _6 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 + _7 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 +- _8 = Lt(_6, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 +- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 ++ _8 = const false; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 ++ assert(const false, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 } bb1: { - _4 = (*_1)[_5]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 - StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:25: +3:26 - StorageDead(_4); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+4:5: +4:6 +- _5 = (*_1)[_6]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 ++ _5 = (*_1)[3 of 4]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + StorageDead(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:25: +3:26 + _0 = const (); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+2:5: +4:6 + StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+4:5: +4:6 StorageDead(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:1: +5:2 return; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:2: +5:2 } diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff index e711babf0..d72675c2d 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff @@ -6,16 +6,17 @@ let _1: *const [i32]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10 let mut _2: *const [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 let _3: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 - let _5: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 - let mut _6: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 - let mut _7: bool; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 - let mut _8: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + let _4: [i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:26: +1:35 + let _6: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 + let mut _7: usize; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + let mut _8: bool; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + let mut _9: &[i32; 3]; // in scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 scope 1 { debug a => _1; // in scope 1 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10 scope 2 { - let _4: i32; // in scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 + let _5: i32; // in scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 scope 3 { - debug _b => _4; // in scope 3 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 + debug _b => _5; // in scope 3 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 } } } @@ -23,27 +24,32 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:9: +1:10 StorageLive(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 - _8 = const _; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + StorageLive(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + _9 = const _; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 // mir::Constant - // + span: $DIR/bad_op_unsafe_oob_for_slices.rs:6:25: 6:35 + // + span: $DIR/bad_op_unsafe_oob_for_slices.rs:9:25: 9:35 // + literal: Const { ty: &[i32; 3], val: Unevaluated(main, [], Some(promoted[0])) } - _2 = &raw const (*_8); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + _3 = &(*_9); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 + _2 = &raw const (*_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 _1 = move _2 as *const [i32] (Pointer(Unsize)); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:25: +1:35 StorageDead(_2); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:34: +1:35 - StorageLive(_4); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 - StorageLive(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 - _5 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 - _6 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 -- _7 = Lt(_5, _6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 -- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 -+ _7 = const false; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 -+ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + StorageDead(_3); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+1:35: +1:36 + StorageLive(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:13: +3:15 + StorageLive(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 + _6 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:23: +3:24 + _7 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 +- _8 = Lt(_6, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 +- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 ++ _8 = const false; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 ++ assert(const false, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 } bb1: { - _4 = (*_1)[_5]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 - StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:25: +3:26 - StorageDead(_4); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+4:5: +4:6 +- _5 = (*_1)[_6]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 ++ _5 = (*_1)[3 of 4]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 + StorageDead(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:25: +3:26 + _0 = const (); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+2:5: +4:6 + StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+4:5: +4:6 StorageDead(_1); // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:1: +5:2 return; // scope 0 at $DIR/bad_op_unsafe_oob_for_slices.rs:+5:2: +5:2 } diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs index 3d252f2d2..ef148d16d 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs @@ -1,4 +1,7 @@ +// unit-test: ConstProp // ignore-wasm32 compiled with panic=abort by default +// compile-flags: -Zmir-enable-passes=+NormalizeArrayLen + // EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR bad_op_unsafe_oob_for_slices.main.ConstProp.diff #[allow(unconditional_panic)] diff --git a/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff b/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff index 85dedf68c..1752d222f 100644 --- a/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff @@ -7,13 +7,17 @@ let mut _2: main::InvalidChar; // in scope 0 at $DIR/invalid_constant.rs:+6:34: +6:63 let mut _4: E; // in scope 0 at $DIR/invalid_constant.rs:+13:25: +13:59 let mut _5: main::InvalidTag; // in scope 0 at $DIR/invalid_constant.rs:+13:34: +13:55 + let mut _7: Empty; // in scope 0 at $DIR/invalid_constant.rs:+20:35: +20:73 + let mut _8: main::NoVariants; // in scope 0 at $DIR/invalid_constant.rs:+20:44: +20:65 scope 1 { debug _invalid_char => _1; // in scope 1 at $DIR/invalid_constant.rs:+6:9: +6:22 let _3: [E; 1]; // in scope 1 at $DIR/invalid_constant.rs:+13:9: +13:21 scope 3 { debug _invalid_tag => _3; // in scope 3 at $DIR/invalid_constant.rs:+13:9: +13:21 + let _6: [Empty; 1]; // in scope 3 at $DIR/invalid_constant.rs:+20:9: +20:31 scope 5 { debug _enum_without_variants => const [ZeroSized: Empty]; // in scope 5 at $DIR/invalid_constant.rs:+20:9: +20:31 + let _9: main::Str<"���">; // in scope 5 at $DIR/invalid_constant.rs:+24:9: +24:22 scope 7 { debug _non_utf8_str => const Str::<"���">; // in scope 7 at $DIR/invalid_constant.rs:+24:9: +24:22 } @@ -39,17 +43,25 @@ StorageLive(_5); // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:55 _5 = InvalidTag { int: const 4_u32 }; // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:55 - _4 = (_5.1: E); // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:57 -- _3 = [move _4]; // scope 1 at $DIR/invalid_constant.rs:+13:24: +13:60 + _4 = const Scalar(0x00000004): E; // scope 4 at $DIR/invalid_constant.rs:+13:34: +13:57 + // mir::Constant + // + span: no-location + // + literal: Const { ty: E, val: Value(Scalar(0x00000004)) } -+ _3 = [const Scalar(0x00000004): E]; // scope 1 at $DIR/invalid_constant.rs:+13:24: +13:60 -+ // mir::Constant -+ // + span: no-location -+ // + literal: Const { ty: E, val: Value(Scalar(0x00000004)) } + _3 = [move _4]; // scope 1 at $DIR/invalid_constant.rs:+13:24: +13:60 StorageDead(_4); // scope 1 at $DIR/invalid_constant.rs:+13:59: +13:60 StorageDead(_5); // scope 1 at $DIR/invalid_constant.rs:+13:60: +13:61 + nop; // scope 3 at $DIR/invalid_constant.rs:+20:9: +20:31 + nop; // scope 3 at $DIR/invalid_constant.rs:+20:35: +20:73 + StorageLive(_8); // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:65 + _8 = NoVariants { int: const 0_u32 }; // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:65 + nop; // scope 6 at $DIR/invalid_constant.rs:+20:44: +20:71 + nop; // scope 3 at $DIR/invalid_constant.rs:+20:34: +20:74 + nop; // scope 3 at $DIR/invalid_constant.rs:+20:73: +20:74 + StorageDead(_8); // scope 3 at $DIR/invalid_constant.rs:+20:74: +20:75 + nop; // scope 5 at $DIR/invalid_constant.rs:+24:9: +24:22 + nop; // scope 0 at $DIR/invalid_constant.rs:+0:11: +27:2 + nop; // scope 5 at $DIR/invalid_constant.rs:+27:1: +27:2 + nop; // scope 3 at $DIR/invalid_constant.rs:+27:1: +27:2 StorageDead(_3); // scope 1 at $DIR/invalid_constant.rs:+27:1: +27:2 StorageDead(_1); // scope 0 at $DIR/invalid_constant.rs:+27:1: +27:2 return; // scope 0 at $DIR/invalid_constant.rs:+27:2: +27:2 diff --git a/tests/mir-opt/const_prop/invalid_constant.rs b/tests/mir-opt/const_prop/invalid_constant.rs index eb6172cdf..bdbc5a199 100644 --- a/tests/mir-opt/const_prop/invalid_constant.rs +++ b/tests/mir-opt/const_prop/invalid_constant.rs @@ -1,3 +1,5 @@ +// unit-test: ConstProp +// compile-flags: -Zmir-enable-passes=+RemoveZsts // Verify that we can pretty print invalid constants. #![feature(adt_const_params)] diff --git a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff index 5331e5b82..33bbad2f4 100644 --- a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff @@ -18,17 +18,20 @@ _2 = [const 0_u8; 5000]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29 StorageLive(_3); // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31 _3 = const 2_usize; // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31 - _4 = const 5000_usize; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 +- _4 = Len(_2); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 - _5 = Lt(_3, _4); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 - assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 ++ _4 = const 5000_usize; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 + _5 = const true; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> bb1; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 ++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 } bb1: { - _1 = _2[_3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 +- _1 = _2[_3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 ++ _1 = _2[2 of 3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 StorageDead(_3); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33 StorageDead(_2); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33 + _0 = const (); // scope 0 at $DIR/large_array_index.rs:+0:11: +3:2 StorageDead(_1); // scope 0 at $DIR/large_array_index.rs:+3:1: +3:2 return; // scope 0 at $DIR/large_array_index.rs:+3:2: +3:2 } diff --git a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff index 5331e5b82..33bbad2f4 100644 --- a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff @@ -18,17 +18,20 @@ _2 = [const 0_u8; 5000]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:29 StorageLive(_3); // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31 _3 = const 2_usize; // scope 0 at $DIR/large_array_index.rs:+2:30: +2:31 - _4 = const 5000_usize; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 +- _4 = Len(_2); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 - _5 = Lt(_3, _4); // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 - assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 ++ _4 = const 5000_usize; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 + _5 = const true; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> bb1; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 ++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 } bb1: { - _1 = _2[_3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 +- _1 = _2[_3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 ++ _1 = _2[2 of 3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 StorageDead(_3); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33 StorageDead(_2); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33 + _0 = const (); // scope 0 at $DIR/large_array_index.rs:+0:11: +3:2 StorageDead(_1); // scope 0 at $DIR/large_array_index.rs:+3:1: +3:2 return; // scope 0 at $DIR/large_array_index.rs:+3:2: +3:2 } diff --git a/tests/mir-opt/const_prop/large_array_index.rs b/tests/mir-opt/const_prop/large_array_index.rs index 073f98495..0876445bf 100644 --- a/tests/mir-opt/const_prop/large_array_index.rs +++ b/tests/mir-opt/const_prop/large_array_index.rs @@ -1,4 +1,6 @@ +// unit-test: ConstProp // ignore-wasm32 compiled with panic=abort by default +// compile-flags: -Zmir-enable-passes=+NormalizeArrayLen // EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR large_array_index.main.ConstProp.diff diff --git a/tests/mir-opt/const_prop/mult_by_zero.rs b/tests/mir-opt/const_prop/mult_by_zero.rs index c839f92f2..7bd30975a 100644 --- a/tests/mir-opt/const_prop/mult_by_zero.rs +++ b/tests/mir-opt/const_prop/mult_by_zero.rs @@ -1,5 +1,4 @@ -// unit-test -// compile-flags: -O -Zmir-opt-level=4 +// unit-test: ConstProp // EMIT_MIR mult_by_zero.test.ConstProp.diff fn test(x : i32) -> i32 { diff --git a/tests/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff b/tests/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff index 1cfe47d0a..629c8e601 100644 --- a/tests/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff +++ b/tests/mir-opt/const_prop/mult_by_zero.test.ConstProp.diff @@ -7,8 +7,11 @@ let mut _2: i32; // in scope 0 at $DIR/mult_by_zero.rs:+1:3: +1:4 bb0: { -- _0 = Mul(_1, const 0_i32); // scope 0 at $DIR/mult_by_zero.rs:+1:3: +1:8 + StorageLive(_2); // scope 0 at $DIR/mult_by_zero.rs:+1:3: +1:4 + _2 = _1; // scope 0 at $DIR/mult_by_zero.rs:+1:3: +1:4 +- _0 = Mul(move _2, const 0_i32); // scope 0 at $DIR/mult_by_zero.rs:+1:3: +1:8 + _0 = const 0_i32; // scope 0 at $DIR/mult_by_zero.rs:+1:3: +1:8 + StorageDead(_2); // scope 0 at $DIR/mult_by_zero.rs:+1:7: +1:8 return; // scope 0 at $DIR/mult_by_zero.rs:+2:2: +2:2 } } diff --git a/tests/mir-opt/const_prop/mutable_variable.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable.main.ConstProp.diff index a672c457a..bd010e7b1 100644 --- a/tests/mir-opt/const_prop/mutable_variable.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/mutable_variable.main.ConstProp.diff @@ -19,6 +19,7 @@ StorageLive(_2); // scope 1 at $DIR/mutable_variable.rs:+3:9: +3:10 - _2 = _1; // scope 1 at $DIR/mutable_variable.rs:+3:13: +3:14 + _2 = const 99_i32; // scope 1 at $DIR/mutable_variable.rs:+3:13: +3:14 + _0 = const (); // scope 0 at $DIR/mutable_variable.rs:+0:11: +4:2 StorageDead(_2); // scope 1 at $DIR/mutable_variable.rs:+4:1: +4:2 StorageDead(_1); // scope 0 at $DIR/mutable_variable.rs:+4:1: +4:2 return; // scope 0 at $DIR/mutable_variable.rs:+4:2: +4:2 diff --git a/tests/mir-opt/const_prop/mutable_variable.rs b/tests/mir-opt/const_prop/mutable_variable.rs index cb01719dd..95987ef7f 100644 --- a/tests/mir-opt/const_prop/mutable_variable.rs +++ b/tests/mir-opt/const_prop/mutable_variable.rs @@ -1,5 +1,4 @@ -// unit-test -// compile-flags: -O +// unit-test: ConstProp // EMIT_MIR mutable_variable.main.ConstProp.diff fn main() { diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff index d088c4f66..539f6dd94 100644 --- a/tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate.main.ConstProp.diff @@ -3,27 +3,26 @@ fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_aggregate.rs:+0:11: +0:11 - let mut _3: i32; // in scope 0 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14 - let mut _4: i32; // in scope 0 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14 + let mut _1: (i32, i32); // in scope 0 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14 scope 1 { - debug x => (i32, i32){ .0 => _3, .1 => _4, }; // in scope 1 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14 - let _1: i32; // in scope 1 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10 - let _2: i32; // in scope 1 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10 + debug x => _1; // in scope 1 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14 + let _2: (i32, i32); // in scope 1 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10 scope 2 { - debug y => (i32, i32){ .0 => _3, .1 => _2, }; // in scope 2 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10 + debug y => _2; // in scope 2 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10 } } bb0: { - StorageLive(_4); // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14 - _3 = const 42_i32; // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:17: +1:25 - _4 = const 43_i32; // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:17: +1:25 - _4 = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate.rs:+2:5: +2:13 + StorageLive(_1); // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:9: +1:14 +- _1 = (const 42_i32, const 43_i32); // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:17: +1:25 ++ _1 = const (42_i32, 43_i32); // scope 0 at $DIR/mutable_variable_aggregate.rs:+1:17: +1:25 + (_1.1: i32) = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate.rs:+2:5: +2:13 StorageLive(_2); // scope 1 at $DIR/mutable_variable_aggregate.rs:+3:9: +3:10 -- _2 = _4; // scope 1 at $DIR/mutable_variable_aggregate.rs:+3:13: +3:14 -+ _2 = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate.rs:+3:13: +3:14 +- _2 = _1; // scope 1 at $DIR/mutable_variable_aggregate.rs:+3:13: +3:14 ++ _2 = const (42_i32, 99_i32); // scope 1 at $DIR/mutable_variable_aggregate.rs:+3:13: +3:14 + _0 = const (); // scope 0 at $DIR/mutable_variable_aggregate.rs:+0:11: +4:2 StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate.rs:+4:1: +4:2 - StorageDead(_4); // scope 0 at $DIR/mutable_variable_aggregate.rs:+4:1: +4:2 + StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate.rs:+4:1: +4:2 return; // scope 0 at $DIR/mutable_variable_aggregate.rs:+4:2: +4:2 } } diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate.rs index d4ff8d890..a145c0354 100644 --- a/tests/mir-opt/const_prop/mutable_variable_aggregate.rs +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate.rs @@ -1,5 +1,4 @@ -// unit-test -// compile-flags: -O +// unit-test: ConstProp // EMIT_MIR mutable_variable_aggregate.main.ConstProp.diff fn main() { diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff index 134f0c080..bec641ecf 100644 --- a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.ConstProp.diff @@ -9,10 +9,9 @@ let _2: &mut (i32, i32); // in scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+2:9: +2:10 scope 2 { debug z => _2; // in scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+2:9: +2:10 - let _3: i32; // in scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10 - let _4: i32; // in scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10 + let _3: (i32, i32); // in scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10 scope 3 { - debug y => (i32, i32){ .0 => _3, .1 => _4, }; // in scope 3 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10 + debug y => _3; // in scope 3 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10 } } } @@ -24,11 +23,9 @@ _2 = &mut _1; // scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+2:13: +2:19 ((*_2).1: i32) = const 99_i32; // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+3:5: +3:13 StorageLive(_3); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10 - StorageLive(_4); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:9: +4:10 - _3 = (_1.0: i32); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:13: +4:14 - _4 = (_1.1: i32); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:13: +4:14 + _3 = _1; // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+4:13: +4:14 + _0 = const (); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+0:11: +5:2 StorageDead(_3); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:1: +5:2 - StorageDead(_4); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:1: +5:2 StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:1: +5:2 StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:1: +5:2 return; // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:+5:2: +5:2 diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs index 9060f7e9b..3099e659f 100644 --- a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs @@ -1,5 +1,4 @@ -// unit-test -// compile-flags: -O +// unit-test: ConstProp // EMIT_MIR mutable_variable_aggregate_mut_ref.main.ConstProp.diff fn main() { diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.diff index 75f6ebc58..374151057 100644 --- a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.ConstProp.diff @@ -16,7 +16,7 @@ StorageLive(_1); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:9: +1:14 _1 = foo() -> bb1; // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+1:29: +1:34 // mir::Constant - // + span: $DIR/mutable_variable_aggregate_partial_read.rs:7:29: 7:32 + // + span: $DIR/mutable_variable_aggregate_partial_read.rs:6:29: 6:32 // + literal: Const { ty: fn() -> (i32, i32) {foo}, val: Value() } } @@ -26,6 +26,7 @@ StorageLive(_2); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:9: +4:10 - _2 = (_1.1: i32); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:13: +4:16 + _2 = const 99_i32; // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+4:13: +4:16 + _0 = const (); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+0:11: +5:2 StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:1: +5:2 StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:1: +5:2 return; // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:+5:2: +5:2 diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs index 70a287cf3..0e823e9dc 100644 --- a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs @@ -1,6 +1,5 @@ // ignore-wasm32 compiled with panic=abort by default -// unit-test -// compile-flags: -O +// unit-test: ConstProp // EMIT_MIR mutable_variable_aggregate_partial_read.main.ConstProp.diff fn main() { diff --git a/tests/mir-opt/const_prop/mutable_variable_no_prop.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_no_prop.main.ConstProp.diff index 7fa29cccd..fab810630 100644 --- a/tests/mir-opt/const_prop/mutable_variable_no_prop.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/mutable_variable_no_prop.main.ConstProp.diff @@ -4,34 +4,39 @@ fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_no_prop.rs:+0:11: +0:11 let mut _1: u32; // in scope 0 at $DIR/mutable_variable_no_prop.rs:+1:9: +1:14 - let mut _2: u32; // in scope 0 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19 - let mut _3: *mut u32; // in scope 0 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19 + let _2: (); // in scope 0 at $DIR/mutable_variable_no_prop.rs:+2:5: +4:6 + let mut _3: u32; // in scope 0 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19 + let mut _4: *mut u32; // in scope 0 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19 scope 1 { debug x => _1; // in scope 1 at $DIR/mutable_variable_no_prop.rs:+1:9: +1:14 - let _4: u32; // in scope 1 at $DIR/mutable_variable_no_prop.rs:+5:9: +5:10 + let _5: u32; // in scope 1 at $DIR/mutable_variable_no_prop.rs:+5:9: +5:10 scope 2 { } scope 3 { - debug y => _4; // in scope 3 at $DIR/mutable_variable_no_prop.rs:+5:9: +5:10 + debug y => _5; // in scope 3 at $DIR/mutable_variable_no_prop.rs:+5:9: +5:10 } } bb0: { StorageLive(_1); // scope 0 at $DIR/mutable_variable_no_prop.rs:+1:9: +1:14 _1 = const 42_u32; // scope 0 at $DIR/mutable_variable_no_prop.rs:+1:17: +1:19 - StorageLive(_2); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19 + StorageLive(_2); // scope 1 at $DIR/mutable_variable_no_prop.rs:+2:5: +4:6 StorageLive(_3); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19 - _3 = const {alloc1: *mut u32}; // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19 + StorageLive(_4); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19 + _4 = const {alloc1: *mut u32}; // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19 // mir::Constant - // + span: $DIR/mutable_variable_no_prop.rs:10:13: 10:19 + // + span: $DIR/mutable_variable_no_prop.rs:9:13: 9:19 // + literal: Const { ty: *mut u32, val: Value(Scalar(alloc1)) } - _2 = (*_3); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19 - _1 = move _2; // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:9: +3:19 - StorageDead(_2); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:18: +3:19 - StorageDead(_3); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:19: +3:20 - StorageLive(_4); // scope 1 at $DIR/mutable_variable_no_prop.rs:+5:9: +5:10 - _4 = _1; // scope 1 at $DIR/mutable_variable_no_prop.rs:+5:13: +5:14 - StorageDead(_4); // scope 1 at $DIR/mutable_variable_no_prop.rs:+6:1: +6:2 + _3 = (*_4); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:13: +3:19 + _1 = move _3; // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:9: +3:19 + StorageDead(_3); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:18: +3:19 + StorageDead(_4); // scope 2 at $DIR/mutable_variable_no_prop.rs:+3:19: +3:20 + _2 = const (); // scope 2 at $DIR/mutable_variable_no_prop.rs:+2:5: +4:6 + StorageDead(_2); // scope 1 at $DIR/mutable_variable_no_prop.rs:+4:5: +4:6 + StorageLive(_5); // scope 1 at $DIR/mutable_variable_no_prop.rs:+5:9: +5:10 + _5 = _1; // scope 1 at $DIR/mutable_variable_no_prop.rs:+5:13: +5:14 + _0 = const (); // scope 0 at $DIR/mutable_variable_no_prop.rs:+0:11: +6:2 + StorageDead(_5); // scope 1 at $DIR/mutable_variable_no_prop.rs:+6:1: +6:2 StorageDead(_1); // scope 0 at $DIR/mutable_variable_no_prop.rs:+6:1: +6:2 return; // scope 0 at $DIR/mutable_variable_no_prop.rs:+6:2: +6:2 } diff --git a/tests/mir-opt/const_prop/mutable_variable_no_prop.rs b/tests/mir-opt/const_prop/mutable_variable_no_prop.rs index b69ec931a..e51c62235 100644 --- a/tests/mir-opt/const_prop/mutable_variable_no_prop.rs +++ b/tests/mir-opt/const_prop/mutable_variable_no_prop.rs @@ -1,5 +1,4 @@ -// unit-test -// compile-flags: -O +// unit-test: ConstProp static mut STATIC: u32 = 0x42424242; diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.diff b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.diff index 9582504b2..3048122d8 100644 --- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.ConstProp.diff @@ -4,17 +4,16 @@ fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_unprop_assign.rs:+0:11: +0:11 let _1: i32; // in scope 0 at $DIR/mutable_variable_unprop_assign.rs:+1:9: +1:10 - let mut _2: i32; // in scope 0 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12 + let mut _3: i32; // in scope 0 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12 scope 1 { debug a => _1; // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:+1:9: +1:10 - let mut _5: i32; // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14 - let mut _6: i32; // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14 + let mut _2: (i32, i32); // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14 scope 2 { - debug x => (i32, i32){ .0 => _5, .1 => _6, }; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14 - let _3: i32; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10 + debug x => _2; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14 + let _4: i32; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10 scope 3 { - debug y => _3; // in scope 3 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10 - let _4: i32; // in scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10 + debug y => _4; // in scope 3 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10 + let _5: i32; // in scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10 scope 4 { debug z => _5; // in scope 4 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10 } @@ -26,22 +25,27 @@ StorageLive(_1); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+1:9: +1:10 _1 = foo() -> bb1; // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+1:13: +1:18 // mir::Constant - // + span: $DIR/mutable_variable_unprop_assign.rs:7:13: 7:16 + // + span: $DIR/mutable_variable_unprop_assign.rs:6:13: 6:16 // + literal: Const { ty: fn() -> i32 {foo}, val: Value() } } bb1: { - StorageLive(_6); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14 - _5 = const 1_i32; // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35 - _6 = const 2_i32; // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35 - StorageLive(_2); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12 - _2 = _1; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12 - _6 = move _2; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:5: +3:12 - StorageDead(_2); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12 - StorageLive(_3); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10 - _3 = _6; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:13: +4:16 - StorageDead(_3); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2 - StorageDead(_6); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2 + StorageLive(_2); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:9: +2:14 +- _2 = (const 1_i32, const 2_i32); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35 ++ _2 = const (1_i32, 2_i32); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+2:29: +2:35 + StorageLive(_3); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12 + _3 = _1; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12 + (_2.1: i32) = move _3; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:5: +3:12 + StorageDead(_3); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+3:11: +3:12 + StorageLive(_4); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:9: +4:10 + _4 = (_2.1: i32); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+4:13: +4:16 + StorageLive(_5); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:9: +5:10 +- _5 = (_2.0: i32); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:13: +5:16 ++ _5 = const 1_i32; // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+5:13: +5:16 + _0 = const (); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+0:11: +6:2 + StorageDead(_5); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2 + StorageDead(_4); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2 + StorageDead(_2); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2 StorageDead(_1); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+6:1: +6:2 return; // scope 0 at $DIR/mutable_variable_unprop_assign.rs:+6:2: +6:2 } diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs index fabd04e9b..5577f78a9 100644 --- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs +++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs @@ -1,6 +1,5 @@ // ignore-wasm32 compiled with panic=abort by default -// unit-test -// compile-flags: -O +// unit-test: ConstProp // EMIT_MIR mutable_variable_unprop_assign.main.ConstProp.diff fn main() { diff --git a/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.diff b/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.diff new file mode 100644 index 000000000..e3757941c --- /dev/null +++ b/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.diff @@ -0,0 +1,44 @@ +- // MIR for `concrete` before ConstProp ++ // MIR for `concrete` after ConstProp + + fn concrete() -> () { + let mut _0: (); // return place in scope 0 at $DIR/offset_of.rs:+0:15: +0:15 + let _1: usize; // in scope 0 at $DIR/offset_of.rs:+1:9: +1:10 + scope 1 { + debug x => _1; // in scope 1 at $DIR/offset_of.rs:+1:9: +1:10 + let _2: usize; // in scope 1 at $DIR/offset_of.rs:+2:9: +2:10 + scope 2 { + debug y => _2; // in scope 2 at $DIR/offset_of.rs:+2:9: +2:10 + let _3: usize; // in scope 2 at $DIR/offset_of.rs:+3:9: +3:11 + scope 3 { + debug z0 => _3; // in scope 3 at $DIR/offset_of.rs:+3:9: +3:11 + let _4: usize; // in scope 3 at $DIR/offset_of.rs:+4:9: +4:11 + scope 4 { + debug z1 => _4; // in scope 4 at $DIR/offset_of.rs:+4:9: +4:11 + } + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/offset_of.rs:+1:9: +1:10 +- _1 = OffsetOf(Alpha, [0]); // scope 0 at $SRC_DIR/core/src/mem/mod.rs:LL:COL ++ _1 = const 4_usize; // scope 0 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + StorageLive(_2); // scope 1 at $DIR/offset_of.rs:+2:9: +2:10 +- _2 = OffsetOf(Alpha, [1]); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL ++ _2 = const 0_usize; // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + StorageLive(_3); // scope 2 at $DIR/offset_of.rs:+3:9: +3:11 +- _3 = OffsetOf(Alpha, [2, 0]); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL ++ _3 = const 2_usize; // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + StorageLive(_4); // scope 3 at $DIR/offset_of.rs:+4:9: +4:11 +- _4 = OffsetOf(Alpha, [2, 1]); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL ++ _4 = const 3_usize; // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + _0 = const (); // scope 0 at $DIR/offset_of.rs:+0:15: +5:2 + StorageDead(_4); // scope 3 at $DIR/offset_of.rs:+5:1: +5:2 + StorageDead(_3); // scope 2 at $DIR/offset_of.rs:+5:1: +5:2 + StorageDead(_2); // scope 1 at $DIR/offset_of.rs:+5:1: +5:2 + StorageDead(_1); // scope 0 at $DIR/offset_of.rs:+5:1: +5:2 + return; // scope 0 at $DIR/offset_of.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/const_prop/offset_of.generic.ConstProp.diff b/tests/mir-opt/const_prop/offset_of.generic.ConstProp.diff new file mode 100644 index 000000000..4a655604c --- /dev/null +++ b/tests/mir-opt/const_prop/offset_of.generic.ConstProp.diff @@ -0,0 +1,40 @@ +- // MIR for `generic` before ConstProp ++ // MIR for `generic` after ConstProp + + fn generic() -> () { + let mut _0: (); // return place in scope 0 at $DIR/offset_of.rs:+0:17: +0:17 + let _1: usize; // in scope 0 at $DIR/offset_of.rs:+1:9: +1:11 + scope 1 { + debug gx => _1; // in scope 1 at $DIR/offset_of.rs:+1:9: +1:11 + let _2: usize; // in scope 1 at $DIR/offset_of.rs:+2:9: +2:11 + scope 2 { + debug gy => _2; // in scope 2 at $DIR/offset_of.rs:+2:9: +2:11 + let _3: usize; // in scope 2 at $DIR/offset_of.rs:+3:9: +3:11 + scope 3 { + debug dx => _3; // in scope 3 at $DIR/offset_of.rs:+3:9: +3:11 + let _4: usize; // in scope 3 at $DIR/offset_of.rs:+4:9: +4:11 + scope 4 { + debug dy => _4; // in scope 4 at $DIR/offset_of.rs:+4:9: +4:11 + } + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/offset_of.rs:+1:9: +1:11 + _1 = OffsetOf(Gamma, [0]); // scope 0 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + StorageLive(_2); // scope 1 at $DIR/offset_of.rs:+2:9: +2:11 + _2 = OffsetOf(Gamma, [1]); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + StorageLive(_3); // scope 2 at $DIR/offset_of.rs:+3:9: +3:11 + _3 = OffsetOf(Delta, [1]); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + StorageLive(_4); // scope 3 at $DIR/offset_of.rs:+4:9: +4:11 + _4 = OffsetOf(Delta, [2]); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + _0 = const (); // scope 0 at $DIR/offset_of.rs:+0:17: +5:2 + StorageDead(_4); // scope 3 at $DIR/offset_of.rs:+5:1: +5:2 + StorageDead(_3); // scope 2 at $DIR/offset_of.rs:+5:1: +5:2 + StorageDead(_2); // scope 1 at $DIR/offset_of.rs:+5:1: +5:2 + StorageDead(_1); // scope 0 at $DIR/offset_of.rs:+5:1: +5:2 + return; // scope 0 at $DIR/offset_of.rs:+5:2: +5:2 + } + } + diff --git a/tests/mir-opt/const_prop/offset_of.rs b/tests/mir-opt/const_prop/offset_of.rs new file mode 100644 index 000000000..4cdcd28ee --- /dev/null +++ b/tests/mir-opt/const_prop/offset_of.rs @@ -0,0 +1,48 @@ +// unit-test: ConstProp + +#![feature(offset_of)] + +use std::marker::PhantomData; +use std::mem::offset_of; + +struct Alpha { + x: u8, + y: u16, + z: Beta, +} + +struct Beta(u8, u8); + +struct Gamma { + x: u8, + y: u16, + _t: T, +} + +#[repr(C)] +struct Delta { + _phantom: PhantomData, + x: u8, + y: u16, +} + +// EMIT_MIR offset_of.concrete.ConstProp.diff +fn concrete() { + let x = offset_of!(Alpha, x); + let y = offset_of!(Alpha, y); + let z0 = offset_of!(Alpha, z.0); + let z1 = offset_of!(Alpha, z.1); +} + +// EMIT_MIR offset_of.generic.ConstProp.diff +fn generic() { + let gx = offset_of!(Gamma, x); + let gy = offset_of!(Gamma, y); + let dx = offset_of!(Delta, x); + let dy = offset_of!(Delta, y); +} + +fn main() { + concrete(); + generic::<()>(); +} diff --git a/tests/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.32bit.diff deleted file mode 100644 index 691aa01a5..000000000 --- a/tests/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.32bit.diff +++ /dev/null @@ -1,59 +0,0 @@ -- // MIR for `main` before ConstProp -+ // MIR for `main` after ConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 - let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 - let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 - let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - let mut _9: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 - scope 1 { - debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - scope 2 { - debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - scope 3 { - debug z => _9; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - } - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 -- _2 = CheckedAdd(const 2_i32, const 2_i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 -- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 -+ _2 = const (4_i32, false); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 - } - - bb1: { -- _1 = move (_2.0: i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 -+ _1 = const 4_i32; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 - StorageLive(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - StorageLive(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 - _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 - StorageLive(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 - _5 = const 3_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 - _6 = const 6_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 -- _7 = Lt(_5, _6); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 -- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 -+ _7 = const true; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - } - - bb2: { -- _3 = _4[_5]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 -+ _3 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - StorageDead(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 - StorageDead(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 - _9 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 - StorageDead(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 - } - } - diff --git a/tests/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.64bit.diff deleted file mode 100644 index 691aa01a5..000000000 --- a/tests/mir-opt/const_prop/optimizes_into_variable.main.ConstProp.64bit.diff +++ /dev/null @@ -1,59 +0,0 @@ -- // MIR for `main` before ConstProp -+ // MIR for `main` after ConstProp - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 - let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 - let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 - let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - let mut _9: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 - scope 1 { - debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - scope 2 { - debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - scope 3 { - debug z => _9; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - } - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 -- _2 = CheckedAdd(const 2_i32, const 2_i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 -- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 -+ _2 = const (4_i32, false); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 - } - - bb1: { -- _1 = move (_2.0: i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 -+ _1 = const 4_i32; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 - StorageLive(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - StorageLive(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 - _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 - StorageLive(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 - _5 = const 3_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 - _6 = const 6_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 -- _7 = Lt(_5, _6); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 -- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 -+ _7 = const true; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - } - - bb2: { -- _3 = _4[_5]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 -+ _3 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - StorageDead(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 - StorageDead(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 - _9 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 - StorageDead(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 - } - } - diff --git a/tests/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.32bit.mir b/tests/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.32bit.mir deleted file mode 100644 index 81cfd22db..000000000 --- a/tests/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.32bit.mir +++ /dev/null @@ -1,25 +0,0 @@ -// MIR for `main` after PreCodegen - -fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - let mut _3: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 - scope 1 { - debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - let _2: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - scope 2 { - debug y => _2; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - scope 3 { - debug z => _3; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - } - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - StorageLive(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 - } -} diff --git a/tests/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.64bit.mir b/tests/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.64bit.mir deleted file mode 100644 index 81cfd22db..000000000 --- a/tests/mir-opt/const_prop/optimizes_into_variable.main.PreCodegen.after.64bit.mir +++ /dev/null @@ -1,25 +0,0 @@ -// MIR for `main` after PreCodegen - -fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - let mut _3: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 - scope 1 { - debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - let _2: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - scope 2 { - debug y => _2; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - scope 3 { - debug z => _3; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - } - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - StorageLive(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 - } -} diff --git a/tests/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff b/tests/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff deleted file mode 100644 index 98cd020da..000000000 --- a/tests/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff +++ /dev/null @@ -1,71 +0,0 @@ -- // MIR for `main` before ScalarReplacementOfAggregates -+ // MIR for `main` after ScalarReplacementOfAggregates - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 - let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 - let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 - let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - let mut _9: Point; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 -+ let mut _10: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 -+ let mut _11: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 - scope 1 { - debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - scope 2 { - debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - scope 3 { - debug z => _8; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - } - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - _2 = CheckedAdd(const 2_i32, const 2_i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 - assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 - } - - bb1: { - _1 = move (_2.0: i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 - StorageLive(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - StorageLive(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 - _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 - StorageLive(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 - _5 = const 3_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 - _6 = Len(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - _7 = Lt(_5, _6); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - } - - bb2: { - _3 = _4[_5]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - StorageDead(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 - StorageDead(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 - StorageLive(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 -- StorageLive(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 -- _9 = Point { x: const 12_u32, y: const 42_u32 }; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 -- _8 = (_9.1: u32); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:38 -- StorageDead(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 -+ StorageLive(_10); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 -+ StorageLive(_11); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 -+ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 -+ _10 = const 12_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 -+ _11 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 -+ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 -+ _8 = _11; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:38 -+ StorageDead(_10); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 -+ StorageDead(_11); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 -+ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 - nop; // scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +4:2 - StorageDead(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - StorageDead(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 - } - } - diff --git a/tests/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff b/tests/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff deleted file mode 100644 index 98cd020da..000000000 --- a/tests/mir-opt/const_prop/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff +++ /dev/null @@ -1,71 +0,0 @@ -- // MIR for `main` before ScalarReplacementOfAggregates -+ // MIR for `main` after ScalarReplacementOfAggregates - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 - let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 - let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 - let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - let mut _9: Point; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 -+ let mut _10: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 -+ let mut _11: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 - scope 1 { - debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - scope 2 { - debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - scope 3 { - debug z => _8; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - } - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - _2 = CheckedAdd(const 2_i32, const 2_i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 - assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 - } - - bb1: { - _1 = move (_2.0: i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 - StorageLive(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - StorageLive(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 - _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 - StorageLive(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 - _5 = const 3_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 - _6 = Len(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - _7 = Lt(_5, _6); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - } - - bb2: { - _3 = _4[_5]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 - StorageDead(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 - StorageDead(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 - StorageLive(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 -- StorageLive(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 -- _9 = Point { x: const 12_u32, y: const 42_u32 }; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 -- _8 = (_9.1: u32); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:38 -- StorageDead(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 -+ StorageLive(_10); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 -+ StorageLive(_11); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 -+ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 -+ _10 = const 12_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 -+ _11 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 -+ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 -+ _8 = _11; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:38 -+ StorageDead(_10); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 -+ StorageDead(_11); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 -+ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 - nop; // scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +4:2 - StorageDead(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - StorageDead(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 - } - } - diff --git a/tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir b/tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir deleted file mode 100644 index 002e914e8..000000000 --- a/tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir +++ /dev/null @@ -1,25 +0,0 @@ -// MIR for `main` after SimplifyLocals-final - -fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - let mut _3: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 - scope 1 { - debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - let _2: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - scope 2 { - debug y => _2; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - scope 3 { - debug z => _3; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - } - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - StorageLive(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 - } -} diff --git a/tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir b/tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir deleted file mode 100644 index 002e914e8..000000000 --- a/tests/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir +++ /dev/null @@ -1,25 +0,0 @@ -// MIR for `main` after SimplifyLocals-final - -fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - let mut _3: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 - scope 1 { - debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - let _2: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - scope 2 { - debug y => _2; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - scope 3 { - debug z => _3; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 - } - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 - StorageLive(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 - StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 - return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 - } -} diff --git a/tests/mir-opt/const_prop/optimizes_into_variable.rs b/tests/mir-opt/const_prop/optimizes_into_variable.rs deleted file mode 100644 index 5ffa15347..000000000 --- a/tests/mir-opt/const_prop/optimizes_into_variable.rs +++ /dev/null @@ -1,19 +0,0 @@ -// ignore-wasm32 compiled with panic=abort by default -// unit-test -// compile-flags: -C overflow-checks=on - -struct Point { - x: u32, - y: u32, -} - -// EMIT_MIR_FOR_EACH_BIT_WIDTH -// EMIT_MIR optimizes_into_variable.main.ScalarReplacementOfAggregates.diff -// EMIT_MIR optimizes_into_variable.main.ConstProp.diff -// EMIT_MIR optimizes_into_variable.main.SimplifyLocals-final.after.mir -// EMIT_MIR optimizes_into_variable.main.PreCodegen.after.mir -fn main() { - let x = 2 + 2; - let y = [0, 1, 2, 3, 4, 5][3]; - let z = (Point { x: 12, y: 42}).y; -} diff --git a/tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff b/tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff index 388c6ca81..c290fba56 100644 --- a/tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/read_immutable_static.main.ConstProp.diff @@ -18,7 +18,7 @@ StorageLive(_3); // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16 _3 = const {alloc1: &u8}; // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16 // mir::Constant - // + span: $DIR/read_immutable_static.rs:8:13: 8:16 + // + span: $DIR/read_immutable_static.rs:7:13: 7:16 // + literal: Const { ty: &u8, val: Value(Scalar(alloc1)) } - _2 = (*_3); // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16 + _2 = const 2_u8; // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:16 @@ -26,7 +26,7 @@ StorageLive(_5); // scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22 _5 = const {alloc1: &u8}; // scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22 // mir::Constant - // + span: $DIR/read_immutable_static.rs:8:19: 8:22 + // + span: $DIR/read_immutable_static.rs:7:19: 7:22 // + literal: Const { ty: &u8, val: Value(Scalar(alloc1)) } - _4 = (*_5); // scope 0 at $DIR/read_immutable_static.rs:+1:19: +1:22 - _1 = Add(move _2, move _4); // scope 0 at $DIR/read_immutable_static.rs:+1:13: +1:22 @@ -36,6 +36,7 @@ StorageDead(_2); // scope 0 at $DIR/read_immutable_static.rs:+1:21: +1:22 StorageDead(_5); // scope 0 at $DIR/read_immutable_static.rs:+1:22: +1:23 StorageDead(_3); // scope 0 at $DIR/read_immutable_static.rs:+1:22: +1:23 + _0 = const (); // scope 0 at $DIR/read_immutable_static.rs:+0:11: +2:2 StorageDead(_1); // scope 0 at $DIR/read_immutable_static.rs:+2:1: +2:2 return; // scope 0 at $DIR/read_immutable_static.rs:+2:2: +2:2 } diff --git a/tests/mir-opt/const_prop/read_immutable_static.rs b/tests/mir-opt/const_prop/read_immutable_static.rs index 4f7afe6ca..fb8f9fe99 100644 --- a/tests/mir-opt/const_prop/read_immutable_static.rs +++ b/tests/mir-opt/const_prop/read_immutable_static.rs @@ -1,5 +1,4 @@ -// unit-test -// compile-flags: -O +// unit-test: ConstProp static FOO: u8 = 2; diff --git a/tests/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff b/tests/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff index 15c93f270..077b9bf83 100644 --- a/tests/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/reify_fn_ptr.main.ConstProp.diff @@ -3,21 +3,26 @@ fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/reify_fn_ptr.rs:+0:11: +0:11 - let mut _1: usize; // in scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:26 - let mut _2: fn(); // in scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:17 + let mut _1: *const fn(); // in scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:41 + let mut _2: usize; // in scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:26 + let mut _3: fn(); // in scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:17 scope 1 { } bb0: { - StorageLive(_1); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:26 - StorageLive(_2); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:17 - _2 = main as fn() (Pointer(ReifyFnPointer)); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:17 + StorageLive(_1); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:41 + StorageLive(_2); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:26 + StorageLive(_3); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:17 + _3 = main as fn() (Pointer(ReifyFnPointer)); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:17 // mir::Constant - // + span: $DIR/reify_fn_ptr.rs:4:13: 4:17 + // + span: $DIR/reify_fn_ptr.rs:5:13: 5:17 // + literal: Const { ty: fn() {main}, val: Value() } - _1 = move _2 as usize (PointerExposeAddress); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:26 - StorageDead(_2); // scope 0 at $DIR/reify_fn_ptr.rs:+1:25: +1:26 - StorageDead(_1); // scope 0 at $DIR/reify_fn_ptr.rs:+1:40: +1:41 + _2 = move _3 as usize (PointerExposeAddress); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:26 + StorageDead(_3); // scope 0 at $DIR/reify_fn_ptr.rs:+1:25: +1:26 + _1 = move _2 as *const fn() (PointerFromExposedAddress); // scope 0 at $DIR/reify_fn_ptr.rs:+1:13: +1:41 + StorageDead(_2); // scope 0 at $DIR/reify_fn_ptr.rs:+1:40: +1:41 + StorageDead(_1); // scope 0 at $DIR/reify_fn_ptr.rs:+1:41: +1:42 + _0 = const (); // scope 0 at $DIR/reify_fn_ptr.rs:+0:11: +2:2 return; // scope 0 at $DIR/reify_fn_ptr.rs:+2:2: +2:2 } } diff --git a/tests/mir-opt/const_prop/reify_fn_ptr.rs b/tests/mir-opt/const_prop/reify_fn_ptr.rs index bfe2563ad..5f6382066 100644 --- a/tests/mir-opt/const_prop/reify_fn_ptr.rs +++ b/tests/mir-opt/const_prop/reify_fn_ptr.rs @@ -1,3 +1,4 @@ +// unit-test: ConstProp // EMIT_MIR reify_fn_ptr.main.ConstProp.diff fn main() { diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.diff index 636032adb..6641220db 100644 --- a/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.diff @@ -20,11 +20,12 @@ _3 = [const 42_u32; 8]; // scope 0 at $DIR/repeat.rs:+1:18: +1:25 StorageLive(_4); // scope 0 at $DIR/repeat.rs:+1:26: +1:27 _4 = const 2_usize; // scope 0 at $DIR/repeat.rs:+1:26: +1:27 - _5 = const 8_usize; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 +- _5 = Len(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:28 - _6 = Lt(_4, _5); // scope 0 at $DIR/repeat.rs:+1:18: +1:28 - assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 ++ _5 = const 8_usize; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 + _6 = const true; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 ++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 } bb1: { @@ -35,6 +36,7 @@ StorageDead(_2); // scope 0 at $DIR/repeat.rs:+1:31: +1:32 StorageDead(_4); // scope 0 at $DIR/repeat.rs:+1:32: +1:33 StorageDead(_3); // scope 0 at $DIR/repeat.rs:+1:32: +1:33 + _0 = const (); // scope 0 at $DIR/repeat.rs:+0:11: +2:2 StorageDead(_1); // scope 0 at $DIR/repeat.rs:+2:1: +2:2 return; // scope 0 at $DIR/repeat.rs:+2:2: +2:2 } diff --git a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.diff index 636032adb..6641220db 100644 --- a/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/repeat.main.ConstProp.64bit.diff @@ -20,11 +20,12 @@ _3 = [const 42_u32; 8]; // scope 0 at $DIR/repeat.rs:+1:18: +1:25 StorageLive(_4); // scope 0 at $DIR/repeat.rs:+1:26: +1:27 _4 = const 2_usize; // scope 0 at $DIR/repeat.rs:+1:26: +1:27 - _5 = const 8_usize; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 +- _5 = Len(_3); // scope 0 at $DIR/repeat.rs:+1:18: +1:28 - _6 = Lt(_4, _5); // scope 0 at $DIR/repeat.rs:+1:18: +1:28 - assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 ++ _5 = const 8_usize; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 + _6 = const true; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 -+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 ++ assert(const true, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> bb1; // scope 0 at $DIR/repeat.rs:+1:18: +1:28 } bb1: { @@ -35,6 +36,7 @@ StorageDead(_2); // scope 0 at $DIR/repeat.rs:+1:31: +1:32 StorageDead(_4); // scope 0 at $DIR/repeat.rs:+1:32: +1:33 StorageDead(_3); // scope 0 at $DIR/repeat.rs:+1:32: +1:33 + _0 = const (); // scope 0 at $DIR/repeat.rs:+0:11: +2:2 StorageDead(_1); // scope 0 at $DIR/repeat.rs:+2:1: +2:2 return; // scope 0 at $DIR/repeat.rs:+2:2: +2:2 } diff --git a/tests/mir-opt/const_prop/repeat.rs b/tests/mir-opt/const_prop/repeat.rs index 2f3b7d2c5..9c11dbc5b 100644 --- a/tests/mir-opt/const_prop/repeat.rs +++ b/tests/mir-opt/const_prop/repeat.rs @@ -1,7 +1,8 @@ +// unit-test: ConstProp // ignore-wasm32 compiled with panic=abort by default -// compile-flags: -O - +// compile-flags: -Zmir-enable-passes=+NormalizeArrayLen // EMIT_MIR_FOR_EACH_BIT_WIDTH + // EMIT_MIR repeat.main.ConstProp.diff fn main() { let x: u32 = [42; 8][2] + 0; diff --git a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.mir b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.mir index ececd9942..b12d84fa4 100644 --- a/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.mir +++ b/tests/mir-opt/const_prop/return_place.add.PreCodegen.before.mir @@ -2,8 +2,14 @@ fn add() -> u32 { let mut _0: u32; // return place in scope 0 at $DIR/return_place.rs:+0:13: +0:16 + let mut _1: (u32, bool); // in scope 0 at $DIR/return_place.rs:+1:5: +1:10 bb0: { + _1 = const (4_u32, false); // scope 0 at $DIR/return_place.rs:+1:5: +1:10 + assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u32, const 2_u32) -> bb1; // scope 0 at $DIR/return_place.rs:+1:5: +1:10 + } + + bb1: { _0 = const 4_u32; // scope 0 at $DIR/return_place.rs:+1:5: +1:10 return; // scope 0 at $DIR/return_place.rs:+2:2: +2:2 } diff --git a/tests/mir-opt/const_prop/return_place.rs b/tests/mir-opt/const_prop/return_place.rs index ae119df85..0e68309f0 100644 --- a/tests/mir-opt/const_prop/return_place.rs +++ b/tests/mir-opt/const_prop/return_place.rs @@ -1,3 +1,4 @@ +// unit-test: ConstProp // ignore-wasm32 compiled with panic=abort by default // compile-flags: -C overflow-checks=on diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.diff b/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.diff index a091b4ace..c2f97a0f6 100644 --- a/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/scalar_literal_propagation.main.ConstProp.diff @@ -11,15 +11,23 @@ } bb0: { + StorageLive(_1); // scope 0 at $DIR/scalar_literal_propagation.rs:+1:9: +1:10 _1 = const 1_u32; // scope 0 at $DIR/scalar_literal_propagation.rs:+1:13: +1:14 -- _2 = consume(_1) -> bb1; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15 -+ _2 = consume(const 1_u32) -> bb1; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15 + StorageLive(_2); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15 + StorageLive(_3); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14 +- _3 = _1; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14 ++ _3 = const 1_u32; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:13: +2:14 + _2 = consume(move _3) -> bb1; // scope 1 at $DIR/scalar_literal_propagation.rs:+2:5: +2:15 // mir::Constant - // + span: $DIR/scalar_literal_propagation.rs:5:5: 5:12 + // + span: $DIR/scalar_literal_propagation.rs:6:5: 6:12 // + literal: Const { ty: fn(u32) {consume}, val: Value() } } bb1: { + StorageDead(_3); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:14: +2:15 + StorageDead(_2); // scope 1 at $DIR/scalar_literal_propagation.rs:+2:15: +2:16 + _0 = const (); // scope 0 at $DIR/scalar_literal_propagation.rs:+0:11: +3:2 + StorageDead(_1); // scope 0 at $DIR/scalar_literal_propagation.rs:+3:1: +3:2 return; // scope 0 at $DIR/scalar_literal_propagation.rs:+3:2: +3:2 } } diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.rs b/tests/mir-opt/const_prop/scalar_literal_propagation.rs index e13e352f8..fc33cc2d0 100644 --- a/tests/mir-opt/const_prop/scalar_literal_propagation.rs +++ b/tests/mir-opt/const_prop/scalar_literal_propagation.rs @@ -1,3 +1,4 @@ +// unit-test: ConstProp // ignore-wasm32 compiled with panic=abort by default // EMIT_MIR scalar_literal_propagation.main.ConstProp.diff fn main() { diff --git a/tests/mir-opt/const_prop/slice_len.rs b/tests/mir-opt/const_prop/slice_len.rs index 4499c54f2..9821d1b1e 100644 --- a/tests/mir-opt/const_prop/slice_len.rs +++ b/tests/mir-opt/const_prop/slice_len.rs @@ -1,6 +1,6 @@ // ignore-wasm32 compiled with panic=abort by default // unit-test: ConstProp -// compile-flags: -Zmir-enable-passes=+InstCombine +// compile-flags: -Zmir-enable-passes=+InstSimplify // EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR slice_len.main.ConstProp.diff diff --git a/tests/mir-opt/const_prop/switch_int.main.ConstProp.diff b/tests/mir-opt/const_prop/switch_int.main.ConstProp.diff index 85704c48a..664b7839f 100644 --- a/tests/mir-opt/const_prop/switch_int.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/switch_int.main.ConstProp.diff @@ -15,14 +15,14 @@ bb1: { _0 = foo(const -1_i32) -> bb3; // scope 0 at $DIR/switch_int.rs:+3:14: +3:21 // mir::Constant - // + span: $DIR/switch_int.rs:10:14: 10:17 + // + span: $DIR/switch_int.rs:12:14: 12:17 // + literal: Const { ty: fn(i32) {foo}, val: Value() } } bb2: { _0 = foo(const 0_i32) -> bb3; // scope 0 at $DIR/switch_int.rs:+2:14: +2:20 // mir::Constant - // + span: $DIR/switch_int.rs:9:14: 9:17 + // + span: $DIR/switch_int.rs:11:14: 11:17 // + literal: Const { ty: fn(i32) {foo}, val: Value() } } diff --git a/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff b/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff index 0864db225..ef2c4d5fa 100644 --- a/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff +++ b/tests/mir-opt/const_prop/switch_int.main.SimplifyConstCondition-after-const-prop.diff @@ -15,14 +15,14 @@ bb1: { _0 = foo(const -1_i32) -> bb3; // scope 0 at $DIR/switch_int.rs:+3:14: +3:21 // mir::Constant - // + span: $DIR/switch_int.rs:10:14: 10:17 + // + span: $DIR/switch_int.rs:12:14: 12:17 // + literal: Const { ty: fn(i32) {foo}, val: Value() } } bb2: { _0 = foo(const 0_i32) -> bb3; // scope 0 at $DIR/switch_int.rs:+2:14: +2:20 // mir::Constant - // + span: $DIR/switch_int.rs:9:14: 9:17 + // + span: $DIR/switch_int.rs:11:14: 11:17 // + literal: Const { ty: fn(i32) {foo}, val: Value() } } diff --git a/tests/mir-opt/const_prop/switch_int.rs b/tests/mir-opt/const_prop/switch_int.rs index 2a2322e43..7158ea4d2 100644 --- a/tests/mir-opt/const_prop/switch_int.rs +++ b/tests/mir-opt/const_prop/switch_int.rs @@ -1,3 +1,5 @@ +// unit-test: ConstProp +// compile-flags: -Zmir-enable-passes=+SimplifyConstCondition-after-const-prop // ignore-wasm32 compiled with panic=abort by default #[inline(never)] fn foo(_: i32) { } diff --git a/tests/mir-opt/const_prop/transmute.from_char.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.from_char.ConstProp.32bit.diff new file mode 100644 index 000000000..933dfbb51 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.from_char.ConstProp.32bit.diff @@ -0,0 +1,15 @@ +- // MIR for `from_char` before ConstProp ++ // MIR for `from_char` after ConstProp + + fn from_char() -> i32 { + let mut _0: i32; // return place in scope 0 at $DIR/transmute.rs:+0:23: +0:26 + scope 1 { + } + + bb0: { +- _0 = const 'R' as i32 (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:28 ++ _0 = const 82_i32; // scope 1 at $DIR/transmute.rs:+1:14: +1:28 + return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.from_char.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.from_char.ConstProp.64bit.diff new file mode 100644 index 000000000..933dfbb51 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.from_char.ConstProp.64bit.diff @@ -0,0 +1,15 @@ +- // MIR for `from_char` before ConstProp ++ // MIR for `from_char` after ConstProp + + fn from_char() -> i32 { + let mut _0: i32; // return place in scope 0 at $DIR/transmute.rs:+0:23: +0:26 + scope 1 { + } + + bb0: { +- _0 = const 'R' as i32 (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:28 ++ _0 = const 82_i32; // scope 1 at $DIR/transmute.rs:+1:14: +1:28 + return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.from_char.ConstProp.diff b/tests/mir-opt/const_prop/transmute.from_char.ConstProp.diff deleted file mode 100644 index 933dfbb51..000000000 --- a/tests/mir-opt/const_prop/transmute.from_char.ConstProp.diff +++ /dev/null @@ -1,15 +0,0 @@ -- // MIR for `from_char` before ConstProp -+ // MIR for `from_char` after ConstProp - - fn from_char() -> i32 { - let mut _0: i32; // return place in scope 0 at $DIR/transmute.rs:+0:23: +0:26 - scope 1 { - } - - bb0: { -- _0 = const 'R' as i32 (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:28 -+ _0 = const 82_i32; // scope 1 at $DIR/transmute.rs:+1:14: +1:28 - return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2 - } - } - diff --git a/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.32bit.diff new file mode 100644 index 000000000..4a31194de --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.32bit.diff @@ -0,0 +1,15 @@ +- // MIR for `invalid_bool` before ConstProp ++ // MIR for `invalid_bool` after ConstProp + + fn invalid_bool() -> bool { + let mut _0: bool; // return place in scope 0 at $DIR/transmute.rs:+0:33: +0:37 + scope 1 { + } + + bb0: { +- _0 = const -1_i8 as bool (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:30 ++ _0 = const {transmute(0xff): bool}; // scope 1 at $DIR/transmute.rs:+1:14: +1:30 + return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.64bit.diff new file mode 100644 index 000000000..4a31194de --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.64bit.diff @@ -0,0 +1,15 @@ +- // MIR for `invalid_bool` before ConstProp ++ // MIR for `invalid_bool` after ConstProp + + fn invalid_bool() -> bool { + let mut _0: bool; // return place in scope 0 at $DIR/transmute.rs:+0:33: +0:37 + scope 1 { + } + + bb0: { +- _0 = const -1_i8 as bool (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:30 ++ _0 = const {transmute(0xff): bool}; // scope 1 at $DIR/transmute.rs:+1:14: +1:30 + return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.diff b/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.diff deleted file mode 100644 index f3474855f..000000000 --- a/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.diff +++ /dev/null @@ -1,14 +0,0 @@ -- // MIR for `invalid_bool` before ConstProp -+ // MIR for `invalid_bool` after ConstProp - - fn invalid_bool() -> bool { - let mut _0: bool; // return place in scope 0 at $DIR/transmute.rs:+0:33: +0:37 - scope 1 { - } - - bb0: { - _0 = const -1_i8 as bool (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:30 - return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2 - } - } - diff --git a/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.32bit.diff new file mode 100644 index 000000000..2c541f2f6 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.32bit.diff @@ -0,0 +1,15 @@ +- // MIR for `invalid_char` before ConstProp ++ // MIR for `invalid_char` after ConstProp + + fn invalid_char() -> char { + let mut _0: char; // return place in scope 0 at $DIR/transmute.rs:+0:33: +0:37 + scope 1 { + } + + bb0: { +- _0 = const _ as char (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:33 ++ _0 = const {transmute(0x7fffffff): char}; // scope 1 at $DIR/transmute.rs:+1:14: +1:33 + return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.64bit.diff new file mode 100644 index 000000000..2c541f2f6 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.64bit.diff @@ -0,0 +1,15 @@ +- // MIR for `invalid_char` before ConstProp ++ // MIR for `invalid_char` after ConstProp + + fn invalid_char() -> char { + let mut _0: char; // return place in scope 0 at $DIR/transmute.rs:+0:33: +0:37 + scope 1 { + } + + bb0: { +- _0 = const _ as char (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:33 ++ _0 = const {transmute(0x7fffffff): char}; // scope 1 at $DIR/transmute.rs:+1:14: +1:33 + return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.diff b/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.diff deleted file mode 100644 index ba087e226..000000000 --- a/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.diff +++ /dev/null @@ -1,14 +0,0 @@ -- // MIR for `invalid_char` before ConstProp -+ // MIR for `invalid_char` after ConstProp - - fn invalid_char() -> char { - let mut _0: char; // return place in scope 0 at $DIR/transmute.rs:+0:33: +0:37 - scope 1 { - } - - bb0: { - _0 = const _ as char (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:33 - return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2 - } - } - diff --git a/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.32bit.diff new file mode 100644 index 000000000..76d464789 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.32bit.diff @@ -0,0 +1,23 @@ +- // MIR for `less_as_i8` before ConstProp ++ // MIR for `less_as_i8` after ConstProp + + fn less_as_i8() -> i8 { + let mut _0: i8; // return place in scope 0 at $DIR/transmute.rs:+0:24: +0:26 + let mut _1: std::cmp::Ordering; // in scope 0 at $DIR/transmute.rs:+1:24: +1:48 + scope 1 { + } + + bb0: { + StorageLive(_1); // scope 1 at $DIR/transmute.rs:+1:24: +1:48 +- _1 = Less; // scope 1 at $DIR/transmute.rs:+1:24: +1:48 +- _0 = move _1 as i8 (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:49 ++ _1 = const Less; // scope 1 at $DIR/transmute.rs:+1:24: +1:48 ++ // mir::Constant ++ // + span: no-location ++ // + literal: Const { ty: std::cmp::Ordering, val: Value(Scalar(0xff)) } ++ _0 = const -1_i8; // scope 1 at $DIR/transmute.rs:+1:14: +1:49 + StorageDead(_1); // scope 1 at $DIR/transmute.rs:+1:48: +1:49 + return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.64bit.diff new file mode 100644 index 000000000..76d464789 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.64bit.diff @@ -0,0 +1,23 @@ +- // MIR for `less_as_i8` before ConstProp ++ // MIR for `less_as_i8` after ConstProp + + fn less_as_i8() -> i8 { + let mut _0: i8; // return place in scope 0 at $DIR/transmute.rs:+0:24: +0:26 + let mut _1: std::cmp::Ordering; // in scope 0 at $DIR/transmute.rs:+1:24: +1:48 + scope 1 { + } + + bb0: { + StorageLive(_1); // scope 1 at $DIR/transmute.rs:+1:24: +1:48 +- _1 = Less; // scope 1 at $DIR/transmute.rs:+1:24: +1:48 +- _0 = move _1 as i8 (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:49 ++ _1 = const Less; // scope 1 at $DIR/transmute.rs:+1:24: +1:48 ++ // mir::Constant ++ // + span: no-location ++ // + literal: Const { ty: std::cmp::Ordering, val: Value(Scalar(0xff)) } ++ _0 = const -1_i8; // scope 1 at $DIR/transmute.rs:+1:14: +1:49 + StorageDead(_1); // scope 1 at $DIR/transmute.rs:+1:48: +1:49 + return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.diff b/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.diff deleted file mode 100644 index 76d464789..000000000 --- a/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.diff +++ /dev/null @@ -1,23 +0,0 @@ -- // MIR for `less_as_i8` before ConstProp -+ // MIR for `less_as_i8` after ConstProp - - fn less_as_i8() -> i8 { - let mut _0: i8; // return place in scope 0 at $DIR/transmute.rs:+0:24: +0:26 - let mut _1: std::cmp::Ordering; // in scope 0 at $DIR/transmute.rs:+1:24: +1:48 - scope 1 { - } - - bb0: { - StorageLive(_1); // scope 1 at $DIR/transmute.rs:+1:24: +1:48 -- _1 = Less; // scope 1 at $DIR/transmute.rs:+1:24: +1:48 -- _0 = move _1 as i8 (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:49 -+ _1 = const Less; // scope 1 at $DIR/transmute.rs:+1:24: +1:48 -+ // mir::Constant -+ // + span: no-location -+ // + literal: Const { ty: std::cmp::Ordering, val: Value(Scalar(0xff)) } -+ _0 = const -1_i8; // scope 1 at $DIR/transmute.rs:+1:14: +1:49 - StorageDead(_1); // scope 1 at $DIR/transmute.rs:+1:48: +1:49 - return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2 - } - } - diff --git a/tests/mir-opt/const_prop/transmute.rs b/tests/mir-opt/const_prop/transmute.rs index b753cdccd..762c42171 100644 --- a/tests/mir-opt/const_prop/transmute.rs +++ b/tests/mir-opt/const_prop/transmute.rs @@ -1,5 +1,7 @@ // unit-test: ConstProp // compile-flags: -O --crate-type=lib +// ignore-endian-big +// EMIT_MIR_FOR_EACH_BIT_WIDTH use std::mem::transmute; diff --git a/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.32bit.diff new file mode 100644 index 000000000..538b1f26e --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.32bit.diff @@ -0,0 +1,22 @@ +- // MIR for `undef_union_as_integer` before ConstProp ++ // MIR for `undef_union_as_integer` after ConstProp + + fn undef_union_as_integer() -> u32 { + let mut _0: u32; // return place in scope 0 at $DIR/transmute.rs:+0:43: +0:46 + let mut _1: undef_union_as_integer::Union32; // in scope 0 at $DIR/transmute.rs:+2:24: +2:44 + let mut _2: (); // in scope 0 at $DIR/transmute.rs:+2:40: +2:42 + scope 1 { + } + + bb0: { + StorageLive(_1); // scope 1 at $DIR/transmute.rs:+2:24: +2:44 + StorageLive(_2); // scope 1 at $DIR/transmute.rs:+2:40: +2:42 + _2 = (); // scope 1 at $DIR/transmute.rs:+2:40: +2:42 + _1 = Union32 { value: move _2 }; // scope 1 at $DIR/transmute.rs:+2:24: +2:44 + StorageDead(_2); // scope 1 at $DIR/transmute.rs:+2:43: +2:44 + _0 = move _1 as u32 (Transmute); // scope 1 at $DIR/transmute.rs:+2:14: +2:45 + StorageDead(_1); // scope 1 at $DIR/transmute.rs:+2:44: +2:45 + return; // scope 0 at $DIR/transmute.rs:+3:2: +3:2 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.64bit.diff new file mode 100644 index 000000000..538b1f26e --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.64bit.diff @@ -0,0 +1,22 @@ +- // MIR for `undef_union_as_integer` before ConstProp ++ // MIR for `undef_union_as_integer` after ConstProp + + fn undef_union_as_integer() -> u32 { + let mut _0: u32; // return place in scope 0 at $DIR/transmute.rs:+0:43: +0:46 + let mut _1: undef_union_as_integer::Union32; // in scope 0 at $DIR/transmute.rs:+2:24: +2:44 + let mut _2: (); // in scope 0 at $DIR/transmute.rs:+2:40: +2:42 + scope 1 { + } + + bb0: { + StorageLive(_1); // scope 1 at $DIR/transmute.rs:+2:24: +2:44 + StorageLive(_2); // scope 1 at $DIR/transmute.rs:+2:40: +2:42 + _2 = (); // scope 1 at $DIR/transmute.rs:+2:40: +2:42 + _1 = Union32 { value: move _2 }; // scope 1 at $DIR/transmute.rs:+2:24: +2:44 + StorageDead(_2); // scope 1 at $DIR/transmute.rs:+2:43: +2:44 + _0 = move _1 as u32 (Transmute); // scope 1 at $DIR/transmute.rs:+2:14: +2:45 + StorageDead(_1); // scope 1 at $DIR/transmute.rs:+2:44: +2:45 + return; // scope 0 at $DIR/transmute.rs:+3:2: +3:2 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.diff b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.diff deleted file mode 100644 index 538b1f26e..000000000 --- a/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.diff +++ /dev/null @@ -1,22 +0,0 @@ -- // MIR for `undef_union_as_integer` before ConstProp -+ // MIR for `undef_union_as_integer` after ConstProp - - fn undef_union_as_integer() -> u32 { - let mut _0: u32; // return place in scope 0 at $DIR/transmute.rs:+0:43: +0:46 - let mut _1: undef_union_as_integer::Union32; // in scope 0 at $DIR/transmute.rs:+2:24: +2:44 - let mut _2: (); // in scope 0 at $DIR/transmute.rs:+2:40: +2:42 - scope 1 { - } - - bb0: { - StorageLive(_1); // scope 1 at $DIR/transmute.rs:+2:24: +2:44 - StorageLive(_2); // scope 1 at $DIR/transmute.rs:+2:40: +2:42 - _2 = (); // scope 1 at $DIR/transmute.rs:+2:40: +2:42 - _1 = Union32 { value: move _2 }; // scope 1 at $DIR/transmute.rs:+2:24: +2:44 - StorageDead(_2); // scope 1 at $DIR/transmute.rs:+2:43: +2:44 - _0 = move _1 as u32 (Transmute); // scope 1 at $DIR/transmute.rs:+2:14: +2:45 - StorageDead(_1); // scope 1 at $DIR/transmute.rs:+2:44: +2:45 - return; // scope 0 at $DIR/transmute.rs:+3:2: +3:2 - } - } - diff --git a/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff new file mode 100644 index 000000000..5258d75bd --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff @@ -0,0 +1,23 @@ +- // MIR for `unreachable_box` before ConstProp ++ // MIR for `unreachable_box` after ConstProp + + fn unreachable_box() -> ! { + let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37 + let _1: std::boxed::Box; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10 + scope 1 { + debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10 + } + scope 2 { + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10 +- _1 = const 1_usize as std::boxed::Box (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52 ++ _1 = const Box::(Unique:: {{ pointer: NonNull:: {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData:: }}, std::alloc::Global); // scope 2 at $DIR/transmute.rs:+1:34: +1:52 ++ // mir::Constant ++ // + span: no-location ++ // + literal: Const { ty: Box, val: Value(Scalar(0x00000001)) } + unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff new file mode 100644 index 000000000..7e57e06a5 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff @@ -0,0 +1,23 @@ +- // MIR for `unreachable_box` before ConstProp ++ // MIR for `unreachable_box` after ConstProp + + fn unreachable_box() -> ! { + let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37 + let _1: std::boxed::Box; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10 + scope 1 { + debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10 + } + scope 2 { + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10 +- _1 = const 1_usize as std::boxed::Box (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52 ++ _1 = const Box::(Unique:: {{ pointer: NonNull:: {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData:: }}, std::alloc::Global); // scope 2 at $DIR/transmute.rs:+1:34: +1:52 ++ // mir::Constant ++ // + span: no-location ++ // + literal: Const { ty: Box, val: Value(Scalar(0x0000000000000001)) } + unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.diff deleted file mode 100644 index 8bf97996a..000000000 --- a/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.diff +++ /dev/null @@ -1,23 +0,0 @@ -- // MIR for `unreachable_box` before ConstProp -+ // MIR for `unreachable_box` after ConstProp - - fn unreachable_box() -> ! { - let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37 - let mut _1: !; // in scope 0 at $DIR/transmute.rs:+0:38: +3:2 - let _2: std::boxed::Box; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10 - let mut _3: !; // in scope 0 at $DIR/transmute.rs:+2:5: +2:16 - scope 1 { - debug x => _2; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10 - } - scope 2 { - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/transmute.rs:+0:38: +3:2 - StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:9: +1:10 - _2 = const 1_usize as std::boxed::Box (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52 - StorageLive(_3); // scope 1 at $DIR/transmute.rs:+2:5: +2:16 - unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13 - } - } - diff --git a/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.32bit.diff new file mode 100644 index 000000000..032681f23 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.32bit.diff @@ -0,0 +1,22 @@ +- // MIR for `unreachable_direct` before ConstProp ++ // MIR for `unreachable_direct` after ConstProp + + fn unreachable_direct() -> ! { + let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:39: +0:40 + let _1: Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10 + let mut _2: (); // in scope 0 at $DIR/transmute.rs:+1:39: +1:41 + scope 1 { + debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10 + } + scope 2 { + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10 + StorageLive(_2); // scope 2 at $DIR/transmute.rs:+1:39: +1:41 + _2 = (); // scope 2 at $DIR/transmute.rs:+1:39: +1:41 + _1 = move _2 as Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:29: +1:42 + unreachable; // scope 2 at $DIR/transmute.rs:+1:29: +1:42 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.64bit.diff new file mode 100644 index 000000000..032681f23 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.64bit.diff @@ -0,0 +1,22 @@ +- // MIR for `unreachable_direct` before ConstProp ++ // MIR for `unreachable_direct` after ConstProp + + fn unreachable_direct() -> ! { + let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:39: +0:40 + let _1: Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10 + let mut _2: (); // in scope 0 at $DIR/transmute.rs:+1:39: +1:41 + scope 1 { + debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10 + } + scope 2 { + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10 + StorageLive(_2); // scope 2 at $DIR/transmute.rs:+1:39: +1:41 + _2 = (); // scope 2 at $DIR/transmute.rs:+1:39: +1:41 + _1 = move _2 as Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:29: +1:42 + unreachable; // scope 2 at $DIR/transmute.rs:+1:29: +1:42 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.diff b/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.diff deleted file mode 100644 index 81b7b3689..000000000 --- a/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.diff +++ /dev/null @@ -1,25 +0,0 @@ -- // MIR for `unreachable_direct` before ConstProp -+ // MIR for `unreachable_direct` after ConstProp - - fn unreachable_direct() -> ! { - let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:39: +0:40 - let mut _1: !; // in scope 0 at $DIR/transmute.rs:+0:41: +3:2 - let _2: Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10 - let mut _3: (); // in scope 0 at $DIR/transmute.rs:+1:39: +1:41 - let mut _4: !; // in scope 0 at $DIR/transmute.rs:+2:5: +2:15 - scope 1 { - debug x => _2; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10 - } - scope 2 { - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/transmute.rs:+0:41: +3:2 - StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:9: +1:10 - StorageLive(_3); // scope 2 at $DIR/transmute.rs:+1:39: +1:41 - _3 = (); // scope 2 at $DIR/transmute.rs:+1:39: +1:41 - _2 = move _3 as Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:29: +1:42 - unreachable; // scope 2 at $DIR/transmute.rs:+1:29: +1:42 - } - } - diff --git a/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.32bit.diff new file mode 100644 index 000000000..ec8a62bd6 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.32bit.diff @@ -0,0 +1,27 @@ +- // MIR for `unreachable_mut` before ConstProp ++ // MIR for `unreachable_mut` after ConstProp + + fn unreachable_mut() -> ! { + let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37 + let _1: &mut Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10 + let mut _2: &mut Never; // in scope 0 at $DIR/transmute.rs:+1:34: +1:52 + scope 1 { + debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10 + } + scope 2 { + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10 + StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:34: +1:52 +- _2 = const 1_usize as &mut Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52 ++ _2 = const {0x1 as &mut Never}; // scope 2 at $DIR/transmute.rs:+1:34: +1:52 ++ // mir::Constant ++ // + span: no-location ++ // + literal: Const { ty: &mut Never, val: Value(Scalar(0x00000001)) } + _1 = &mut (*_2); // scope 0 at $DIR/transmute.rs:+1:34: +1:52 + StorageDead(_2); // scope 0 at $DIR/transmute.rs:+1:54: +1:55 + unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.64bit.diff new file mode 100644 index 000000000..288da6e56 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.64bit.diff @@ -0,0 +1,27 @@ +- // MIR for `unreachable_mut` before ConstProp ++ // MIR for `unreachable_mut` after ConstProp + + fn unreachable_mut() -> ! { + let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37 + let _1: &mut Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10 + let mut _2: &mut Never; // in scope 0 at $DIR/transmute.rs:+1:34: +1:52 + scope 1 { + debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10 + } + scope 2 { + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10 + StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:34: +1:52 +- _2 = const 1_usize as &mut Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52 ++ _2 = const {0x1 as &mut Never}; // scope 2 at $DIR/transmute.rs:+1:34: +1:52 ++ // mir::Constant ++ // + span: no-location ++ // + literal: Const { ty: &mut Never, val: Value(Scalar(0x0000000000000001)) } + _1 = &mut (*_2); // scope 0 at $DIR/transmute.rs:+1:34: +1:52 + StorageDead(_2); // scope 0 at $DIR/transmute.rs:+1:54: +1:55 + unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.diff b/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.diff deleted file mode 100644 index 34f7aea8e..000000000 --- a/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.diff +++ /dev/null @@ -1,27 +0,0 @@ -- // MIR for `unreachable_mut` before ConstProp -+ // MIR for `unreachable_mut` after ConstProp - - fn unreachable_mut() -> ! { - let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37 - let mut _1: !; // in scope 0 at $DIR/transmute.rs:+0:38: +3:2 - let _2: &mut Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10 - let mut _3: &mut Never; // in scope 0 at $DIR/transmute.rs:+1:34: +1:52 - let mut _4: !; // in scope 0 at $DIR/transmute.rs:+2:5: +2:16 - scope 1 { - debug x => _2; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10 - } - scope 2 { - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/transmute.rs:+0:38: +3:2 - StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:9: +1:10 - StorageLive(_3); // scope 0 at $DIR/transmute.rs:+1:34: +1:52 - _3 = const 1_usize as &mut Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52 - _2 = &mut (*_3); // scope 0 at $DIR/transmute.rs:+1:34: +1:52 - StorageDead(_3); // scope 0 at $DIR/transmute.rs:+1:54: +1:55 - StorageLive(_4); // scope 1 at $DIR/transmute.rs:+2:5: +2:16 - unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13 - } - } - diff --git a/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.32bit.diff new file mode 100644 index 000000000..dcca0fca6 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.32bit.diff @@ -0,0 +1,23 @@ +- // MIR for `unreachable_ref` before ConstProp ++ // MIR for `unreachable_ref` after ConstProp + + fn unreachable_ref() -> ! { + let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37 + let _1: &Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10 + scope 1 { + debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10 + } + scope 2 { + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10 +- _1 = const 1_usize as &Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:30: +1:48 ++ _1 = const {0x1 as &Never}; // scope 2 at $DIR/transmute.rs:+1:30: +1:48 ++ // mir::Constant ++ // + span: no-location ++ // + literal: Const { ty: &Never, val: Value(Scalar(0x00000001)) } + unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.64bit.diff new file mode 100644 index 000000000..3a0b967e6 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.64bit.diff @@ -0,0 +1,23 @@ +- // MIR for `unreachable_ref` before ConstProp ++ // MIR for `unreachable_ref` after ConstProp + + fn unreachable_ref() -> ! { + let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37 + let _1: &Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10 + scope 1 { + debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10 + } + scope 2 { + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10 +- _1 = const 1_usize as &Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:30: +1:48 ++ _1 = const {0x1 as &Never}; // scope 2 at $DIR/transmute.rs:+1:30: +1:48 ++ // mir::Constant ++ // + span: no-location ++ // + literal: Const { ty: &Never, val: Value(Scalar(0x0000000000000001)) } + unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.diff b/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.diff deleted file mode 100644 index ff95f2a0b..000000000 --- a/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.diff +++ /dev/null @@ -1,23 +0,0 @@ -- // MIR for `unreachable_ref` before ConstProp -+ // MIR for `unreachable_ref` after ConstProp - - fn unreachable_ref() -> ! { - let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37 - let mut _1: !; // in scope 0 at $DIR/transmute.rs:+0:38: +3:2 - let _2: &Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10 - let mut _3: !; // in scope 0 at $DIR/transmute.rs:+2:5: +2:16 - scope 1 { - debug x => _2; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10 - } - scope 2 { - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/transmute.rs:+0:38: +3:2 - StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:9: +1:10 - _2 = const 1_usize as &Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:30: +1:48 - StorageLive(_3); // scope 1 at $DIR/transmute.rs:+2:5: +2:16 - unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13 - } - } - diff --git a/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.32bit.diff b/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.32bit.diff new file mode 100644 index 000000000..eac33b730 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.32bit.diff @@ -0,0 +1,15 @@ +- // MIR for `valid_char` before ConstProp ++ // MIR for `valid_char` after ConstProp + + fn valid_char() -> char { + let mut _0: char; // return place in scope 0 at $DIR/transmute.rs:+0:24: +0:28 + scope 1 { + } + + bb0: { +- _0 = const 82_u32 as char (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:33 ++ _0 = const 'R'; // scope 1 at $DIR/transmute.rs:+1:14: +1:33 + return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.64bit.diff new file mode 100644 index 000000000..eac33b730 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.64bit.diff @@ -0,0 +1,15 @@ +- // MIR for `valid_char` before ConstProp ++ // MIR for `valid_char` after ConstProp + + fn valid_char() -> char { + let mut _0: char; // return place in scope 0 at $DIR/transmute.rs:+0:24: +0:28 + scope 1 { + } + + bb0: { +- _0 = const 82_u32 as char (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:33 ++ _0 = const 'R'; // scope 1 at $DIR/transmute.rs:+1:14: +1:33 + return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.diff b/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.diff deleted file mode 100644 index eac33b730..000000000 --- a/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.diff +++ /dev/null @@ -1,15 +0,0 @@ -- // MIR for `valid_char` before ConstProp -+ // MIR for `valid_char` after ConstProp - - fn valid_char() -> char { - let mut _0: char; // return place in scope 0 at $DIR/transmute.rs:+0:24: +0:28 - scope 1 { - } - - bb0: { -- _0 = const 82_u32 as char (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:33 -+ _0 = const 'R'; // scope 1 at $DIR/transmute.rs:+1:14: +1:33 - return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2 - } - } - diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff index 12313b6c5..e4a7c0d1e 100644 --- a/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff +++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.ConstProp.diff @@ -11,15 +11,24 @@ } bb0: { + StorageLive(_1); // scope 0 at $DIR/tuple_literal_propagation.rs:+1:9: +1:10 - _1 = (const 1_u32, const 2_u32); // scope 0 at $DIR/tuple_literal_propagation.rs:+1:13: +1:19 + _1 = const (1_u32, 2_u32); // scope 0 at $DIR/tuple_literal_propagation.rs:+1:13: +1:19 - _2 = consume(_1) -> bb1; // scope 1 at $DIR/tuple_literal_propagation.rs:+3:5: +3:15 + StorageLive(_2); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:5: +3:15 + StorageLive(_3); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:13: +3:14 +- _3 = _1; // scope 1 at $DIR/tuple_literal_propagation.rs:+3:13: +3:14 ++ _3 = const (1_u32, 2_u32); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:13: +3:14 + _2 = consume(move _3) -> bb1; // scope 1 at $DIR/tuple_literal_propagation.rs:+3:5: +3:15 // mir::Constant - // + span: $DIR/tuple_literal_propagation.rs:6:5: 6:12 + // + span: $DIR/tuple_literal_propagation.rs:7:5: 7:12 // + literal: Const { ty: fn((u32, u32)) {consume}, val: Value() } } bb1: { + StorageDead(_3); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:14: +3:15 + StorageDead(_2); // scope 1 at $DIR/tuple_literal_propagation.rs:+3:15: +3:16 + _0 = const (); // scope 0 at $DIR/tuple_literal_propagation.rs:+0:11: +4:2 + StorageDead(_1); // scope 0 at $DIR/tuple_literal_propagation.rs:+4:1: +4:2 return; // scope 0 at $DIR/tuple_literal_propagation.rs:+4:2: +4:2 } } diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.rs b/tests/mir-opt/const_prop/tuple_literal_propagation.rs index edd748d00..f342ae270 100644 --- a/tests/mir-opt/const_prop/tuple_literal_propagation.rs +++ b/tests/mir-opt/const_prop/tuple_literal_propagation.rs @@ -1,3 +1,4 @@ +// unit-test: ConstProp // ignore-wasm32 compiled with panic=abort by default // EMIT_MIR tuple_literal_propagation.main.ConstProp.diff fn main() { diff --git a/tests/mir-opt/const_prop/while_let_loops.change_loop_body.ConstProp.diff b/tests/mir-opt/const_prop/while_let_loops.change_loop_body.ConstProp.diff new file mode 100644 index 000000000..377324218 --- /dev/null +++ b/tests/mir-opt/const_prop/while_let_loops.change_loop_body.ConstProp.diff @@ -0,0 +1,54 @@ +- // MIR for `change_loop_body` before ConstProp ++ // MIR for `change_loop_body` after ConstProp + + fn change_loop_body() -> () { + let mut _0: (); // return place in scope 0 at $DIR/while_let_loops.rs:+0:27: +0:27 + let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:+1:9: +1:15 + let mut _2: (); // in scope 0 at $DIR/while_let_loops.rs:+0:1: +6:2 + let mut _3: std::option::Option; // in scope 0 at $DIR/while_let_loops.rs:+2:28: +2:32 + let mut _4: isize; // in scope 0 at $DIR/while_let_loops.rs:+2:15: +2:25 + let mut _5: !; // in scope 0 at $DIR/while_let_loops.rs:+2:33: +5:6 + let mut _6: !; // in scope 0 at $DIR/while_let_loops.rs:+2:5: +5:6 + let _7: (); // in scope 0 at $DIR/while_let_loops.rs:+2:5: +5:6 + let mut _8: !; // in scope 0 at $DIR/while_let_loops.rs:+2:5: +5:6 + scope 1 { + debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:+1:9: +1:15 + scope 2 { + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:+1:9: +1:15 + _1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:+1:18: +1:19 + StorageLive(_3); // scope 2 at $DIR/while_let_loops.rs:+2:28: +2:32 + _3 = Option::::None; // scope 2 at $DIR/while_let_loops.rs:+2:28: +2:32 +- _4 = discriminant(_3); // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25 +- switchInt(move _4) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25 ++ _4 = const 0_isize; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25 ++ switchInt(const 0_isize) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25 + } + + bb1: { + switchInt(((_3 as Some).0: u32)) -> [0: bb2, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25 + } + + bb2: { + _1 = const 1_i32; // scope 2 at $DIR/while_let_loops.rs:+3:9: +3:15 + _0 = const (); // scope 2 at $DIR/while_let_loops.rs:+4:9: +4:14 + goto -> bb4; // scope 2 at $DIR/while_let_loops.rs:+4:9: +4:14 + } + + bb3: { + StorageLive(_7); // scope 1 at $DIR/while_let_loops.rs:+2:5: +5:6 + _0 = const (); // scope 1 at $DIR/while_let_loops.rs:+2:5: +5:6 + StorageDead(_7); // scope 1 at $DIR/while_let_loops.rs:+5:5: +5:6 + goto -> bb4; // scope 1 at no-location + } + + bb4: { + StorageDead(_3); // scope 1 at $DIR/while_let_loops.rs:+5:5: +5:6 + StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:+6:1: +6:2 + return; // scope 0 at $DIR/while_let_loops.rs:+6:2: +6:2 + } + } + diff --git a/tests/mir-opt/const_prop/while_let_loops.rs b/tests/mir-opt/const_prop/while_let_loops.rs new file mode 100644 index 000000000..595a94b88 --- /dev/null +++ b/tests/mir-opt/const_prop/while_let_loops.rs @@ -0,0 +1,14 @@ +// unit-test: ConstProp +// EMIT_MIR while_let_loops.change_loop_body.ConstProp.diff + +pub fn change_loop_body() { + let mut _x = 0; + while let Some(0u32) = None { + _x = 1; + break; + } +} + +fn main() { + change_loop_body(); +} diff --git a/tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff b/tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff index def9fc642..a5f52d089 100644 --- a/tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff +++ b/tests/mir-opt/const_prop_miscompile.bar.ConstProp.diff @@ -19,8 +19,7 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/const_prop_miscompile.rs:+1:9: +1:14 -- _1 = (const 1_i32,); // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21 -+ _1 = const (1_i32,); // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21 + _1 = (const 1_i32,); // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21 StorageLive(_2); // scope 1 at $DIR/const_prop_miscompile.rs:+2:5: +4:6 StorageLive(_3); // scope 2 at $DIR/const_prop_miscompile.rs:+3:10: +3:22 _3 = &raw mut (_1.0: i32); // scope 2 at $DIR/const_prop_miscompile.rs:+3:10: +3:22 diff --git a/tests/mir-opt/const_prop_miscompile.foo.ConstProp.diff b/tests/mir-opt/const_prop_miscompile.foo.ConstProp.diff index b54c10a14..42ddc2a56 100644 --- a/tests/mir-opt/const_prop_miscompile.foo.ConstProp.diff +++ b/tests/mir-opt/const_prop_miscompile.foo.ConstProp.diff @@ -16,8 +16,7 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/const_prop_miscompile.rs:+1:9: +1:14 -- _1 = (const 1_i32,); // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21 -+ _1 = const (1_i32,); // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21 + _1 = (const 1_i32,); // scope 0 at $DIR/const_prop_miscompile.rs:+1:17: +1:21 StorageLive(_2); // scope 1 at $DIR/const_prop_miscompile.rs:+2:6: +2:14 _2 = &mut (_1.0: i32); // scope 1 at $DIR/const_prop_miscompile.rs:+2:6: +2:14 (*_2) = const 5_i32; // scope 1 at $DIR/const_prop_miscompile.rs:+2:5: +2:18 diff --git a/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.diff b/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.diff index 2a0bff57d..51707e716 100644 --- a/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.diff +++ b/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.diff @@ -20,8 +20,7 @@ } bb1: { -- _0 = opaque::(_3) -> bb2; // scope 0 at $DIR/borrowed_local.rs:+12:13: +12:38 -+ _0 = opaque::(_1) -> bb2; // scope 0 at $DIR/borrowed_local.rs:+12:13: +12:38 + _0 = opaque::(_3) -> bb2; // scope 0 at $DIR/borrowed_local.rs:+12:13: +12:38 // mir::Constant // + span: $DIR/borrowed_local.rs:28:28: 28:34 // + literal: Const { ty: fn(u8) -> bool {opaque::}, val: Value() } diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.diff index 69acebf76..1c7b6494d 100644 --- a/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.diff +++ b/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.diff @@ -6,15 +6,17 @@ let mut _0: i32; // return place in scope 0 at $DIR/copy_propagation_arg.rs:+0:27: +0:30 let _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:+1:9: +1:10 scope 1 { - debug y => _2; // in scope 1 at $DIR/copy_propagation_arg.rs:+1:9: +1:10 +- debug y => _2; // in scope 1 at $DIR/copy_propagation_arg.rs:+1:9: +1:10 ++ debug y => _0; // in scope 1 at $DIR/copy_propagation_arg.rs:+1:9: +1:10 } bb0: { - StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+1:9: +1:10 - _2 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14 +- StorageLive(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+1:9: +1:10 +- _2 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14 ++ _0 = _1; // scope 0 at $DIR/copy_propagation_arg.rs:+1:13: +1:14 _1 = const 123_i32; // scope 1 at $DIR/copy_propagation_arg.rs:+2:5: +2:12 - _0 = _2; // scope 1 at $DIR/copy_propagation_arg.rs:+3:5: +3:6 - StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+4:1: +4:2 +- _0 = _2; // scope 1 at $DIR/copy_propagation_arg.rs:+3:5: +3:6 +- StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:+4:1: +4:2 return; // scope 0 at $DIR/copy_propagation_arg.rs:+4:2: +4:2 } } diff --git a/tests/mir-opt/copy-prop/partial_init.main.CopyProp.diff b/tests/mir-opt/copy-prop/partial_init.main.CopyProp.diff new file mode 100644 index 000000000..586643905 --- /dev/null +++ b/tests/mir-opt/copy-prop/partial_init.main.CopyProp.diff @@ -0,0 +1,13 @@ +- // MIR for `main` before CopyProp ++ // MIR for `main` after CopyProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/partial_init.rs:+0:15: +0:15 + let mut _1: (isize,); // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + + bb0: { + (_1.0: isize) = const 1_isize; // scope 0 at $DIR/partial_init.rs:+4:13: +4:20 + return; // scope 0 at $DIR/partial_init.rs:+5:13: +5:21 + } + } + diff --git a/tests/mir-opt/copy-prop/partial_init.rs b/tests/mir-opt/copy-prop/partial_init.rs new file mode 100644 index 000000000..f5ab9974f --- /dev/null +++ b/tests/mir-opt/copy-prop/partial_init.rs @@ -0,0 +1,18 @@ +// unit-test: CopyProp +// Verify that we do not ICE on partial initializations. + +#![feature(custom_mir, core_intrinsics)] +extern crate core; +use core::intrinsics::mir::*; + +// EMIT_MIR partial_init.main.CopyProp.diff +#[custom_mir(dialect = "runtime", phase = "post-cleanup")] +pub fn main() { + mir! ( + let x: (isize, ); + { + x.0 = 1; + Return() + } + ) +} diff --git a/tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination.diff b/tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination.diff new file mode 100644 index 000000000..761c074ed --- /dev/null +++ b/tests/mir-opt/dead-store-elimination/place_mention.main.DeadStoreElimination.diff @@ -0,0 +1,25 @@ +- // MIR for `main` before DeadStoreElimination ++ // MIR for `main` after DeadStoreElimination + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/place_mention.rs:+0:11: +0:11 + let mut _1: (&str, &str); // in scope 0 at $DIR/place_mention.rs:+3:18: +3:36 + scope 1 { + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/place_mention.rs:+3:18: +3:36 + _1 = (const "Hello", const "World"); // scope 0 at $DIR/place_mention.rs:+3:18: +3:36 + // mir::Constant + // + span: $DIR/place_mention.rs:8:19: 8:26 + // + literal: Const { ty: &str, val: Value(Slice(..)) } + // mir::Constant + // + span: $DIR/place_mention.rs:8:28: 8:35 + // + literal: Const { ty: &str, val: Value(Slice(..)) } + PlaceMention(_1); // scope 0 at $DIR/place_mention.rs:+3:18: +3:36 + StorageDead(_1); // scope 0 at $DIR/place_mention.rs:+3:36: +3:37 + _0 = const (); // scope 0 at $DIR/place_mention.rs:+0:11: +4:2 + return; // scope 0 at $DIR/place_mention.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/dead-store-elimination/place_mention.rs b/tests/mir-opt/dead-store-elimination/place_mention.rs new file mode 100644 index 000000000..59dc74454 --- /dev/null +++ b/tests/mir-opt/dead-store-elimination/place_mention.rs @@ -0,0 +1,9 @@ +// unit-test: DeadStoreElimination +// compile-flags: -Zmir-keep-place-mention + +// EMIT_MIR place_mention.main.DeadStoreElimination.diff +fn main() { + // Verify that we account for the `PlaceMention` statement as a use of the tuple, + // and don't remove it as a dead store. + let (_, _) = ("Hello", "World"); +} diff --git a/tests/mir-opt/dont_yeet_assert.generic.InstCombine.diff b/tests/mir-opt/dont_yeet_assert.generic.InstCombine.diff deleted file mode 100644 index c0fc1fb1d..000000000 --- a/tests/mir-opt/dont_yeet_assert.generic.InstCombine.diff +++ /dev/null @@ -1,23 +0,0 @@ -- // MIR for `generic` before InstCombine -+ // MIR for `generic` after InstCombine - - fn generic() -> () { - let mut _0: (); // return place in scope 0 at $DIR/dont_yeet_assert.rs:+0:21: +0:21 - let _1: (); // in scope 0 at $DIR/dont_yeet_assert.rs:+1:5: +1:61 - - bb0: { - StorageLive(_1); // scope 0 at $DIR/dont_yeet_assert.rs:+1:5: +1:61 - _1 = assert_mem_uninitialized_valid::<&T>() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/dont_yeet_assert.rs:+1:5: +1:61 - // mir::Constant - // + span: $DIR/dont_yeet_assert.rs:10:5: 10:59 - // + user_ty: UserType(0) - // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_mem_uninitialized_valid::<&T>}, val: Value() } - } - - bb1: { - StorageDead(_1); // scope 0 at $DIR/dont_yeet_assert.rs:+1:61: +1:62 - _0 = const (); // scope 0 at $DIR/dont_yeet_assert.rs:+0:21: +2:2 - return; // scope 0 at $DIR/dont_yeet_assert.rs:+2:2: +2:2 - } - } - diff --git a/tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff b/tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff new file mode 100644 index 000000000..cadf05152 --- /dev/null +++ b/tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff @@ -0,0 +1,23 @@ +- // MIR for `generic` before InstSimplify ++ // MIR for `generic` after InstSimplify + + fn generic() -> () { + let mut _0: (); // return place in scope 0 at $DIR/dont_yeet_assert.rs:+0:21: +0:21 + let _1: (); // in scope 0 at $DIR/dont_yeet_assert.rs:+1:5: +1:61 + + bb0: { + StorageLive(_1); // scope 0 at $DIR/dont_yeet_assert.rs:+1:5: +1:61 + _1 = assert_mem_uninitialized_valid::<&T>() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/dont_yeet_assert.rs:+1:5: +1:61 + // mir::Constant + // + span: $DIR/dont_yeet_assert.rs:10:5: 10:59 + // + user_ty: UserType(0) + // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_mem_uninitialized_valid::<&T>}, val: Value() } + } + + bb1: { + StorageDead(_1); // scope 0 at $DIR/dont_yeet_assert.rs:+1:61: +1:62 + _0 = const (); // scope 0 at $DIR/dont_yeet_assert.rs:+0:21: +2:2 + return; // scope 0 at $DIR/dont_yeet_assert.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/dont_yeet_assert.rs b/tests/mir-opt/dont_yeet_assert.rs index 7cec761ea..38cc5a293 100644 --- a/tests/mir-opt/dont_yeet_assert.rs +++ b/tests/mir-opt/dont_yeet_assert.rs @@ -1,11 +1,11 @@ // compile-flags: --crate-type=lib -// unit-test: InstCombine +// unit-test: InstSimplify #![feature(core_intrinsics)] // Want to make sure this assertion isn't compiled away in generic code. -// EMIT_MIR dont_yeet_assert.generic.InstCombine.diff +// EMIT_MIR dont_yeet_assert.generic.InstSimplify.diff pub fn generic() { core::intrinsics::assert_mem_uninitialized_valid::<&T>(); } diff --git a/tests/mir-opt/equal_true.opt.InstCombine.diff b/tests/mir-opt/equal_true.opt.InstCombine.diff deleted file mode 100644 index 8b542a7c1..000000000 --- a/tests/mir-opt/equal_true.opt.InstCombine.diff +++ /dev/null @@ -1,35 +0,0 @@ -- // MIR for `opt` before InstCombine -+ // MIR for `opt` after InstCombine - - fn opt(_1: bool) -> i32 { - debug x => _1; // in scope 0 at $DIR/equal_true.rs:+0:8: +0:9 - let mut _0: i32; // return place in scope 0 at $DIR/equal_true.rs:+0:20: +0:23 - let mut _2: bool; // in scope 0 at $DIR/equal_true.rs:+1:8: +1:17 - let mut _3: bool; // in scope 0 at $DIR/equal_true.rs:+1:8: +1:9 - - bb0: { - StorageLive(_2); // scope 0 at $DIR/equal_true.rs:+1:8: +1:17 - StorageLive(_3); // scope 0 at $DIR/equal_true.rs:+1:8: +1:9 - _3 = _1; // scope 0 at $DIR/equal_true.rs:+1:8: +1:9 -- _2 = Eq(move _3, const true); // scope 0 at $DIR/equal_true.rs:+1:8: +1:17 -+ _2 = move _3; // scope 0 at $DIR/equal_true.rs:+1:8: +1:17 - StorageDead(_3); // scope 0 at $DIR/equal_true.rs:+1:16: +1:17 - switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/equal_true.rs:+1:8: +1:17 - } - - bb1: { - _0 = const 0_i32; // scope 0 at $DIR/equal_true.rs:+1:20: +1:21 - goto -> bb3; // scope 0 at $DIR/equal_true.rs:+1:5: +1:34 - } - - bb2: { - _0 = const 1_i32; // scope 0 at $DIR/equal_true.rs:+1:31: +1:32 - goto -> bb3; // scope 0 at $DIR/equal_true.rs:+1:5: +1:34 - } - - bb3: { - StorageDead(_2); // scope 0 at $DIR/equal_true.rs:+1:33: +1:34 - return; // scope 0 at $DIR/equal_true.rs:+2:2: +2:2 - } - } - diff --git a/tests/mir-opt/equal_true.opt.InstSimplify.diff b/tests/mir-opt/equal_true.opt.InstSimplify.diff new file mode 100644 index 000000000..4ef413200 --- /dev/null +++ b/tests/mir-opt/equal_true.opt.InstSimplify.diff @@ -0,0 +1,35 @@ +- // MIR for `opt` before InstSimplify ++ // MIR for `opt` after InstSimplify + + fn opt(_1: bool) -> i32 { + debug x => _1; // in scope 0 at $DIR/equal_true.rs:+0:8: +0:9 + let mut _0: i32; // return place in scope 0 at $DIR/equal_true.rs:+0:20: +0:23 + let mut _2: bool; // in scope 0 at $DIR/equal_true.rs:+1:8: +1:17 + let mut _3: bool; // in scope 0 at $DIR/equal_true.rs:+1:8: +1:9 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/equal_true.rs:+1:8: +1:17 + StorageLive(_3); // scope 0 at $DIR/equal_true.rs:+1:8: +1:9 + _3 = _1; // scope 0 at $DIR/equal_true.rs:+1:8: +1:9 +- _2 = Eq(move _3, const true); // scope 0 at $DIR/equal_true.rs:+1:8: +1:17 ++ _2 = move _3; // scope 0 at $DIR/equal_true.rs:+1:8: +1:17 + StorageDead(_3); // scope 0 at $DIR/equal_true.rs:+1:16: +1:17 + switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/equal_true.rs:+1:8: +1:17 + } + + bb1: { + _0 = const 0_i32; // scope 0 at $DIR/equal_true.rs:+1:20: +1:21 + goto -> bb3; // scope 0 at $DIR/equal_true.rs:+1:5: +1:34 + } + + bb2: { + _0 = const 1_i32; // scope 0 at $DIR/equal_true.rs:+1:31: +1:32 + goto -> bb3; // scope 0 at $DIR/equal_true.rs:+1:5: +1:34 + } + + bb3: { + StorageDead(_2); // scope 0 at $DIR/equal_true.rs:+1:33: +1:34 + return; // scope 0 at $DIR/equal_true.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/equal_true.rs b/tests/mir-opt/equal_true.rs index 717d10c6d..fbb5d8d37 100644 --- a/tests/mir-opt/equal_true.rs +++ b/tests/mir-opt/equal_true.rs @@ -1,6 +1,6 @@ -// unit-test InstCombine +// unit-test InstSimplify -// EMIT_MIR equal_true.opt.InstCombine.diff +// EMIT_MIR equal_true.opt.InstSimplify.diff fn opt(x: bool) -> i32 { if x == true { 0 } else { 1 } diff --git a/tests/mir-opt/inline/issue_106141.outer.Inline.diff b/tests/mir-opt/inline/issue_106141.outer.Inline.diff index 18df6f9af..3aebfb69e 100644 --- a/tests/mir-opt/inline/issue_106141.outer.Inline.diff +++ b/tests/mir-opt/inline/issue_106141.outer.Inline.diff @@ -8,7 +8,7 @@ + let mut _2: bool; // in scope 1 at $DIR/issue_106141.rs:14:8: 14:21 + let mut _3: &[bool; 1]; // in scope 1 at $DIR/issue_106141.rs:12:18: 12:25 + scope 2 { -+ debug buffer => _3; // in scope 2 at $DIR/issue_106141.rs:12:9: 12:15 ++ debug buffer => const _; // in scope 2 at $DIR/issue_106141.rs:12:9: 12:15 + scope 3 { + debug index => _0; // in scope 3 at $DIR/issue_106141.rs:13:9: 13:14 + } diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff index 6184a0acd..d76cd0e2b 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff @@ -10,50 +10,52 @@ + scope 1 (inlined core::num::::unchecked_shl) { // at $DIR/unchecked_shifts.rs:11:7: 11:23 + debug self => _3; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + debug rhs => _4; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL -+ let mut _5: u16; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL -+ let mut _6: std::option::Option; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL -+ let mut _7: std::result::Result; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL ++ let mut _5: u16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ let mut _6: (u32,); // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ let mut _7: u32; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL + scope 2 { -+ scope 3 (inlined >::try_into) { // at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL -+ debug self => _4; // in scope 3 at $SRC_DIR/core/src/convert/mod.rs:LL:COL -+ scope 4 (inlined convert::num:: for u16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL -+ debug u => _4; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ let mut _8: bool; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ let mut _9: u32; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ let mut _10: u16; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ } -+ } -+ scope 5 (inlined Result::::ok) { // at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL -+ debug self => _7; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL -+ let mut _11: isize; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL -+ let _12: u16; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL -+ scope 6 { -+ debug x => _12; // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL -+ } -+ scope 7 { -+ scope 8 { -+ debug x => const TryFromIntError(()); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL ++ scope 3 (inlined core::num::::unchecked_shl::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ debug x => _7; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ let mut _8: std::option::Option; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ let mut _9: std::result::Result; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ scope 4 { ++ scope 5 (inlined >::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ debug self => _7; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL ++ scope 6 (inlined convert::num:: for u16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL ++ debug u => _7; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ let mut _10: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ let mut _11: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ let mut _12: u16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ } + } -+ } -+ } -+ scope 9 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL -+ debug self => _6; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ let mut _13: &std::option::Option; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ let mut _14: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ scope 10 { -+ debug val => _5; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL -+ } -+ scope 11 { -+ scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL -+ scope 14 { -+ scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL ++ scope 7 (inlined Result::::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ debug self => _9; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ let mut _13: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ let _14: u16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ scope 8 { ++ debug x => _14; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL ++ } ++ } ++ scope 9 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ debug self => _8; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL ++ let mut _15: &std::option::Option; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL ++ let mut _16: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL ++ scope 10 { ++ debug val => _5; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL ++ } ++ scope 11 { ++ scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL ++ scope 14 { ++ scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL ++ } ++ } + } + } ++ scope 12 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL ++ debug self => _15; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL ++ } + } + } -+ scope 12 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL -+ debug self => _13; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL -+ } + } + } + } @@ -67,75 +69,81 @@ - // mir::Constant - // + span: $DIR/unchecked_shifts.rs:11:7: 11:20 - // + literal: Const { ty: unsafe fn(u16, u32) -> u16 {core::num::::unchecked_shl}, val: Value() } -+ StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL -+ StorageLive(_6); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL -+ StorageLive(_7); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL -+ StorageLive(_8); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ StorageLive(_9); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ _9 = const 65535_u32; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ _8 = Gt(_4, move _9); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ StorageDead(_9); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ switchInt(move _8) -> [0: bb4, otherwise: bb3]; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageLive(_6); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ _6 = (_4,); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageLive(_7); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ _7 = move (_6.0: u32); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageLive(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageLive(_9); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageLive(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ StorageLive(_11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ _11 = const 65535_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ _10 = Gt(_7, move _11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ StorageDead(_11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ switchInt(move _10) -> [0: bb3, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL } bb1: { -+ StorageDead(_12); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL -+ StorageDead(_7); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL -+ StorageLive(_13); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL -+ _14 = discriminant(_6); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ switchInt(move _14) -> [1: bb9, otherwise: bb7]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ } -+ -+ bb2: { + StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL StorageDead(_4); // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23 StorageDead(_3); // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23 return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2 + } + -+ bb3: { -+ _7 = Result::::Err(const TryFromIntError(())); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ bb2: { ++ _9 = Result::::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + // mir::Constant + // + span: no-location + // + literal: Const { ty: TryFromIntError, val: Value() } -+ goto -> bb5; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ } ++ ++ bb3: { ++ StorageLive(_12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ _12 = _7 as u16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ _9 = Result::::Ok(move _12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ StorageDead(_12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + } + + bb4: { -+ StorageLive(_10); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ _10 = _4 as u16 (IntToInt); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ _7 = Result::::Ok(move _10); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ StorageDead(_10); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ goto -> bb5; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ StorageDead(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ StorageLive(_14); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ _13 = discriminant(_9); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ switchInt(move _13) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + } + + bb5: { -+ StorageDead(_8); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ StorageLive(_12); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL -+ _11 = discriminant(_7); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL -+ switchInt(move _11) -> [0: bb8, 1: bb6, otherwise: bb7]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL ++ _8 = Option::::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + } + + bb6: { -+ _6 = Option::::None; // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL -+ goto -> bb1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + } + + bb7: { -+ unreachable; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL ++ _14 = move ((_9 as Ok).0: u16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ _8 = Option::::Some(move _14); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL ++ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + } + + bb8: { -+ _12 = move ((_7 as Ok).0: u16); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL -+ _6 = Option::::Some(move _12); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL -+ goto -> bb1; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL ++ StorageDead(_14); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageDead(_9); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageLive(_15); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ _16 = discriminant(_8); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL ++ switchInt(move _16) -> [1: bb9, otherwise: bb6]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + } + + bb9: { -+ _5 = move ((_6 as Some).0: u16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ StorageDead(_13); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL -+ StorageDead(_6); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL -+ _0 = unchecked_shl::(_3, move _5) -> [return: bb2, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL ++ _5 = move ((_8 as Some).0: u16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL ++ StorageDead(_15); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageDead(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageDead(_7); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageDead(_6); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ _0 = unchecked_shl::(_3, move _5) -> [return: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u16, u16) -> u16 {unchecked_shl::}, val: Value() } diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir index 726b6bbf9..3c175ed15 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir @@ -7,122 +7,130 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 { scope 1 (inlined core::num::::unchecked_shl) { // at $DIR/unchecked_shifts.rs:11:7: 11:23 debug self => _1; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL debug rhs => _2; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - let mut _3: u16; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - let mut _4: std::option::Option; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - let mut _5: std::result::Result; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + let mut _3: u16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _4: (u32,); // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _5: u32; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL scope 2 { - scope 3 (inlined >::try_into) { // at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - debug self => _2; // in scope 3 at $SRC_DIR/core/src/convert/mod.rs:LL:COL - scope 4 (inlined convert::num:: for u16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL - debug u => _2; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - let mut _6: bool; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - let mut _7: u32; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - let mut _8: u16; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - } - } - scope 5 (inlined Result::::ok) { // at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - debug self => _5; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _9: isize; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - let _10: u16; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - scope 6 { - debug x => _10; // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL - } - scope 7 { - scope 8 { - debug x => const TryFromIntError(()); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL + scope 3 (inlined core::num::::unchecked_shl::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL + debug x => _5; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _6: std::option::Option; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _7: std::result::Result; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL + scope 4 { + scope 5 (inlined >::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL + debug self => _5; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL + scope 6 (inlined convert::num:: for u16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL + debug u => _5; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + let mut _8: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + let mut _9: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + let mut _10: u16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + } } - } - } - scope 9 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - debug self => _4; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _11: &std::option::Option; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _12: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - scope 10 { - debug val => _3; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL - } - scope 11 { - scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL - scope 14 { - scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 7 (inlined Result::::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL + debug self => _7; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + let mut _11: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + let _12: u16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + scope 8 { + debug x => _12; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL + } + } + scope 9 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL + debug self => _6; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _13: &std::option::Option; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _14: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + scope 10 { + debug val => _3; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL + } + scope 11 { + scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL + scope 14 { + scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + } + } } } + scope 12 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL + debug self => _13; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL + } } } - scope 12 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL - debug self => _11; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL - } } } } bb0: { - StorageLive(_3); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - StorageLive(_4); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - StorageLive(_6); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageLive(_7); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _7 = const 65535_u32; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _6 = Gt(_2, move _7); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageDead(_7); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - switchInt(move _6) -> [0: bb4, otherwise: bb3]; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageLive(_3); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_4); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _4 = (_2,); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _5 = move (_4.0: u32); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageLive(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _9 = const 65535_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _8 = Gt(_5, move _9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageDead(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + switchInt(move _8) -> [0: bb3, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL } bb1: { - StorageDead(_10); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - StorageLive(_11); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - _12 = discriminant(_4); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - switchInt(move _12) -> [1: bb9, otherwise: bb7]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - } - - bb2: { StorageDead(_3); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2 } - bb3: { - _5 = Result::::Err(const TryFromIntError(())); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL + bb2: { + _7 = Result::::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL // mir::Constant // + span: no-location // + literal: Const { ty: TryFromIntError, val: Value() } - goto -> bb5; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL + goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + } + + bb3: { + StorageLive(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _10 = _5 as u16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _7 = Result::::Ok(move _10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageDead(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL } bb4: { - StorageLive(_8); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _8 = _2 as u16 (IntToInt); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _5 = Result::::Ok(move _8); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageDead(_8); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - goto -> bb5; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageDead(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageLive(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _11 = discriminant(_7); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + switchInt(move _11) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL } bb5: { - StorageDead(_6); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageLive(_10); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - _9 = discriminant(_5); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - switchInt(move _9) -> [0: bb8, 1: bb6, otherwise: bb7]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL + _6 = Option::::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL } bb6: { - _4 = Option::::None; // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - goto -> bb1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL } bb7: { - unreachable; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL + _12 = move ((_7 as Ok).0: u16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + _6 = Option::::Some(move _12); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL + goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL } bb8: { - _10 = move ((_5 as Ok).0: u16); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - _4 = Option::::Some(move _10); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL - goto -> bb1; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL + StorageDead(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageDead(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _14 = discriminant(_6); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + switchInt(move _14) -> [1: bb9, otherwise: bb6]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL } bb9: { - _3 = move ((_4 as Some).0: u16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - StorageDead(_11); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - StorageDead(_4); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - _0 = unchecked_shl::(_1, move _3) -> [return: bb2, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + _3 = move ((_6 as Some).0: u16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageDead(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageDead(_4); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _0 = unchecked_shl::(_1, move _3) -> [return: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u16, u16) -> u16 {unchecked_shl::}, val: Value() } diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff index 35d5b6e72..f3d3e6090 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff @@ -10,50 +10,52 @@ + scope 1 (inlined core::num::::unchecked_shr) { // at $DIR/unchecked_shifts.rs:17:7: 17:23 + debug self => _3; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL + debug rhs => _4; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL -+ let mut _5: i16; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL -+ let mut _6: std::option::Option; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL -+ let mut _7: std::result::Result; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL ++ let mut _5: i16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ let mut _6: (u32,); // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ let mut _7: u32; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL + scope 2 { -+ scope 3 (inlined >::try_into) { // at $SRC_DIR/core/src/num/int_macros.rs:LL:COL -+ debug self => _4; // in scope 3 at $SRC_DIR/core/src/convert/mod.rs:LL:COL -+ scope 4 (inlined convert::num:: for i16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL -+ debug u => _4; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ let mut _8: bool; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ let mut _9: u32; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ let mut _10: i16; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ } -+ } -+ scope 5 (inlined Result::::ok) { // at $SRC_DIR/core/src/num/int_macros.rs:LL:COL -+ debug self => _7; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL -+ let mut _11: isize; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL -+ let _12: i16; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL -+ scope 6 { -+ debug x => _12; // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL -+ } -+ scope 7 { -+ scope 8 { -+ debug x => const TryFromIntError(()); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL ++ scope 3 (inlined core::num::::unchecked_shr::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ debug x => _7; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ let mut _8: std::option::Option; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ let mut _9: std::result::Result; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ scope 4 { ++ scope 5 (inlined >::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ debug self => _7; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL ++ scope 6 (inlined convert::num:: for i16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL ++ debug u => _7; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ let mut _10: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ let mut _11: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ let mut _12: i16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ } + } -+ } -+ } -+ scope 9 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $SRC_DIR/core/src/num/int_macros.rs:LL:COL -+ debug self => _6; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ let mut _13: &std::option::Option; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ let mut _14: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ scope 10 { -+ debug val => _5; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL -+ } -+ scope 11 { -+ scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL -+ scope 14 { -+ scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL ++ scope 7 (inlined Result::::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ debug self => _9; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ let mut _13: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ let _14: i16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ scope 8 { ++ debug x => _14; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL ++ } ++ } ++ scope 9 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ debug self => _8; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL ++ let mut _15: &std::option::Option; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL ++ let mut _16: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL ++ scope 10 { ++ debug val => _5; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL ++ } ++ scope 11 { ++ scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL ++ scope 14 { ++ scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL ++ } ++ } + } + } ++ scope 12 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL ++ debug self => _15; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL ++ } + } + } -+ scope 12 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL -+ debug self => _13; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL -+ } + } + } + } @@ -67,75 +69,81 @@ - // mir::Constant - // + span: $DIR/unchecked_shifts.rs:17:7: 17:20 - // + literal: Const { ty: unsafe fn(i16, u32) -> i16 {core::num::::unchecked_shr}, val: Value() } -+ StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL -+ StorageLive(_6); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL -+ StorageLive(_7); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL -+ StorageLive(_8); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ StorageLive(_9); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ _9 = const 32767_u32; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ _8 = Gt(_4, move _9); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ StorageDead(_9); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ switchInt(move _8) -> [0: bb4, otherwise: bb3]; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageLive(_6); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ _6 = (_4,); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageLive(_7); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ _7 = move (_6.0: u32); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageLive(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageLive(_9); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageLive(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ StorageLive(_11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ _11 = const 32767_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ _10 = Gt(_7, move _11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ StorageDead(_11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ switchInt(move _10) -> [0: bb3, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL } bb1: { -+ StorageDead(_12); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL -+ StorageDead(_7); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL -+ StorageLive(_13); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL -+ _14 = discriminant(_6); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ switchInt(move _14) -> [1: bb9, otherwise: bb7]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ } -+ -+ bb2: { + StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL StorageDead(_4); // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23 StorageDead(_3); // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23 return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2 + } + -+ bb3: { -+ _7 = Result::::Err(const TryFromIntError(())); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ bb2: { ++ _9 = Result::::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + // mir::Constant + // + span: no-location + // + literal: Const { ty: TryFromIntError, val: Value() } -+ goto -> bb5; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ } ++ ++ bb3: { ++ StorageLive(_12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ _12 = _7 as i16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ _9 = Result::::Ok(move _12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ StorageDead(_12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + } + + bb4: { -+ StorageLive(_10); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ _10 = _4 as i16 (IntToInt); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ _7 = Result::::Ok(move _10); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ StorageDead(_10); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ goto -> bb5; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ StorageDead(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ StorageLive(_14); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ _13 = discriminant(_9); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ switchInt(move _13) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + } + + bb5: { -+ StorageDead(_8); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ StorageLive(_12); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL -+ _11 = discriminant(_7); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL -+ switchInt(move _11) -> [0: bb8, 1: bb6, otherwise: bb7]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL ++ _8 = Option::::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + } + + bb6: { -+ _6 = Option::::None; // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL -+ goto -> bb1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + } + + bb7: { -+ unreachable; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL ++ _14 = move ((_9 as Ok).0: i16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL ++ _8 = Option::::Some(move _14); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL ++ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + } + + bb8: { -+ _12 = move ((_7 as Ok).0: i16); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL -+ _6 = Option::::Some(move _12); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL -+ goto -> bb1; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL ++ StorageDead(_14); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageDead(_9); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageLive(_15); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ _16 = discriminant(_8); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL ++ switchInt(move _16) -> [1: bb9, otherwise: bb6]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + } + + bb9: { -+ _5 = move ((_6 as Some).0: i16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ StorageDead(_13); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL -+ StorageDead(_6); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL -+ _0 = unchecked_shr::(_3, move _5) -> [return: bb2, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL ++ _5 = move ((_8 as Some).0: i16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL ++ StorageDead(_15); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageDead(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageDead(_7); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ StorageDead(_6); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ _0 = unchecked_shr::(_3, move _5) -> [return: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/num/int_macros.rs:LL:COL + // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i16, i16) -> i16 {unchecked_shr::}, val: Value() } diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir index b006085b5..724b3c567 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir @@ -7,122 +7,130 @@ fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 { scope 1 (inlined core::num::::unchecked_shr) { // at $DIR/unchecked_shifts.rs:17:7: 17:23 debug self => _1; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL debug rhs => _2; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL - let mut _3: i16; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL - let mut _4: std::option::Option; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL - let mut _5: std::result::Result; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL + let mut _3: i16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _4: (u32,); // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _5: u32; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL scope 2 { - scope 3 (inlined >::try_into) { // at $SRC_DIR/core/src/num/int_macros.rs:LL:COL - debug self => _2; // in scope 3 at $SRC_DIR/core/src/convert/mod.rs:LL:COL - scope 4 (inlined convert::num:: for i16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL - debug u => _2; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - let mut _6: bool; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - let mut _7: u32; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - let mut _8: i16; // in scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - } - } - scope 5 (inlined Result::::ok) { // at $SRC_DIR/core/src/num/int_macros.rs:LL:COL - debug self => _5; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _9: isize; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - let _10: i16; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - scope 6 { - debug x => _10; // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL - } - scope 7 { - scope 8 { - debug x => const TryFromIntError(()); // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL + scope 3 (inlined core::num::::unchecked_shr::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL + debug x => _5; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _6: std::option::Option; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _7: std::result::Result; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL + scope 4 { + scope 5 (inlined >::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL + debug self => _5; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL + scope 6 (inlined convert::num:: for i16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL + debug u => _5; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + let mut _8: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + let mut _9: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + let mut _10: i16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + } } - } - } - scope 9 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $SRC_DIR/core/src/num/int_macros.rs:LL:COL - debug self => _4; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _11: &std::option::Option; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _12: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - scope 10 { - debug val => _3; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL - } - scope 11 { - scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL - scope 14 { - scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 7 (inlined Result::::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL + debug self => _7; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + let mut _11: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + let _12: i16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + scope 8 { + debug x => _12; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL + } + } + scope 9 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL + debug self => _6; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _13: &std::option::Option; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _14: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + scope 10 { + debug val => _3; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL + } + scope 11 { + scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL + scope 14 { + scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + } + } } } + scope 12 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL + debug self => _13; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL + } } } - scope 12 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL - debug self => _11; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL - } } } } bb0: { - StorageLive(_3); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL - StorageLive(_4); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL - StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL - StorageLive(_6); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageLive(_7); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _7 = const 32767_u32; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _6 = Gt(_2, move _7); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageDead(_7); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - switchInt(move _6) -> [0: bb4, otherwise: bb3]; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageLive(_3); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_4); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _4 = (_2,); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _5 = move (_4.0: u32); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageLive(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _9 = const 32767_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _8 = Gt(_5, move _9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageDead(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + switchInt(move _8) -> [0: bb3, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL } bb1: { - StorageDead(_10); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL - StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL - StorageLive(_11); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL - _12 = discriminant(_4); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - switchInt(move _12) -> [1: bb9, otherwise: bb7]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - } - - bb2: { StorageDead(_3); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2 } - bb3: { - _5 = Result::::Err(const TryFromIntError(())); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL + bb2: { + _7 = Result::::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL // mir::Constant // + span: no-location // + literal: Const { ty: TryFromIntError, val: Value() } - goto -> bb5; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL + goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + } + + bb3: { + StorageLive(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _10 = _5 as i16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _7 = Result::::Ok(move _10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageDead(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL } bb4: { - StorageLive(_8); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _8 = _2 as i16 (IntToInt); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _5 = Result::::Ok(move _8); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageDead(_8); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - goto -> bb5; // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageDead(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + StorageLive(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _11 = discriminant(_7); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + switchInt(move _11) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL } bb5: { - StorageDead(_6); // scope 4 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageLive(_10); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL - _9 = discriminant(_5); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - switchInt(move _9) -> [0: bb8, 1: bb6, otherwise: bb7]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL + _6 = Option::::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL } bb6: { - _4 = Option::::None; // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - goto -> bb1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL } bb7: { - unreachable; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL + _12 = move ((_7 as Ok).0: i16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL + _6 = Option::::Some(move _12); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL + goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL } bb8: { - _10 = move ((_5 as Ok).0: i16); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - _4 = Option::::Some(move _10); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL - goto -> bb1; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL + StorageDead(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageDead(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _14 = discriminant(_6); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + switchInt(move _14) -> [1: bb9, otherwise: bb6]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL } bb9: { - _3 = move ((_4 as Some).0: i16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - StorageDead(_11); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL - StorageDead(_4); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL - _0 = unchecked_shr::(_1, move _3) -> [return: bb2, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL + _3 = move ((_6 as Some).0: i16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageDead(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageDead(_4); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _0 = unchecked_shr::(_1, move _3) -> [return: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/num/int_macros.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i16, i16) -> i16 {unchecked_shr::}, val: Value() } diff --git a/tests/mir-opt/inline/unsized_argument.caller.Inline.diff b/tests/mir-opt/inline/unsized_argument.caller.Inline.diff new file mode 100644 index 000000000..745f2bb19 --- /dev/null +++ b/tests/mir-opt/inline/unsized_argument.caller.Inline.diff @@ -0,0 +1,50 @@ +- // MIR for `caller` before Inline ++ // MIR for `caller` after Inline + + fn caller(_1: Box<[i32]>) -> () { + debug x => _1; // in scope 0 at $DIR/unsized_argument.rs:+0:11: +0:12 + let mut _0: (); // return place in scope 0 at $DIR/unsized_argument.rs:+0:26: +0:26 + let _2: (); // in scope 0 at $DIR/unsized_argument.rs:+1:5: +1:15 + let mut _3: std::boxed::Box<[i32]>; // in scope 0 at $DIR/unsized_argument.rs:+1:13: +1:14 + let mut _4: (); // in scope 0 at $DIR/unsized_argument.rs:+1:14: +1:15 + let mut _5: (); // in scope 0 at $DIR/unsized_argument.rs:+1:14: +1:15 + let mut _6: (); // in scope 0 at $DIR/unsized_argument.rs:+1:14: +1:15 + let mut _7: *const [i32]; // in scope 0 at $DIR/unsized_argument.rs:+1:13: +1:14 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/unsized_argument.rs:+1:5: +1:15 + StorageLive(_3); // scope 0 at $DIR/unsized_argument.rs:+1:13: +1:14 + _3 = move _1; // scope 0 at $DIR/unsized_argument.rs:+1:13: +1:14 + _7 = (((_3.0: std::ptr::Unique<[i32]>).0: std::ptr::NonNull<[i32]>).0: *const [i32]); // scope 0 at $DIR/unsized_argument.rs:+1:5: +1:15 + _2 = callee(move (*_7)) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/unsized_argument.rs:+1:5: +1:15 + // mir::Constant + // + span: $DIR/unsized_argument.rs:9:5: 9:11 + // + literal: Const { ty: fn([i32]) {callee}, val: Value() } + } + + bb1: { + StorageDead(_3); // scope 0 at $DIR/unsized_argument.rs:+1:14: +1:15 + StorageDead(_2); // scope 0 at $DIR/unsized_argument.rs:+1:15: +1:16 + _0 = const (); // scope 0 at $DIR/unsized_argument.rs:+0:26: +2:2 + return; // scope 0 at $DIR/unsized_argument.rs:+2:2: +2:2 + } + + bb2 (cleanup): { + resume; // scope 0 at $DIR/unsized_argument.rs:+0:1: +2:2 + } + + bb3: { + _4 = alloc::alloc::box_free::<[i32], std::alloc::Global>(move (_3.0: std::ptr::Unique<[i32]>), move (_3.1: std::alloc::Global)) -> bb1; // scope 0 at $DIR/unsized_argument.rs:+1:14: +1:15 + // mir::Constant + // + span: $DIR/unsized_argument.rs:9:14: 9:15 + // + literal: Const { ty: unsafe fn(Unique<[i32]>, std::alloc::Global) {alloc::alloc::box_free::<[i32], std::alloc::Global>}, val: Value() } + } + + bb4 (cleanup): { + _6 = alloc::alloc::box_free::<[i32], std::alloc::Global>(move (_3.0: std::ptr::Unique<[i32]>), move (_3.1: std::alloc::Global)) -> [return: bb2, unwind terminate]; // scope 0 at $DIR/unsized_argument.rs:+1:14: +1:15 + // mir::Constant + // + span: $DIR/unsized_argument.rs:9:14: 9:15 + // + literal: Const { ty: unsafe fn(Unique<[i32]>, std::alloc::Global) {alloc::alloc::box_free::<[i32], std::alloc::Global>}, val: Value() } + } + } + diff --git a/tests/mir-opt/inline/unsized_argument.rs b/tests/mir-opt/inline/unsized_argument.rs new file mode 100644 index 000000000..b2c51407f --- /dev/null +++ b/tests/mir-opt/inline/unsized_argument.rs @@ -0,0 +1,15 @@ +// needs-unwind +#![feature(unsized_fn_params)] + +#[inline(always)] +fn callee(y: [i32]) {} + +// EMIT_MIR unsized_argument.caller.Inline.diff +fn caller(x: Box<[i32]>) { + callee(*x); +} + +fn main() { + let b = Box::new([1]); + caller(b); +} diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff index 543ddcfc4..8a8cd896e 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff @@ -34,7 +34,7 @@ - // + literal: Const { ty: unsafe fn(Option) -> T {Option::::unwrap_unchecked}, val: Value() } + StorageLive(_3); // scope 0 at $DIR/unwrap_unchecked.rs:+1:9: +1:27 + _4 = discriminant(_2); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL -+ switchInt(move _4) -> [0: bb1, 1: bb2, otherwise: bb1]; // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL ++ switchInt(move _4) -> [1: bb2, otherwise: bb1]; // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL } bb1: { diff --git a/tests/mir-opt/instcombine_duplicate_switch_targets.assert_zero.InstCombine.diff b/tests/mir-opt/instcombine_duplicate_switch_targets.assert_zero.InstCombine.diff deleted file mode 100644 index e04079453..000000000 --- a/tests/mir-opt/instcombine_duplicate_switch_targets.assert_zero.InstCombine.diff +++ /dev/null @@ -1,21 +0,0 @@ -- // MIR for `assert_zero` before InstCombine -+ // MIR for `assert_zero` after InstCombine - - fn assert_zero(_1: u8) -> u8 { - let mut _0: u8; // return place in scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+0:37: +0:39 - - bb0: { -- switchInt(_1) -> [0: bb2, 1: bb1, otherwise: bb1]; // scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+3:13: +7:14 -+ switchInt(_1) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+3:13: +7:14 - } - - bb1: { - unreachable; // scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+10:13: +10:26 - } - - bb2: { - _0 = _1; // scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+13:13: +13:20 - return; // scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+14:13: +14:21 - } - } - diff --git a/tests/mir-opt/instcombine_duplicate_switch_targets.rs b/tests/mir-opt/instcombine_duplicate_switch_targets.rs deleted file mode 100644 index ef3b487af..000000000 --- a/tests/mir-opt/instcombine_duplicate_switch_targets.rs +++ /dev/null @@ -1,27 +0,0 @@ -#![feature(custom_mir, core_intrinsics)] -#![crate_type = "lib"] - -use std::intrinsics::mir::*; - -// unit-test: InstCombine - -// EMIT_MIR instcombine_duplicate_switch_targets.assert_zero.InstCombine.diff -#[custom_mir(dialect = "runtime", phase = "post-cleanup")] -pub unsafe fn assert_zero(x: u8) -> u8 { - mir!( - { - match x { - 0 => retblock, - 1 => unreachable, - _ => unreachable, - } - } - unreachable = { - Unreachable() - } - retblock = { - RET = x; - Return() - } - ) -} diff --git a/tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff b/tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff new file mode 100644 index 000000000..04ba8dd8e --- /dev/null +++ b/tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff @@ -0,0 +1,21 @@ +- // MIR for `assert_zero` before InstSimplify ++ // MIR for `assert_zero` after InstSimplify + + fn assert_zero(_1: u8) -> u8 { + let mut _0: u8; // return place in scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+0:37: +0:39 + + bb0: { +- switchInt(_1) -> [0: bb2, 1: bb1, otherwise: bb1]; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+3:13: +7:14 ++ switchInt(_1) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+3:13: +7:14 + } + + bb1: { + unreachable; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+10:13: +10:26 + } + + bb2: { + _0 = _1; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+13:13: +13:20 + return; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+14:13: +14:21 + } + } + diff --git a/tests/mir-opt/instsimplify_duplicate_switch_targets.rs b/tests/mir-opt/instsimplify_duplicate_switch_targets.rs new file mode 100644 index 000000000..3e280a40f --- /dev/null +++ b/tests/mir-opt/instsimplify_duplicate_switch_targets.rs @@ -0,0 +1,27 @@ +#![feature(custom_mir, core_intrinsics)] +#![crate_type = "lib"] + +use std::intrinsics::mir::*; + +// unit-test: InstSimplify + +// EMIT_MIR instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff +#[custom_mir(dialect = "runtime", phase = "post-cleanup")] +pub unsafe fn assert_zero(x: u8) -> u8 { + mir!( + { + match x { + 0 => retblock, + 1 => unreachable, + _ => unreachable, + } + } + unreachable = { + Unreachable() + } + retblock = { + RET = x; + Return() + } + ) +} diff --git a/tests/mir-opt/intrinsic_asserts.generic.InstCombine.diff b/tests/mir-opt/intrinsic_asserts.generic.InstCombine.diff deleted file mode 100644 index 09fc145e7..000000000 --- a/tests/mir-opt/intrinsic_asserts.generic.InstCombine.diff +++ /dev/null @@ -1,42 +0,0 @@ -- // MIR for `generic` before InstCombine -+ // MIR for `generic` after InstCombine - - fn generic() -> () { - let mut _0: (); // return place in scope 0 at $DIR/intrinsic_asserts.rs:+0:21: +0:21 - let _1: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:46 - let _2: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:47 - let _3: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:60 - - bb0: { - nop; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:46 - _1 = assert_inhabited::() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:46 - // mir::Constant - // + span: $DIR/intrinsic_asserts.rs:25:5: 25:44 - // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_inhabited::}, val: Value() } - } - - bb1: { - nop; // scope 0 at $DIR/intrinsic_asserts.rs:+1:46: +1:47 - nop; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:47 - _2 = assert_zero_valid::() -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:47 - // mir::Constant - // + span: $DIR/intrinsic_asserts.rs:26:5: 26:45 - // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_zero_valid::}, val: Value() } - } - - bb2: { - nop; // scope 0 at $DIR/intrinsic_asserts.rs:+2:47: +2:48 - nop; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:60 - _3 = assert_mem_uninitialized_valid::() -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:60 - // mir::Constant - // + span: $DIR/intrinsic_asserts.rs:27:5: 27:58 - // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_mem_uninitialized_valid::}, val: Value() } - } - - bb3: { - nop; // scope 0 at $DIR/intrinsic_asserts.rs:+3:60: +3:61 - nop; // scope 0 at $DIR/intrinsic_asserts.rs:+0:21: +4:2 - return; // scope 0 at $DIR/intrinsic_asserts.rs:+4:2: +4:2 - } - } - diff --git a/tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff b/tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff new file mode 100644 index 000000000..a59f4a43a --- /dev/null +++ b/tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff @@ -0,0 +1,42 @@ +- // MIR for `generic` before InstSimplify ++ // MIR for `generic` after InstSimplify + + fn generic() -> () { + let mut _0: (); // return place in scope 0 at $DIR/intrinsic_asserts.rs:+0:21: +0:21 + let _1: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:46 + let _2: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:47 + let _3: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:60 + + bb0: { + nop; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:46 + _1 = assert_inhabited::() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:46 + // mir::Constant + // + span: $DIR/intrinsic_asserts.rs:25:5: 25:44 + // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_inhabited::}, val: Value() } + } + + bb1: { + nop; // scope 0 at $DIR/intrinsic_asserts.rs:+1:46: +1:47 + nop; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:47 + _2 = assert_zero_valid::() -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:47 + // mir::Constant + // + span: $DIR/intrinsic_asserts.rs:26:5: 26:45 + // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_zero_valid::}, val: Value() } + } + + bb2: { + nop; // scope 0 at $DIR/intrinsic_asserts.rs:+2:47: +2:48 + nop; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:60 + _3 = assert_mem_uninitialized_valid::() -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:60 + // mir::Constant + // + span: $DIR/intrinsic_asserts.rs:27:5: 27:58 + // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_mem_uninitialized_valid::}, val: Value() } + } + + bb3: { + nop; // scope 0 at $DIR/intrinsic_asserts.rs:+3:60: +3:61 + nop; // scope 0 at $DIR/intrinsic_asserts.rs:+0:21: +4:2 + return; // scope 0 at $DIR/intrinsic_asserts.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/intrinsic_asserts.panics.InstCombine.diff b/tests/mir-opt/intrinsic_asserts.panics.InstCombine.diff deleted file mode 100644 index c52174ef5..000000000 --- a/tests/mir-opt/intrinsic_asserts.panics.InstCombine.diff +++ /dev/null @@ -1,47 +0,0 @@ -- // MIR for `panics` before InstCombine -+ // MIR for `panics` after InstCombine - - fn panics() -> () { - let mut _0: (); // return place in scope 0 at $DIR/intrinsic_asserts.rs:+0:17: +0:17 - let _1: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:50 - let _2: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:49 - let _3: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:62 - - bb0: { - nop; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:50 -- _1 = assert_inhabited::() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:50 -+ _1 = assert_inhabited::() -> unwind unreachable; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:50 - // mir::Constant - // + span: $DIR/intrinsic_asserts.rs:17:5: 17:48 - // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_inhabited::}, val: Value() } - } - - bb1: { - nop; // scope 0 at $DIR/intrinsic_asserts.rs:+1:50: +1:51 - nop; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:49 -- _2 = assert_zero_valid::<&u8>() -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:49 -+ _2 = assert_zero_valid::<&u8>() -> unwind unreachable; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:49 - // mir::Constant - // + span: $DIR/intrinsic_asserts.rs:18:5: 18:47 - // + user_ty: UserType(0) - // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_zero_valid::<&u8>}, val: Value() } - } - - bb2: { - nop; // scope 0 at $DIR/intrinsic_asserts.rs:+2:49: +2:50 - nop; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:62 -- _3 = assert_mem_uninitialized_valid::<&u8>() -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:62 -+ _3 = assert_mem_uninitialized_valid::<&u8>() -> unwind unreachable; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:62 - // mir::Constant - // + span: $DIR/intrinsic_asserts.rs:19:5: 19:60 - // + user_ty: UserType(1) - // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_mem_uninitialized_valid::<&u8>}, val: Value() } - } - - bb3: { - nop; // scope 0 at $DIR/intrinsic_asserts.rs:+3:62: +3:63 - nop; // scope 0 at $DIR/intrinsic_asserts.rs:+0:17: +4:2 - return; // scope 0 at $DIR/intrinsic_asserts.rs:+4:2: +4:2 - } - } - diff --git a/tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff b/tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff new file mode 100644 index 000000000..195e8bd4e --- /dev/null +++ b/tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff @@ -0,0 +1,47 @@ +- // MIR for `panics` before InstSimplify ++ // MIR for `panics` after InstSimplify + + fn panics() -> () { + let mut _0: (); // return place in scope 0 at $DIR/intrinsic_asserts.rs:+0:17: +0:17 + let _1: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:50 + let _2: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:49 + let _3: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:62 + + bb0: { + nop; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:50 +- _1 = assert_inhabited::() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:50 ++ _1 = assert_inhabited::() -> unwind unreachable; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:50 + // mir::Constant + // + span: $DIR/intrinsic_asserts.rs:17:5: 17:48 + // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_inhabited::}, val: Value() } + } + + bb1: { + nop; // scope 0 at $DIR/intrinsic_asserts.rs:+1:50: +1:51 + nop; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:49 +- _2 = assert_zero_valid::<&u8>() -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:49 ++ _2 = assert_zero_valid::<&u8>() -> unwind unreachable; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:49 + // mir::Constant + // + span: $DIR/intrinsic_asserts.rs:18:5: 18:47 + // + user_ty: UserType(0) + // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_zero_valid::<&u8>}, val: Value() } + } + + bb2: { + nop; // scope 0 at $DIR/intrinsic_asserts.rs:+2:49: +2:50 + nop; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:62 +- _3 = assert_mem_uninitialized_valid::<&u8>() -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:62 ++ _3 = assert_mem_uninitialized_valid::<&u8>() -> unwind unreachable; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:62 + // mir::Constant + // + span: $DIR/intrinsic_asserts.rs:19:5: 19:60 + // + user_ty: UserType(1) + // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_mem_uninitialized_valid::<&u8>}, val: Value() } + } + + bb3: { + nop; // scope 0 at $DIR/intrinsic_asserts.rs:+3:62: +3:63 + nop; // scope 0 at $DIR/intrinsic_asserts.rs:+0:17: +4:2 + return; // scope 0 at $DIR/intrinsic_asserts.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/intrinsic_asserts.removable.InstCombine.diff b/tests/mir-opt/intrinsic_asserts.removable.InstCombine.diff deleted file mode 100644 index d059d47ee..000000000 --- a/tests/mir-opt/intrinsic_asserts.removable.InstCombine.diff +++ /dev/null @@ -1,45 +0,0 @@ -- // MIR for `removable` before InstCombine -+ // MIR for `removable` after InstCombine - - fn removable() -> () { - let mut _0: (); // return place in scope 0 at $DIR/intrinsic_asserts.rs:+0:20: +0:20 - let _1: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:47 - let _2: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:48 - let _3: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:61 - - bb0: { - nop; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:47 -- _1 = assert_inhabited::<()>() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:47 -- // mir::Constant -- // + span: $DIR/intrinsic_asserts.rs:7:5: 7:45 -- // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_inhabited::<()>}, val: Value() } -+ goto -> bb1; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:47 - } - - bb1: { - nop; // scope 0 at $DIR/intrinsic_asserts.rs:+1:47: +1:48 - nop; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:48 -- _2 = assert_zero_valid::() -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:48 -- // mir::Constant -- // + span: $DIR/intrinsic_asserts.rs:8:5: 8:46 -- // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_zero_valid::}, val: Value() } -+ goto -> bb2; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:48 - } - - bb2: { - nop; // scope 0 at $DIR/intrinsic_asserts.rs:+2:48: +2:49 - nop; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:61 -- _3 = assert_mem_uninitialized_valid::() -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:61 -- // mir::Constant -- // + span: $DIR/intrinsic_asserts.rs:9:5: 9:59 -- // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_mem_uninitialized_valid::}, val: Value() } -+ goto -> bb3; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:61 - } - - bb3: { - nop; // scope 0 at $DIR/intrinsic_asserts.rs:+3:61: +3:62 - nop; // scope 0 at $DIR/intrinsic_asserts.rs:+0:20: +4:2 - return; // scope 0 at $DIR/intrinsic_asserts.rs:+4:2: +4:2 - } - } - diff --git a/tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff b/tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff new file mode 100644 index 000000000..a4a65074c --- /dev/null +++ b/tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff @@ -0,0 +1,45 @@ +- // MIR for `removable` before InstSimplify ++ // MIR for `removable` after InstSimplify + + fn removable() -> () { + let mut _0: (); // return place in scope 0 at $DIR/intrinsic_asserts.rs:+0:20: +0:20 + let _1: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:47 + let _2: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:48 + let _3: (); // in scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:61 + + bb0: { + nop; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:47 +- _1 = assert_inhabited::<()>() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:47 +- // mir::Constant +- // + span: $DIR/intrinsic_asserts.rs:7:5: 7:45 +- // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_inhabited::<()>}, val: Value() } ++ goto -> bb1; // scope 0 at $DIR/intrinsic_asserts.rs:+1:5: +1:47 + } + + bb1: { + nop; // scope 0 at $DIR/intrinsic_asserts.rs:+1:47: +1:48 + nop; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:48 +- _2 = assert_zero_valid::() -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:48 +- // mir::Constant +- // + span: $DIR/intrinsic_asserts.rs:8:5: 8:46 +- // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_zero_valid::}, val: Value() } ++ goto -> bb2; // scope 0 at $DIR/intrinsic_asserts.rs:+2:5: +2:48 + } + + bb2: { + nop; // scope 0 at $DIR/intrinsic_asserts.rs:+2:48: +2:49 + nop; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:61 +- _3 = assert_mem_uninitialized_valid::() -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:61 +- // mir::Constant +- // + span: $DIR/intrinsic_asserts.rs:9:5: 9:59 +- // + literal: Const { ty: extern "rust-intrinsic" fn() {assert_mem_uninitialized_valid::}, val: Value() } ++ goto -> bb3; // scope 0 at $DIR/intrinsic_asserts.rs:+3:5: +3:61 + } + + bb3: { + nop; // scope 0 at $DIR/intrinsic_asserts.rs:+3:61: +3:62 + nop; // scope 0 at $DIR/intrinsic_asserts.rs:+0:20: +4:2 + return; // scope 0 at $DIR/intrinsic_asserts.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/intrinsic_asserts.rs b/tests/mir-opt/intrinsic_asserts.rs index 8fb99cdf6..302d4bda1 100644 --- a/tests/mir-opt/intrinsic_asserts.rs +++ b/tests/mir-opt/intrinsic_asserts.rs @@ -2,7 +2,7 @@ #![feature(core_intrinsics)] // All these assertions pass, so all the intrinsic calls should be deleted. -// EMIT_MIR intrinsic_asserts.removable.InstCombine.diff +// EMIT_MIR intrinsic_asserts.removable.InstSimplify.diff pub fn removable() { core::intrinsics::assert_inhabited::<()>(); core::intrinsics::assert_zero_valid::(); @@ -12,7 +12,7 @@ pub fn removable() { enum Never {} // These assertions all diverge, so their target blocks should become None. -// EMIT_MIR intrinsic_asserts.panics.InstCombine.diff +// EMIT_MIR intrinsic_asserts.panics.InstSimplify.diff pub fn panics() { core::intrinsics::assert_inhabited::(); core::intrinsics::assert_zero_valid::<&u8>(); @@ -20,7 +20,7 @@ pub fn panics() { } // Whether or not these asserts pass isn't known, so they shouldn't be modified. -// EMIT_MIR intrinsic_asserts.generic.InstCombine.diff +// EMIT_MIR intrinsic_asserts.generic.InstSimplify.diff pub fn generic() { core::intrinsics::assert_inhabited::(); core::intrinsics::assert_zero_valid::(); diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.diff index d98f75e75..46b450a4e 100644 --- a/tests/mir-opt/issue_41888.main.ElaborateDrops.diff +++ b/tests/mir-opt/issue_41888.main.ElaborateDrops.diff @@ -22,9 +22,9 @@ } bb0: { -+ _9 = const false; // scope 0 at $DIR/issue_41888.rs:+1:9: +1:10 + _7 = const false; // scope 0 at $DIR/issue_41888.rs:+1:9: +1:10 + _8 = const false; // scope 0 at $DIR/issue_41888.rs:+1:9: +1:10 ++ _9 = const false; // scope 0 at $DIR/issue_41888.rs:+1:9: +1:10 StorageLive(_1); // scope 0 at $DIR/issue_41888.rs:+1:9: +1:10 StorageLive(_2); // scope 1 at $DIR/issue_41888.rs:+2:8: +2:14 _2 = cond() -> [return: bb1, unwind: bb11]; // scope 1 at $DIR/issue_41888.rs:+2:8: +2:14 diff --git a/tests/mir-opt/issue_72181_1.f.built.after.mir b/tests/mir-opt/issue_72181_1.f.built.after.mir index 4086da520..25f472251 100644 --- a/tests/mir-opt/issue_72181_1.f.built.after.mir +++ b/tests/mir-opt/issue_72181_1.f.built.after.mir @@ -3,27 +3,13 @@ fn f(_1: Void) -> ! { debug v => _1; // in scope 0 at $DIR/issue_72181_1.rs:+0:6: +0:7 let mut _0: !; // return place in scope 0 at $DIR/issue_72181_1.rs:+0:18: +0:19 - let mut _2: !; // in scope 0 at $DIR/issue_72181_1.rs:+0:20: +2:2 - let mut _3: !; // in scope 0 at $DIR/issue_72181_1.rs:+1:5: +1:15 bb0: { - StorageLive(_2); // scope 0 at $DIR/issue_72181_1.rs:+0:20: +2:2 - StorageLive(_3); // scope 0 at $DIR/issue_72181_1.rs:+1:5: +1:15 FakeRead(ForMatchedPlace(None), _1); // scope 0 at $DIR/issue_72181_1.rs:+1:11: +1:12 unreachable; // scope 0 at $DIR/issue_72181_1.rs:+1:11: +1:12 } bb1: { - unreachable; // scope 0 at $DIR/issue_72181_1.rs:+1:5: +1:15 - } - - bb2: { - StorageDead(_3); // scope 0 at $DIR/issue_72181_1.rs:+1:14: +1:15 - unreachable; // scope 0 at $DIR/issue_72181_1.rs:+0:20: +2:2 - } - - bb3: { - StorageDead(_2); // scope 0 at $DIR/issue_72181_1.rs:+2:1: +2:2 return; // scope 0 at $DIR/issue_72181_1.rs:+2:2: +2:2 } } diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff index abb89b91d..73b9ea46c 100644 --- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff +++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.diff @@ -21,9 +21,9 @@ let _13: &T; // in scope 1 at $DIR/issue_76432.rs:+3:18: +3:24 let _14: &T; // in scope 1 at $DIR/issue_76432.rs:+3:26: +3:32 scope 2 { - debug v1 => _12; // in scope 2 at $DIR/issue_76432.rs:+3:10: +3:16 - debug v2 => _13; // in scope 2 at $DIR/issue_76432.rs:+3:18: +3:24 - debug v3 => _14; // in scope 2 at $DIR/issue_76432.rs:+3:26: +3:32 + debug v1 => &(*_2)[0 of 3]; // in scope 2 at $DIR/issue_76432.rs:+3:10: +3:16 + debug v2 => &(*_2)[1 of 3]; // in scope 2 at $DIR/issue_76432.rs:+3:18: +3:24 + debug v3 => &(*_2)[2 of 3]; // in scope 2 at $DIR/issue_76432.rs:+3:26: +3:32 } } @@ -52,15 +52,6 @@ } bb2: { - StorageLive(_12); // scope 1 at $DIR/issue_76432.rs:+3:10: +3:16 - _12 = &(*_2)[0 of 3]; // scope 1 at $DIR/issue_76432.rs:+3:10: +3:16 - StorageLive(_13); // scope 1 at $DIR/issue_76432.rs:+3:18: +3:24 - _13 = &(*_2)[1 of 3]; // scope 1 at $DIR/issue_76432.rs:+3:18: +3:24 - StorageLive(_14); // scope 1 at $DIR/issue_76432.rs:+3:26: +3:32 - _14 = &(*_2)[2 of 3]; // scope 1 at $DIR/issue_76432.rs:+3:26: +3:32 - StorageDead(_14); // scope 1 at $DIR/issue_76432.rs:+3:84: +3:85 - StorageDead(_13); // scope 1 at $DIR/issue_76432.rs:+3:84: +3:85 - StorageDead(_12); // scope 1 at $DIR/issue_76432.rs:+3:84: +3:85 StorageDead(_5); // scope 0 at $DIR/issue_76432.rs:+6:1: +6:2 StorageDead(_2); // scope 0 at $DIR/issue_76432.rs:+6:1: +6:2 return; // scope 0 at $DIR/issue_76432.rs:+6:2: +6:2 diff --git a/tests/mir-opt/issue_78192.f.InstCombine.diff b/tests/mir-opt/issue_78192.f.InstCombine.diff deleted file mode 100644 index 116ca304c..000000000 --- a/tests/mir-opt/issue_78192.f.InstCombine.diff +++ /dev/null @@ -1,29 +0,0 @@ -- // MIR for `f` before InstCombine -+ // MIR for `f` after InstCombine - - fn f(_1: &T) -> *const T { - debug a => _1; // in scope 0 at $DIR/issue_78192.rs:+0:13: +0:14 - let mut _0: *const T; // return place in scope 0 at $DIR/issue_78192.rs:+0:23: +0:31 - let _2: &*const T; // in scope 0 at $DIR/issue_78192.rs:+1:9: +1:10 - let _3: &*const T; // in scope 0 at $DIR/issue_78192.rs:+1:24: +1:40 - let _4: *const T; // in scope 0 at $DIR/issue_78192.rs:+1:25: +1:40 - scope 1 { - debug b => _2; // in scope 1 at $DIR/issue_78192.rs:+1:9: +1:10 - } - - bb0: { - StorageLive(_2); // scope 0 at $DIR/issue_78192.rs:+1:9: +1:10 - StorageLive(_3); // scope 0 at $DIR/issue_78192.rs:+1:24: +1:40 - StorageLive(_4); // scope 0 at $DIR/issue_78192.rs:+1:25: +1:40 - _4 = &raw const (*_1); // scope 0 at $DIR/issue_78192.rs:+1:26: +1:27 - _3 = &_4; // scope 0 at $DIR/issue_78192.rs:+1:24: +1:40 -- _2 = &(*_3); // scope 0 at $DIR/issue_78192.rs:+1:24: +1:40 -+ _2 = _3; // scope 0 at $DIR/issue_78192.rs:+1:24: +1:40 - StorageDead(_3); // scope 0 at $DIR/issue_78192.rs:+1:40: +1:41 - _0 = (*_2); // scope 1 at $DIR/issue_78192.rs:+2:5: +2:7 - StorageDead(_4); // scope 0 at $DIR/issue_78192.rs:+3:1: +3:2 - StorageDead(_2); // scope 0 at $DIR/issue_78192.rs:+3:1: +3:2 - return; // scope 0 at $DIR/issue_78192.rs:+3:2: +3:2 - } - } - diff --git a/tests/mir-opt/issue_78192.f.InstSimplify.diff b/tests/mir-opt/issue_78192.f.InstSimplify.diff new file mode 100644 index 000000000..914d7ceb2 --- /dev/null +++ b/tests/mir-opt/issue_78192.f.InstSimplify.diff @@ -0,0 +1,29 @@ +- // MIR for `f` before InstSimplify ++ // MIR for `f` after InstSimplify + + fn f(_1: &T) -> *const T { + debug a => _1; // in scope 0 at $DIR/issue_78192.rs:+0:13: +0:14 + let mut _0: *const T; // return place in scope 0 at $DIR/issue_78192.rs:+0:23: +0:31 + let _2: &*const T; // in scope 0 at $DIR/issue_78192.rs:+1:9: +1:10 + let _3: &*const T; // in scope 0 at $DIR/issue_78192.rs:+1:24: +1:40 + let _4: *const T; // in scope 0 at $DIR/issue_78192.rs:+1:25: +1:40 + scope 1 { + debug b => _2; // in scope 1 at $DIR/issue_78192.rs:+1:9: +1:10 + } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/issue_78192.rs:+1:9: +1:10 + StorageLive(_3); // scope 0 at $DIR/issue_78192.rs:+1:24: +1:40 + StorageLive(_4); // scope 0 at $DIR/issue_78192.rs:+1:25: +1:40 + _4 = &raw const (*_1); // scope 0 at $DIR/issue_78192.rs:+1:26: +1:27 + _3 = &_4; // scope 0 at $DIR/issue_78192.rs:+1:24: +1:40 +- _2 = &(*_3); // scope 0 at $DIR/issue_78192.rs:+1:24: +1:40 ++ _2 = _3; // scope 0 at $DIR/issue_78192.rs:+1:24: +1:40 + StorageDead(_3); // scope 0 at $DIR/issue_78192.rs:+1:40: +1:41 + _0 = (*_2); // scope 1 at $DIR/issue_78192.rs:+2:5: +2:7 + StorageDead(_4); // scope 0 at $DIR/issue_78192.rs:+3:1: +3:2 + StorageDead(_2); // scope 0 at $DIR/issue_78192.rs:+3:1: +3:2 + return; // scope 0 at $DIR/issue_78192.rs:+3:2: +3:2 + } + } + diff --git a/tests/mir-opt/issue_78192.rs b/tests/mir-opt/issue_78192.rs index 39f665402..95142a3e4 100644 --- a/tests/mir-opt/issue_78192.rs +++ b/tests/mir-opt/issue_78192.rs @@ -8,4 +8,4 @@ fn main() { f(&2); } -// EMIT_MIR issue_78192.f.InstCombine.diff +// EMIT_MIR issue_78192.f.InstSimplify.diff diff --git a/tests/mir-opt/issue_99325.main.built.after.mir b/tests/mir-opt/issue_99325.main.built.after.mir index 2324f5356..0424ce3ab 100644 --- a/tests/mir-opt/issue_99325.main.built.after.mir +++ b/tests/mir-opt/issue_99325.main.built.after.mir @@ -1,8 +1,8 @@ // MIR for `main` after built | User Type Annotations -| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserSubsts { substs: [Const { ty: &'static [u8; 4], kind: Value(Branch([Leaf(0x41), Leaf(0x41), Leaf(0x41), Leaf(0x41)])) }], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:10:16: 10:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} -| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserSubsts { substs: [Const { ty: &'static [u8; 4], kind: Unevaluated(UnevaluatedConst { def: WithOptConstParam { did: DefId(0:8 ~ issue_99325[22bb]::main::{constant#1}), const_param_did: Some(DefId(0:4 ~ issue_99325[22bb]::function_with_bytes::BYTES)) }, substs: [] }) }], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:11:16: 11:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} +| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserSubsts { substs: [Const { ty: &'static [u8; 4], kind: Branch([Leaf(0x41), Leaf(0x41), Leaf(0x41), Leaf(0x41)]) }], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:10:16: 10:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} +| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserSubsts { substs: [Const { ty: &'static [u8; 4], kind: Unevaluated([], DefId(0:8 ~ issue_99325[22bb]::main::{constant#1})) }], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:11:16: 11:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} | fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/issue_99325.rs:+0:15: +0:15 diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir index 42b605326..9f955b471 100644 --- a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir +++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir @@ -4,31 +4,29 @@ fn num_to_digit(_1: char) -> u32 { debug num => _1; // in scope 0 at $DIR/issue_59352.rs:+0:21: +0:24 let mut _0: u32; // return place in scope 0 at $DIR/issue_59352.rs:+0:35: +0:38 let mut _2: std::option::Option; // in scope 0 at $DIR/issue_59352.rs:+2:26: +2:41 - let mut _3: u32; // in scope 0 at $DIR/issue_59352.rs:+2:12: +2:23 scope 1 (inlined char::methods::::is_digit) { // at $DIR/issue_59352.rs:15:12: 15:23 debug self => _1; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - debug radix => _3; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - let mut _4: &std::option::Option; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - let _5: std::option::Option; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + debug radix => const 8_u32; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + let mut _3: &std::option::Option; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + let _4: std::option::Option; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL scope 2 (inlined Option::::is_some) { // at $SRC_DIR/core/src/char/methods.rs:LL:COL - debug self => _4; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _6: isize; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL + debug self => _3; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _5: isize; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL } } scope 3 (inlined #[track_caller] Option::::unwrap) { // at $DIR/issue_59352.rs:15:42: 15:50 debug self => _2; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _7: isize; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _8: !; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _6: isize; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _7: !; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL scope 4 { debug val => _0; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL } } bb0: { - StorageLive(_3); // scope 0 at $DIR/issue_59352.rs:+2:12: +2:23 + StorageLive(_3); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL StorageLive(_4); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - StorageLive(_5); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - _5 = char::methods::::to_digit(_1, const 8_u32) -> bb5; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + _4 = char::methods::::to_digit(_1, const 8_u32) -> bb5; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/char/methods.rs:LL:COL // + literal: Const { ty: fn(char, u32) -> Option {char::methods::::to_digit}, val: Value() } @@ -43,8 +41,8 @@ fn num_to_digit(_1: char) -> u32 { } bb2: { - _7 = discriminant(_2); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL - switchInt(move _7) -> [0: bb6, 1: bb8, otherwise: bb7]; // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + _6 = discriminant(_2); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + switchInt(move _6) -> [0: bb6, 1: bb8, otherwise: bb7]; // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL } bb3: { @@ -57,16 +55,15 @@ fn num_to_digit(_1: char) -> u32 { } bb5: { - _4 = &_5; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - _6 = discriminant((*_4)); // scope 2 at $SRC_DIR/core/src/option.rs:LL:COL + _3 = &_4; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL + _5 = discriminant((*_3)); // scope 2 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_3); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL StorageDead(_4); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - StorageDead(_5); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL - StorageDead(_3); // scope 0 at $DIR/issue_59352.rs:+2:12: +2:23 - switchInt(move _6) -> [1: bb1, otherwise: bb3]; // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23 + switchInt(move _5) -> [1: bb1, otherwise: bb3]; // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23 } bb6: { - _8 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value"); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + _7 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value"); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/option.rs:LL:COL // + literal: Const { ty: fn(&'static str) -> ! {core::panicking::panic}, val: Value() } diff --git a/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff index cc5079af7..b022e2ba4 100644 --- a/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff +++ b/tests/mir-opt/lower_intrinsics.option_payload.LowerIntrinsics.diff @@ -24,7 +24,7 @@ _4 = &raw const (*_1); // scope 1 at $DIR/lower_intrinsics.rs:+2:55: +2:56 - _3 = option_payload_ptr::(move _4) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:18: +2:57 - // mir::Constant -- // + span: $DIR/lower_intrinsics.rs:133:18: 133:54 +- // + span: $DIR/lower_intrinsics.rs:137:18: 137:54 - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const Option) -> *const usize {option_payload_ptr::}, val: Value() } + _3 = &raw const (((*_4) as Some).0: usize); // scope 1 at $DIR/lower_intrinsics.rs:+2:18: +2:57 + goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+2:18: +2:57 @@ -37,7 +37,7 @@ _6 = &raw const (*_2); // scope 2 at $DIR/lower_intrinsics.rs:+3:55: +3:56 - _5 = option_payload_ptr::(move _6) -> [return: bb2, unwind unreachable]; // scope 2 at $DIR/lower_intrinsics.rs:+3:18: +3:57 - // mir::Constant -- // + span: $DIR/lower_intrinsics.rs:134:18: 134:54 +- // + span: $DIR/lower_intrinsics.rs:138:18: 138:54 - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const Option) -> *const String {option_payload_ptr::}, val: Value() } + _5 = &raw const (((*_6) as Some).0: std::string::String); // scope 2 at $DIR/lower_intrinsics.rs:+3:18: +3:57 + goto -> bb2; // scope 2 at $DIR/lower_intrinsics.rs:+3:18: +3:57 diff --git a/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.diff new file mode 100644 index 000000000..60a1dd0ba --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.diff @@ -0,0 +1,30 @@ +- // MIR for `ptr_offset` before LowerIntrinsics ++ // MIR for `ptr_offset` after LowerIntrinsics + + fn ptr_offset(_1: *const i32, _2: isize) -> *const i32 { + debug p => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:26: +0:27 + debug d => _2; // in scope 0 at $DIR/lower_intrinsics.rs:+0:41: +0:42 + let mut _0: *const i32; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:54: +0:64 + let mut _3: *const i32; // in scope 0 at $DIR/lower_intrinsics.rs:+1:30: +1:31 + let mut _4: isize; // in scope 0 at $DIR/lower_intrinsics.rs:+1:33: +1:34 + + bb0: { + StorageLive(_3); // scope 0 at $DIR/lower_intrinsics.rs:+1:30: +1:31 + _3 = _1; // scope 0 at $DIR/lower_intrinsics.rs:+1:30: +1:31 + StorageLive(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:33: +1:34 + _4 = _2; // scope 0 at $DIR/lower_intrinsics.rs:+1:33: +1:34 +- _0 = offset::<*const i32, isize>(move _3, move _4) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:35 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:144:5: 144:29 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*const i32, isize) -> *const i32 {offset::<*const i32, isize>}, val: Value() } ++ _0 = Offset(move _3, move _4); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:35 ++ goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:35 + } + + bb1: { + StorageDead(_4); // scope 0 at $DIR/lower_intrinsics.rs:+1:34: +1:35 + StorageDead(_3); // scope 0 at $DIR/lower_intrinsics.rs:+1:34: +1:35 + return; // scope 0 at $DIR/lower_intrinsics.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/lower_intrinsics.rs b/tests/mir-opt/lower_intrinsics.rs index 33fef930a..0ca88a42e 100644 --- a/tests/mir-opt/lower_intrinsics.rs +++ b/tests/mir-opt/lower_intrinsics.rs @@ -124,13 +124,22 @@ pub fn read_via_copy_uninhabited(r: &Never) -> Never { unsafe { core::intrinsics::read_via_copy(r) } } +// EMIT_MIR lower_intrinsics.write_via_move_string.LowerIntrinsics.diff +pub fn write_via_move_string(r: &mut String, v: String) { + unsafe { core::intrinsics::write_via_move(r, v) } +} + pub enum Never {} // EMIT_MIR lower_intrinsics.option_payload.LowerIntrinsics.diff -#[cfg(not(bootstrap))] pub fn option_payload(o: &Option, p: &Option) { unsafe { let _x = core::intrinsics::option_payload_ptr(o); let _y = core::intrinsics::option_payload_ptr(p); } } + +// EMIT_MIR lower_intrinsics.ptr_offset.LowerIntrinsics.diff +pub unsafe fn ptr_offset(p: *const i32, d: isize) -> *const i32 { + core::intrinsics::offset(p, d) +} diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff index 8735a7500..aa5d9619d 100644 --- a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff +++ b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.diff @@ -3,26 +3,22 @@ fn transmute_to_box_uninhabited() -> ! { let mut _0: !; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:49: +0:50 - let mut _1: !; // in scope 0 at $DIR/lower_intrinsics.rs:+0:51: +3:2 - let _2: std::boxed::Box; // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10 - let mut _3: !; // in scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:16 + let _1: std::boxed::Box; // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10 scope 1 { - debug x => _2; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:10 + debug x => _1; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:10 } bb0: { - StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+0:51: +3:2 - StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10 -- _2 = transmute::>(const 1_usize) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52 + StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10 +- _1 = transmute::>(const 1_usize) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52 - // mir::Constant - // + span: $DIR/lower_intrinsics.rs:70:25: 70:44 - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(usize) -> Box {transmute::>}, val: Value() } -+ _2 = const 1_usize as std::boxed::Box (Transmute); // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52 ++ _1 = const 1_usize as std::boxed::Box (Transmute); // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52 + goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52 } bb1: { - StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:+2:5: +2:16 unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+2:11: +2:13 } } diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff index a77213277..5fafd45fe 100644 --- a/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff +++ b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.diff @@ -3,26 +3,22 @@ fn transmute_to_mut_uninhabited() -> ! { let mut _0: !; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:49: +0:50 - let mut _1: !; // in scope 0 at $DIR/lower_intrinsics.rs:+0:51: +3:2 - let _2: &mut Never; // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10 - let mut _3: !; // in scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:16 + let _1: &mut Never; // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10 scope 1 { - debug x => _2; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:10 + debug x => _1; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:10 } bb0: { - StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+0:51: +3:2 - StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10 -- _2 = transmute::(const 1_usize) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52 + StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10 +- _1 = transmute::(const 1_usize) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52 - // mir::Constant - // + span: $DIR/lower_intrinsics.rs:64:25: 64:44 - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(usize) -> &mut Never {transmute::}, val: Value() } -+ _2 = const 1_usize as &mut Never (Transmute); // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52 ++ _1 = const 1_usize as &mut Never (Transmute); // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52 + goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:25: +1:52 } bb1: { - StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:+2:5: +2:16 unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+2:11: +2:13 } } diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff index c4d53d4e8..08dead132 100644 --- a/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff +++ b/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.diff @@ -3,26 +3,22 @@ fn transmute_to_ref_uninhabited() -> ! { let mut _0: !; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:49: +0:50 - let mut _1: !; // in scope 0 at $DIR/lower_intrinsics.rs:+0:51: +3:2 - let _2: &Never; // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10 - let mut _3: !; // in scope 0 at $DIR/lower_intrinsics.rs:+2:5: +2:16 + let _1: &Never; // in scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10 scope 1 { - debug x => _2; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:10 + debug x => _1; // in scope 1 at $DIR/lower_intrinsics.rs:+1:9: +1:10 } bb0: { - StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+0:51: +3:2 - StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10 -- _2 = transmute::(const 1_usize) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:21: +1:48 + StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+1:9: +1:10 +- _1 = transmute::(const 1_usize) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:21: +1:48 - // mir::Constant - // + span: $DIR/lower_intrinsics.rs:58:21: 58:40 - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(usize) -> &Never {transmute::}, val: Value() } -+ _2 = const 1_usize as &Never (Transmute); // scope 0 at $DIR/lower_intrinsics.rs:+1:21: +1:48 ++ _1 = const 1_usize as &Never (Transmute); // scope 0 at $DIR/lower_intrinsics.rs:+1:21: +1:48 + goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:21: +1:48 } bb1: { - StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:+2:5: +2:16 unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+2:11: +2:13 } } diff --git a/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.diff index c0cc698c4..28e45909c 100644 --- a/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.diff +++ b/tests/mir-opt/lower_intrinsics.unreachable.LowerIntrinsics.diff @@ -3,16 +3,15 @@ fn unreachable() -> ! { let mut _0: !; // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:25: +0:26 - let mut _1: !; // in scope 0 at $DIR/lower_intrinsics.rs:+0:27: +2:2 - let _2: (); // in scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:45 - let mut _3: !; // in scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:45 + let _1: (); // in scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:45 + let mut _2: !; // in scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:45 scope 1 { } bb0: { - StorageLive(_2); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:47 - StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:45 -- _3 = std::intrinsics::unreachable() -> unwind unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:45 + StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:+1:5: +1:47 + StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:45 +- _2 = std::intrinsics::unreachable() -> unwind unreachable; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:45 - // mir::Constant - // + span: $DIR/lower_intrinsics.rs:31:14: 31:43 - // + literal: Const { ty: unsafe extern "rust-intrinsic" fn() -> ! {std::intrinsics::unreachable}, val: Value() } diff --git a/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.diff index 0bfb34aca..217f27efe 100644 --- a/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.diff +++ b/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.diff @@ -30,10 +30,10 @@ _4 = _1; // scope 0 at $DIR/lower_intrinsics.rs:+1:45: +1:46 StorageLive(_5); // scope 0 at $DIR/lower_intrinsics.rs:+1:48: +1:49 _5 = _2; // scope 0 at $DIR/lower_intrinsics.rs:+1:48: +1:49 -- _3 = wrapping_add::(move _4, move _5) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:50 +- _3 = std::intrinsics::wrapping_add::(move _4, move _5) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:50 - // mir::Constant - // + span: $DIR/lower_intrinsics.rs:9:14: 9:44 -- // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> i32 {wrapping_add::}, val: Value() } +- // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> i32 {std::intrinsics::wrapping_add::}, val: Value() } + _3 = Add(move _4, move _5); // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:50 + goto -> bb1; // scope 0 at $DIR/lower_intrinsics.rs:+1:14: +1:50 } @@ -46,10 +46,10 @@ _7 = _1; // scope 1 at $DIR/lower_intrinsics.rs:+2:45: +2:46 StorageLive(_8); // scope 1 at $DIR/lower_intrinsics.rs:+2:48: +2:49 _8 = _2; // scope 1 at $DIR/lower_intrinsics.rs:+2:48: +2:49 -- _6 = wrapping_sub::(move _7, move _8) -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:50 +- _6 = std::intrinsics::wrapping_sub::(move _7, move _8) -> [return: bb2, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:50 - // mir::Constant - // + span: $DIR/lower_intrinsics.rs:10:14: 10:44 -- // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> i32 {wrapping_sub::}, val: Value() } +- // + literal: Const { ty: extern "rust-intrinsic" fn(i32, i32) -> i32 {std::intrinsics::wrapping_sub::}, val: Value() } + _6 = Sub(move _7, move _8); // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:50 + goto -> bb2; // scope 1 at $DIR/lower_intrinsics.rs:+2:14: +2:50 } diff --git a/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.diff b/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.diff new file mode 100644 index 000000000..38d99f661 --- /dev/null +++ b/tests/mir-opt/lower_intrinsics.write_via_move_string.LowerIntrinsics.diff @@ -0,0 +1,36 @@ +- // MIR for `write_via_move_string` before LowerIntrinsics ++ // MIR for `write_via_move_string` after LowerIntrinsics + + fn write_via_move_string(_1: &mut String, _2: String) -> () { + debug r => _1; // in scope 0 at $DIR/lower_intrinsics.rs:+0:30: +0:31 + debug v => _2; // in scope 0 at $DIR/lower_intrinsics.rs:+0:46: +0:47 + let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:+0:57: +0:57 + let mut _3: *mut std::string::String; // in scope 0 at $DIR/lower_intrinsics.rs:+1:47: +1:48 + let mut _4: std::string::String; // in scope 0 at $DIR/lower_intrinsics.rs:+1:50: +1:51 + scope 1 { + } + + bb0: { + StorageLive(_3); // scope 1 at $DIR/lower_intrinsics.rs:+1:47: +1:48 + _3 = &raw mut (*_1); // scope 1 at $DIR/lower_intrinsics.rs:+1:47: +1:48 + StorageLive(_4); // scope 1 at $DIR/lower_intrinsics.rs:+1:50: +1:51 + _4 = move _2; // scope 1 at $DIR/lower_intrinsics.rs:+1:50: +1:51 +- _0 = write_via_move::(move _3, move _4) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:52 +- // mir::Constant +- // + span: $DIR/lower_intrinsics.rs:129:14: 129:46 +- // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(*mut String, String) {write_via_move::}, val: Value() } ++ (*_3) = move _4; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:52 ++ goto -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:+1:14: +1:52 + } + + bb1: { + StorageDead(_4); // scope 1 at $DIR/lower_intrinsics.rs:+1:51: +1:52 + StorageDead(_3); // scope 1 at $DIR/lower_intrinsics.rs:+1:51: +1:52 + goto -> bb2; // scope 0 at $DIR/lower_intrinsics.rs:+2:1: +2:2 + } + + bb2: { + return; // scope 0 at $DIR/lower_intrinsics.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/lower_intrinsics_e2e.f_u64.PreCodegen.after.mir b/tests/mir-opt/lower_intrinsics_e2e.f_u64.PreCodegen.after.mir deleted file mode 100644 index 4f5df1331..000000000 --- a/tests/mir-opt/lower_intrinsics_e2e.f_u64.PreCodegen.after.mir +++ /dev/null @@ -1,25 +0,0 @@ -// MIR for `f_u64` after PreCodegen - -fn f_u64() -> () { - let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics_e2e.rs:+0:16: +0:16 - let mut _1: u64; // in scope 0 at $DIR/lower_intrinsics_e2e.rs:+1:5: +1:21 - scope 1 (inlined f_dispatch::) { // at $DIR/lower_intrinsics_e2e.rs:15:5: 15:21 - debug t => _1; // in scope 1 at $DIR/lower_intrinsics_e2e.rs:19:22: 19:23 - let _2: (); // in scope 1 at $DIR/lower_intrinsics_e2e.rs:23:9: 23:21 - scope 2 (inlined std::mem::size_of::) { // at $DIR/lower_intrinsics_e2e.rs:20:8: 20:32 - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/lower_intrinsics_e2e.rs:+1:5: +1:21 - _2 = f_non_zst::(const 0_u64) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics_e2e.rs:23:9: 23:21 - // mir::Constant - // + span: $DIR/lower_intrinsics_e2e.rs:23:9: 23:18 - // + literal: Const { ty: fn(u64) {f_non_zst::}, val: Value() } - } - - bb1: { - StorageDead(_1); // scope 0 at $DIR/lower_intrinsics_e2e.rs:+1:5: +1:21 - return; // scope 0 at $DIR/lower_intrinsics_e2e.rs:+2:2: +2:2 - } -} diff --git a/tests/mir-opt/lower_intrinsics_e2e.f_unit.PreCodegen.after.mir b/tests/mir-opt/lower_intrinsics_e2e.f_unit.PreCodegen.after.mir deleted file mode 100644 index 8654e80cd..000000000 --- a/tests/mir-opt/lower_intrinsics_e2e.f_unit.PreCodegen.after.mir +++ /dev/null @@ -1,22 +0,0 @@ -// MIR for `f_unit` after PreCodegen - -fn f_unit() -> () { - let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics_e2e.rs:+0:17: +0:17 - scope 1 (inlined f_dispatch::<()>) { // at $DIR/lower_intrinsics_e2e.rs:9:5: 9:19 - debug t => const (); // in scope 1 at $DIR/lower_intrinsics_e2e.rs:19:22: 19:23 - let _1: (); // in scope 1 at $DIR/lower_intrinsics_e2e.rs:21:9: 21:17 - scope 2 (inlined std::mem::size_of::<()>) { // at $DIR/lower_intrinsics_e2e.rs:20:8: 20:32 - } - } - - bb0: { - _1 = f_zst::<()>(const ()) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/lower_intrinsics_e2e.rs:21:9: 21:17 - // mir::Constant - // + span: $DIR/lower_intrinsics_e2e.rs:21:9: 21:14 - // + literal: Const { ty: fn(()) {f_zst::<()>}, val: Value() } - } - - bb1: { - return; // scope 0 at $DIR/lower_intrinsics_e2e.rs:+2:2: +2:2 - } -} diff --git a/tests/mir-opt/lower_intrinsics_e2e.rs b/tests/mir-opt/lower_intrinsics_e2e.rs deleted file mode 100644 index 872ef59b0..000000000 --- a/tests/mir-opt/lower_intrinsics_e2e.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Checks that we do not have any branches in the MIR for the two tested functions. - -// compile-flags: -Cpanic=abort -#![feature(core_intrinsics)] -#![crate_type = "lib"] - -// EMIT_MIR lower_intrinsics_e2e.f_unit.PreCodegen.after.mir -pub fn f_unit() { - f_dispatch(()); -} - - -// EMIT_MIR lower_intrinsics_e2e.f_u64.PreCodegen.after.mir -pub fn f_u64() { - f_dispatch(0u64); -} - -#[inline(always)] -pub fn f_dispatch(t: T) { - if std::mem::size_of::() == 0 { - f_zst(t); - } else { - f_non_zst(t); - } -} - -#[inline(never)] -pub fn f_zst(_t: T) { -} - -#[inline(never)] -pub fn f_non_zst(_t: T) {} diff --git a/tests/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir b/tests/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir index 6cd6d8b77..be5baf6ee 100644 --- a/tests/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir +++ b/tests/mir-opt/nll/named_lifetimes_basic.use_x.nll.0.mir @@ -1,39 +1,39 @@ // MIR for `use_x` 0 nll | Free Region Mapping -| '_#0r | Global | ['_#2r, '_#1r, '_#0r, '_#4r, '_#3r] -| '_#1r | Local | ['_#1r, '_#4r] -| '_#2r | Local | ['_#2r, '_#1r, '_#4r] -| '_#3r | Local | ['_#4r, '_#3r] -| '_#4r | Local | ['_#4r] +| '?0 | Global | ['?2, '?1, '?0, '?4, '?3] +| '?1 | Local | ['?1, '?4] +| '?2 | Local | ['?2, '?1, '?4] +| '?3 | Local | ['?4, '?3] +| '?4 | Local | ['?4] | | Inferred Region Values -| '_#0r | U0 | {bb0[0..=1], '_#0r, '_#1r, '_#2r, '_#3r, '_#4r} -| '_#1r | U0 | {bb0[0..=1], '_#1r} -| '_#2r | U0 | {bb0[0..=1], '_#2r} -| '_#3r | U0 | {bb0[0..=1], '_#3r} -| '_#4r | U0 | {bb0[0..=1], '_#4r} -| '_#5r | U0 | {bb0[0..=1], '_#1r} -| '_#6r | U0 | {bb0[0..=1], '_#2r} -| '_#7r | U0 | {bb0[0..=1], '_#1r} -| '_#8r | U0 | {bb0[0..=1], '_#3r} +| '?0 | U0 | {bb0[0..=1], '?0, '?1, '?2, '?3, '?4} +| '?1 | U0 | {bb0[0..=1], '?1} +| '?2 | U0 | {bb0[0..=1], '?2} +| '?3 | U0 | {bb0[0..=1], '?3} +| '?4 | U0 | {bb0[0..=1], '?4} +| '?5 | U0 | {bb0[0..=1], '?1} +| '?6 | U0 | {bb0[0..=1], '?2} +| '?7 | U0 | {bb0[0..=1], '?1} +| '?8 | U0 | {bb0[0..=1], '?3} | | Inference Constraints -| '_#0r live at {bb0[0..=1]} -| '_#1r live at {bb0[0..=1]} -| '_#2r live at {bb0[0..=1]} -| '_#3r live at {bb0[0..=1]} -| '_#4r live at {bb0[0..=1]} -| '_#1r: '_#5r due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:26: 12:27) ($DIR/named_lifetimes_basic.rs:12:26: 12:27 (#0) -| '_#1r: '_#7r due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:54: 12:55) ($DIR/named_lifetimes_basic.rs:12:54: 12:55 (#0) -| '_#2r: '_#6r due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:42: 12:43) ($DIR/named_lifetimes_basic.rs:12:42: 12:43 (#0) -| '_#3r: '_#8r due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:66: 12:67) ($DIR/named_lifetimes_basic.rs:12:66: 12:67 (#0) -| '_#5r: '_#1r due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:26: 12:27) ($DIR/named_lifetimes_basic.rs:12:26: 12:27 (#0) -| '_#6r: '_#2r due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:42: 12:43) ($DIR/named_lifetimes_basic.rs:12:42: 12:43 (#0) -| '_#7r: '_#1r due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:54: 12:55) ($DIR/named_lifetimes_basic.rs:12:54: 12:55 (#0) -| '_#8r: '_#3r due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:66: 12:67) ($DIR/named_lifetimes_basic.rs:12:66: 12:67 (#0) +| '?0 live at {bb0[0..=1]} +| '?1 live at {bb0[0..=1]} +| '?2 live at {bb0[0..=1]} +| '?3 live at {bb0[0..=1]} +| '?4 live at {bb0[0..=1]} +| '?1: '?5 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:26: 12:27) ($DIR/named_lifetimes_basic.rs:12:26: 12:27 (#0) +| '?1: '?7 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:54: 12:55) ($DIR/named_lifetimes_basic.rs:12:54: 12:55 (#0) +| '?2: '?6 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:42: 12:43) ($DIR/named_lifetimes_basic.rs:12:42: 12:43 (#0) +| '?3: '?8 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:66: 12:67) ($DIR/named_lifetimes_basic.rs:12:66: 12:67 (#0) +| '?5: '?1 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:26: 12:27) ($DIR/named_lifetimes_basic.rs:12:26: 12:27 (#0) +| '?6: '?2 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:42: 12:43) ($DIR/named_lifetimes_basic.rs:12:42: 12:43 (#0) +| '?7: '?1 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:54: 12:55) ($DIR/named_lifetimes_basic.rs:12:54: 12:55 (#0) +| '?8: '?3 due to BoringNoLocation at All($DIR/named_lifetimes_basic.rs:12:66: 12:67) ($DIR/named_lifetimes_basic.rs:12:66: 12:67 (#0) | -fn use_x(_1: &'_#5r mut i32, _2: &'_#6r u32, _3: &'_#7r u32, _4: &'_#8r u32) -> bool { +fn use_x(_1: &'?5 mut i32, _2: &'?6 u32, _3: &'?7 u32, _4: &'?8 u32) -> bool { debug w => _1; // in scope 0 at $DIR/named_lifetimes_basic.rs:+0:26: +0:27 debug x => _2; // in scope 0 at $DIR/named_lifetimes_basic.rs:+0:42: +0:43 debug y => _3; // in scope 0 at $DIR/named_lifetimes_basic.rs:+0:54: +0:55 diff --git a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir index 798e45df8..c425f3cd5 100644 --- a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir +++ b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir @@ -1,28 +1,28 @@ // MIR for `main` 0 nll | Free Region Mapping -| '_#0r | Global | ['_#0r, '_#1r] -| '_#1r | Local | ['_#1r] +| '?0 | Global | ['?0, '?1] +| '?1 | Local | ['?1] | | Inferred Region Values -| '_#0r | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0], '_#0r, '_#1r} -| '_#1r | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0], '_#1r} -| '_#2r | U0 | {bb1[0..=7], bb2[0..=2]} -| '_#3r | U0 | {bb1[1..=7], bb2[0..=2]} -| '_#4r | U0 | {bb1[4..=7], bb2[0..=2]} +| '?0 | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0], '?0, '?1} +| '?1 | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0], '?1} +| '?2 | U0 | {bb1[0..=7], bb2[0..=2]} +| '?3 | U0 | {bb1[1..=7], bb2[0..=2]} +| '?4 | U0 | {bb1[4..=7], bb2[0..=2]} | | Inference Constraints -| '_#0r live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0]} -| '_#1r live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0]} -| '_#2r live at {bb1[0]} -| '_#3r live at {bb1[1..=3]} -| '_#4r live at {bb1[4..=7], bb2[0..=2]} -| '_#2r: '_#3r due to Assignment at Single(bb1[0]) ($DIR/region_subtyping_basic.rs:18:13: 18:18 (#0) -| '_#3r: '_#4r due to Assignment at Single(bb1[3]) ($DIR/region_subtyping_basic.rs:19:13: 19:14 (#0) +| '?0 live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0]} +| '?1 live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0]} +| '?2 live at {bb1[0]} +| '?3 live at {bb1[1..=3]} +| '?4 live at {bb1[4..=7], bb2[0..=2]} +| '?2: '?3 due to Assignment at Single(bb1[0]) ($DIR/region_subtyping_basic.rs:18:13: 18:18 (#0) +| '?3: '?4 due to Assignment at Single(bb1[3]) ($DIR/region_subtyping_basic.rs:19:13: 19:14 (#0) | fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/region_subtyping_basic.rs:+0:11: +0:11 - let mut _1: [usize; Const(Value(Leaf(0x00000003)): usize)]; // in scope 0 at $DIR/region_subtyping_basic.rs:+1:9: +1:14 + let mut _1: [usize; Const { ty: usize, kind: Leaf(0x00000003) }]; // in scope 0 at $DIR/region_subtyping_basic.rs:+1:9: +1:14 let _3: usize; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:16: +2:17 let mut _4: usize; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:14: +2:18 let mut _5: bool; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:14: +2:18 @@ -32,10 +32,10 @@ fn main() -> () { let _10: bool; // in scope 0 at $DIR/region_subtyping_basic.rs:+7:9: +7:18 scope 1 { debug v => _1; // in scope 1 at $DIR/region_subtyping_basic.rs:+1:9: +1:14 - let _2: &'_#3r usize; // in scope 1 at $DIR/region_subtyping_basic.rs:+2:9: +2:10 + let _2: &'?3 usize; // in scope 1 at $DIR/region_subtyping_basic.rs:+2:9: +2:10 scope 2 { debug p => _2; // in scope 2 at $DIR/region_subtyping_basic.rs:+2:9: +2:10 - let _6: &'_#4r usize; // in scope 2 at $DIR/region_subtyping_basic.rs:+3:9: +3:10 + let _6: &'?4 usize; // in scope 2 at $DIR/region_subtyping_basic.rs:+3:9: +3:10 scope 3 { debug q => _6; // in scope 3 at $DIR/region_subtyping_basic.rs:+3:9: +3:10 } @@ -55,7 +55,7 @@ fn main() -> () { } bb1: { - _2 = &'_#2r _1[_3]; // bb1[0]: scope 1 at $DIR/region_subtyping_basic.rs:+2:13: +2:18 + _2 = &'?2 _1[_3]; // bb1[0]: scope 1 at $DIR/region_subtyping_basic.rs:+2:13: +2:18 FakeRead(ForLet(None), _2); // bb1[1]: scope 1 at $DIR/region_subtyping_basic.rs:+2:9: +2:10 StorageLive(_6); // bb1[2]: scope 2 at $DIR/region_subtyping_basic.rs:+3:9: +3:10 _6 = _2; // bb1[3]: scope 2 at $DIR/region_subtyping_basic.rs:+3:13: +3:14 diff --git a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir index 4767bfc76..22ad24f8d 100644 --- a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir +++ b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir @@ -1,28 +1,28 @@ // MIR for `main` 0 nll | Free Region Mapping -| '_#0r | Global | ['_#0r, '_#1r] -| '_#1r | Local | ['_#1r] +| '?0 | Global | ['?0, '?1] +| '?1 | Local | ['?1] | | Inferred Region Values -| '_#0r | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0], '_#0r, '_#1r} -| '_#1r | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0], '_#1r} -| '_#2r | U0 | {bb1[0..=7], bb2[0..=2]} -| '_#3r | U0 | {bb1[1..=7], bb2[0..=2]} -| '_#4r | U0 | {bb1[4..=7], bb2[0..=2]} +| '?0 | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0], '?0, '?1} +| '?1 | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0], '?1} +| '?2 | U0 | {bb1[0..=7], bb2[0..=2]} +| '?3 | U0 | {bb1[1..=7], bb2[0..=2]} +| '?4 | U0 | {bb1[4..=7], bb2[0..=2]} | | Inference Constraints -| '_#0r live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0]} -| '_#1r live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0]} -| '_#2r live at {bb1[0]} -| '_#3r live at {bb1[1..=3]} -| '_#4r live at {bb1[4..=7], bb2[0..=2]} -| '_#2r: '_#3r due to Assignment at Single(bb1[0]) ($DIR/region_subtyping_basic.rs:18:13: 18:18 (#0) -| '_#3r: '_#4r due to Assignment at Single(bb1[3]) ($DIR/region_subtyping_basic.rs:19:13: 19:14 (#0) +| '?0 live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0]} +| '?1 live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0]} +| '?2 live at {bb1[0]} +| '?3 live at {bb1[1..=3]} +| '?4 live at {bb1[4..=7], bb2[0..=2]} +| '?2: '?3 due to Assignment at Single(bb1[0]) ($DIR/region_subtyping_basic.rs:18:13: 18:18 (#0) +| '?3: '?4 due to Assignment at Single(bb1[3]) ($DIR/region_subtyping_basic.rs:19:13: 19:14 (#0) | fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/region_subtyping_basic.rs:+0:11: +0:11 - let mut _1: [usize; Const(Value(Leaf(0x0000000000000003)): usize)]; // in scope 0 at $DIR/region_subtyping_basic.rs:+1:9: +1:14 + let mut _1: [usize; Const { ty: usize, kind: Leaf(0x0000000000000003) }]; // in scope 0 at $DIR/region_subtyping_basic.rs:+1:9: +1:14 let _3: usize; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:16: +2:17 let mut _4: usize; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:14: +2:18 let mut _5: bool; // in scope 0 at $DIR/region_subtyping_basic.rs:+2:14: +2:18 @@ -32,10 +32,10 @@ fn main() -> () { let _10: bool; // in scope 0 at $DIR/region_subtyping_basic.rs:+7:9: +7:18 scope 1 { debug v => _1; // in scope 1 at $DIR/region_subtyping_basic.rs:+1:9: +1:14 - let _2: &'_#3r usize; // in scope 1 at $DIR/region_subtyping_basic.rs:+2:9: +2:10 + let _2: &'?3 usize; // in scope 1 at $DIR/region_subtyping_basic.rs:+2:9: +2:10 scope 2 { debug p => _2; // in scope 2 at $DIR/region_subtyping_basic.rs:+2:9: +2:10 - let _6: &'_#4r usize; // in scope 2 at $DIR/region_subtyping_basic.rs:+3:9: +3:10 + let _6: &'?4 usize; // in scope 2 at $DIR/region_subtyping_basic.rs:+3:9: +3:10 scope 3 { debug q => _6; // in scope 3 at $DIR/region_subtyping_basic.rs:+3:9: +3:10 } @@ -55,7 +55,7 @@ fn main() -> () { } bb1: { - _2 = &'_#2r _1[_3]; // bb1[0]: scope 1 at $DIR/region_subtyping_basic.rs:+2:13: +2:18 + _2 = &'?2 _1[_3]; // bb1[0]: scope 1 at $DIR/region_subtyping_basic.rs:+2:13: +2:18 FakeRead(ForLet(None), _2); // bb1[1]: scope 1 at $DIR/region_subtyping_basic.rs:+2:9: +2:10 StorageLive(_6); // bb1[2]: scope 2 at $DIR/region_subtyping_basic.rs:+3:9: +3:10 _6 = _2; // bb1[3]: scope 2 at $DIR/region_subtyping_basic.rs:+3:13: +3:14 diff --git a/tests/mir-opt/not_equal_false.opt.InstCombine.diff b/tests/mir-opt/not_equal_false.opt.InstCombine.diff deleted file mode 100644 index b558c35ac..000000000 --- a/tests/mir-opt/not_equal_false.opt.InstCombine.diff +++ /dev/null @@ -1,35 +0,0 @@ -- // MIR for `opt` before InstCombine -+ // MIR for `opt` after InstCombine - - fn opt(_1: bool) -> u32 { - debug x => _1; // in scope 0 at $DIR/not_equal_false.rs:+0:8: +0:9 - let mut _0: u32; // return place in scope 0 at $DIR/not_equal_false.rs:+0:20: +0:23 - let mut _2: bool; // in scope 0 at $DIR/not_equal_false.rs:+1:8: +1:18 - let mut _3: bool; // in scope 0 at $DIR/not_equal_false.rs:+1:8: +1:9 - - bb0: { - StorageLive(_2); // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:18 - StorageLive(_3); // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:9 - _3 = _1; // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:9 -- _2 = Ne(move _3, const false); // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:18 -+ _2 = move _3; // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:18 - StorageDead(_3); // scope 0 at $DIR/not_equal_false.rs:+1:17: +1:18 - switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:18 - } - - bb1: { - _0 = const 0_u32; // scope 0 at $DIR/not_equal_false.rs:+1:21: +1:22 - goto -> bb3; // scope 0 at $DIR/not_equal_false.rs:+1:5: +1:35 - } - - bb2: { - _0 = const 1_u32; // scope 0 at $DIR/not_equal_false.rs:+1:32: +1:33 - goto -> bb3; // scope 0 at $DIR/not_equal_false.rs:+1:5: +1:35 - } - - bb3: { - StorageDead(_2); // scope 0 at $DIR/not_equal_false.rs:+1:34: +1:35 - return; // scope 0 at $DIR/not_equal_false.rs:+2:2: +2:2 - } - } - diff --git a/tests/mir-opt/not_equal_false.opt.InstSimplify.diff b/tests/mir-opt/not_equal_false.opt.InstSimplify.diff new file mode 100644 index 000000000..8e7776a0b --- /dev/null +++ b/tests/mir-opt/not_equal_false.opt.InstSimplify.diff @@ -0,0 +1,35 @@ +- // MIR for `opt` before InstSimplify ++ // MIR for `opt` after InstSimplify + + fn opt(_1: bool) -> u32 { + debug x => _1; // in scope 0 at $DIR/not_equal_false.rs:+0:8: +0:9 + let mut _0: u32; // return place in scope 0 at $DIR/not_equal_false.rs:+0:20: +0:23 + let mut _2: bool; // in scope 0 at $DIR/not_equal_false.rs:+1:8: +1:18 + let mut _3: bool; // in scope 0 at $DIR/not_equal_false.rs:+1:8: +1:9 + + bb0: { + StorageLive(_2); // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:18 + StorageLive(_3); // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:9 + _3 = _1; // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:9 +- _2 = Ne(move _3, const false); // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:18 ++ _2 = move _3; // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:18 + StorageDead(_3); // scope 0 at $DIR/not_equal_false.rs:+1:17: +1:18 + switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/not_equal_false.rs:+1:8: +1:18 + } + + bb1: { + _0 = const 0_u32; // scope 0 at $DIR/not_equal_false.rs:+1:21: +1:22 + goto -> bb3; // scope 0 at $DIR/not_equal_false.rs:+1:5: +1:35 + } + + bb2: { + _0 = const 1_u32; // scope 0 at $DIR/not_equal_false.rs:+1:32: +1:33 + goto -> bb3; // scope 0 at $DIR/not_equal_false.rs:+1:5: +1:35 + } + + bb3: { + StorageDead(_2); // scope 0 at $DIR/not_equal_false.rs:+1:34: +1:35 + return; // scope 0 at $DIR/not_equal_false.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/not_equal_false.rs b/tests/mir-opt/not_equal_false.rs index 2ae03da40..e05607329 100644 --- a/tests/mir-opt/not_equal_false.rs +++ b/tests/mir-opt/not_equal_false.rs @@ -1,5 +1,5 @@ -// unit-test: InstCombine -// EMIT_MIR not_equal_false.opt.InstCombine.diff +// unit-test: InstSimplify +// EMIT_MIR not_equal_false.opt.InstSimplify.diff fn opt(x: bool) -> u32 { if x != false { 0 } else { 1 } diff --git a/tests/mir-opt/nrvo_miscompile_111005.rs b/tests/mir-opt/nrvo_miscompile_111005.rs new file mode 100644 index 000000000..a9f391b79 --- /dev/null +++ b/tests/mir-opt/nrvo_miscompile_111005.rs @@ -0,0 +1,22 @@ +// This is a miscompilation, #111005 to track + +// unit-test: RenameReturnPlace + +#![feature(custom_mir, core_intrinsics)] +extern crate core; +use core::intrinsics::mir::*; + +// EMIT_MIR nrvo_miscompile_111005.wrong.RenameReturnPlace.diff +#[custom_mir(dialect = "runtime", phase = "initial")] +pub fn wrong(arg: char) -> char { + mir!({ + let temp = arg; + RET = temp; + temp = 'b'; + Return() + }) +} + +fn main() { + assert_eq!(wrong('a'), 'a'); +} diff --git a/tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff b/tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff new file mode 100644 index 000000000..a0acb6e7e --- /dev/null +++ b/tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff @@ -0,0 +1,18 @@ +- // MIR for `wrong` before RenameReturnPlace ++ // MIR for `wrong` after RenameReturnPlace + + fn wrong(_1: char) -> char { +- let mut _0: char; // return place in scope 0 at $DIR/nrvo_miscompile_111005.rs:+0:28: +0:32 ++ let mut _0: char; // return place in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _2: char; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + + bb0: { +- _2 = _1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL +- _0 = _2; // scope 0 at $DIR/nrvo_miscompile_111005.rs:+3:9: +3:19 +- _2 = const 'b'; // scope 0 at $DIR/nrvo_miscompile_111005.rs:+4:9: +4:19 ++ _0 = _1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL ++ _0 = const 'b'; // scope 0 at $DIR/nrvo_miscompile_111005.rs:+4:9: +4:19 + return; // scope 0 at $DIR/nrvo_miscompile_111005.rs:+5:9: +5:17 + } + } + diff --git a/tests/mir-opt/pre-codegen/README.md b/tests/mir-opt/pre-codegen/README.md new file mode 100644 index 000000000..a338c18e0 --- /dev/null +++ b/tests/mir-opt/pre-codegen/README.md @@ -0,0 +1,3 @@ +The goal of this directory is to track the quality of MIR that is given to codegen in a standard `-O` condiguration. + +As such, feel free to `--bless` whatever changes you get here, so long as doing so doesn't add substantially more MIR. diff --git a/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs b/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs new file mode 100644 index 000000000..d8af6b14d --- /dev/null +++ b/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs @@ -0,0 +1,17 @@ +// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=0 +// ignore-debug: standard library debug assertions add a panic that breaks this optimization + +#![crate_type = "lib"] + +pub enum Thing { + A, + B, +} + +// EMIT_MIR duplicate_switch_targets.ub_if_b.PreCodegen.after.mir +pub unsafe fn ub_if_b(t: Thing) -> Thing { + match t { + Thing::A => t, + Thing::B => std::hint::unreachable_unchecked(), + } +} diff --git a/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir new file mode 100644 index 000000000..0e885cf94 --- /dev/null +++ b/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir @@ -0,0 +1,27 @@ +// MIR for `ub_if_b` after PreCodegen + +fn ub_if_b(_1: Thing) -> Thing { + debug t => _1; // in scope 0 at $DIR/duplicate_switch_targets.rs:+0:23: +0:24 + let mut _0: Thing; // return place in scope 0 at $DIR/duplicate_switch_targets.rs:+0:36: +0:41 + let mut _2: isize; // in scope 0 at $DIR/duplicate_switch_targets.rs:+2:9: +2:17 + scope 1 (inlined unreachable_unchecked) { // at $DIR/duplicate_switch_targets.rs:15:21: 15:55 + scope 2 { + scope 3 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + } + } + } + + bb0: { + _2 = discriminant(_1); // scope 0 at $DIR/duplicate_switch_targets.rs:+1:11: +1:12 + switchInt(move _2) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/duplicate_switch_targets.rs:+1:5: +1:12 + } + + bb1: { + unreachable; // scope 2 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + } + + bb2: { + _0 = move _1; // scope 0 at $DIR/duplicate_switch_targets.rs:+2:21: +2:22 + return; // scope 0 at $DIR/duplicate_switch_targets.rs:+5:2: +5:2 + } +} diff --git a/tests/mir-opt/pre-codegen/intrinsics.f_u64.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/intrinsics.f_u64.PreCodegen.after.mir new file mode 100644 index 000000000..76e1fea2f --- /dev/null +++ b/tests/mir-opt/pre-codegen/intrinsics.f_u64.PreCodegen.after.mir @@ -0,0 +1,26 @@ +// MIR for `f_u64` after PreCodegen + +fn f_u64() -> () { + let mut _0: (); // return place in scope 0 at $DIR/intrinsics.rs:+0:16: +0:16 + let mut _1: u64; // in scope 0 at $DIR/intrinsics.rs:+1:5: +1:21 + scope 1 (inlined f_dispatch::) { // at $DIR/intrinsics.rs:19:5: 19:21 + debug t => const 0_u64; // in scope 1 at $DIR/intrinsics.rs:23:22: 23:23 + let _2: (); // in scope 1 at $DIR/intrinsics.rs:27:9: 27:21 + scope 2 (inlined std::mem::size_of::) { // at $DIR/intrinsics.rs:24:8: 24:32 + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/intrinsics.rs:+1:5: +1:21 + _1 = const 0_u64; // scope 0 at $DIR/intrinsics.rs:+1:5: +1:21 + _2 = f_non_zst::(move _1) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/intrinsics.rs:27:9: 27:21 + // mir::Constant + // + span: $DIR/intrinsics.rs:27:9: 27:18 + // + literal: Const { ty: fn(u64) {f_non_zst::}, val: Value() } + } + + bb1: { + StorageDead(_1); // scope 0 at $DIR/intrinsics.rs:+1:5: +1:21 + return; // scope 0 at $DIR/intrinsics.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/pre-codegen/intrinsics.f_unit.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/intrinsics.f_unit.PreCodegen.after.mir new file mode 100644 index 000000000..3d416de34 --- /dev/null +++ b/tests/mir-opt/pre-codegen/intrinsics.f_unit.PreCodegen.after.mir @@ -0,0 +1,22 @@ +// MIR for `f_unit` after PreCodegen + +fn f_unit() -> () { + let mut _0: (); // return place in scope 0 at $DIR/intrinsics.rs:+0:17: +0:17 + scope 1 (inlined f_dispatch::<()>) { // at $DIR/intrinsics.rs:13:5: 13:19 + debug t => const (); // in scope 1 at $DIR/intrinsics.rs:23:22: 23:23 + let _1: (); // in scope 1 at $DIR/intrinsics.rs:25:9: 25:17 + scope 2 (inlined std::mem::size_of::<()>) { // at $DIR/intrinsics.rs:24:8: 24:32 + } + } + + bb0: { + _1 = f_zst::<()>(const ()) -> [return: bb1, unwind unreachable]; // scope 1 at $DIR/intrinsics.rs:25:9: 25:17 + // mir::Constant + // + span: $DIR/intrinsics.rs:25:9: 25:14 + // + literal: Const { ty: fn(()) {f_zst::<()>}, val: Value() } + } + + bb1: { + return; // scope 0 at $DIR/intrinsics.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/pre-codegen/intrinsics.rs b/tests/mir-opt/pre-codegen/intrinsics.rs new file mode 100644 index 000000000..ecdb656cb --- /dev/null +++ b/tests/mir-opt/pre-codegen/intrinsics.rs @@ -0,0 +1,36 @@ +// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 +// only-64bit +// ignore-debug + +// Checks that we do not have any branches in the MIR for the two tested functions. + +// compile-flags: -Cpanic=abort +#![feature(core_intrinsics)] +#![crate_type = "lib"] + +// EMIT_MIR intrinsics.f_unit.PreCodegen.after.mir +pub fn f_unit() { + f_dispatch(()); +} + + +// EMIT_MIR intrinsics.f_u64.PreCodegen.after.mir +pub fn f_u64() { + f_dispatch(0u64); +} + +#[inline(always)] +pub fn f_dispatch(t: T) { + if std::mem::size_of::() == 0 { + f_zst(t); + } else { + f_non_zst(t); + } +} + +#[inline(never)] +pub fn f_zst(_t: T) { +} + +#[inline(never)] +pub fn f_non_zst(_t: T) {} diff --git a/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.mir new file mode 100644 index 000000000..1d2387102 --- /dev/null +++ b/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.mir @@ -0,0 +1,16 @@ +// MIR for `manual_replace` after PreCodegen + +fn manual_replace(_1: &mut u32, _2: u32) -> u32 { + debug r => _1; // in scope 0 at $DIR/mem_replace.rs:+0:23: +0:24 + debug v => _2; // in scope 0 at $DIR/mem_replace.rs:+0:36: +0:37 + let mut _0: u32; // return place in scope 0 at $DIR/mem_replace.rs:+0:47: +0:50 + scope 1 { + debug temp => _0; // in scope 1 at $DIR/mem_replace.rs:+1:9: +1:13 + } + + bb0: { + _0 = (*_1); // scope 0 at $DIR/mem_replace.rs:+1:16: +1:18 + (*_1) = _2; // scope 1 at $DIR/mem_replace.rs:+2:5: +2:11 + return; // scope 0 at $DIR/mem_replace.rs:+4:2: +4:2 + } +} diff --git a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir new file mode 100644 index 000000000..50e0538c1 --- /dev/null +++ b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir @@ -0,0 +1,53 @@ +// MIR for `mem_replace` after PreCodegen + +fn mem_replace(_1: &mut u32, _2: u32) -> u32 { + debug r => _1; // in scope 0 at $DIR/mem_replace.rs:+0:20: +0:21 + debug v => _2; // in scope 0 at $DIR/mem_replace.rs:+0:33: +0:34 + let mut _0: u32; // return place in scope 0 at $DIR/mem_replace.rs:+0:44: +0:47 + scope 1 (inlined std::mem::replace::) { // at $DIR/mem_replace.rs:16:5: 16:28 + debug dest => _1; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + debug src => _2; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + let mut _3: *const u32; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + let mut _4: *mut u32; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + scope 2 { + scope 3 { + debug result => _0; // in scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + scope 7 (inlined std::ptr::write::) { // at $SRC_DIR/core/src/mem/mod.rs:LL:COL + debug dst => _4; // in scope 7 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug src => _2; // in scope 7 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + let mut _6: *mut u32; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 8 { + scope 9 (inlined std::ptr::write::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug dst => _6; // in scope 9 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + } + } + } + } + scope 4 (inlined std::ptr::read::) { // at $SRC_DIR/core/src/mem/mod.rs:LL:COL + debug src => _3; // in scope 4 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + let mut _5: *const u32; // in scope 4 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 5 { + scope 6 (inlined std::ptr::read::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug src => _5; // in scope 6 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + } + } + } + } + } + + bb0: { + StorageLive(_3); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + _3 = &raw const (*_1); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + StorageLive(_5); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + _0 = (*_3); // scope 5 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + StorageDead(_5); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + StorageDead(_3); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + StorageLive(_4); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + _4 = &raw mut (*_1); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + StorageLive(_6); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + (*_4) = _2; // scope 8 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + StorageDead(_6); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + StorageDead(_4); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + return; // scope 0 at $DIR/mem_replace.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/pre-codegen/mem_replace.rs b/tests/mir-opt/pre-codegen/mem_replace.rs new file mode 100644 index 000000000..e5066c38b --- /dev/null +++ b/tests/mir-opt/pre-codegen/mem_replace.rs @@ -0,0 +1,17 @@ +// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 +// only-64bit +// ignore-debug + +#![crate_type = "lib"] + +// EMIT_MIR mem_replace.manual_replace.PreCodegen.after.mir +pub fn manual_replace(r: &mut u32, v: u32) -> u32 { + let temp = *r; + *r = v; + temp +} + +// EMIT_MIR mem_replace.mem_replace.PreCodegen.after.mir +pub fn mem_replace(r: &mut u32, v: u32) -> u32 { + std::mem::replace(r, v) +} diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.diff new file mode 100644 index 000000000..691aa01a5 --- /dev/null +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.diff @@ -0,0 +1,59 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 + let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + let mut _9: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 + scope 1 { + debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + scope 2 { + debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + scope 3 { + debug z => _9; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 +- _2 = CheckedAdd(const 2_i32, const 2_i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 +- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 ++ _2 = const (4_i32, false); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 ++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + } + + bb1: { +- _1 = move (_2.0: i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 ++ _1 = const 4_i32; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + StorageLive(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + StorageLive(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + StorageLive(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + _5 = const 3_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + _6 = const 6_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 +- _7 = Lt(_5, _6); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 +- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 ++ _7 = const true; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + } + + bb2: { +- _3 = _4[_5]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 ++ _3 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + StorageDead(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 + StorageDead(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 + _9 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 + StorageDead(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 + StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 + return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.diff new file mode 100644 index 000000000..691aa01a5 --- /dev/null +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.diff @@ -0,0 +1,59 @@ +- // MIR for `main` before ConstProp ++ // MIR for `main` after ConstProp + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 + let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + let mut _9: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 + scope 1 { + debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + scope 2 { + debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + scope 3 { + debug z => _9; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 +- _2 = CheckedAdd(const 2_i32, const 2_i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 +- assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 ++ _2 = const (4_i32, false); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 ++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + } + + bb1: { +- _1 = move (_2.0: i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 ++ _1 = const 4_i32; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + StorageLive(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + StorageLive(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + StorageLive(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + _5 = const 3_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + _6 = const 6_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 +- _7 = Lt(_5, _6); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 +- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 ++ _7 = const true; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 ++ assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + } + + bb2: { +- _3 = _4[_5]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 ++ _3 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + StorageDead(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 + StorageDead(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 + _9 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 + StorageDead(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 + StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 + return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.mir new file mode 100644 index 000000000..7886bf19e --- /dev/null +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.32bit.mir @@ -0,0 +1,18 @@ +// MIR for `main` after PreCodegen + +fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 + scope 1 { + debug x => const 4_i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + scope 2 { + debug y => const 3_i32; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + scope 3 { + debug z => const 42_u32; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + } + } + } + + bb0: { + return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 + } +} diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.mir new file mode 100644 index 000000000..7886bf19e --- /dev/null +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.PreCodegen.after.64bit.mir @@ -0,0 +1,18 @@ +// MIR for `main` after PreCodegen + +fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 + scope 1 { + debug x => const 4_i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + scope 2 { + debug y => const 3_i32; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + scope 3 { + debug z => const 42_u32; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + } + } + } + + bb0: { + return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 + } +} diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff new file mode 100644 index 000000000..98cd020da --- /dev/null +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.diff @@ -0,0 +1,71 @@ +- // MIR for `main` before ScalarReplacementOfAggregates ++ // MIR for `main` after ScalarReplacementOfAggregates + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 + let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + let mut _9: Point; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ let mut _10: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ let mut _11: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 + scope 1 { + debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + scope 2 { + debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + scope 3 { + debug z => _8; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + _2 = CheckedAdd(const 2_i32, const 2_i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + } + + bb1: { + _1 = move (_2.0: i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + StorageLive(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + StorageLive(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + StorageLive(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + _5 = const 3_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + _6 = Len(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + _7 = Lt(_5, _6); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + } + + bb2: { + _3 = _4[_5]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + StorageDead(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 + StorageDead(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 + StorageLive(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 +- StorageLive(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 +- _9 = Point { x: const 12_u32, y: const 42_u32 }; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 +- _8 = (_9.1: u32); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:38 +- StorageDead(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 ++ StorageLive(_10); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ StorageLive(_11); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ _10 = const 12_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ _11 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ _8 = _11; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:38 ++ StorageDead(_10); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 ++ StorageDead(_11); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 ++ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 + nop; // scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +4:2 + StorageDead(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 + StorageDead(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 + StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 + return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff new file mode 100644 index 000000000..98cd020da --- /dev/null +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.diff @@ -0,0 +1,71 @@ +- // MIR for `main` before ScalarReplacementOfAggregates ++ // MIR for `main` after ScalarReplacementOfAggregates + + fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 + let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + let mut _9: Point; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ let mut _10: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ let mut _11: u32; // in scope 0 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 + scope 1 { + debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + scope 2 { + debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + scope 3 { + debug z => _8; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + _2 = CheckedAdd(const 2_i32, const 2_i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", const 2_i32, const 2_i32) -> bb1; // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + } + + bb1: { + _1 = move (_2.0: i32); // scope 0 at $DIR/optimizes_into_variable.rs:+1:13: +1:18 + StorageLive(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + StorageLive(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + _4 = [const 0_i32, const 1_i32, const 2_i32, const 3_i32, const 4_i32, const 5_i32]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:31 + StorageLive(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + _5 = const 3_usize; // scope 1 at $DIR/optimizes_into_variable.rs:+2:32: +2:33 + _6 = Len(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + _7 = Lt(_5, _6); // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> bb2; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + } + + bb2: { + _3 = _4[_5]; // scope 1 at $DIR/optimizes_into_variable.rs:+2:13: +2:34 + StorageDead(_5); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 + StorageDead(_4); // scope 1 at $DIR/optimizes_into_variable.rs:+2:34: +2:35 + StorageLive(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 +- StorageLive(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 +- _9 = Point { x: const 12_u32, y: const 42_u32 }; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 +- _8 = (_9.1: u32); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:38 +- StorageDead(_9); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 ++ StorageLive(_10); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ StorageLive(_11); // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ _10 = const 12_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ _11 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:36 ++ _8 = _11; // scope 2 at $DIR/optimizes_into_variable.rs:+3:13: +3:38 ++ StorageDead(_10); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 ++ StorageDead(_11); // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 ++ nop; // scope 2 at $DIR/optimizes_into_variable.rs:+3:38: +3:39 + nop; // scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +4:2 + StorageDead(_8); // scope 2 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 + StorageDead(_3); // scope 1 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 + StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:+4:1: +4:2 + return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 + } + } + diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir new file mode 100644 index 000000000..5bea94c7f --- /dev/null +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.32bit.mir @@ -0,0 +1,18 @@ +// MIR for `main` after SimplifyLocals-final + +fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 + scope 1 { + debug x => const 4_i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + scope 2 { + debug y => const 3_i32; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + scope 3 { + debug z => const 42_u32; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + } + } + } + + bb0: { + return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 + } +} diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir new file mode 100644 index 000000000..5bea94c7f --- /dev/null +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.SimplifyLocals-final.after.64bit.mir @@ -0,0 +1,18 @@ +// MIR for `main` after SimplifyLocals-final + +fn main() -> () { + let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:+0:11: +0:11 + scope 1 { + debug x => const 4_i32; // in scope 1 at $DIR/optimizes_into_variable.rs:+1:9: +1:10 + scope 2 { + debug y => const 3_i32; // in scope 2 at $DIR/optimizes_into_variable.rs:+2:9: +2:10 + scope 3 { + debug z => const 42_u32; // in scope 3 at $DIR/optimizes_into_variable.rs:+3:9: +3:10 + } + } + } + + bb0: { + return; // scope 0 at $DIR/optimizes_into_variable.rs:+4:2: +4:2 + } +} diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.rs b/tests/mir-opt/pre-codegen/optimizes_into_variable.rs new file mode 100644 index 000000000..bb32cd3af --- /dev/null +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.rs @@ -0,0 +1,18 @@ +// ignore-wasm32 compiled with panic=abort by default +// compile-flags: -C overflow-checks=on + +struct Point { + x: u32, + y: u32, +} + +// EMIT_MIR_FOR_EACH_BIT_WIDTH +// EMIT_MIR optimizes_into_variable.main.ScalarReplacementOfAggregates.diff +// EMIT_MIR optimizes_into_variable.main.ConstProp.diff +// EMIT_MIR optimizes_into_variable.main.SimplifyLocals-final.after.mir +// EMIT_MIR optimizes_into_variable.main.PreCodegen.after.mir +fn main() { + let x = 2 + 2; + let y = [0, 1, 2, 3, 4, 5][3]; + let z = (Point { x: 12, y: 42}).y; +} diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.mir new file mode 100644 index 000000000..343a4a5a6 --- /dev/null +++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.mir @@ -0,0 +1,91 @@ +// MIR for `forward_loop` after PreCodegen + +fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { + debug start => _1; // in scope 0 at $DIR/range_iter.rs:+0:21: +0:26 + debug end => _2; // in scope 0 at $DIR/range_iter.rs:+0:33: +0:36 + debug f => _3; // in scope 0 at $DIR/range_iter.rs:+0:43: +0:44 + let mut _0: (); // return place in scope 0 at $DIR/range_iter.rs:+0:60: +0:60 + let mut _4: std::ops::Range; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24 + let mut _5: std::ops::Range; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24 + let _6: (); // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24 + let mut _7: std::option::Option; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24 + let mut _8: &mut std::ops::Range; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:24 + let mut _9: isize; // in scope 0 at $DIR/range_iter.rs:+1:5: +3:6 + let mut _11: &impl Fn(u32); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:10 + let mut _12: (u32,); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:13 + scope 1 { + debug iter => _5; // in scope 1 at $DIR/range_iter.rs:+1:14: +1:24 + let _10: u32; // in scope 1 at $DIR/range_iter.rs:+1:9: +1:10 + scope 2 { + debug x => _10; // in scope 2 at $DIR/range_iter.rs:+1:9: +1:10 + } + scope 4 (inlined iter::range::>::next) { // at $DIR/range_iter.rs:21:14: 21:24 + debug self => _8; // in scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL + } + } + scope 3 (inlined as IntoIterator>::into_iter) { // at $DIR/range_iter.rs:21:14: 21:24 + debug self => _4; // in scope 3 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + + bb0: { + _4 = std::ops::Range:: { start: _1, end: _2 }; // scope 0 at $DIR/range_iter.rs:+1:14: +1:24 + StorageLive(_5); // scope 0 at $DIR/range_iter.rs:+1:14: +1:24 + _5 = move _4; // scope 0 at $DIR/range_iter.rs:+1:14: +1:24 + goto -> bb1; // scope 1 at $DIR/range_iter.rs:+1:5: +3:6 + } + + bb1: { + StorageLive(_7); // scope 1 at $DIR/range_iter.rs:+1:14: +1:24 + _8 = &mut _5; // scope 1 at $DIR/range_iter.rs:+1:14: +1:24 + _7 = as iter::range::RangeIteratorImpl>::spec_next(_8) -> [return: bb9, unwind: bb7]; // scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL + // + literal: Const { ty: for<'a> fn(&'a mut std::ops::Range) -> Option< as iter::range::RangeIteratorImpl>::Item> { as iter::range::RangeIteratorImpl>::spec_next}, val: Value() } + } + + bb2: { + _10 = ((_7 as Some).0: u32); // scope 1 at $DIR/range_iter.rs:+1:9: +1:10 + StorageLive(_11); // scope 2 at $DIR/range_iter.rs:+2:9: +2:10 + _11 = &_3; // scope 2 at $DIR/range_iter.rs:+2:9: +2:10 + StorageLive(_12); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 + _12 = (_10,); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 + _6 = >::call(move _11, move _12) -> [return: bb5, unwind: bb7]; // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 + // mir::Constant + // + span: $DIR/range_iter.rs:22:9: 22:10 + // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(u32), (u32,)) -> >::Output {>::call}, val: Value() } + } + + bb3: { + unreachable; // scope 1 at $DIR/range_iter.rs:+1:14: +1:24 + } + + bb4: { + StorageDead(_7); // scope 1 at $DIR/range_iter.rs:+3:5: +3:6 + StorageDead(_5); // scope 0 at $DIR/range_iter.rs:+3:5: +3:6 + drop(_3) -> bb6; // scope 0 at $DIR/range_iter.rs:+4:1: +4:2 + } + + bb5: { + StorageDead(_12); // scope 2 at $DIR/range_iter.rs:+2:12: +2:13 + StorageDead(_11); // scope 2 at $DIR/range_iter.rs:+2:12: +2:13 + StorageDead(_7); // scope 1 at $DIR/range_iter.rs:+3:5: +3:6 + goto -> bb1; // scope 1 at $DIR/range_iter.rs:+1:5: +3:6 + } + + bb6: { + return; // scope 0 at $DIR/range_iter.rs:+4:2: +4:2 + } + + bb7 (cleanup): { + drop(_3) -> [return: bb8, unwind terminate]; // scope 0 at $DIR/range_iter.rs:+4:1: +4:2 + } + + bb8 (cleanup): { + resume; // scope 0 at $DIR/range_iter.rs:+0:1: +4:2 + } + + bb9: { + _9 = discriminant(_7); // scope 1 at $DIR/range_iter.rs:+1:14: +1:24 + switchInt(move _9) -> [0: bb4, 1: bb2, otherwise: bb3]; // scope 1 at $DIR/range_iter.rs:+1:14: +1:24 + } +} diff --git a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.mir new file mode 100644 index 000000000..f45eabba2 --- /dev/null +++ b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.mir @@ -0,0 +1,95 @@ +// MIR for `inclusive_loop` after PreCodegen + +fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { + debug start => _1; // in scope 0 at $DIR/range_iter.rs:+0:23: +0:28 + debug end => _2; // in scope 0 at $DIR/range_iter.rs:+0:35: +0:38 + debug f => _3; // in scope 0 at $DIR/range_iter.rs:+0:45: +0:46 + let mut _0: (); // return place in scope 0 at $DIR/range_iter.rs:+0:62: +0:62 + let mut _4: std::ops::RangeInclusive; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25 + let mut _5: std::ops::RangeInclusive; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25 + let _6: (); // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25 + let mut _7: std::option::Option; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25 + let mut _8: &mut std::ops::RangeInclusive; // in scope 0 at $DIR/range_iter.rs:+1:14: +1:25 + let mut _9: isize; // in scope 0 at $DIR/range_iter.rs:+1:5: +3:6 + let mut _11: &impl Fn(u32); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:10 + let mut _12: (u32,); // in scope 0 at $DIR/range_iter.rs:+2:9: +2:13 + scope 1 { + debug iter => _5; // in scope 1 at $DIR/range_iter.rs:+1:14: +1:25 + let _10: u32; // in scope 1 at $DIR/range_iter.rs:+1:9: +1:10 + scope 2 { + debug x => _10; // in scope 2 at $DIR/range_iter.rs:+1:9: +1:10 + } + scope 5 (inlined iter::range::>::next) { // at $DIR/range_iter.rs:28:14: 28:25 + debug self => _8; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + } + } + scope 3 (inlined RangeInclusive::::new) { // at $DIR/range_iter.rs:28:14: 28:25 + debug start => _1; // in scope 3 at $SRC_DIR/core/src/ops/range.rs:LL:COL + debug end => _2; // in scope 3 at $SRC_DIR/core/src/ops/range.rs:LL:COL + } + scope 4 (inlined as IntoIterator>::into_iter) { // at $DIR/range_iter.rs:28:14: 28:25 + debug self => _4; // in scope 4 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + + bb0: { + _4 = RangeInclusive:: { start: _1, end: _2, exhausted: const false }; // scope 3 at $SRC_DIR/core/src/ops/range.rs:LL:COL + StorageLive(_5); // scope 0 at $DIR/range_iter.rs:+1:14: +1:25 + _5 = move _4; // scope 0 at $DIR/range_iter.rs:+1:14: +1:25 + goto -> bb1; // scope 1 at $DIR/range_iter.rs:+1:5: +3:6 + } + + bb1: { + StorageLive(_7); // scope 1 at $DIR/range_iter.rs:+1:14: +1:25 + _8 = &mut _5; // scope 1 at $DIR/range_iter.rs:+1:14: +1:25 + _7 = as iter::range::RangeInclusiveIteratorImpl>::spec_next(_8) -> [return: bb9, unwind: bb7]; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL + // + literal: Const { ty: for<'a> fn(&'a mut RangeInclusive) -> Option< as iter::range::RangeInclusiveIteratorImpl>::Item> { as iter::range::RangeInclusiveIteratorImpl>::spec_next}, val: Value() } + } + + bb2: { + _10 = ((_7 as Some).0: u32); // scope 1 at $DIR/range_iter.rs:+1:9: +1:10 + StorageLive(_11); // scope 2 at $DIR/range_iter.rs:+2:9: +2:10 + _11 = &_3; // scope 2 at $DIR/range_iter.rs:+2:9: +2:10 + StorageLive(_12); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 + _12 = (_10,); // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 + _6 = >::call(move _11, move _12) -> [return: bb5, unwind: bb7]; // scope 2 at $DIR/range_iter.rs:+2:9: +2:13 + // mir::Constant + // + span: $DIR/range_iter.rs:29:9: 29:10 + // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(u32), (u32,)) -> >::Output {>::call}, val: Value() } + } + + bb3: { + unreachable; // scope 1 at $DIR/range_iter.rs:+1:14: +1:25 + } + + bb4: { + StorageDead(_7); // scope 1 at $DIR/range_iter.rs:+3:5: +3:6 + StorageDead(_5); // scope 0 at $DIR/range_iter.rs:+3:5: +3:6 + drop(_3) -> bb6; // scope 0 at $DIR/range_iter.rs:+4:1: +4:2 + } + + bb5: { + StorageDead(_12); // scope 2 at $DIR/range_iter.rs:+2:12: +2:13 + StorageDead(_11); // scope 2 at $DIR/range_iter.rs:+2:12: +2:13 + StorageDead(_7); // scope 1 at $DIR/range_iter.rs:+3:5: +3:6 + goto -> bb1; // scope 1 at $DIR/range_iter.rs:+1:5: +3:6 + } + + bb6: { + return; // scope 0 at $DIR/range_iter.rs:+4:2: +4:2 + } + + bb7 (cleanup): { + drop(_3) -> [return: bb8, unwind terminate]; // scope 0 at $DIR/range_iter.rs:+4:1: +4:2 + } + + bb8 (cleanup): { + resume; // scope 0 at $DIR/range_iter.rs:+0:1: +4:2 + } + + bb9: { + _9 = discriminant(_7); // scope 1 at $DIR/range_iter.rs:+1:14: +1:25 + switchInt(move _9) -> [0: bb4, 1: bb2, otherwise: bb3]; // scope 1 at $DIR/range_iter.rs:+1:14: +1:25 + } +} diff --git a/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.mir new file mode 100644 index 000000000..d013b1b94 --- /dev/null +++ b/tests/mir-opt/pre-codegen/range_iter.range_inclusive_iter_next.PreCodegen.after.mir @@ -0,0 +1,20 @@ +// MIR for `range_inclusive_iter_next` after PreCodegen + +fn range_inclusive_iter_next(_1: &mut RangeInclusive) -> Option { + debug it => _1; // in scope 0 at $DIR/range_iter.rs:+0:34: +0:36 + let mut _0: std::option::Option; // return place in scope 0 at $DIR/range_iter.rs:+0:67: +0:78 + scope 1 (inlined iter::range::>::next) { // at $DIR/range_iter.rs:16:8: 16:14 + debug self => _1; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + } + + bb0: { + _0 = as iter::range::RangeInclusiveIteratorImpl>::spec_next(_1) -> bb1; // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL + // + literal: Const { ty: for<'a> fn(&'a mut RangeInclusive) -> Option< as iter::range::RangeInclusiveIteratorImpl>::Item> { as iter::range::RangeInclusiveIteratorImpl>::spec_next}, val: Value() } + } + + bb1: { + return; // scope 0 at $DIR/range_iter.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.mir new file mode 100644 index 000000000..cae46e2b0 --- /dev/null +++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.mir @@ -0,0 +1,20 @@ +// MIR for `range_iter_next` after PreCodegen + +fn range_iter_next(_1: &mut std::ops::Range) -> Option { + debug it => _1; // in scope 0 at $DIR/range_iter.rs:+0:24: +0:26 + let mut _0: std::option::Option; // return place in scope 0 at $DIR/range_iter.rs:+0:48: +0:59 + scope 1 (inlined iter::range::>::next) { // at $DIR/range_iter.rs:11:8: 11:14 + debug self => _1; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + } + + bb0: { + _0 = as iter::range::RangeIteratorImpl>::spec_next(_1) -> bb1; // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL + // + literal: Const { ty: for<'a> fn(&'a mut std::ops::Range) -> Option< as iter::range::RangeIteratorImpl>::Item> { as iter::range::RangeIteratorImpl>::spec_next}, val: Value() } + } + + bb1: { + return; // scope 0 at $DIR/range_iter.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/pre-codegen/range_iter.rs b/tests/mir-opt/pre-codegen/range_iter.rs new file mode 100644 index 000000000..fe21d4dfd --- /dev/null +++ b/tests/mir-opt/pre-codegen/range_iter.rs @@ -0,0 +1,31 @@ +// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 +// only-64bit +// ignore-debug + +#![crate_type = "lib"] + +use std::ops::{Range, RangeInclusive}; + +// EMIT_MIR range_iter.range_iter_next.PreCodegen.after.mir +pub fn range_iter_next(it: &mut Range) -> Option { + it.next() +} + +// EMIT_MIR range_iter.range_inclusive_iter_next.PreCodegen.after.mir +pub fn range_inclusive_iter_next(it: &mut RangeInclusive) -> Option { + it.next() +} + +// EMIT_MIR range_iter.forward_loop.PreCodegen.after.mir +pub fn forward_loop(start: u32, end: u32, f: impl Fn(u32)) { + for x in start..end { + f(x) + } +} + +// EMIT_MIR range_iter.inclusive_loop.PreCodegen.after.mir +pub fn inclusive_loop(start: u32, end: u32, f: impl Fn(u32)) { + for x in start..=end { + f(x) + } +} diff --git a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir new file mode 100644 index 000000000..986ab3588 --- /dev/null +++ b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir @@ -0,0 +1,56 @@ +// MIR for `ezmap` after PreCodegen + +fn ezmap(_1: Option) -> Option { + debug x => _1; // in scope 0 at $DIR/simple_option_map.rs:+0:14: +0:15 + let mut _0: std::option::Option; // return place in scope 0 at $DIR/simple_option_map.rs:+0:33: +0:44 + let mut _6: i32; // in scope 0 at $DIR/simple_option_map.rs:11:25: 11:29 + scope 1 (inlined map::) { // at $DIR/simple_option_map.rs:18:5: 18:22 + debug slf => _1; // in scope 1 at $DIR/simple_option_map.rs:6:17: 6:20 + debug f => const ZeroSized: [closure@$DIR/simple_option_map.rs:18:12: 18:15]; // in scope 1 at $DIR/simple_option_map.rs:6:33: 6:34 + let mut _2: isize; // in scope 1 at $DIR/simple_option_map.rs:11:9: 11:16 + let _3: i32; // in scope 1 at $DIR/simple_option_map.rs:11:14: 11:15 + let mut _4: i32; // in scope 1 at $DIR/simple_option_map.rs:11:25: 11:29 + let mut _5: (i32,); // in scope 1 at $DIR/simple_option_map.rs:11:25: 11:29 + scope 2 { + debug x => _3; // in scope 2 at $DIR/simple_option_map.rs:11:14: 11:15 + scope 3 (inlined ezmap::{closure#0}) { // at $DIR/simple_option_map.rs:11:25: 11:29 + debug n => _6; // in scope 3 at $DIR/simple_option_map.rs:+1:13: +1:14 + } + } + } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/simple_option_map.rs:+1:5: +1:22 + _2 = discriminant(_1); // scope 1 at $DIR/simple_option_map.rs:10:11: 10:14 + switchInt(move _2) -> [0: bb1, 1: bb3, otherwise: bb2]; // scope 1 at $DIR/simple_option_map.rs:10:5: 10:14 + } + + bb1: { + _0 = Option::::None; // scope 1 at $DIR/simple_option_map.rs:12:17: 12:21 + goto -> bb4; // scope 1 at $DIR/simple_option_map.rs:12:17: 12:21 + } + + bb2: { + unreachable; // scope 1 at $DIR/simple_option_map.rs:10:11: 10:14 + } + + bb3: { + _3 = ((_1 as Some).0: i32); // scope 1 at $DIR/simple_option_map.rs:11:14: 11:15 + StorageLive(_4); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29 + StorageLive(_5); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29 + _5 = (move _3,); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29 + StorageLive(_6); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29 + _6 = move (_5.0: i32); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29 + _4 = Add(_6, const 1_i32); // scope 3 at $DIR/simple_option_map.rs:+1:16: +1:21 + StorageDead(_6); // scope 2 at $DIR/simple_option_map.rs:11:25: 11:29 + StorageDead(_5); // scope 2 at $DIR/simple_option_map.rs:11:28: 11:29 + _0 = Option::::Some(move _4); // scope 2 at $DIR/simple_option_map.rs:11:20: 11:30 + StorageDead(_4); // scope 2 at $DIR/simple_option_map.rs:11:29: 11:30 + goto -> bb4; // scope 1 at $DIR/simple_option_map.rs:14:1: 14:2 + } + + bb4: { + StorageDead(_3); // scope 0 at $DIR/simple_option_map.rs:+1:5: +1:22 + return; // scope 0 at $DIR/simple_option_map.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/pre-codegen/simple_option_map.rs b/tests/mir-opt/pre-codegen/simple_option_map.rs new file mode 100644 index 000000000..fb3da68e4 --- /dev/null +++ b/tests/mir-opt/pre-codegen/simple_option_map.rs @@ -0,0 +1,23 @@ +// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 +// only-64bit +// ignore-debug + +#[inline(always)] +fn map(slf: Option, f: F) -> Option +where + F: FnOnce(T) -> U, +{ + match slf { + Some(x) => Some(f(x)), + None => None, + } +} + +// EMIT_MIR simple_option_map.ezmap.PreCodegen.after.mir +pub fn ezmap(x: Option) -> Option { + map(x, |n| n + 1) +} + +fn main() { + assert_eq!(None, ezmap(None)); +} diff --git a/tests/mir-opt/pre-codegen/slice_index.rs b/tests/mir-opt/pre-codegen/slice_index.rs new file mode 100644 index 000000000..44b456276 --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_index.rs @@ -0,0 +1,27 @@ +// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 +// only-64bit +// ignore-debug + +#![crate_type = "lib"] + +use std::ops::Range; + +// EMIT_MIR slice_index.slice_index_usize.PreCodegen.after.mir +pub fn slice_index_usize(slice: &[u32], index: usize) -> u32 { + slice[index] +} + +// EMIT_MIR slice_index.slice_get_mut_usize.PreCodegen.after.mir +pub fn slice_get_mut_usize(slice: &mut [u32], index: usize) -> Option<&mut u32> { + slice.get_mut(index) +} + +// EMIT_MIR slice_index.slice_index_range.PreCodegen.after.mir +pub fn slice_index_range(slice: &[u32], index: Range) -> &[u32] { + &slice[index] +} + +// EMIT_MIR slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir +pub unsafe fn slice_get_unchecked_mut_range(slice: &mut [u32], index: Range) -> &mut [u32] { + slice.get_unchecked_mut(index) +} diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.mir new file mode 100644 index 000000000..715a1e3fc --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.mir @@ -0,0 +1,105 @@ +// MIR for `slice_get_mut_usize` after PreCodegen + +fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { + debug slice => _1; // in scope 0 at $DIR/slice_index.rs:+0:28: +0:33 + debug index => _2; // in scope 0 at $DIR/slice_index.rs:+0:47: +0:52 + let mut _0: std::option::Option<&mut u32>; // return place in scope 0 at $DIR/slice_index.rs:+0:64: +0:80 + scope 1 (inlined core::slice::::get_mut::) { // at $DIR/slice_index.rs:16:11: 16:25 + debug self => _1; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + debug index => _2; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + scope 2 (inlined >::get_mut) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL + debug self => _2; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug slice => _1; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _3: bool; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _4: usize; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _5: &[u32]; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _6: &mut u32; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _7: *mut u32; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _8: *mut [u32]; // in scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + scope 3 { + scope 4 (inlined >::get_unchecked_mut) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug self => _2; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug slice => _8; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _9: *mut u32; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _10: usize; // in scope 4 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + let mut _11: *mut [u32]; // in scope 4 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 5 { + debug this => _2; // in scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + scope 6 { + scope 7 (inlined >::get_unchecked_mut::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug this => _10; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug slice => _11; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 8 (inlined ptr::mut_ptr::::len) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug self => _11; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + let mut _12: *const [u32]; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 9 (inlined std::ptr::metadata::<[u32]>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug ptr => _12; // in scope 9 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + scope 10 { + } + } + } + } + scope 11 (inlined ptr::mut_ptr::::as_mut_ptr) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug self => _8; // in scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + } + scope 12 (inlined ptr::mut_ptr::::add) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug self => _9; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug count => _2; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 13 { + } + } + } + } + } + } + } + } + + bb0: { + StorageLive(_6); // scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_3); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_4); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_5); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _5 = &(*_1); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _4 = Len((*_5)); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_5); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _3 = Lt(_2, move _4); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_4); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + switchInt(move _3) -> [0: bb2, otherwise: bb1]; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + } + + bb1: { + StorageLive(_7); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_8); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _8 = &raw mut (*_1); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_10); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_11); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_12); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_9); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _9 = _8 as *mut u32 (PtrToPtr); // scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + _7 = Offset(_9, _2); // scope 13 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + StorageDead(_9); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_12); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_11); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_10); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_8); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _6 = &mut (*_7); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _0 = Option::<&mut u32>::Some(_6); // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_7); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + goto -> bb3; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + } + + bb2: { + _0 = const Option::<&mut u32>::None; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + // mir::Constant + // + span: no-location + // + literal: Const { ty: Option<&mut u32>, val: Value(Scalar(0x0000000000000000)) } + goto -> bb3; // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + } + + bb3: { + StorageDead(_3); // scope 2 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_6); // scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + return; // scope 0 at $DIR/slice_index.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir new file mode 100644 index 000000000..7a10b929e --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir @@ -0,0 +1,134 @@ +// MIR for `slice_get_unchecked_mut_range` after PreCodegen + +fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> &mut [u32] { + debug slice => _1; // in scope 0 at $DIR/slice_index.rs:+0:45: +0:50 + debug index => _2; // in scope 0 at $DIR/slice_index.rs:+0:64: +0:69 + let mut _0: &mut [u32]; // return place in scope 0 at $DIR/slice_index.rs:+0:88: +0:98 + scope 1 (inlined core::slice::::get_unchecked_mut::>) { // at $DIR/slice_index.rs:26:11: 26:35 + debug self => _1; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + debug index => _2; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + let mut _3: *mut [u32]; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + let mut _4: *mut [u32]; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + scope 2 { + scope 3 (inlined as SliceIndex<[u32]>>::get_unchecked_mut) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL + debug self => _2; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug slice => _4; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let _5: std::ops::Range; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _7: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _8: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _9: *mut u32; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _10: *mut u32; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _11: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _12: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _13: std::ops::Range; // in scope 3 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + let mut _14: *mut [u32]; // in scope 3 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 4 { + debug this => _5; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL + scope 5 { + let _6: usize; // in scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + scope 6 { + debug new_len => _6; // in scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + scope 11 (inlined ptr::mut_ptr::::as_mut_ptr) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug self => _4; // in scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + } + scope 12 (inlined ptr::mut_ptr::::add) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug self => _10; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug count => _11; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 13 { + } + } + scope 14 (inlined slice_from_raw_parts_mut::) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug data => _9; // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug len => _12; // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + let mut _16: *mut (); // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + scope 15 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug self => _9; // in scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + } + scope 16 (inlined std::ptr::from_raw_parts_mut::<[u32]>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug data_address => _16; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + debug metadata => _12; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + let mut _17: std::ptr::metadata::PtrRepr<[u32]>; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + let mut _18: std::ptr::metadata::PtrComponents<[u32]>; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + let mut _19: *const (); // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + scope 17 { + } + } + } + } + scope 7 (inlined as SliceIndex<[T]>>::get_unchecked_mut::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug this => _13; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug slice => _14; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 8 (inlined ptr::mut_ptr::::len) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug self => _14; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + let mut _15: *const [u32]; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 9 (inlined std::ptr::metadata::<[u32]>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug ptr => _15; // in scope 9 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + scope 10 { + } + } + } + } + } + } + } + } + } + + bb0: { + StorageLive(_3); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_4); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _4 = &raw mut (*_1); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_5); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_13); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_14); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_15); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_6); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_7); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _7 = (_2.1: usize); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_8); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _8 = (_2.0: usize); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _6 = unchecked_sub::(move _7, move _8) -> [return: bb1, unwind unreachable]; // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/slice/index.rs:LL:COL + // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(usize, usize) -> usize {unchecked_sub::}, val: Value() } + } + + bb1: { + StorageDead(_8); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_7); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_9); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_10); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _10 = _4 as *mut u32 (PtrToPtr); // scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + StorageLive(_11); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _11 = (_2.0: usize); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _9 = Offset(_10, _11); // scope 13 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + StorageDead(_11); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_10); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_12); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _12 = _6; // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_16); // scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + _16 = _9 as *mut () (PtrToPtr); // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + StorageLive(_17); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageLive(_18); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageLive(_19); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _19 = _16 as *const () (Pointer(MutToConstPointer)); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _18 = ptr::metadata::PtrComponents::<[u32]> { data_address: move _19, metadata: _12 }; // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_19); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _17 = ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _18 }; // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_18); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _3 = (_17.1: *mut [u32]); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_17); // scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_16); // scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + StorageDead(_12); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_9); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_6); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_15); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_14); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_13); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_5); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_4); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _0 = &mut (*_3); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_3); // scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + return; // scope 0 at $DIR/slice_index.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.mir new file mode 100644 index 000000000..dcf79a4a4 --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.mir @@ -0,0 +1,26 @@ +// MIR for `slice_index_range` after PreCodegen + +fn slice_index_range(_1: &[u32], _2: std::ops::Range) -> &[u32] { + debug slice => _1; // in scope 0 at $DIR/slice_index.rs:+0:26: +0:31 + debug index => _2; // in scope 0 at $DIR/slice_index.rs:+0:41: +0:46 + let mut _0: &[u32]; // return place in scope 0 at $DIR/slice_index.rs:+0:65: +0:71 + scope 1 (inlined #[track_caller] core::slice::index::> for [u32]>::index) { // at $DIR/slice_index.rs:21:6: 21:18 + debug self => _1; // in scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug index => _2; // in scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let _3: &[u32]; // in scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL + } + + bb0: { + StorageLive(_3); // scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _3 = as SliceIndex<[u32]>>::index(move _2, _1) -> bb1; // scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/slice/index.rs:LL:COL + // + literal: Const { ty: for<'a> fn(std::ops::Range, &'a [u32]) -> &'a as SliceIndex<[u32]>>::Output { as SliceIndex<[u32]>>::index}, val: Value() } + } + + bb1: { + _0 = _3; // scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_3); // scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL + return; // scope 0 at $DIR/slice_index.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.mir new file mode 100644 index 000000000..6cc0ee057 --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.mir @@ -0,0 +1,20 @@ +// MIR for `slice_index_usize` after PreCodegen + +fn slice_index_usize(_1: &[u32], _2: usize) -> u32 { + debug slice => _1; // in scope 0 at $DIR/slice_index.rs:+0:26: +0:31 + debug index => _2; // in scope 0 at $DIR/slice_index.rs:+0:41: +0:46 + let mut _0: u32; // return place in scope 0 at $DIR/slice_index.rs:+0:58: +0:61 + let mut _3: usize; // in scope 0 at $DIR/slice_index.rs:+1:5: +1:17 + let mut _4: bool; // in scope 0 at $DIR/slice_index.rs:+1:5: +1:17 + + bb0: { + _3 = Len((*_1)); // scope 0 at $DIR/slice_index.rs:+1:5: +1:17 + _4 = Lt(_2, _3); // scope 0 at $DIR/slice_index.rs:+1:5: +1:17 + assert(move _4, "index out of bounds: the length is {} but the index is {}", move _3, _2) -> bb1; // scope 0 at $DIR/slice_index.rs:+1:5: +1:17 + } + + bb1: { + _0 = (*_1)[_2]; // scope 0 at $DIR/slice_index.rs:+1:5: +1:17 + return; // scope 0 at $DIR/slice_index.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir new file mode 100644 index 000000000..0da7e5536 --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.mir @@ -0,0 +1,203 @@ +// MIR for `forward_loop` after PreCodegen + +fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { + debug slice => _1; // in scope 0 at $DIR/slice_iter.rs:+0:28: +0:33 + debug f => _2; // in scope 0 at $DIR/slice_iter.rs:+0:44: +0:45 + let mut _0: (); // return place in scope 0 at $DIR/slice_iter.rs:+0:60: +0:60 + let mut _3: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + let mut _4: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + let _5: (); // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + let mut _6: std::option::Option<&T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + let mut _7: &mut std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + let mut _8: isize; // in scope 0 at $DIR/slice_iter.rs:+1:5: +3:6 + let mut _10: &impl Fn(&T); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:10 + let mut _11: (&T,); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:13 + scope 1 { + debug iter => _4; // in scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 + let _9: &T; // in scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 + scope 2 { + debug x => _9; // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10 + } + } + scope 3 (inlined core::slice::::iter) { // at $DIR/slice_iter.rs:28:20: 28:26 + debug self => _1; // in scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + scope 4 (inlined std::slice::Iter::<'_, T>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL + debug slice => _1; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let _12: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _14: bool; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _15: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _16: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _17: std::ptr::NonNull; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _18: *mut T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _19: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 5 { + debug ptr => _12; // in scope 5 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 6 { + let _13: *const T; // in scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 7 { + debug end => _13; // in scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 13 (inlined NonNull::::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug ptr => _18; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _21: *const T; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _22: *mut T; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 14 { + scope 15 (inlined NonNull::::new_unchecked::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug ptr => _22; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 16 (inlined ptr::mut_ptr::::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + debug self => _22; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + let mut _23: *mut u8; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 17 { + scope 18 (inlined ptr::mut_ptr::::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug ptr => _23; // in scope 18 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 19 (inlined ptr::mut_ptr::::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _23; // in scope 19 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 20 { + scope 21 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _23; // in scope 21 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + } + } + } + } + } + } + } + } + } + } + scope 9 (inlined invalid::) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug addr => _15; // in scope 9 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + scope 10 { + } + } + scope 11 (inlined ptr::const_ptr::::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug self => _12; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + debug count => _16; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + scope 12 { + } + } + } + } + scope 8 (inlined core::slice::::as_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug self => _1; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + let mut _20: *const [T]; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + } + } + } + scope 22 (inlined as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:28:14: 28:26 + debug self => _3; // in scope 22 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + + bb0: { + StorageLive(_12); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_20); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _20 = &raw const (*_1); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _12 = move _20 as *const T (PtrToPtr); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_20); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_13); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_14); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _14 = const _; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + switchInt(move _14) -> [0: bb11, otherwise: bb10]; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb1: { + StorageLive(_6); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 + _7 = &mut _4; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 + _6 = as Iterator>::next(_7) -> [return: bb2, unwind: bb8]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 + // mir::Constant + // + span: $DIR/slice_iter.rs:28:14: 28:26 + // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, T>) -> Option< as Iterator>::Item> { as Iterator>::next}, val: Value() } + } + + bb2: { + _8 = discriminant(_6); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 + switchInt(move _8) -> [0: bb5, 1: bb3, otherwise: bb4]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 + } + + bb3: { + _9 = ((_6 as Some).0: &T); // scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 + StorageLive(_10); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10 + _10 = &_2; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10 + StorageLive(_11); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 + _11 = (_9,); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 + _5 = >::call(move _10, move _11) -> [return: bb6, unwind: bb8]; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 + // mir::Constant + // + span: $DIR/slice_iter.rs:29:9: 29:10 + // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(&T), (&T,)) -> >::Output {>::call}, val: Value() } + } + + bb4: { + unreachable; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:26 + } + + bb5: { + StorageDead(_6); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6 + StorageDead(_4); // scope 0 at $DIR/slice_iter.rs:+3:5: +3:6 + drop(_2) -> bb7; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2 + } + + bb6: { + StorageDead(_11); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13 + StorageDead(_10); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13 + StorageDead(_6); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6 + goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6 + } + + bb7: { + return; // scope 0 at $DIR/slice_iter.rs:+4:2: +4:2 + } + + bb8 (cleanup): { + drop(_2) -> [return: bb9, unwind terminate]; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2 + } + + bb9 (cleanup): { + resume; // scope 0 at $DIR/slice_iter.rs:+0:1: +4:2 + } + + bb10: { + StorageLive(_15); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _15 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _13 = _15 as *const T (Transmute); // scope 10 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + StorageDead(_15); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb12; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb11: { + StorageLive(_16); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _16 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _13 = Offset(_12, _16); // scope 12 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + StorageDead(_16); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb12; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb12: { + StorageDead(_14); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_17); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_18); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _18 = _12 as *mut T (PtrToPtr); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_21); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_22); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_23); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _21 = _18 as *const T (Pointer(MutToConstPointer)); // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + _17 = NonNull:: { pointer: _21 }; // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + StorageDead(_23); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_22); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_21); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_18); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_19); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _19 = _13; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _3 = std::slice::Iter::<'_, T> { ptr: move _17, end: move _19, _marker: const ZeroSized: PhantomData<&T> }; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + // mir::Constant + // + span: no-location + // + literal: Const { ty: PhantomData<&T>, val: Value() } + // adt + // + user_ty: UserType(1) + StorageDead(_19); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_17); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_13); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_12); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_4); // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + _4 = move _3; // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6 + } +} diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir new file mode 100644 index 000000000..45b41b54c --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.mir @@ -0,0 +1,220 @@ +// MIR for `reverse_loop` after PreCodegen + +fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { + debug slice => _1; // in scope 0 at $DIR/slice_iter.rs:+0:28: +0:33 + debug f => _2; // in scope 0 at $DIR/slice_iter.rs:+0:44: +0:45 + let mut _0: (); // return place in scope 0 at $DIR/slice_iter.rs:+0:60: +0:60 + let mut _3: std::iter::Rev>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 + let mut _4: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + let mut _5: std::iter::Rev>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 + let _6: (); // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 + let mut _7: std::option::Option<&T>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 + let mut _8: &mut std::iter::Rev>; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 + let mut _9: isize; // in scope 0 at $DIR/slice_iter.rs:+1:5: +3:6 + let mut _11: &impl Fn(&T); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:10 + let mut _12: (&T,); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:13 + scope 1 { + debug iter => _5; // in scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 + let _10: &T; // in scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 + scope 2 { + debug x => _10; // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10 + } + scope 25 (inlined > as Iterator>::next) { // at $DIR/slice_iter.rs:35:14: 35:32 + debug self => _8; // in scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + let mut _25: &mut std::slice::Iter<'_, T>; // in scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + } + } + scope 3 (inlined core::slice::::iter) { // at $DIR/slice_iter.rs:35:20: 35:26 + debug self => _1; // in scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + scope 4 (inlined std::slice::Iter::<'_, T>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL + debug slice => _1; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let _13: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _15: bool; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _16: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _17: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _18: std::ptr::NonNull; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _19: *mut T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _20: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 5 { + debug ptr => _13; // in scope 5 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 6 { + let _14: *const T; // in scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 7 { + debug end => _14; // in scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 13 (inlined NonNull::::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug ptr => _19; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _22: *const T; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _23: *mut T; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 14 { + scope 15 (inlined NonNull::::new_unchecked::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug ptr => _23; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 16 (inlined ptr::mut_ptr::::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + debug self => _23; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + let mut _24: *mut u8; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 17 { + scope 18 (inlined ptr::mut_ptr::::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug ptr => _24; // in scope 18 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 19 (inlined ptr::mut_ptr::::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _24; // in scope 19 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 20 { + scope 21 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _24; // in scope 21 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + } + } + } + } + } + } + } + } + } + } + scope 9 (inlined invalid::) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug addr => _16; // in scope 9 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + scope 10 { + } + } + scope 11 (inlined ptr::const_ptr::::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug self => _13; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + debug count => _17; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + scope 12 { + } + } + } + } + scope 8 (inlined core::slice::::as_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug self => _1; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + let mut _21: *const [T]; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + } + } + } + scope 22 (inlined as Iterator>::rev) { // at $DIR/slice_iter.rs:35:27: 35:32 + debug self => _4; // in scope 22 at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + scope 23 (inlined Rev::>::new) { // at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + debug iter => _4; // in scope 23 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + } + } + scope 24 (inlined > as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:35:14: 35:32 + debug self => _3; // in scope 24 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + + bb0: { + StorageLive(_4); // scope 0 at $DIR/slice_iter.rs:+1:14: +1:26 + StorageLive(_13); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_21); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _21 = &raw const (*_1); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _13 = move _21 as *const T (PtrToPtr); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_21); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_14); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_15); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _15 = const _; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + switchInt(move _15) -> [0: bb10, otherwise: bb9]; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb1: { + StorageLive(_7); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 + _8 = &mut _5; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 + StorageLive(_25); // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + _25 = &mut ((*_8).0: std::slice::Iter<'_, T>); // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + _7 = as DoubleEndedIterator>::next_back(move _25) -> [return: bb12, unwind: bb7]; // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, T>) -> Option< as Iterator>::Item> { as DoubleEndedIterator>::next_back}, val: Value() } + } + + bb2: { + _10 = ((_7 as Some).0: &T); // scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 + StorageLive(_11); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10 + _11 = &_2; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10 + StorageLive(_12); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 + _12 = (_10,); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 + _6 = >::call(move _11, move _12) -> [return: bb5, unwind: bb7]; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:13 + // mir::Constant + // + span: $DIR/slice_iter.rs:36:9: 36:10 + // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(&T), (&T,)) -> >::Output {>::call}, val: Value() } + } + + bb3: { + unreachable; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 + } + + bb4: { + StorageDead(_7); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6 + StorageDead(_5); // scope 0 at $DIR/slice_iter.rs:+3:5: +3:6 + drop(_2) -> bb6; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2 + } + + bb5: { + StorageDead(_12); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13 + StorageDead(_11); // scope 2 at $DIR/slice_iter.rs:+2:12: +2:13 + StorageDead(_7); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6 + goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6 + } + + bb6: { + return; // scope 0 at $DIR/slice_iter.rs:+4:2: +4:2 + } + + bb7 (cleanup): { + drop(_2) -> [return: bb8, unwind terminate]; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2 + } + + bb8 (cleanup): { + resume; // scope 0 at $DIR/slice_iter.rs:+0:1: +4:2 + } + + bb9: { + StorageLive(_16); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _16 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _14 = _16 as *const T (Transmute); // scope 10 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + StorageDead(_16); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb11; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb10: { + StorageLive(_17); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _17 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _14 = Offset(_13, _17); // scope 12 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + StorageDead(_17); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb11; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb11: { + StorageDead(_15); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_18); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_19); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _19 = _13 as *mut T (PtrToPtr); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_22); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_23); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_24); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _22 = _19 as *const T (Pointer(MutToConstPointer)); // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + _18 = NonNull:: { pointer: _22 }; // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + StorageDead(_24); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_23); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_22); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_19); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_20); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _20 = _14; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _4 = std::slice::Iter::<'_, T> { ptr: move _18, end: move _20, _marker: const ZeroSized: PhantomData<&T> }; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + // mir::Constant + // + span: no-location + // + literal: Const { ty: PhantomData<&T>, val: Value() } + // adt + // + user_ty: UserType(1) + StorageDead(_20); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_18); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_14); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_13); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _3 = Rev::> { iter: move _4 }; // scope 23 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + StorageDead(_4); // scope 0 at $DIR/slice_iter.rs:+1:31: +1:32 + StorageLive(_5); // scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 + _5 = move _3; // scope 0 at $DIR/slice_iter.rs:+1:14: +1:32 + goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6 + } + + bb12: { + StorageDead(_25); // scope 25 at $SRC_DIR/core/src/iter/adapters/rev.rs:LL:COL + _9 = discriminant(_7); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 + switchInt(move _9) -> [0: bb4, 1: bb2, otherwise: bb3]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:32 + } +} diff --git a/tests/mir-opt/pre-codegen/slice_iter.rs b/tests/mir-opt/pre-codegen/slice_iter.rs new file mode 100644 index 000000000..ca423ca55 --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_iter.rs @@ -0,0 +1,38 @@ +// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 +// only-64bit +// ignore-debug + +#![crate_type = "lib"] + +// When this test was added, the MIR for `next` was 174 lines just for the basic +// blocks -- far more if you counted the scopes. The goal of having this here +// is to hopefully keep it a reasonable size, ideally eventually small enough +// that the mir inliner would actually be willing to inline it, since it's an +// important building block and usually very few *backend* instructions. + +// As such, feel free to `--bless` whatever changes you get here, so long as +// doing so doesn't add substantially more MIR. + +// EMIT_MIR slice_iter.slice_iter_next.PreCodegen.after.mir +pub fn slice_iter_next<'a, T>(it: &mut std::slice::Iter<'a, T>) -> Option<&'a T> { + it.next() +} + +// EMIT_MIR slice_iter.slice_iter_mut_next_back.PreCodegen.after.mir +pub fn slice_iter_mut_next_back<'a, T>(it: &mut std::slice::IterMut<'a, T>) -> Option<&'a mut T> { + it.next_back() +} + +// EMIT_MIR slice_iter.forward_loop.PreCodegen.after.mir +pub fn forward_loop<'a, T>(slice: &'a [T], f: impl Fn(&T)) { + for x in slice.iter() { + f(x) + } +} + +// EMIT_MIR slice_iter.reverse_loop.PreCodegen.after.mir +pub fn reverse_loop<'a, T>(slice: &'a [T], f: impl Fn(&T)) { + for x in slice.iter().rev() { + f(x) + } +} diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.mir new file mode 100644 index 000000000..a1431d473 --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_mut_next_back.PreCodegen.after.mir @@ -0,0 +1,17 @@ +// MIR for `slice_iter_mut_next_back` after PreCodegen + +fn slice_iter_mut_next_back(_1: &mut std::slice::IterMut<'_, T>) -> Option<&mut T> { + debug it => _1; // in scope 0 at $DIR/slice_iter.rs:+0:40: +0:42 + let mut _0: std::option::Option<&mut T>; // return place in scope 0 at $DIR/slice_iter.rs:+0:80: +0:97 + + bb0: { + _0 = as DoubleEndedIterator>::next_back(_1) -> bb1; // scope 0 at $DIR/slice_iter.rs:+1:5: +1:19 + // mir::Constant + // + span: $DIR/slice_iter.rs:23:8: 23:17 + // + literal: Const { ty: for<'a> fn(&'a mut std::slice::IterMut<'_, T>) -> Option< as Iterator>::Item> { as DoubleEndedIterator>::next_back}, val: Value() } + } + + bb1: { + return; // scope 0 at $DIR/slice_iter.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.mir new file mode 100644 index 000000000..d2a963cad --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_next.PreCodegen.after.mir @@ -0,0 +1,17 @@ +// MIR for `slice_iter_next` after PreCodegen + +fn slice_iter_next(_1: &mut std::slice::Iter<'_, T>) -> Option<&T> { + debug it => _1; // in scope 0 at $DIR/slice_iter.rs:+0:31: +0:33 + let mut _0: std::option::Option<&T>; // return place in scope 0 at $DIR/slice_iter.rs:+0:68: +0:81 + + bb0: { + _0 = as Iterator>::next(_1) -> bb1; // scope 0 at $DIR/slice_iter.rs:+1:5: +1:14 + // mir::Constant + // + span: $DIR/slice_iter.rs:18:8: 18:12 + // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, T>) -> Option< as Iterator>::Item> { as Iterator>::next}, val: Value() } + } + + bb1: { + return; // scope 0 at $DIR/slice_iter.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir new file mode 100644 index 000000000..53971b4cf --- /dev/null +++ b/tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir @@ -0,0 +1,70 @@ +// MIR for `new` after PreCodegen + +fn new(_1: Result) -> Result { + debug x => _1; // in scope 0 at $DIR/try_identity.rs:+0:14: +0:15 + let mut _0: std::result::Result; // return place in scope 0 at $DIR/try_identity.rs:+0:34: +0:46 + let mut _2: std::ops::ControlFlow; // in scope 0 at $DIR/try_identity.rs:+2:15: +7:10 + let mut _3: isize; // in scope 0 at $DIR/try_identity.rs:+4:17: +4:22 + let _4: T; // in scope 0 at $DIR/try_identity.rs:+4:20: +4:21 + let _5: E; // in scope 0 at $DIR/try_identity.rs:+5:21: +5:22 + let mut _6: isize; // in scope 0 at $DIR/try_identity.rs:+8:13: +8:37 + let _7: T; // in scope 0 at $DIR/try_identity.rs:+8:35: +8:36 + let _8: E; // in scope 0 at $DIR/try_identity.rs:+9:32: +9:33 + scope 1 { + debug v => _4; // in scope 1 at $DIR/try_identity.rs:+4:20: +4:21 + } + scope 2 { + debug e => _5; // in scope 2 at $DIR/try_identity.rs:+5:21: +5:22 + } + scope 3 { + debug v => _7; // in scope 3 at $DIR/try_identity.rs:+8:35: +8:36 + } + scope 4 { + debug e => _8; // in scope 4 at $DIR/try_identity.rs:+9:32: +9:33 + } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/try_identity.rs:+2:15: +7:10 + _3 = discriminant(_1); // scope 0 at $DIR/try_identity.rs:+3:19: +3:20 + switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 0 at $DIR/try_identity.rs:+3:13: +3:20 + } + + bb1: { + _5 = move ((_1 as Err).0: E); // scope 0 at $DIR/try_identity.rs:+5:21: +5:22 + _2 = ControlFlow::::Break(move _5); // scope 2 at $DIR/try_identity.rs:+5:27: +5:48 + goto -> bb4; // scope 0 at $DIR/try_identity.rs:+5:47: +5:48 + } + + bb2: { + unreachable; // scope 0 at $DIR/try_identity.rs:+3:19: +3:20 + } + + bb3: { + _4 = move ((_1 as Ok).0: T); // scope 0 at $DIR/try_identity.rs:+4:20: +4:21 + _2 = ControlFlow::::Continue(move _4); // scope 1 at $DIR/try_identity.rs:+4:26: +4:50 + goto -> bb4; // scope 0 at $DIR/try_identity.rs:+4:49: +4:50 + } + + bb4: { + _6 = discriminant(_2); // scope 0 at $DIR/try_identity.rs:+2:15: +7:10 + switchInt(move _6) -> [0: bb6, 1: bb5, otherwise: bb2]; // scope 0 at $DIR/try_identity.rs:+2:9: +7:10 + } + + bb5: { + _8 = move ((_2 as Break).0: E); // scope 0 at $DIR/try_identity.rs:+9:32: +9:33 + _0 = Result::::Err(move _8); // scope 4 at $DIR/try_identity.rs:+9:45: +9:51 + StorageDead(_2); // scope 0 at $DIR/try_identity.rs:+12:1: +12:2 + goto -> bb7; // scope 0 at $DIR/try_identity.rs:+12:1: +12:2 + } + + bb6: { + _7 = move ((_2 as Continue).0: T); // scope 0 at $DIR/try_identity.rs:+8:35: +8:36 + _0 = Result::::Ok(move _7); // scope 0 at $DIR/try_identity.rs:+1:5: +11:6 + StorageDead(_2); // scope 0 at $DIR/try_identity.rs:+12:1: +12:2 + goto -> bb7; // scope 0 at $DIR/try_identity.rs:+12:1: +12:2 + } + + bb7: { + return; // scope 0 at $DIR/try_identity.rs:+12:2: +12:2 + } +} diff --git a/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir new file mode 100644 index 000000000..e217d1994 --- /dev/null +++ b/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir @@ -0,0 +1,40 @@ +// MIR for `old` after PreCodegen + +fn old(_1: Result) -> Result { + debug x => _1; // in scope 0 at $DIR/try_identity.rs:+0:14: +0:15 + let mut _0: std::result::Result; // return place in scope 0 at $DIR/try_identity.rs:+0:34: +0:46 + let mut _2: isize; // in scope 0 at $DIR/try_identity.rs:+3:13: +3:18 + let _3: T; // in scope 0 at $DIR/try_identity.rs:+3:16: +3:17 + let _4: E; // in scope 0 at $DIR/try_identity.rs:+4:17: +4:18 + scope 1 { + debug v => _3; // in scope 1 at $DIR/try_identity.rs:+3:16: +3:17 + } + scope 2 { + debug e => _4; // in scope 2 at $DIR/try_identity.rs:+4:17: +4:18 + } + + bb0: { + _2 = discriminant(_1); // scope 0 at $DIR/try_identity.rs:+2:15: +2:16 + switchInt(move _2) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 0 at $DIR/try_identity.rs:+2:9: +2:16 + } + + bb1: { + _4 = move ((_1 as Err).0: E); // scope 0 at $DIR/try_identity.rs:+4:17: +4:18 + _0 = Result::::Err(move _4); // scope 2 at $DIR/try_identity.rs:+4:30: +4:36 + goto -> bb4; // scope 0 at $DIR/try_identity.rs:+7:1: +7:2 + } + + bb2: { + unreachable; // scope 0 at $DIR/try_identity.rs:+2:15: +2:16 + } + + bb3: { + _3 = move ((_1 as Ok).0: T); // scope 0 at $DIR/try_identity.rs:+3:16: +3:17 + _0 = Result::::Ok(move _3); // scope 0 at $DIR/try_identity.rs:+1:5: +6:6 + goto -> bb4; // scope 0 at $DIR/try_identity.rs:+7:1: +7:2 + } + + bb4: { + return; // scope 0 at $DIR/try_identity.rs:+7:2: +7:2 + } +} diff --git a/tests/mir-opt/pre-codegen/try_identity.rs b/tests/mir-opt/pre-codegen/try_identity.rs new file mode 100644 index 000000000..079ecccab --- /dev/null +++ b/tests/mir-opt/pre-codegen/try_identity.rs @@ -0,0 +1,38 @@ +// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2 +// only-64bit +// ignore-debug + +// Track the status of MIR optimizations simplifying `Ok(res?)` for both the old and new desugarings +// of that syntax. + +use std::ops::ControlFlow; + +// EMIT_MIR try_identity.new.PreCodegen.after.mir +fn new(x: Result) -> Result { + Ok( + match { + match x { + Ok(v) => ControlFlow::Continue(v), + Err(e) => ControlFlow::Break(e), + } + } { + ControlFlow::Continue(v) => v, + ControlFlow::Break(e) => return Err(e), + } + ) +} + +// EMIT_MIR try_identity.old.PreCodegen.after.mir +fn old(x: Result) -> Result { + Ok( + match x { + Ok(v) => v, + Err(e) => return Err(e), + } + ) +} + +fn main() { + let _ = new::<(), ()>(Ok(())); + let _ = old::<(), ()>(Ok(())); +} diff --git a/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff b/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff new file mode 100644 index 000000000..07bd48fc8 --- /dev/null +++ b/tests/mir-opt/reference_prop.debuginfo.ReferencePropagation.diff @@ -0,0 +1,175 @@ +- // MIR for `debuginfo` before ReferencePropagation ++ // MIR for `debuginfo` after ReferencePropagation + + fn debuginfo() -> () { + let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:16: +0:16 + let _1: &mut u8; // in scope 0 at $DIR/reference_prop.rs:+3:9: +3:19 + let mut _2: u8; // in scope 0 at $DIR/reference_prop.rs:+3:27: +3:31 + let _4: debuginfo::T; // in scope 0 at $DIR/reference_prop.rs:+4:18: +4:22 + let _6: (); // in scope 0 at $DIR/reference_prop.rs:+9:5: +12:6 + let mut _7: std::option::Option; // in scope 0 at $DIR/reference_prop.rs:+9:11: +9:18 + let mut _8: isize; // in scope 0 at $DIR/reference_prop.rs:+10:9: +10:13 + let _10: (); // in scope 0 at $DIR/reference_prop.rs:+16:5: +17:6 + let mut _11: &[i32]; // in scope 0 at $DIR/reference_prop.rs:+16:82: +16:94 + let _12: &[i32]; // in scope 0 at $DIR/reference_prop.rs:+16:83: +16:94 + let mut _13: &[i32; 10]; // in scope 0 at $DIR/reference_prop.rs:+16:83: +16:90 + let _14: [i32; 10]; // in scope 0 at $DIR/reference_prop.rs:+16:83: +16:90 + let mut _15: std::ops::RangeFull; // in scope 0 at $DIR/reference_prop.rs:+16:91: +16:93 + let mut _16: usize; // in scope 0 at $DIR/reference_prop.rs:+16:12: +16:79 + let mut _17: usize; // in scope 0 at $DIR/reference_prop.rs:+16:12: +16:79 + let mut _18: bool; // in scope 0 at $DIR/reference_prop.rs:+16:12: +16:79 + let _23: &&mut u8; // in scope 0 at $DIR/reference_prop.rs:+19:28: +19:40 + let _24: &mut u8; // in scope 0 at $DIR/reference_prop.rs:+19:29: +19:40 + let mut _25: debuginfo::T; // in scope 0 at $DIR/reference_prop.rs:+19:34: +19:38 + scope 1 { +- debug ref_mut_u8 => _1; // in scope 1 at $DIR/reference_prop.rs:+3:9: +3:19 ++ debug ref_mut_u8 => &_2; // in scope 1 at $DIR/reference_prop.rs:+3:9: +3:19 + let _3: &u8; // in scope 1 at $DIR/reference_prop.rs:+4:9: +4:14 + let mut _28: &debuginfo::T; // in scope 1 at $DIR/reference_prop.rs:+4:17: +4:24 + scope 2 { +- debug field => _3; // in scope 2 at $DIR/reference_prop.rs:+4:9: +4:14 ++ debug field => &((*_28).0: u8); // in scope 2 at $DIR/reference_prop.rs:+4:9: +4:14 + let _5: &u8; // in scope 2 at $DIR/reference_prop.rs:+7:9: +7:17 + scope 3 { +- debug reborrow => _5; // in scope 3 at $DIR/reference_prop.rs:+7:9: +7:17 ++ debug reborrow => &_2; // in scope 3 at $DIR/reference_prop.rs:+7:9: +7:17 + let _9: &i32; // in scope 3 at $DIR/reference_prop.rs:+11:14: +11:31 + let _22: &&&mut u8; // in scope 3 at $DIR/reference_prop.rs:+19:9: +19:24 + let mut _27: &std::option::Option; // in scope 3 at $DIR/reference_prop.rs:+11:14: +11:31 + scope 4 { +- debug variant_field => _9; // in scope 4 at $DIR/reference_prop.rs:+11:14: +11:31 ++ debug variant_field => &(((*_27) as Some).0: i32); // in scope 4 at $DIR/reference_prop.rs:+11:14: +11:31 + } + scope 5 { +- debug constant_index => _19; // in scope 5 at $DIR/reference_prop.rs:+16:16: +16:34 ++ debug constant_index => &(*_11)[1 of 3]; // in scope 5 at $DIR/reference_prop.rs:+16:16: +16:34 + debug subslice => _20; // in scope 5 at $DIR/reference_prop.rs:+16:36: +16:44 + debug constant_index_from_end => _21; // in scope 5 at $DIR/reference_prop.rs:+16:51: +16:78 + let _19: &i32; // in scope 5 at $DIR/reference_prop.rs:+16:16: +16:34 + let _20: &[i32]; // in scope 5 at $DIR/reference_prop.rs:+16:36: +16:44 + let _21: &i32; // in scope 5 at $DIR/reference_prop.rs:+16:51: +16:78 + let mut _26: &[i32; 10]; // in scope 5 at $DIR/reference_prop.rs:+16:83: +16:90 + } + scope 6 { +- debug multiple_borrow => _22; // in scope 6 at $DIR/reference_prop.rs:+19:9: +19:24 ++ debug multiple_borrow => &&&(_25.0: u8); // in scope 6 at $DIR/reference_prop.rs:+19:9: +19:24 + } + } + } + } + + bb0: { +- StorageLive(_1); // scope 0 at $DIR/reference_prop.rs:+3:9: +3:19 + StorageLive(_2); // scope 0 at $DIR/reference_prop.rs:+3:27: +3:31 + _2 = const 5_u8; // scope 0 at $DIR/reference_prop.rs:+3:27: +3:31 +- _1 = &mut _2; // scope 0 at $DIR/reference_prop.rs:+3:22: +3:31 +- StorageLive(_3); // scope 1 at $DIR/reference_prop.rs:+4:9: +4:14 + _28 = const _; // scope 1 at $DIR/reference_prop.rs:+4:17: +4:24 + // mir::Constant + // + span: $DIR/reference_prop.rs:535:17: 535:24 + // + literal: Const { ty: &T, val: Unevaluated(debuginfo, [], Some(promoted[2])) } +- _3 = &((*_28).0: u8); // scope 1 at $DIR/reference_prop.rs:+4:17: +4:24 +- StorageLive(_5); // scope 2 at $DIR/reference_prop.rs:+7:9: +7:17 +- _5 = &(*_1); // scope 2 at $DIR/reference_prop.rs:+7:20: +7:32 +- StorageLive(_6); // scope 3 at $DIR/reference_prop.rs:+9:5: +12:6 + StorageLive(_7); // scope 3 at $DIR/reference_prop.rs:+9:11: +9:18 + _7 = Option::::Some(const 0_i32); // scope 3 at $DIR/reference_prop.rs:+9:11: +9:18 + _8 = discriminant(_7); // scope 3 at $DIR/reference_prop.rs:+9:11: +9:18 + switchInt(move _8) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 3 at $DIR/reference_prop.rs:+9:5: +9:18 + } + + bb1: { +- StorageLive(_9); // scope 3 at $DIR/reference_prop.rs:+11:14: +11:31 + _27 = const _; // scope 3 at $DIR/reference_prop.rs:+11:14: +11:31 + // mir::Constant + // + span: $DIR/reference_prop.rs:542:14: 542:31 + // + literal: Const { ty: &Option, val: Unevaluated(debuginfo, [], Some(promoted[1])) } +- _9 = &(((*_27) as Some).0: i32); // scope 3 at $DIR/reference_prop.rs:+11:14: +11:31 +- _6 = const (); // scope 4 at $DIR/reference_prop.rs:+11:36: +11:38 +- StorageDead(_9); // scope 3 at $DIR/reference_prop.rs:+11:37: +11:38 + goto -> bb4; // scope 3 at $DIR/reference_prop.rs:+11:37: +11:38 + } + + bb2: { + unreachable; // scope 3 at $DIR/reference_prop.rs:+9:11: +9:18 + } + + bb3: { +- _6 = const (); // scope 3 at $DIR/reference_prop.rs:+10:17: +10:19 + goto -> bb4; // scope 3 at $DIR/reference_prop.rs:+10:17: +10:19 + } + + bb4: { + StorageDead(_7); // scope 3 at $DIR/reference_prop.rs:+12:5: +12:6 +- StorageDead(_6); // scope 3 at $DIR/reference_prop.rs:+12:5: +12:6 +- StorageLive(_10); // scope 3 at $DIR/reference_prop.rs:+16:5: +17:6 + StorageLive(_11); // scope 5 at $DIR/reference_prop.rs:+16:82: +16:94 + StorageLive(_12); // scope 5 at $DIR/reference_prop.rs:+16:83: +16:94 + StorageLive(_13); // scope 5 at $DIR/reference_prop.rs:+16:83: +16:90 + _26 = const _; // scope 5 at $DIR/reference_prop.rs:+16:83: +16:90 + // mir::Constant + // + span: $DIR/reference_prop.rs:547:83: 547:90 + // + literal: Const { ty: &[i32; 10], val: Unevaluated(debuginfo, [], Some(promoted[0])) } + _13 = &(*_26); // scope 5 at $DIR/reference_prop.rs:+16:83: +16:90 + StorageLive(_15); // scope 5 at $DIR/reference_prop.rs:+16:91: +16:93 + _15 = RangeFull; // scope 5 at $DIR/reference_prop.rs:+16:91: +16:93 + _12 = <[i32; 10] as Index>::index(move _13, move _15) -> bb5; // scope 5 at $DIR/reference_prop.rs:+16:83: +16:94 + // mir::Constant + // + span: $DIR/reference_prop.rs:547:83: 547:94 + // + literal: Const { ty: for<'a> fn(&'a [i32; 10], RangeFull) -> &'a <[i32; 10] as Index>::Output {<[i32; 10] as Index>::index}, val: Value() } + } + + bb5: { + StorageDead(_15); // scope 5 at $DIR/reference_prop.rs:+16:93: +16:94 + StorageDead(_13); // scope 5 at $DIR/reference_prop.rs:+16:93: +16:94 + _11 = &(*_12); // scope 5 at $DIR/reference_prop.rs:+16:82: +16:94 + _16 = Len((*_11)); // scope 5 at $DIR/reference_prop.rs:+16:12: +16:79 + _17 = const 3_usize; // scope 5 at $DIR/reference_prop.rs:+16:12: +16:79 + _18 = Ge(move _16, move _17); // scope 5 at $DIR/reference_prop.rs:+16:12: +16:79 + switchInt(move _18) -> [0: bb7, otherwise: bb6]; // scope 5 at $DIR/reference_prop.rs:+16:12: +16:79 + } + + bb6: { +- StorageLive(_19); // scope 5 at $DIR/reference_prop.rs:+16:16: +16:34 +- _19 = &(*_11)[1 of 3]; // scope 5 at $DIR/reference_prop.rs:+16:16: +16:34 + StorageLive(_20); // scope 5 at $DIR/reference_prop.rs:+16:36: +16:44 + _20 = &(*_11)[2:-1]; // scope 5 at $DIR/reference_prop.rs:+16:36: +16:44 + StorageLive(_21); // scope 5 at $DIR/reference_prop.rs:+16:51: +16:78 + _21 = &(*_11)[-1 of 3]; // scope 5 at $DIR/reference_prop.rs:+16:51: +16:78 +- _10 = const (); // scope 5 at $DIR/reference_prop.rs:+16:95: +17:6 + StorageDead(_21); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6 + StorageDead(_20); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6 +- StorageDead(_19); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6 + goto -> bb8; // scope 3 at $DIR/reference_prop.rs:+16:5: +17:6 + } + + bb7: { +- _10 = const (); // scope 3 at $DIR/reference_prop.rs:+17:6: +17:6 + goto -> bb8; // scope 3 at $DIR/reference_prop.rs:+16:5: +17:6 + } + + bb8: { + StorageDead(_12); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6 + StorageDead(_11); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6 +- StorageDead(_10); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6 +- StorageLive(_22); // scope 3 at $DIR/reference_prop.rs:+19:9: +19:24 +- StorageLive(_23); // scope 3 at $DIR/reference_prop.rs:+19:28: +19:40 +- StorageLive(_24); // scope 3 at $DIR/reference_prop.rs:+19:29: +19:40 + StorageLive(_25); // scope 3 at $DIR/reference_prop.rs:+19:34: +19:38 + _25 = T(const 6_u8); // scope 3 at $DIR/reference_prop.rs:+19:34: +19:38 +- _24 = &mut (_25.0: u8); // scope 3 at $DIR/reference_prop.rs:+19:29: +19:40 +- _23 = &_24; // scope 3 at $DIR/reference_prop.rs:+19:28: +19:40 +- _22 = &_23; // scope 3 at $DIR/reference_prop.rs:+19:27: +19:40 + _0 = const (); // scope 0 at $DIR/reference_prop.rs:+0:16: +20:2 + StorageDead(_25); // scope 3 at $DIR/reference_prop.rs:+20:1: +20:2 +- StorageDead(_24); // scope 3 at $DIR/reference_prop.rs:+20:1: +20:2 +- StorageDead(_23); // scope 3 at $DIR/reference_prop.rs:+20:1: +20:2 +- StorageDead(_22); // scope 3 at $DIR/reference_prop.rs:+20:1: +20:2 +- StorageDead(_5); // scope 2 at $DIR/reference_prop.rs:+20:1: +20:2 +- StorageDead(_3); // scope 1 at $DIR/reference_prop.rs:+20:1: +20:2 + StorageDead(_2); // scope 0 at $DIR/reference_prop.rs:+20:1: +20:2 +- StorageDead(_1); // scope 0 at $DIR/reference_prop.rs:+20:1: +20:2 + return; // scope 0 at $DIR/reference_prop.rs:+20:2: +20:2 + } + } + diff --git a/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff b/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff new file mode 100644 index 000000000..e158f64e9 --- /dev/null +++ b/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff @@ -0,0 +1,38 @@ +- // MIR for `dominate_storage` before ReferencePropagation ++ // MIR for `dominate_storage` after ReferencePropagation + + fn dominate_storage() -> () { + let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:23: +0:23 + let mut _1: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _2: &i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _3: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _4: bool; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _5: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _6: bool; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + + bb0: { + goto -> bb1; // scope 0 at $DIR/reference_prop.rs:+8:11: +8:20 + } + + bb1: { + _1 = const 5_i32; // scope 0 at $DIR/reference_prop.rs:+10:13: +10:18 + _2 = &_1; // scope 0 at $DIR/reference_prop.rs:+11:13: +11:19 + goto -> bb2; // scope 0 at $DIR/reference_prop.rs:+12:13: +12:22 + } + + bb2: { + _5 = (*_2); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + _0 = opaque::(_5) -> bb3; // scope 0 at $DIR/reference_prop.rs:+16:13: +16:38 + // mir::Constant + // + span: $DIR/reference_prop.rs:455:28: 455:34 + // + literal: Const { ty: fn(i32) {opaque::}, val: Value() } + } + + bb3: { + StorageDead(_1); // scope 0 at $DIR/reference_prop.rs:+19:13: +19:27 + StorageLive(_1); // scope 0 at $DIR/reference_prop.rs:+20:13: +20:27 + _6 = const true; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + switchInt(_6) -> [0: bb3, otherwise: bb1]; // scope 0 at $DIR/reference_prop.rs:+22:13: +22:47 + } + } + diff --git a/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff b/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff new file mode 100644 index 000000000..38ab16ced --- /dev/null +++ b/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff @@ -0,0 +1,56 @@ +- // MIR for `maybe_dead` before ReferencePropagation ++ // MIR for `maybe_dead` after ReferencePropagation + + fn maybe_dead(_1: bool) -> () { + let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:24: +0:24 + let mut _2: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _3: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _4: &i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _5: &mut i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _6: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _7: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _8: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + + bb0: { + StorageLive(_2); // scope 0 at $DIR/reference_prop.rs:+7:13: +7:27 + StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+8:13: +8:27 + _2 = const 5_i32; // scope 0 at $DIR/reference_prop.rs:+9:13: +9:18 + _3 = const 5_i32; // scope 0 at $DIR/reference_prop.rs:+10:13: +10:18 + _4 = &_2; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + _5 = &mut _3; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + (*_5) = const 7_i32; // scope 0 at $DIR/reference_prop.rs:+14:13: +14:19 +- _6 = (*_4); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL ++ _6 = _2; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + switchInt(_1) -> [1: bb1, otherwise: bb2]; // scope 0 at $DIR/reference_prop.rs:+17:13: +17:46 + } + + bb1: { + StorageDead(_2); // scope 0 at $DIR/reference_prop.rs:+20:13: +20:27 + StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+21:13: +21:27 + _0 = opaque::(_6) -> bb2; // scope 0 at $DIR/reference_prop.rs:+22:13: +22:38 + // mir::Constant + // + span: $DIR/reference_prop.rs:489:28: 489:34 + // + literal: Const { ty: fn(i32) {opaque::}, val: Value() } + } + + bb2: { + _7 = (*_4); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + _0 = opaque::(_7) -> bb3; // scope 0 at $DIR/reference_prop.rs:+27:13: +27:38 + // mir::Constant + // + span: $DIR/reference_prop.rs:494:28: 494:34 + // + literal: Const { ty: fn(i32) {opaque::}, val: Value() } + } + + bb3: { + _8 = (*_5); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + _0 = opaque::(_8) -> bb4; // scope 0 at $DIR/reference_prop.rs:+33:13: +33:43 + // mir::Constant + // + span: $DIR/reference_prop.rs:500:33: 500:39 + // + literal: Const { ty: fn(i32) {opaque::}, val: Value() } + } + + bb4: { + return; // scope 0 at $DIR/reference_prop.rs:+36:13: +36:21 + } + } + diff --git a/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff b/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff new file mode 100644 index 000000000..6e4517868 --- /dev/null +++ b/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff @@ -0,0 +1,27 @@ +- // MIR for `multiple_storage` before ReferencePropagation ++ // MIR for `multiple_storage` after ReferencePropagation + + fn multiple_storage() -> () { + let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:23: +0:23 + let mut _1: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _2: &i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _3: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + + bb0: { + StorageLive(_1); // scope 0 at $DIR/reference_prop.rs:+6:13: +6:27 + _1 = const 5_i32; // scope 0 at $DIR/reference_prop.rs:+7:13: +7:18 + _2 = &_1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + StorageDead(_1); // scope 0 at $DIR/reference_prop.rs:+9:13: +9:27 + StorageLive(_1); // scope 0 at $DIR/reference_prop.rs:+10:13: +10:27 + _3 = (*_2); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + _0 = opaque::(_3) -> bb1; // scope 0 at $DIR/reference_prop.rs:+14:13: +14:43 + // mir::Constant + // + span: $DIR/reference_prop.rs:429:33: 429:39 + // + literal: Const { ty: fn(i32) {opaque::}, val: Value() } + } + + bb1: { + return; // scope 0 at $DIR/reference_prop.rs:+18:13: +18:21 + } + } + diff --git a/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff new file mode 100644 index 000000000..d99e11035 --- /dev/null +++ b/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff @@ -0,0 +1,75 @@ +- // MIR for `mut_raw_then_mut_shr` before ReferencePropagation ++ // MIR for `mut_raw_then_mut_shr` after ReferencePropagation + + fn mut_raw_then_mut_shr() -> (i32, i32) { + let mut _0: (i32, i32); // return place in scope 0 at $DIR/reference_prop.rs:+0:30: +0:40 + let mut _1: i32; // in scope 0 at $DIR/reference_prop.rs:+1:9: +1:14 + let mut _4: *mut i32; // in scope 0 at $DIR/reference_prop.rs:+3:16: +3:36 + let mut _5: &mut i32; // in scope 0 at $DIR/reference_prop.rs:+3:16: +3:26 + let _8: (); // in scope 0 at $DIR/reference_prop.rs:+7:5: +7:26 + let mut _9: i32; // in scope 0 at $DIR/reference_prop.rs:+8:6: +8:7 + let mut _10: i32; // in scope 0 at $DIR/reference_prop.rs:+8:9: +8:10 + scope 1 { + debug x => _1; // in scope 1 at $DIR/reference_prop.rs:+1:9: +1:14 + let _2: &mut i32; // in scope 1 at $DIR/reference_prop.rs:+2:9: +2:13 + scope 2 { +- debug xref => _2; // in scope 2 at $DIR/reference_prop.rs:+2:9: +2:13 ++ debug xref => &_1; // in scope 2 at $DIR/reference_prop.rs:+2:9: +2:13 + let _3: *mut i32; // in scope 2 at $DIR/reference_prop.rs:+3:9: +3:13 + scope 3 { +- debug xraw => _3; // in scope 3 at $DIR/reference_prop.rs:+3:9: +3:13 ++ debug xraw => &_1; // in scope 3 at $DIR/reference_prop.rs:+3:9: +3:13 + let _6: &i32; // in scope 3 at $DIR/reference_prop.rs:+4:9: +4:13 + scope 4 { +- debug xshr => _6; // in scope 4 at $DIR/reference_prop.rs:+4:9: +4:13 ++ debug xshr => &_1; // in scope 4 at $DIR/reference_prop.rs:+4:9: +4:13 + let _7: i32; // in scope 4 at $DIR/reference_prop.rs:+6:9: +6:10 + scope 5 { + debug a => _7; // in scope 5 at $DIR/reference_prop.rs:+6:9: +6:10 + scope 6 { + } + } + } + } + } + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/reference_prop.rs:+1:9: +1:14 + _1 = const 2_i32; // scope 0 at $DIR/reference_prop.rs:+1:17: +1:18 +- StorageLive(_2); // scope 1 at $DIR/reference_prop.rs:+2:9: +2:13 +- _2 = &mut _1; // scope 1 at $DIR/reference_prop.rs:+2:16: +2:22 +- StorageLive(_3); // scope 2 at $DIR/reference_prop.rs:+3:9: +3:13 +- StorageLive(_4); // scope 2 at $DIR/reference_prop.rs:+3:16: +3:36 +- StorageLive(_5); // scope 2 at $DIR/reference_prop.rs:+3:16: +3:26 +- _5 = &mut (*_2); // scope 2 at $DIR/reference_prop.rs:+3:16: +3:26 +- _4 = &raw mut (*_5); // scope 2 at $DIR/reference_prop.rs:+3:16: +3:26 +- _3 = _4; // scope 2 at $DIR/reference_prop.rs:+3:16: +3:36 +- StorageDead(_5); // scope 2 at $DIR/reference_prop.rs:+3:36: +3:37 +- StorageDead(_4); // scope 2 at $DIR/reference_prop.rs:+3:36: +3:37 +- StorageLive(_6); // scope 3 at $DIR/reference_prop.rs:+4:9: +4:13 +- _6 = &(*_2); // scope 3 at $DIR/reference_prop.rs:+4:16: +4:22 + StorageLive(_7); // scope 4 at $DIR/reference_prop.rs:+6:9: +6:10 +- _7 = (*_6); // scope 4 at $DIR/reference_prop.rs:+6:13: +6:18 +- StorageLive(_8); // scope 5 at $DIR/reference_prop.rs:+7:5: +7:26 +- (*_3) = const 4_i32; // scope 6 at $DIR/reference_prop.rs:+7:14: +7:23 +- _8 = const (); // scope 6 at $DIR/reference_prop.rs:+7:5: +7:26 +- StorageDead(_8); // scope 5 at $DIR/reference_prop.rs:+7:25: +7:26 ++ _7 = _1; // scope 4 at $DIR/reference_prop.rs:+6:13: +6:18 ++ _1 = const 4_i32; // scope 6 at $DIR/reference_prop.rs:+7:14: +7:23 + StorageLive(_9); // scope 5 at $DIR/reference_prop.rs:+8:6: +8:7 + _9 = _7; // scope 5 at $DIR/reference_prop.rs:+8:6: +8:7 + StorageLive(_10); // scope 5 at $DIR/reference_prop.rs:+8:9: +8:10 + _10 = _1; // scope 5 at $DIR/reference_prop.rs:+8:9: +8:10 + _0 = (move _9, move _10); // scope 5 at $DIR/reference_prop.rs:+8:5: +8:11 + StorageDead(_10); // scope 5 at $DIR/reference_prop.rs:+8:10: +8:11 + StorageDead(_9); // scope 5 at $DIR/reference_prop.rs:+8:10: +8:11 + StorageDead(_7); // scope 4 at $DIR/reference_prop.rs:+9:1: +9:2 +- StorageDead(_6); // scope 3 at $DIR/reference_prop.rs:+9:1: +9:2 +- StorageDead(_3); // scope 2 at $DIR/reference_prop.rs:+9:1: +9:2 +- StorageDead(_2); // scope 1 at $DIR/reference_prop.rs:+9:1: +9:2 + StorageDead(_1); // scope 0 at $DIR/reference_prop.rs:+9:1: +9:2 + return; // scope 0 at $DIR/reference_prop.rs:+9:2: +9:2 + } + } + diff --git a/tests/mir-opt/reference_prop.read_through_raw.ReferencePropagation.diff b/tests/mir-opt/reference_prop.read_through_raw.ReferencePropagation.diff new file mode 100644 index 000000000..75c1f8f57 --- /dev/null +++ b/tests/mir-opt/reference_prop.read_through_raw.ReferencePropagation.diff @@ -0,0 +1,23 @@ +- // MIR for `read_through_raw` before ReferencePropagation ++ // MIR for `read_through_raw` after ReferencePropagation + + fn read_through_raw(_1: &mut usize) -> usize { + let mut _0: usize; // return place in scope 0 at $DIR/reference_prop.rs:+0:39: +0:44 + let mut _2: &mut usize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _3: &mut usize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _4: *mut usize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _5: *mut usize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + + bb0: { +- _2 = &mut (*_1); // scope 0 at $DIR/reference_prop.rs:+10:13: +10:25 +- _3 = &mut (*_2); // scope 0 at $DIR/reference_prop.rs:+11:13: +11:26 +- _4 = &raw mut (*_2); // scope 0 at $DIR/reference_prop.rs:+12:13: +12:30 +- _5 = &raw mut (*_3); // scope 0 at $DIR/reference_prop.rs:+13:13: +13:30 +- _0 = (*_4); // scope 0 at $DIR/reference_prop.rs:+15:13: +15:22 +- _0 = (*_5); // scope 0 at $DIR/reference_prop.rs:+16:13: +16:22 ++ _0 = (*_1); // scope 0 at $DIR/reference_prop.rs:+15:13: +15:22 ++ _0 = (*_1); // scope 0 at $DIR/reference_prop.rs:+16:13: +16:22 + return; // scope 0 at $DIR/reference_prop.rs:+17:13: +17:21 + } + } + diff --git a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff new file mode 100644 index 000000000..7b31ee695 --- /dev/null +++ b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff @@ -0,0 +1,475 @@ +- // MIR for `reference_propagation` before ReferencePropagation ++ // MIR for `reference_propagation` after ReferencePropagation + + fn reference_propagation(_1: &T, _2: &T) -> () { + debug single => _1; // in scope 0 at $DIR/reference_prop.rs:+0:39: +0:45 + debug multiple => _2; // in scope 0 at $DIR/reference_prop.rs:+0:54: +0:66 + let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:75: +0:75 + let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +7:6 + let _4: usize; // in scope 0 at $DIR/reference_prop.rs:+3:13: +3:14 + let _7: (); // in scope 0 at $DIR/reference_prop.rs:+6:9: +6:19 + let mut _8: (); // in scope 0 at $DIR/reference_prop.rs:+6:16: +6:18 + let _9: (); // in scope 0 at $DIR/reference_prop.rs:+10:5: +18:6 + let _10: usize; // in scope 0 at $DIR/reference_prop.rs:+11:13: +11:14 + let mut _13: &usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:16 + let _14: &usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:16 + let _16: (); // in scope 0 at $DIR/reference_prop.rs:+17:9: +17:19 + let mut _17: (); // in scope 0 at $DIR/reference_prop.rs:+17:16: +17:18 + let _18: (); // in scope 0 at $DIR/reference_prop.rs:+21:5: +27:6 + let _19: usize; // in scope 0 at $DIR/reference_prop.rs:+22:13: +22:14 + let _23: (); // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:18 + let mut _24: &&usize; // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:17 + let _25: (); // in scope 0 at $DIR/reference_prop.rs:+30:5: +36:6 + let _26: usize; // in scope 0 at $DIR/reference_prop.rs:+31:13: +31:14 + let _30: (); // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:18 + let mut _31: *mut &usize; // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:17 + let _32: (); // in scope 0 at $DIR/reference_prop.rs:+39:5: +44:6 + let _33: usize; // in scope 0 at $DIR/reference_prop.rs:+40:13: +40:14 + let _36: (); // in scope 0 at $DIR/reference_prop.rs:+43:9: +43:18 + let mut _37: &usize; // in scope 0 at $DIR/reference_prop.rs:+43:16: +43:17 + let _38: (); // in scope 0 at $DIR/reference_prop.rs:+47:5: +57:6 + let _39: usize; // in scope 0 at $DIR/reference_prop.rs:+48:13: +48:14 + let _45: (); // in scope 0 at $DIR/reference_prop.rs:+56:9: +56:19 + let mut _46: &usize; // in scope 0 at $DIR/reference_prop.rs:+56:16: +56:18 + let _47: (); // in scope 0 at $DIR/reference_prop.rs:+60:5: +64:6 + let _48: &T; // in scope 0 at $DIR/reference_prop.rs:+61:13: +61:14 + let _50: (); // in scope 0 at $DIR/reference_prop.rs:+63:9: +63:19 + let mut _51: (); // in scope 0 at $DIR/reference_prop.rs:+63:16: +63:18 + let _52: (); // in scope 0 at $DIR/reference_prop.rs:+67:5: +72:6 + let _53: &T; // in scope 0 at $DIR/reference_prop.rs:+68:13: +68:14 + let mut _54: &T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:28 + let _55: &T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:28 + let _57: (); // in scope 0 at $DIR/reference_prop.rs:+71:9: +71:19 + let mut _58: (); // in scope 0 at $DIR/reference_prop.rs:+71:16: +71:18 + let _59: (); // in scope 0 at $DIR/reference_prop.rs:+75:5: +81:6 + let _60: usize; // in scope 0 at $DIR/reference_prop.rs:+76:13: +76:14 + let _64: (); // in scope 0 at $DIR/reference_prop.rs:+80:9: +80:19 + let mut _65: (); // in scope 0 at $DIR/reference_prop.rs:+80:16: +80:18 + let _66: usize; // in scope 0 at $DIR/reference_prop.rs:+85:13: +85:14 + let _70: (); // in scope 0 at $DIR/reference_prop.rs:+89:9: +89:19 + let mut _71: (); // in scope 0 at $DIR/reference_prop.rs:+89:16: +89:18 + scope 1 { + debug a => _4; // in scope 1 at $DIR/reference_prop.rs:+3:13: +3:14 + let _5: &usize; // in scope 1 at $DIR/reference_prop.rs:+4:13: +4:14 + scope 2 { +- debug b => _5; // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14 ++ debug b => &_4; // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14 + let _6: usize; // in scope 2 at $DIR/reference_prop.rs:+5:13: +5:14 + scope 3 { + debug c => _6; // in scope 3 at $DIR/reference_prop.rs:+5:13: +5:14 + } + } + } + scope 4 { + debug a => _10; // in scope 4 at $DIR/reference_prop.rs:+11:13: +11:14 + let _11: usize; // in scope 4 at $DIR/reference_prop.rs:+12:13: +12:15 + scope 5 { + debug a2 => _11; // in scope 5 at $DIR/reference_prop.rs:+12:13: +12:15 + let mut _12: &usize; // in scope 5 at $DIR/reference_prop.rs:+13:13: +13:18 + scope 6 { + debug b => _12; // in scope 6 at $DIR/reference_prop.rs:+13:13: +13:18 + let _15: usize; // in scope 6 at $DIR/reference_prop.rs:+16:13: +16:14 + scope 7 { + debug c => _15; // in scope 7 at $DIR/reference_prop.rs:+16:13: +16:14 + } + } + } + } + scope 8 { + debug a => _19; // in scope 8 at $DIR/reference_prop.rs:+22:13: +22:14 + let _20: &usize; // in scope 8 at $DIR/reference_prop.rs:+23:13: +23:14 + scope 9 { + debug b => _20; // in scope 9 at $DIR/reference_prop.rs:+23:13: +23:14 + let _21: &&usize; // in scope 9 at $DIR/reference_prop.rs:+24:13: +24:14 + scope 10 { + debug d => _21; // in scope 10 at $DIR/reference_prop.rs:+24:13: +24:14 + let _22: usize; // in scope 10 at $DIR/reference_prop.rs:+25:13: +25:14 + scope 11 { + debug c => _22; // in scope 11 at $DIR/reference_prop.rs:+25:13: +25:14 + } + } + } + } + scope 12 { + debug a => _26; // in scope 12 at $DIR/reference_prop.rs:+31:13: +31:14 + let mut _27: &usize; // in scope 12 at $DIR/reference_prop.rs:+32:13: +32:18 + scope 13 { + debug b => _27; // in scope 13 at $DIR/reference_prop.rs:+32:13: +32:18 + let _28: *mut &usize; // in scope 13 at $DIR/reference_prop.rs:+33:13: +33:14 + scope 14 { + debug d => _28; // in scope 14 at $DIR/reference_prop.rs:+33:13: +33:14 + let _29: usize; // in scope 14 at $DIR/reference_prop.rs:+34:13: +34:14 + scope 15 { + debug c => _29; // in scope 15 at $DIR/reference_prop.rs:+34:13: +34:14 + } + } + } + } + scope 16 { + debug a => _33; // in scope 16 at $DIR/reference_prop.rs:+40:13: +40:14 + let _34: &usize; // in scope 16 at $DIR/reference_prop.rs:+41:13: +41:14 + scope 17 { + debug b => _34; // in scope 17 at $DIR/reference_prop.rs:+41:13: +41:14 + let _35: usize; // in scope 17 at $DIR/reference_prop.rs:+42:13: +42:14 + scope 18 { + debug c => _35; // in scope 18 at $DIR/reference_prop.rs:+42:13: +42:14 + } + } + } + scope 19 { + debug a => _39; // in scope 19 at $DIR/reference_prop.rs:+48:13: +48:14 + let _40: &usize; // in scope 19 at $DIR/reference_prop.rs:+49:13: +49:15 + scope 20 { + debug b1 => _40; // in scope 20 at $DIR/reference_prop.rs:+49:13: +49:15 + let _41: usize; // in scope 20 at $DIR/reference_prop.rs:+50:13: +50:14 + scope 21 { + debug c => _41; // in scope 21 at $DIR/reference_prop.rs:+50:13: +50:14 + let _42: &usize; // in scope 21 at $DIR/reference_prop.rs:+51:13: +51:15 + scope 22 { + debug b2 => _42; // in scope 22 at $DIR/reference_prop.rs:+51:13: +51:15 + let _43: usize; // in scope 22 at $DIR/reference_prop.rs:+52:13: +52:15 + scope 23 { + debug c2 => _43; // in scope 23 at $DIR/reference_prop.rs:+52:13: +52:15 + let _44: &usize; // in scope 23 at $DIR/reference_prop.rs:+53:13: +53:15 + scope 24 { + debug b3 => _44; // in scope 24 at $DIR/reference_prop.rs:+53:13: +53:15 + } + } + } + } + } + } + scope 25 { +- debug a => _48; // in scope 25 at $DIR/reference_prop.rs:+61:13: +61:14 ++ debug a => _1; // in scope 25 at $DIR/reference_prop.rs:+61:13: +61:14 + let _49: T; // in scope 25 at $DIR/reference_prop.rs:+62:13: +62:14 + scope 26 { + debug b => _49; // in scope 26 at $DIR/reference_prop.rs:+62:13: +62:14 + } + } + scope 27 { + debug a => _53; // in scope 27 at $DIR/reference_prop.rs:+68:13: +68:14 + let _56: T; // in scope 27 at $DIR/reference_prop.rs:+70:13: +70:14 + scope 28 { + debug b => _56; // in scope 28 at $DIR/reference_prop.rs:+70:13: +70:14 + } + } + scope 29 { + debug a => _60; // in scope 29 at $DIR/reference_prop.rs:+76:13: +76:14 + let _61: &usize; // in scope 29 at $DIR/reference_prop.rs:+77:13: +77:14 + scope 30 { +- debug b => _61; // in scope 30 at $DIR/reference_prop.rs:+77:13: +77:14 ++ debug b => &_60; // in scope 30 at $DIR/reference_prop.rs:+77:13: +77:14 + let _62: &&usize; // in scope 30 at $DIR/reference_prop.rs:+78:13: +78:14 + scope 31 { +- debug d => _62; // in scope 31 at $DIR/reference_prop.rs:+78:13: +78:14 ++ debug d => &&_60; // in scope 31 at $DIR/reference_prop.rs:+78:13: +78:14 + let _63: usize; // in scope 31 at $DIR/reference_prop.rs:+79:13: +79:14 + scope 32 { + debug c => _63; // in scope 32 at $DIR/reference_prop.rs:+79:13: +79:14 + } + } + } + } + scope 33 { + debug a => _66; // in scope 33 at $DIR/reference_prop.rs:+85:13: +85:14 + let mut _67: &usize; // in scope 33 at $DIR/reference_prop.rs:+86:13: +86:18 + scope 34 { +- debug b => _67; // in scope 34 at $DIR/reference_prop.rs:+86:13: +86:18 ++ debug b => &_66; // in scope 34 at $DIR/reference_prop.rs:+86:13: +86:18 + let _68: &mut &usize; // in scope 34 at $DIR/reference_prop.rs:+87:13: +87:14 + scope 35 { +- debug d => _68; // in scope 35 at $DIR/reference_prop.rs:+87:13: +87:14 ++ debug d => &&_66; // in scope 35 at $DIR/reference_prop.rs:+87:13: +87:14 + let _69: usize; // in scope 35 at $DIR/reference_prop.rs:+88:13: +88:14 + scope 36 { + debug c => _69; // in scope 36 at $DIR/reference_prop.rs:+88:13: +88:14 + } + } + } + } + + bb0: { +- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6 + StorageLive(_4); // scope 0 at $DIR/reference_prop.rs:+3:13: +3:14 + _4 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+3:17: +3:24 +- StorageLive(_5); // scope 1 at $DIR/reference_prop.rs:+4:13: +4:14 +- _5 = &_4; // scope 1 at $DIR/reference_prop.rs:+4:17: +4:19 + StorageLive(_6); // scope 2 at $DIR/reference_prop.rs:+5:13: +5:14 +- _6 = (*_5); // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19 ++ _6 = _4; // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19 + StorageLive(_7); // scope 3 at $DIR/reference_prop.rs:+6:9: +6:19 + StorageLive(_8); // scope 3 at $DIR/reference_prop.rs:+6:16: +6:18 + _8 = (); // scope 3 at $DIR/reference_prop.rs:+6:16: +6:18 + _7 = opaque::<()>(move _8) -> bb1; // scope 3 at $DIR/reference_prop.rs:+6:9: +6:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:16:9: 16:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb1: { + StorageDead(_8); // scope 3 at $DIR/reference_prop.rs:+6:18: +6:19 + StorageDead(_7); // scope 3 at $DIR/reference_prop.rs:+6:19: +6:20 +- _3 = const (); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6 + StorageDead(_6); // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6 +- StorageDead(_5); // scope 1 at $DIR/reference_prop.rs:+7:5: +7:6 + StorageDead(_4); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6 +- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6 +- StorageLive(_9); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6 + StorageLive(_10); // scope 0 at $DIR/reference_prop.rs:+11:13: +11:14 + _10 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+11:17: +11:24 + StorageLive(_11); // scope 4 at $DIR/reference_prop.rs:+12:13: +12:15 + _11 = const 7_usize; // scope 4 at $DIR/reference_prop.rs:+12:18: +12:25 + StorageLive(_12); // scope 5 at $DIR/reference_prop.rs:+13:13: +13:18 + _12 = &_10; // scope 5 at $DIR/reference_prop.rs:+13:21: +13:23 + StorageLive(_13); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:16 +- StorageLive(_14); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:16 +- _14 = &_11; // scope 6 at $DIR/reference_prop.rs:+14:13: +14:16 +- _13 = &(*_14); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:16 ++ _13 = &_11; // scope 6 at $DIR/reference_prop.rs:+14:13: +14:16 + _12 = move _13; // scope 6 at $DIR/reference_prop.rs:+14:9: +14:16 + StorageDead(_13); // scope 6 at $DIR/reference_prop.rs:+14:15: +14:16 +- StorageDead(_14); // scope 6 at $DIR/reference_prop.rs:+14:16: +14:17 + StorageLive(_15); // scope 6 at $DIR/reference_prop.rs:+16:13: +16:14 + _15 = (*_12); // scope 6 at $DIR/reference_prop.rs:+16:17: +16:19 + StorageLive(_16); // scope 7 at $DIR/reference_prop.rs:+17:9: +17:19 + StorageLive(_17); // scope 7 at $DIR/reference_prop.rs:+17:16: +17:18 + _17 = (); // scope 7 at $DIR/reference_prop.rs:+17:16: +17:18 + _16 = opaque::<()>(move _17) -> bb2; // scope 7 at $DIR/reference_prop.rs:+17:9: +17:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:27:9: 27:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb2: { + StorageDead(_17); // scope 7 at $DIR/reference_prop.rs:+17:18: +17:19 + StorageDead(_16); // scope 7 at $DIR/reference_prop.rs:+17:19: +17:20 +- _9 = const (); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6 + StorageDead(_15); // scope 6 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_12); // scope 5 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_11); // scope 4 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_10); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6 +- StorageDead(_9); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6 +- StorageLive(_18); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6 + StorageLive(_19); // scope 0 at $DIR/reference_prop.rs:+22:13: +22:14 + _19 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+22:17: +22:24 + StorageLive(_20); // scope 8 at $DIR/reference_prop.rs:+23:13: +23:14 + _20 = &_19; // scope 8 at $DIR/reference_prop.rs:+23:17: +23:19 + StorageLive(_21); // scope 9 at $DIR/reference_prop.rs:+24:13: +24:14 + _21 = &_20; // scope 9 at $DIR/reference_prop.rs:+24:17: +24:19 + StorageLive(_22); // scope 10 at $DIR/reference_prop.rs:+25:13: +25:14 + _22 = (*_20); // scope 10 at $DIR/reference_prop.rs:+25:17: +25:19 + StorageLive(_23); // scope 11 at $DIR/reference_prop.rs:+26:9: +26:18 + StorageLive(_24); // scope 11 at $DIR/reference_prop.rs:+26:16: +26:17 + _24 = _21; // scope 11 at $DIR/reference_prop.rs:+26:16: +26:17 + _23 = opaque::<&&usize>(move _24) -> bb3; // scope 11 at $DIR/reference_prop.rs:+26:9: +26:18 + // mir::Constant + // + span: $DIR/reference_prop.rs:36:9: 36:15 + // + literal: Const { ty: fn(&&usize) {opaque::<&&usize>}, val: Value() } + } + + bb3: { + StorageDead(_24); // scope 11 at $DIR/reference_prop.rs:+26:17: +26:18 + StorageDead(_23); // scope 11 at $DIR/reference_prop.rs:+26:18: +26:19 +- _18 = const (); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6 + StorageDead(_22); // scope 10 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_21); // scope 9 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_20); // scope 8 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_19); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6 +- StorageDead(_18); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6 +- StorageLive(_25); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6 + StorageLive(_26); // scope 0 at $DIR/reference_prop.rs:+31:13: +31:14 + _26 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+31:17: +31:24 + StorageLive(_27); // scope 12 at $DIR/reference_prop.rs:+32:13: +32:18 + _27 = &_26; // scope 12 at $DIR/reference_prop.rs:+32:21: +32:23 + StorageLive(_28); // scope 13 at $DIR/reference_prop.rs:+33:13: +33:14 + _28 = &raw mut _27; // scope 13 at $DIR/reference_prop.rs:+33:17: +33:27 + StorageLive(_29); // scope 14 at $DIR/reference_prop.rs:+34:13: +34:14 + _29 = (*_27); // scope 14 at $DIR/reference_prop.rs:+34:17: +34:19 + StorageLive(_30); // scope 15 at $DIR/reference_prop.rs:+35:9: +35:18 + StorageLive(_31); // scope 15 at $DIR/reference_prop.rs:+35:16: +35:17 + _31 = _28; // scope 15 at $DIR/reference_prop.rs:+35:16: +35:17 + _30 = opaque::<*mut &usize>(move _31) -> bb4; // scope 15 at $DIR/reference_prop.rs:+35:9: +35:18 + // mir::Constant + // + span: $DIR/reference_prop.rs:45:9: 45:15 + // + literal: Const { ty: fn(*mut &usize) {opaque::<*mut &usize>}, val: Value() } + } + + bb4: { + StorageDead(_31); // scope 15 at $DIR/reference_prop.rs:+35:17: +35:18 + StorageDead(_30); // scope 15 at $DIR/reference_prop.rs:+35:18: +35:19 +- _25 = const (); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6 + StorageDead(_29); // scope 14 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_28); // scope 13 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_27); // scope 12 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_26); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6 +- StorageDead(_25); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6 +- StorageLive(_32); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6 + StorageLive(_33); // scope 0 at $DIR/reference_prop.rs:+40:13: +40:14 + _33 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+40:17: +40:24 + StorageLive(_34); // scope 16 at $DIR/reference_prop.rs:+41:13: +41:14 + _34 = &_33; // scope 16 at $DIR/reference_prop.rs:+41:17: +41:19 + StorageLive(_35); // scope 17 at $DIR/reference_prop.rs:+42:13: +42:14 +- _35 = (*_34); // scope 17 at $DIR/reference_prop.rs:+42:17: +42:19 ++ _35 = _33; // scope 17 at $DIR/reference_prop.rs:+42:17: +42:19 + StorageLive(_36); // scope 18 at $DIR/reference_prop.rs:+43:9: +43:18 + StorageLive(_37); // scope 18 at $DIR/reference_prop.rs:+43:16: +43:17 + _37 = _34; // scope 18 at $DIR/reference_prop.rs:+43:16: +43:17 + _36 = opaque::<&usize>(move _37) -> bb5; // scope 18 at $DIR/reference_prop.rs:+43:9: +43:18 + // mir::Constant + // + span: $DIR/reference_prop.rs:53:9: 53:15 + // + literal: Const { ty: fn(&usize) {opaque::<&usize>}, val: Value() } + } + + bb5: { + StorageDead(_37); // scope 18 at $DIR/reference_prop.rs:+43:17: +43:18 + StorageDead(_36); // scope 18 at $DIR/reference_prop.rs:+43:18: +43:19 +- _32 = const (); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6 + StorageDead(_35); // scope 17 at $DIR/reference_prop.rs:+44:5: +44:6 + StorageDead(_34); // scope 16 at $DIR/reference_prop.rs:+44:5: +44:6 + StorageDead(_33); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6 +- StorageDead(_32); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6 +- StorageLive(_38); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6 + StorageLive(_39); // scope 0 at $DIR/reference_prop.rs:+48:13: +48:14 + _39 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+48:17: +48:24 + StorageLive(_40); // scope 19 at $DIR/reference_prop.rs:+49:13: +49:15 + _40 = &_39; // scope 19 at $DIR/reference_prop.rs:+49:18: +49:20 + StorageLive(_41); // scope 20 at $DIR/reference_prop.rs:+50:13: +50:14 +- _41 = (*_40); // scope 20 at $DIR/reference_prop.rs:+50:17: +50:20 ++ _41 = _39; // scope 20 at $DIR/reference_prop.rs:+50:17: +50:20 + StorageLive(_42); // scope 21 at $DIR/reference_prop.rs:+51:13: +51:15 + _42 = _40; // scope 21 at $DIR/reference_prop.rs:+51:18: +51:20 + StorageLive(_43); // scope 22 at $DIR/reference_prop.rs:+52:13: +52:15 +- _43 = (*_42); // scope 22 at $DIR/reference_prop.rs:+52:18: +52:21 ++ _43 = _39; // scope 22 at $DIR/reference_prop.rs:+52:18: +52:21 + StorageLive(_44); // scope 23 at $DIR/reference_prop.rs:+53:13: +53:15 + _44 = _42; // scope 23 at $DIR/reference_prop.rs:+53:18: +53:20 + StorageLive(_45); // scope 24 at $DIR/reference_prop.rs:+56:9: +56:19 + StorageLive(_46); // scope 24 at $DIR/reference_prop.rs:+56:16: +56:18 + _46 = _44; // scope 24 at $DIR/reference_prop.rs:+56:16: +56:18 + _45 = opaque::<&usize>(move _46) -> bb6; // scope 24 at $DIR/reference_prop.rs:+56:9: +56:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:66:9: 66:15 + // + literal: Const { ty: fn(&usize) {opaque::<&usize>}, val: Value() } + } + + bb6: { + StorageDead(_46); // scope 24 at $DIR/reference_prop.rs:+56:18: +56:19 + StorageDead(_45); // scope 24 at $DIR/reference_prop.rs:+56:19: +56:20 +- _38 = const (); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6 + StorageDead(_44); // scope 23 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_43); // scope 22 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_42); // scope 21 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_41); // scope 20 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_40); // scope 19 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_39); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6 +- StorageDead(_38); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6 +- StorageLive(_47); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6 +- StorageLive(_48); // scope 0 at $DIR/reference_prop.rs:+61:13: +61:14 +- _48 = &(*_1); // scope 0 at $DIR/reference_prop.rs:+61:17: +61:25 + StorageLive(_49); // scope 25 at $DIR/reference_prop.rs:+62:13: +62:14 +- _49 = (*_48); // scope 25 at $DIR/reference_prop.rs:+62:17: +62:19 ++ _49 = (*_1); // scope 25 at $DIR/reference_prop.rs:+62:17: +62:19 + StorageLive(_50); // scope 26 at $DIR/reference_prop.rs:+63:9: +63:19 + StorageLive(_51); // scope 26 at $DIR/reference_prop.rs:+63:16: +63:18 + _51 = (); // scope 26 at $DIR/reference_prop.rs:+63:16: +63:18 + _50 = opaque::<()>(move _51) -> bb7; // scope 26 at $DIR/reference_prop.rs:+63:9: +63:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:73:9: 73:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb7: { + StorageDead(_51); // scope 26 at $DIR/reference_prop.rs:+63:18: +63:19 + StorageDead(_50); // scope 26 at $DIR/reference_prop.rs:+63:19: +63:20 +- _47 = const (); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6 + StorageDead(_49); // scope 25 at $DIR/reference_prop.rs:+64:5: +64:6 +- StorageDead(_48); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6 +- StorageDead(_47); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6 +- StorageLive(_52); // scope 0 at $DIR/reference_prop.rs:+67:5: +72:6 + StorageLive(_53); // scope 0 at $DIR/reference_prop.rs:+68:13: +68:14 + _53 = &(*_2); // scope 0 at $DIR/reference_prop.rs:+68:17: +68:27 + StorageLive(_54); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:28 +- StorageLive(_55); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:28 +- _55 = &(*_1); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:28 +- _54 = &(*_55); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:28 ++ _54 = &(*_1); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:28 + _2 = move _54; // scope 27 at $DIR/reference_prop.rs:+69:9: +69:28 + StorageDead(_54); // scope 27 at $DIR/reference_prop.rs:+69:27: +69:28 +- StorageDead(_55); // scope 27 at $DIR/reference_prop.rs:+69:28: +69:29 + StorageLive(_56); // scope 27 at $DIR/reference_prop.rs:+70:13: +70:14 + _56 = (*_53); // scope 27 at $DIR/reference_prop.rs:+70:17: +70:19 + StorageLive(_57); // scope 28 at $DIR/reference_prop.rs:+71:9: +71:19 + StorageLive(_58); // scope 28 at $DIR/reference_prop.rs:+71:16: +71:18 + _58 = (); // scope 28 at $DIR/reference_prop.rs:+71:16: +71:18 + _57 = opaque::<()>(move _58) -> bb8; // scope 28 at $DIR/reference_prop.rs:+71:9: +71:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:81:9: 81:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb8: { + StorageDead(_58); // scope 28 at $DIR/reference_prop.rs:+71:18: +71:19 + StorageDead(_57); // scope 28 at $DIR/reference_prop.rs:+71:19: +71:20 +- _52 = const (); // scope 0 at $DIR/reference_prop.rs:+67:5: +72:6 + StorageDead(_56); // scope 27 at $DIR/reference_prop.rs:+72:5: +72:6 + StorageDead(_53); // scope 0 at $DIR/reference_prop.rs:+72:5: +72:6 +- StorageDead(_52); // scope 0 at $DIR/reference_prop.rs:+72:5: +72:6 +- StorageLive(_59); // scope 0 at $DIR/reference_prop.rs:+75:5: +81:6 + StorageLive(_60); // scope 0 at $DIR/reference_prop.rs:+76:13: +76:14 + _60 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+76:17: +76:24 +- StorageLive(_61); // scope 29 at $DIR/reference_prop.rs:+77:13: +77:14 +- _61 = &_60; // scope 29 at $DIR/reference_prop.rs:+77:17: +77:19 +- StorageLive(_62); // scope 30 at $DIR/reference_prop.rs:+78:13: +78:14 +- _62 = &_61; // scope 30 at $DIR/reference_prop.rs:+78:17: +78:19 + StorageLive(_63); // scope 31 at $DIR/reference_prop.rs:+79:13: +79:14 +- _63 = (*_61); // scope 31 at $DIR/reference_prop.rs:+79:17: +79:19 ++ _63 = _60; // scope 31 at $DIR/reference_prop.rs:+79:17: +79:19 + StorageLive(_64); // scope 32 at $DIR/reference_prop.rs:+80:9: +80:19 + StorageLive(_65); // scope 32 at $DIR/reference_prop.rs:+80:16: +80:18 + _65 = (); // scope 32 at $DIR/reference_prop.rs:+80:16: +80:18 + _64 = opaque::<()>(move _65) -> bb9; // scope 32 at $DIR/reference_prop.rs:+80:9: +80:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:90:9: 90:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb9: { + StorageDead(_65); // scope 32 at $DIR/reference_prop.rs:+80:18: +80:19 + StorageDead(_64); // scope 32 at $DIR/reference_prop.rs:+80:19: +80:20 +- _59 = const (); // scope 0 at $DIR/reference_prop.rs:+75:5: +81:6 + StorageDead(_63); // scope 31 at $DIR/reference_prop.rs:+81:5: +81:6 +- StorageDead(_62); // scope 30 at $DIR/reference_prop.rs:+81:5: +81:6 +- StorageDead(_61); // scope 29 at $DIR/reference_prop.rs:+81:5: +81:6 + StorageDead(_60); // scope 0 at $DIR/reference_prop.rs:+81:5: +81:6 +- StorageDead(_59); // scope 0 at $DIR/reference_prop.rs:+81:5: +81:6 + StorageLive(_66); // scope 0 at $DIR/reference_prop.rs:+85:13: +85:14 + _66 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+85:17: +85:24 +- StorageLive(_67); // scope 33 at $DIR/reference_prop.rs:+86:13: +86:18 +- _67 = &_66; // scope 33 at $DIR/reference_prop.rs:+86:21: +86:23 +- StorageLive(_68); // scope 34 at $DIR/reference_prop.rs:+87:13: +87:14 +- _68 = &mut _67; // scope 34 at $DIR/reference_prop.rs:+87:17: +87:23 + StorageLive(_69); // scope 35 at $DIR/reference_prop.rs:+88:13: +88:14 +- _69 = (*_67); // scope 35 at $DIR/reference_prop.rs:+88:17: +88:19 ++ _69 = _66; // scope 35 at $DIR/reference_prop.rs:+88:17: +88:19 + StorageLive(_70); // scope 36 at $DIR/reference_prop.rs:+89:9: +89:19 + StorageLive(_71); // scope 36 at $DIR/reference_prop.rs:+89:16: +89:18 + _71 = (); // scope 36 at $DIR/reference_prop.rs:+89:16: +89:18 + _70 = opaque::<()>(move _71) -> bb10; // scope 36 at $DIR/reference_prop.rs:+89:9: +89:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:99:9: 99:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb10: { + StorageDead(_71); // scope 36 at $DIR/reference_prop.rs:+89:18: +89:19 + StorageDead(_70); // scope 36 at $DIR/reference_prop.rs:+89:19: +89:20 + _0 = const (); // scope 0 at $DIR/reference_prop.rs:+84:5: +90:6 + StorageDead(_69); // scope 35 at $DIR/reference_prop.rs:+90:5: +90:6 +- StorageDead(_68); // scope 34 at $DIR/reference_prop.rs:+90:5: +90:6 +- StorageDead(_67); // scope 33 at $DIR/reference_prop.rs:+90:5: +90:6 + StorageDead(_66); // scope 0 at $DIR/reference_prop.rs:+90:5: +90:6 + return; // scope 0 at $DIR/reference_prop.rs:+91:2: +91:2 + } + } + diff --git a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff new file mode 100644 index 000000000..ddeb04e50 --- /dev/null +++ b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff @@ -0,0 +1,536 @@ +- // MIR for `reference_propagation_const_ptr` before ReferencePropagation ++ // MIR for `reference_propagation_const_ptr` after ReferencePropagation + + fn reference_propagation_const_ptr(_1: *const T, _2: *const T) -> () { + debug single => _1; // in scope 0 at $DIR/reference_prop.rs:+0:45: +0:51 + debug multiple => _2; // in scope 0 at $DIR/reference_prop.rs:+0:63: +0:75 + let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:87: +0:87 + let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +7:6 + let _7: (); // in scope 0 at $DIR/reference_prop.rs:+6:9: +6:19 + let mut _8: (); // in scope 0 at $DIR/reference_prop.rs:+6:16: +6:18 + let _9: (); // in scope 0 at $DIR/reference_prop.rs:+10:5: +18:6 + let mut _13: *const usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:26 + let _15: (); // in scope 0 at $DIR/reference_prop.rs:+17:9: +17:19 + let mut _16: (); // in scope 0 at $DIR/reference_prop.rs:+17:16: +17:18 + let _17: (); // in scope 0 at $DIR/reference_prop.rs:+21:5: +27:6 + let _22: (); // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:18 + let mut _23: &*const usize; // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:17 + let _24: (); // in scope 0 at $DIR/reference_prop.rs:+30:5: +36:6 + let _29: (); // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:18 + let mut _30: *mut *const usize; // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:17 + let _31: (); // in scope 0 at $DIR/reference_prop.rs:+39:5: +44:6 + let _35: (); // in scope 0 at $DIR/reference_prop.rs:+43:9: +43:18 + let mut _36: *const usize; // in scope 0 at $DIR/reference_prop.rs:+43:16: +43:17 + let _37: (); // in scope 0 at $DIR/reference_prop.rs:+47:5: +57:6 + let _44: (); // in scope 0 at $DIR/reference_prop.rs:+56:9: +56:19 + let mut _45: *const usize; // in scope 0 at $DIR/reference_prop.rs:+56:16: +56:18 + let _46: (); // in scope 0 at $DIR/reference_prop.rs:+60:5: +64:6 + let _49: (); // in scope 0 at $DIR/reference_prop.rs:+63:9: +63:19 + let mut _50: (); // in scope 0 at $DIR/reference_prop.rs:+63:16: +63:18 + let _51: (); // in scope 0 at $DIR/reference_prop.rs:+67:5: +72:6 + let mut _53: *const T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:38 + let _55: (); // in scope 0 at $DIR/reference_prop.rs:+71:9: +71:19 + let mut _56: (); // in scope 0 at $DIR/reference_prop.rs:+71:16: +71:18 + let _57: (); // in scope 0 at $DIR/reference_prop.rs:+75:5: +81:6 + let _62: (); // in scope 0 at $DIR/reference_prop.rs:+80:9: +80:19 + let mut _63: (); // in scope 0 at $DIR/reference_prop.rs:+80:16: +80:18 + let _64: (); // in scope 0 at $DIR/reference_prop.rs:+84:5: +90:6 + let _69: (); // in scope 0 at $DIR/reference_prop.rs:+89:9: +89:19 + let mut _70: (); // in scope 0 at $DIR/reference_prop.rs:+89:16: +89:18 + let _75: (); // in scope 0 at $DIR/reference_prop.rs:+98:9: +98:19 + let mut _76: (); // in scope 0 at $DIR/reference_prop.rs:+98:16: +98:18 + scope 1 { + let _4: usize; // in scope 1 at $DIR/reference_prop.rs:+3:13: +3:14 + scope 2 { + debug a => _4; // in scope 2 at $DIR/reference_prop.rs:+3:13: +3:14 + let _5: *const usize; // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14 + scope 3 { +- debug b => _5; // in scope 3 at $DIR/reference_prop.rs:+4:13: +4:14 ++ debug b => &_4; // in scope 3 at $DIR/reference_prop.rs:+4:13: +4:14 + let _6: usize; // in scope 3 at $DIR/reference_prop.rs:+5:13: +5:14 + scope 4 { + debug c => _6; // in scope 4 at $DIR/reference_prop.rs:+5:13: +5:14 + } + } + } + } + scope 5 { + let _10: usize; // in scope 5 at $DIR/reference_prop.rs:+11:13: +11:14 + scope 6 { + debug a => _10; // in scope 6 at $DIR/reference_prop.rs:+11:13: +11:14 + let _11: usize; // in scope 6 at $DIR/reference_prop.rs:+12:13: +12:15 + scope 7 { + debug a2 => _11; // in scope 7 at $DIR/reference_prop.rs:+12:13: +12:15 + let mut _12: *const usize; // in scope 7 at $DIR/reference_prop.rs:+13:13: +13:18 + scope 8 { + debug b => _12; // in scope 8 at $DIR/reference_prop.rs:+13:13: +13:18 + let _14: usize; // in scope 8 at $DIR/reference_prop.rs:+16:13: +16:14 + scope 9 { + debug c => _14; // in scope 9 at $DIR/reference_prop.rs:+16:13: +16:14 + } + } + } + } + } + scope 10 { + let _18: usize; // in scope 10 at $DIR/reference_prop.rs:+22:13: +22:14 + scope 11 { + debug a => _18; // in scope 11 at $DIR/reference_prop.rs:+22:13: +22:14 + let _19: *const usize; // in scope 11 at $DIR/reference_prop.rs:+23:13: +23:14 + scope 12 { + debug b => _19; // in scope 12 at $DIR/reference_prop.rs:+23:13: +23:14 + let _20: &*const usize; // in scope 12 at $DIR/reference_prop.rs:+24:13: +24:14 + scope 13 { + debug d => _20; // in scope 13 at $DIR/reference_prop.rs:+24:13: +24:14 + let _21: usize; // in scope 13 at $DIR/reference_prop.rs:+25:13: +25:14 + scope 14 { + debug c => _21; // in scope 14 at $DIR/reference_prop.rs:+25:13: +25:14 + } + } + } + } + } + scope 15 { + let _25: usize; // in scope 15 at $DIR/reference_prop.rs:+31:13: +31:14 + scope 16 { + debug a => _25; // in scope 16 at $DIR/reference_prop.rs:+31:13: +31:14 + let mut _26: *const usize; // in scope 16 at $DIR/reference_prop.rs:+32:13: +32:18 + scope 17 { + debug b => _26; // in scope 17 at $DIR/reference_prop.rs:+32:13: +32:18 + let _27: *mut *const usize; // in scope 17 at $DIR/reference_prop.rs:+33:13: +33:14 + scope 18 { + debug d => _27; // in scope 18 at $DIR/reference_prop.rs:+33:13: +33:14 + let _28: usize; // in scope 18 at $DIR/reference_prop.rs:+34:13: +34:14 + scope 19 { + debug c => _28; // in scope 19 at $DIR/reference_prop.rs:+34:13: +34:14 + } + } + } + } + } + scope 20 { + let _32: usize; // in scope 20 at $DIR/reference_prop.rs:+40:13: +40:14 + scope 21 { + debug a => _32; // in scope 21 at $DIR/reference_prop.rs:+40:13: +40:14 + let _33: *const usize; // in scope 21 at $DIR/reference_prop.rs:+41:13: +41:14 + scope 22 { + debug b => _33; // in scope 22 at $DIR/reference_prop.rs:+41:13: +41:14 + let _34: usize; // in scope 22 at $DIR/reference_prop.rs:+42:13: +42:14 + scope 23 { + debug c => _34; // in scope 23 at $DIR/reference_prop.rs:+42:13: +42:14 + } + } + } + } + scope 24 { + let _38: usize; // in scope 24 at $DIR/reference_prop.rs:+48:13: +48:14 + scope 25 { + debug a => _38; // in scope 25 at $DIR/reference_prop.rs:+48:13: +48:14 + let _39: *const usize; // in scope 25 at $DIR/reference_prop.rs:+49:13: +49:15 + scope 26 { + debug b1 => _39; // in scope 26 at $DIR/reference_prop.rs:+49:13: +49:15 + let _40: usize; // in scope 26 at $DIR/reference_prop.rs:+50:13: +50:14 + scope 27 { + debug c => _40; // in scope 27 at $DIR/reference_prop.rs:+50:13: +50:14 + let _41: *const usize; // in scope 27 at $DIR/reference_prop.rs:+51:13: +51:15 + scope 28 { + debug b2 => _41; // in scope 28 at $DIR/reference_prop.rs:+51:13: +51:15 + let _42: usize; // in scope 28 at $DIR/reference_prop.rs:+52:13: +52:15 + scope 29 { + debug c2 => _42; // in scope 29 at $DIR/reference_prop.rs:+52:13: +52:15 + let _43: *const usize; // in scope 29 at $DIR/reference_prop.rs:+53:13: +53:15 + scope 30 { + debug b3 => _43; // in scope 30 at $DIR/reference_prop.rs:+53:13: +53:15 + } + } + } + } + } + } + } + scope 31 { + let _47: *const T; // in scope 31 at $DIR/reference_prop.rs:+61:13: +61:14 + scope 32 { +- debug a => _47; // in scope 32 at $DIR/reference_prop.rs:+61:13: +61:14 ++ debug a => _1; // in scope 32 at $DIR/reference_prop.rs:+61:13: +61:14 + let _48: T; // in scope 32 at $DIR/reference_prop.rs:+62:13: +62:14 + scope 33 { + debug b => _48; // in scope 33 at $DIR/reference_prop.rs:+62:13: +62:14 + } + } + } + scope 34 { + let _52: *const T; // in scope 34 at $DIR/reference_prop.rs:+68:13: +68:14 + scope 35 { + debug a => _52; // in scope 35 at $DIR/reference_prop.rs:+68:13: +68:14 + let _54: T; // in scope 35 at $DIR/reference_prop.rs:+70:13: +70:14 + scope 36 { + debug b => _54; // in scope 36 at $DIR/reference_prop.rs:+70:13: +70:14 + } + } + } + scope 37 { + let _58: usize; // in scope 37 at $DIR/reference_prop.rs:+76:13: +76:14 + scope 38 { + debug a => _58; // in scope 38 at $DIR/reference_prop.rs:+76:13: +76:14 + let _59: *const usize; // in scope 38 at $DIR/reference_prop.rs:+77:13: +77:14 + scope 39 { +- debug b => _59; // in scope 39 at $DIR/reference_prop.rs:+77:13: +77:14 ++ debug b => &_58; // in scope 39 at $DIR/reference_prop.rs:+77:13: +77:14 + let _60: *const usize; // in scope 39 at $DIR/reference_prop.rs:+78:13: +78:14 + scope 40 { +- debug c => _60; // in scope 40 at $DIR/reference_prop.rs:+78:13: +78:14 ++ debug c => &_58; // in scope 40 at $DIR/reference_prop.rs:+78:13: +78:14 + let _61: usize; // in scope 40 at $DIR/reference_prop.rs:+79:13: +79:14 + scope 41 { + debug e => _61; // in scope 41 at $DIR/reference_prop.rs:+79:13: +79:14 + } + } + } + } + } + scope 42 { + let _65: usize; // in scope 42 at $DIR/reference_prop.rs:+85:13: +85:14 + scope 43 { + debug a => _65; // in scope 43 at $DIR/reference_prop.rs:+85:13: +85:14 + let _66: *const usize; // in scope 43 at $DIR/reference_prop.rs:+86:13: +86:14 + scope 44 { +- debug b => _66; // in scope 44 at $DIR/reference_prop.rs:+86:13: +86:14 ++ debug b => &_65; // in scope 44 at $DIR/reference_prop.rs:+86:13: +86:14 + let _67: &*const usize; // in scope 44 at $DIR/reference_prop.rs:+87:13: +87:14 + scope 45 { +- debug d => _67; // in scope 45 at $DIR/reference_prop.rs:+87:13: +87:14 ++ debug d => &&_65; // in scope 45 at $DIR/reference_prop.rs:+87:13: +87:14 + let _68: usize; // in scope 45 at $DIR/reference_prop.rs:+88:13: +88:14 + scope 46 { + debug c => _68; // in scope 46 at $DIR/reference_prop.rs:+88:13: +88:14 + } + } + } + } + } + scope 47 { + let _71: usize; // in scope 47 at $DIR/reference_prop.rs:+94:13: +94:14 + scope 48 { + debug a => _71; // in scope 48 at $DIR/reference_prop.rs:+94:13: +94:14 + let mut _72: *const usize; // in scope 48 at $DIR/reference_prop.rs:+95:13: +95:18 + scope 49 { +- debug b => _72; // in scope 49 at $DIR/reference_prop.rs:+95:13: +95:18 ++ debug b => &_71; // in scope 49 at $DIR/reference_prop.rs:+95:13: +95:18 + let _73: &mut *const usize; // in scope 49 at $DIR/reference_prop.rs:+96:13: +96:14 + scope 50 { +- debug d => _73; // in scope 50 at $DIR/reference_prop.rs:+96:13: +96:14 ++ debug d => &&_71; // in scope 50 at $DIR/reference_prop.rs:+96:13: +96:14 + let _74: usize; // in scope 50 at $DIR/reference_prop.rs:+97:13: +97:14 + scope 51 { + debug c => _74; // in scope 51 at $DIR/reference_prop.rs:+97:13: +97:14 + } + } + } + } + } + + bb0: { +- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6 + StorageLive(_4); // scope 1 at $DIR/reference_prop.rs:+3:13: +3:14 + _4 = const 5_usize; // scope 1 at $DIR/reference_prop.rs:+3:17: +3:24 +- StorageLive(_5); // scope 2 at $DIR/reference_prop.rs:+4:13: +4:14 +- _5 = &raw const _4; // scope 2 at $DIR/reference_prop.rs:+4:17: +4:29 + StorageLive(_6); // scope 3 at $DIR/reference_prop.rs:+5:13: +5:14 +- _6 = (*_5); // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19 ++ _6 = _4; // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19 + StorageLive(_7); // scope 4 at $DIR/reference_prop.rs:+6:9: +6:19 + StorageLive(_8); // scope 4 at $DIR/reference_prop.rs:+6:16: +6:18 + _8 = (); // scope 4 at $DIR/reference_prop.rs:+6:16: +6:18 + _7 = opaque::<()>(move _8) -> bb1; // scope 4 at $DIR/reference_prop.rs:+6:9: +6:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:202:9: 202:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb1: { + StorageDead(_8); // scope 4 at $DIR/reference_prop.rs:+6:18: +6:19 + StorageDead(_7); // scope 4 at $DIR/reference_prop.rs:+6:19: +6:20 +- _3 = const (); // scope 1 at $DIR/reference_prop.rs:+2:5: +7:6 + StorageDead(_6); // scope 3 at $DIR/reference_prop.rs:+7:5: +7:6 +- StorageDead(_5); // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6 + StorageDead(_4); // scope 1 at $DIR/reference_prop.rs:+7:5: +7:6 +- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6 +- StorageLive(_9); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6 + StorageLive(_10); // scope 5 at $DIR/reference_prop.rs:+11:13: +11:14 + _10 = const 5_usize; // scope 5 at $DIR/reference_prop.rs:+11:17: +11:24 + StorageLive(_11); // scope 6 at $DIR/reference_prop.rs:+12:13: +12:15 + _11 = const 7_usize; // scope 6 at $DIR/reference_prop.rs:+12:18: +12:25 + StorageLive(_12); // scope 7 at $DIR/reference_prop.rs:+13:13: +13:18 + _12 = &raw const _10; // scope 7 at $DIR/reference_prop.rs:+13:21: +13:33 + StorageLive(_13); // scope 8 at $DIR/reference_prop.rs:+14:13: +14:26 + _13 = &raw const _11; // scope 8 at $DIR/reference_prop.rs:+14:13: +14:26 + _12 = move _13; // scope 8 at $DIR/reference_prop.rs:+14:9: +14:26 + StorageDead(_13); // scope 8 at $DIR/reference_prop.rs:+14:25: +14:26 + StorageLive(_14); // scope 8 at $DIR/reference_prop.rs:+16:13: +16:14 + _14 = (*_12); // scope 8 at $DIR/reference_prop.rs:+16:17: +16:19 + StorageLive(_15); // scope 9 at $DIR/reference_prop.rs:+17:9: +17:19 + StorageLive(_16); // scope 9 at $DIR/reference_prop.rs:+17:16: +17:18 + _16 = (); // scope 9 at $DIR/reference_prop.rs:+17:16: +17:18 + _15 = opaque::<()>(move _16) -> bb2; // scope 9 at $DIR/reference_prop.rs:+17:9: +17:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:213:9: 213:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb2: { + StorageDead(_16); // scope 9 at $DIR/reference_prop.rs:+17:18: +17:19 + StorageDead(_15); // scope 9 at $DIR/reference_prop.rs:+17:19: +17:20 +- _9 = const (); // scope 5 at $DIR/reference_prop.rs:+10:5: +18:6 + StorageDead(_14); // scope 8 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_12); // scope 7 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_11); // scope 6 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_10); // scope 5 at $DIR/reference_prop.rs:+18:5: +18:6 +- StorageDead(_9); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6 +- StorageLive(_17); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6 + StorageLive(_18); // scope 10 at $DIR/reference_prop.rs:+22:13: +22:14 + _18 = const 5_usize; // scope 10 at $DIR/reference_prop.rs:+22:17: +22:24 + StorageLive(_19); // scope 11 at $DIR/reference_prop.rs:+23:13: +23:14 + _19 = &raw const _18; // scope 11 at $DIR/reference_prop.rs:+23:17: +23:29 + StorageLive(_20); // scope 12 at $DIR/reference_prop.rs:+24:13: +24:14 + _20 = &_19; // scope 12 at $DIR/reference_prop.rs:+24:17: +24:19 + StorageLive(_21); // scope 13 at $DIR/reference_prop.rs:+25:13: +25:14 + _21 = (*_19); // scope 13 at $DIR/reference_prop.rs:+25:17: +25:19 + StorageLive(_22); // scope 14 at $DIR/reference_prop.rs:+26:9: +26:18 + StorageLive(_23); // scope 14 at $DIR/reference_prop.rs:+26:16: +26:17 + _23 = _20; // scope 14 at $DIR/reference_prop.rs:+26:16: +26:17 + _22 = opaque::<&*const usize>(move _23) -> bb3; // scope 14 at $DIR/reference_prop.rs:+26:9: +26:18 + // mir::Constant + // + span: $DIR/reference_prop.rs:222:9: 222:15 + // + literal: Const { ty: fn(&*const usize) {opaque::<&*const usize>}, val: Value() } + } + + bb3: { + StorageDead(_23); // scope 14 at $DIR/reference_prop.rs:+26:17: +26:18 + StorageDead(_22); // scope 14 at $DIR/reference_prop.rs:+26:18: +26:19 +- _17 = const (); // scope 10 at $DIR/reference_prop.rs:+21:5: +27:6 + StorageDead(_21); // scope 13 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_20); // scope 12 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_19); // scope 11 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_18); // scope 10 at $DIR/reference_prop.rs:+27:5: +27:6 +- StorageDead(_17); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6 +- StorageLive(_24); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6 + StorageLive(_25); // scope 15 at $DIR/reference_prop.rs:+31:13: +31:14 + _25 = const 5_usize; // scope 15 at $DIR/reference_prop.rs:+31:17: +31:24 + StorageLive(_26); // scope 16 at $DIR/reference_prop.rs:+32:13: +32:18 + _26 = &raw const _25; // scope 16 at $DIR/reference_prop.rs:+32:21: +32:33 + StorageLive(_27); // scope 17 at $DIR/reference_prop.rs:+33:13: +33:14 + _27 = &raw mut _26; // scope 17 at $DIR/reference_prop.rs:+33:17: +33:27 + StorageLive(_28); // scope 18 at $DIR/reference_prop.rs:+34:13: +34:14 + _28 = (*_26); // scope 18 at $DIR/reference_prop.rs:+34:17: +34:19 + StorageLive(_29); // scope 19 at $DIR/reference_prop.rs:+35:9: +35:18 + StorageLive(_30); // scope 19 at $DIR/reference_prop.rs:+35:16: +35:17 + _30 = _27; // scope 19 at $DIR/reference_prop.rs:+35:16: +35:17 + _29 = opaque::<*mut *const usize>(move _30) -> bb4; // scope 19 at $DIR/reference_prop.rs:+35:9: +35:18 + // mir::Constant + // + span: $DIR/reference_prop.rs:231:9: 231:15 + // + literal: Const { ty: fn(*mut *const usize) {opaque::<*mut *const usize>}, val: Value() } + } + + bb4: { + StorageDead(_30); // scope 19 at $DIR/reference_prop.rs:+35:17: +35:18 + StorageDead(_29); // scope 19 at $DIR/reference_prop.rs:+35:18: +35:19 +- _24 = const (); // scope 15 at $DIR/reference_prop.rs:+30:5: +36:6 + StorageDead(_28); // scope 18 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_27); // scope 17 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_26); // scope 16 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_25); // scope 15 at $DIR/reference_prop.rs:+36:5: +36:6 +- StorageDead(_24); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6 +- StorageLive(_31); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6 + StorageLive(_32); // scope 20 at $DIR/reference_prop.rs:+40:13: +40:14 + _32 = const 7_usize; // scope 20 at $DIR/reference_prop.rs:+40:17: +40:24 + StorageLive(_33); // scope 21 at $DIR/reference_prop.rs:+41:13: +41:14 + _33 = &raw const _32; // scope 21 at $DIR/reference_prop.rs:+41:17: +41:29 + StorageLive(_34); // scope 22 at $DIR/reference_prop.rs:+42:13: +42:14 +- _34 = (*_33); // scope 22 at $DIR/reference_prop.rs:+42:17: +42:19 ++ _34 = _32; // scope 22 at $DIR/reference_prop.rs:+42:17: +42:19 + StorageLive(_35); // scope 23 at $DIR/reference_prop.rs:+43:9: +43:18 + StorageLive(_36); // scope 23 at $DIR/reference_prop.rs:+43:16: +43:17 + _36 = _33; // scope 23 at $DIR/reference_prop.rs:+43:16: +43:17 + _35 = opaque::<*const usize>(move _36) -> bb5; // scope 23 at $DIR/reference_prop.rs:+43:9: +43:18 + // mir::Constant + // + span: $DIR/reference_prop.rs:239:9: 239:15 + // + literal: Const { ty: fn(*const usize) {opaque::<*const usize>}, val: Value() } + } + + bb5: { + StorageDead(_36); // scope 23 at $DIR/reference_prop.rs:+43:17: +43:18 + StorageDead(_35); // scope 23 at $DIR/reference_prop.rs:+43:18: +43:19 +- _31 = const (); // scope 20 at $DIR/reference_prop.rs:+39:5: +44:6 + StorageDead(_34); // scope 22 at $DIR/reference_prop.rs:+44:5: +44:6 + StorageDead(_33); // scope 21 at $DIR/reference_prop.rs:+44:5: +44:6 + StorageDead(_32); // scope 20 at $DIR/reference_prop.rs:+44:5: +44:6 +- StorageDead(_31); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6 +- StorageLive(_37); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6 + StorageLive(_38); // scope 24 at $DIR/reference_prop.rs:+48:13: +48:14 + _38 = const 7_usize; // scope 24 at $DIR/reference_prop.rs:+48:17: +48:24 + StorageLive(_39); // scope 25 at $DIR/reference_prop.rs:+49:13: +49:15 + _39 = &raw const _38; // scope 25 at $DIR/reference_prop.rs:+49:18: +49:30 + StorageLive(_40); // scope 26 at $DIR/reference_prop.rs:+50:13: +50:14 +- _40 = (*_39); // scope 26 at $DIR/reference_prop.rs:+50:17: +50:20 ++ _40 = _38; // scope 26 at $DIR/reference_prop.rs:+50:17: +50:20 + StorageLive(_41); // scope 27 at $DIR/reference_prop.rs:+51:13: +51:15 + _41 = _39; // scope 27 at $DIR/reference_prop.rs:+51:18: +51:20 + StorageLive(_42); // scope 28 at $DIR/reference_prop.rs:+52:13: +52:15 +- _42 = (*_41); // scope 28 at $DIR/reference_prop.rs:+52:18: +52:21 ++ _42 = _38; // scope 28 at $DIR/reference_prop.rs:+52:18: +52:21 + StorageLive(_43); // scope 29 at $DIR/reference_prop.rs:+53:13: +53:15 + _43 = _41; // scope 29 at $DIR/reference_prop.rs:+53:18: +53:20 + StorageLive(_44); // scope 30 at $DIR/reference_prop.rs:+56:9: +56:19 + StorageLive(_45); // scope 30 at $DIR/reference_prop.rs:+56:16: +56:18 + _45 = _43; // scope 30 at $DIR/reference_prop.rs:+56:16: +56:18 + _44 = opaque::<*const usize>(move _45) -> bb6; // scope 30 at $DIR/reference_prop.rs:+56:9: +56:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:252:9: 252:15 + // + literal: Const { ty: fn(*const usize) {opaque::<*const usize>}, val: Value() } + } + + bb6: { + StorageDead(_45); // scope 30 at $DIR/reference_prop.rs:+56:18: +56:19 + StorageDead(_44); // scope 30 at $DIR/reference_prop.rs:+56:19: +56:20 +- _37 = const (); // scope 24 at $DIR/reference_prop.rs:+47:5: +57:6 + StorageDead(_43); // scope 29 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_42); // scope 28 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_41); // scope 27 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_40); // scope 26 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_39); // scope 25 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_38); // scope 24 at $DIR/reference_prop.rs:+57:5: +57:6 +- StorageDead(_37); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6 +- StorageLive(_46); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6 +- StorageLive(_47); // scope 31 at $DIR/reference_prop.rs:+61:13: +61:14 +- _47 = &raw const (*_1); // scope 31 at $DIR/reference_prop.rs:+61:17: +61:35 + StorageLive(_48); // scope 32 at $DIR/reference_prop.rs:+62:13: +62:14 +- _48 = (*_47); // scope 32 at $DIR/reference_prop.rs:+62:17: +62:19 ++ _48 = (*_1); // scope 32 at $DIR/reference_prop.rs:+62:17: +62:19 + StorageLive(_49); // scope 33 at $DIR/reference_prop.rs:+63:9: +63:19 + StorageLive(_50); // scope 33 at $DIR/reference_prop.rs:+63:16: +63:18 + _50 = (); // scope 33 at $DIR/reference_prop.rs:+63:16: +63:18 + _49 = opaque::<()>(move _50) -> bb7; // scope 33 at $DIR/reference_prop.rs:+63:9: +63:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:259:9: 259:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb7: { + StorageDead(_50); // scope 33 at $DIR/reference_prop.rs:+63:18: +63:19 + StorageDead(_49); // scope 33 at $DIR/reference_prop.rs:+63:19: +63:20 +- _46 = const (); // scope 31 at $DIR/reference_prop.rs:+60:5: +64:6 + StorageDead(_48); // scope 32 at $DIR/reference_prop.rs:+64:5: +64:6 +- StorageDead(_47); // scope 31 at $DIR/reference_prop.rs:+64:5: +64:6 +- StorageDead(_46); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6 +- StorageLive(_51); // scope 0 at $DIR/reference_prop.rs:+67:5: +72:6 + StorageLive(_52); // scope 34 at $DIR/reference_prop.rs:+68:13: +68:14 + _52 = &raw const (*_2); // scope 34 at $DIR/reference_prop.rs:+68:17: +68:37 + StorageLive(_53); // scope 35 at $DIR/reference_prop.rs:+69:20: +69:38 + _53 = &raw const (*_1); // scope 35 at $DIR/reference_prop.rs:+69:20: +69:38 + _2 = move _53; // scope 35 at $DIR/reference_prop.rs:+69:9: +69:38 + StorageDead(_53); // scope 35 at $DIR/reference_prop.rs:+69:37: +69:38 + StorageLive(_54); // scope 35 at $DIR/reference_prop.rs:+70:13: +70:14 + _54 = (*_52); // scope 35 at $DIR/reference_prop.rs:+70:17: +70:19 + StorageLive(_55); // scope 36 at $DIR/reference_prop.rs:+71:9: +71:19 + StorageLive(_56); // scope 36 at $DIR/reference_prop.rs:+71:16: +71:18 + _56 = (); // scope 36 at $DIR/reference_prop.rs:+71:16: +71:18 + _55 = opaque::<()>(move _56) -> bb8; // scope 36 at $DIR/reference_prop.rs:+71:9: +71:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:267:9: 267:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb8: { + StorageDead(_56); // scope 36 at $DIR/reference_prop.rs:+71:18: +71:19 + StorageDead(_55); // scope 36 at $DIR/reference_prop.rs:+71:19: +71:20 +- _51 = const (); // scope 34 at $DIR/reference_prop.rs:+67:5: +72:6 + StorageDead(_54); // scope 35 at $DIR/reference_prop.rs:+72:5: +72:6 + StorageDead(_52); // scope 34 at $DIR/reference_prop.rs:+72:5: +72:6 +- StorageDead(_51); // scope 0 at $DIR/reference_prop.rs:+72:5: +72:6 +- StorageLive(_57); // scope 0 at $DIR/reference_prop.rs:+75:5: +81:6 + StorageLive(_58); // scope 37 at $DIR/reference_prop.rs:+76:13: +76:14 + _58 = const 13_usize; // scope 37 at $DIR/reference_prop.rs:+76:17: +76:25 +- StorageLive(_59); // scope 38 at $DIR/reference_prop.rs:+77:13: +77:14 +- _59 = &raw const _58; // scope 38 at $DIR/reference_prop.rs:+77:17: +77:29 +- StorageLive(_60); // scope 39 at $DIR/reference_prop.rs:+78:13: +78:14 +- _60 = &raw const (*_59); // scope 39 at $DIR/reference_prop.rs:+78:17: +78:30 + StorageLive(_61); // scope 40 at $DIR/reference_prop.rs:+79:13: +79:14 +- _61 = (*_60); // scope 40 at $DIR/reference_prop.rs:+79:17: +79:19 ++ _61 = _58; // scope 40 at $DIR/reference_prop.rs:+79:17: +79:19 + StorageLive(_62); // scope 41 at $DIR/reference_prop.rs:+80:9: +80:19 + StorageLive(_63); // scope 41 at $DIR/reference_prop.rs:+80:16: +80:18 + _63 = (); // scope 41 at $DIR/reference_prop.rs:+80:16: +80:18 + _62 = opaque::<()>(move _63) -> bb9; // scope 41 at $DIR/reference_prop.rs:+80:9: +80:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:276:9: 276:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb9: { + StorageDead(_63); // scope 41 at $DIR/reference_prop.rs:+80:18: +80:19 + StorageDead(_62); // scope 41 at $DIR/reference_prop.rs:+80:19: +80:20 +- _57 = const (); // scope 37 at $DIR/reference_prop.rs:+75:5: +81:6 + StorageDead(_61); // scope 40 at $DIR/reference_prop.rs:+81:5: +81:6 +- StorageDead(_60); // scope 39 at $DIR/reference_prop.rs:+81:5: +81:6 +- StorageDead(_59); // scope 38 at $DIR/reference_prop.rs:+81:5: +81:6 + StorageDead(_58); // scope 37 at $DIR/reference_prop.rs:+81:5: +81:6 +- StorageDead(_57); // scope 0 at $DIR/reference_prop.rs:+81:5: +81:6 +- StorageLive(_64); // scope 0 at $DIR/reference_prop.rs:+84:5: +90:6 + StorageLive(_65); // scope 42 at $DIR/reference_prop.rs:+85:13: +85:14 + _65 = const 5_usize; // scope 42 at $DIR/reference_prop.rs:+85:17: +85:24 +- StorageLive(_66); // scope 43 at $DIR/reference_prop.rs:+86:13: +86:14 +- _66 = &raw const _65; // scope 43 at $DIR/reference_prop.rs:+86:17: +86:29 +- StorageLive(_67); // scope 44 at $DIR/reference_prop.rs:+87:13: +87:14 +- _67 = &_66; // scope 44 at $DIR/reference_prop.rs:+87:17: +87:19 + StorageLive(_68); // scope 45 at $DIR/reference_prop.rs:+88:13: +88:14 +- _68 = (*_66); // scope 45 at $DIR/reference_prop.rs:+88:17: +88:19 ++ _68 = _65; // scope 45 at $DIR/reference_prop.rs:+88:17: +88:19 + StorageLive(_69); // scope 46 at $DIR/reference_prop.rs:+89:9: +89:19 + StorageLive(_70); // scope 46 at $DIR/reference_prop.rs:+89:16: +89:18 + _70 = (); // scope 46 at $DIR/reference_prop.rs:+89:16: +89:18 + _69 = opaque::<()>(move _70) -> bb10; // scope 46 at $DIR/reference_prop.rs:+89:9: +89:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:285:9: 285:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb10: { + StorageDead(_70); // scope 46 at $DIR/reference_prop.rs:+89:18: +89:19 + StorageDead(_69); // scope 46 at $DIR/reference_prop.rs:+89:19: +89:20 +- _64 = const (); // scope 42 at $DIR/reference_prop.rs:+84:5: +90:6 + StorageDead(_68); // scope 45 at $DIR/reference_prop.rs:+90:5: +90:6 +- StorageDead(_67); // scope 44 at $DIR/reference_prop.rs:+90:5: +90:6 +- StorageDead(_66); // scope 43 at $DIR/reference_prop.rs:+90:5: +90:6 + StorageDead(_65); // scope 42 at $DIR/reference_prop.rs:+90:5: +90:6 +- StorageDead(_64); // scope 0 at $DIR/reference_prop.rs:+90:5: +90:6 + StorageLive(_71); // scope 47 at $DIR/reference_prop.rs:+94:13: +94:14 + _71 = const 5_usize; // scope 47 at $DIR/reference_prop.rs:+94:17: +94:24 +- StorageLive(_72); // scope 48 at $DIR/reference_prop.rs:+95:13: +95:18 +- _72 = &raw const _71; // scope 48 at $DIR/reference_prop.rs:+95:21: +95:33 +- StorageLive(_73); // scope 49 at $DIR/reference_prop.rs:+96:13: +96:14 +- _73 = &mut _72; // scope 49 at $DIR/reference_prop.rs:+96:17: +96:23 + StorageLive(_74); // scope 50 at $DIR/reference_prop.rs:+97:13: +97:14 +- _74 = (*_72); // scope 50 at $DIR/reference_prop.rs:+97:17: +97:19 ++ _74 = _71; // scope 50 at $DIR/reference_prop.rs:+97:17: +97:19 + StorageLive(_75); // scope 51 at $DIR/reference_prop.rs:+98:9: +98:19 + StorageLive(_76); // scope 51 at $DIR/reference_prop.rs:+98:16: +98:18 + _76 = (); // scope 51 at $DIR/reference_prop.rs:+98:16: +98:18 + _75 = opaque::<()>(move _76) -> bb11; // scope 51 at $DIR/reference_prop.rs:+98:9: +98:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:294:9: 294:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb11: { + StorageDead(_76); // scope 51 at $DIR/reference_prop.rs:+98:18: +98:19 + StorageDead(_75); // scope 51 at $DIR/reference_prop.rs:+98:19: +98:20 + _0 = const (); // scope 47 at $DIR/reference_prop.rs:+93:5: +99:6 + StorageDead(_74); // scope 50 at $DIR/reference_prop.rs:+99:5: +99:6 +- StorageDead(_73); // scope 49 at $DIR/reference_prop.rs:+99:5: +99:6 +- StorageDead(_72); // scope 48 at $DIR/reference_prop.rs:+99:5: +99:6 + StorageDead(_71); // scope 47 at $DIR/reference_prop.rs:+99:5: +99:6 + return; // scope 0 at $DIR/reference_prop.rs:+100:2: +100:2 + } + } + diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff new file mode 100644 index 000000000..8d059de5b --- /dev/null +++ b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff @@ -0,0 +1,472 @@ +- // MIR for `reference_propagation_mut` before ReferencePropagation ++ // MIR for `reference_propagation_mut` after ReferencePropagation + + fn reference_propagation_mut(_1: &mut T, _2: &mut T) -> () { + debug single => _1; // in scope 0 at $DIR/reference_prop.rs:+0:43: +0:49 + debug multiple => _2; // in scope 0 at $DIR/reference_prop.rs:+0:62: +0:74 + let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:87: +0:87 + let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +7:6 + let mut _4: usize; // in scope 0 at $DIR/reference_prop.rs:+3:13: +3:18 + let _7: (); // in scope 0 at $DIR/reference_prop.rs:+6:9: +6:19 + let mut _8: (); // in scope 0 at $DIR/reference_prop.rs:+6:16: +6:18 + let _9: (); // in scope 0 at $DIR/reference_prop.rs:+10:5: +18:6 + let mut _10: usize; // in scope 0 at $DIR/reference_prop.rs:+11:13: +11:18 + let mut _13: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:20 + let mut _14: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:20 + let _16: (); // in scope 0 at $DIR/reference_prop.rs:+17:9: +17:19 + let mut _17: (); // in scope 0 at $DIR/reference_prop.rs:+17:16: +17:18 + let _18: (); // in scope 0 at $DIR/reference_prop.rs:+21:5: +27:6 + let mut _19: usize; // in scope 0 at $DIR/reference_prop.rs:+22:13: +22:18 + let _23: (); // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:18 + let mut _24: &&mut usize; // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:17 + let _25: (); // in scope 0 at $DIR/reference_prop.rs:+30:5: +36:6 + let mut _26: usize; // in scope 0 at $DIR/reference_prop.rs:+31:13: +31:18 + let _30: (); // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:18 + let mut _31: *mut &mut usize; // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:17 + let _32: (); // in scope 0 at $DIR/reference_prop.rs:+39:5: +44:6 + let mut _33: usize; // in scope 0 at $DIR/reference_prop.rs:+40:13: +40:18 + let _36: (); // in scope 0 at $DIR/reference_prop.rs:+43:9: +43:18 + let mut _37: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+43:16: +43:17 + let _38: (); // in scope 0 at $DIR/reference_prop.rs:+47:5: +57:6 + let mut _39: usize; // in scope 0 at $DIR/reference_prop.rs:+48:13: +48:18 + let _45: (); // in scope 0 at $DIR/reference_prop.rs:+56:9: +56:19 + let mut _46: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+56:16: +56:18 + let _47: (); // in scope 0 at $DIR/reference_prop.rs:+60:5: +64:6 + let _48: &mut T; // in scope 0 at $DIR/reference_prop.rs:+61:13: +61:14 + let _50: (); // in scope 0 at $DIR/reference_prop.rs:+63:9: +63:19 + let mut _51: (); // in scope 0 at $DIR/reference_prop.rs:+63:16: +63:18 + let _52: (); // in scope 0 at $DIR/reference_prop.rs:+67:5: +72:6 + let _53: &mut T; // in scope 0 at $DIR/reference_prop.rs:+68:13: +68:14 + let mut _54: &mut T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:32 + let mut _55: &mut T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:32 + let _57: (); // in scope 0 at $DIR/reference_prop.rs:+71:9: +71:19 + let mut _58: (); // in scope 0 at $DIR/reference_prop.rs:+71:16: +71:18 + let _59: (); // in scope 0 at $DIR/reference_prop.rs:+75:5: +81:6 + let mut _60: usize; // in scope 0 at $DIR/reference_prop.rs:+76:13: +76:18 + let _64: (); // in scope 0 at $DIR/reference_prop.rs:+80:9: +80:19 + let mut _65: (); // in scope 0 at $DIR/reference_prop.rs:+80:16: +80:18 + let mut _66: usize; // in scope 0 at $DIR/reference_prop.rs:+85:13: +85:18 + let _70: (); // in scope 0 at $DIR/reference_prop.rs:+89:9: +89:19 + let mut _71: (); // in scope 0 at $DIR/reference_prop.rs:+89:16: +89:18 + scope 1 { + debug a => _4; // in scope 1 at $DIR/reference_prop.rs:+3:13: +3:18 + let _5: &mut usize; // in scope 1 at $DIR/reference_prop.rs:+4:13: +4:14 + scope 2 { +- debug b => _5; // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14 ++ debug b => &_4; // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14 + let _6: usize; // in scope 2 at $DIR/reference_prop.rs:+5:13: +5:14 + scope 3 { + debug c => _6; // in scope 3 at $DIR/reference_prop.rs:+5:13: +5:14 + } + } + } + scope 4 { + debug a => _10; // in scope 4 at $DIR/reference_prop.rs:+11:13: +11:18 + let mut _11: usize; // in scope 4 at $DIR/reference_prop.rs:+12:13: +12:19 + scope 5 { + debug a2 => _11; // in scope 5 at $DIR/reference_prop.rs:+12:13: +12:19 + let mut _12: &mut usize; // in scope 5 at $DIR/reference_prop.rs:+13:13: +13:18 + scope 6 { + debug b => _12; // in scope 6 at $DIR/reference_prop.rs:+13:13: +13:18 + let _15: usize; // in scope 6 at $DIR/reference_prop.rs:+16:13: +16:14 + scope 7 { + debug c => _15; // in scope 7 at $DIR/reference_prop.rs:+16:13: +16:14 + } + } + } + } + scope 8 { + debug a => _19; // in scope 8 at $DIR/reference_prop.rs:+22:13: +22:18 + let _20: &mut usize; // in scope 8 at $DIR/reference_prop.rs:+23:13: +23:14 + scope 9 { + debug b => _20; // in scope 9 at $DIR/reference_prop.rs:+23:13: +23:14 + let _21: &&mut usize; // in scope 9 at $DIR/reference_prop.rs:+24:13: +24:14 + scope 10 { + debug d => _21; // in scope 10 at $DIR/reference_prop.rs:+24:13: +24:14 + let _22: usize; // in scope 10 at $DIR/reference_prop.rs:+25:13: +25:14 + scope 11 { + debug c => _22; // in scope 11 at $DIR/reference_prop.rs:+25:13: +25:14 + } + } + } + } + scope 12 { + debug a => _26; // in scope 12 at $DIR/reference_prop.rs:+31:13: +31:18 + let mut _27: &mut usize; // in scope 12 at $DIR/reference_prop.rs:+32:13: +32:18 + scope 13 { + debug b => _27; // in scope 13 at $DIR/reference_prop.rs:+32:13: +32:18 + let _28: *mut &mut usize; // in scope 13 at $DIR/reference_prop.rs:+33:13: +33:14 + scope 14 { + debug d => _28; // in scope 14 at $DIR/reference_prop.rs:+33:13: +33:14 + let _29: usize; // in scope 14 at $DIR/reference_prop.rs:+34:13: +34:14 + scope 15 { + debug c => _29; // in scope 15 at $DIR/reference_prop.rs:+34:13: +34:14 + } + } + } + } + scope 16 { + debug a => _33; // in scope 16 at $DIR/reference_prop.rs:+40:13: +40:18 + let _34: &mut usize; // in scope 16 at $DIR/reference_prop.rs:+41:13: +41:14 + scope 17 { + debug b => _34; // in scope 17 at $DIR/reference_prop.rs:+41:13: +41:14 + let _35: usize; // in scope 17 at $DIR/reference_prop.rs:+42:13: +42:14 + scope 18 { + debug c => _35; // in scope 18 at $DIR/reference_prop.rs:+42:13: +42:14 + } + } + } + scope 19 { + debug a => _39; // in scope 19 at $DIR/reference_prop.rs:+48:13: +48:18 + let _40: &mut usize; // in scope 19 at $DIR/reference_prop.rs:+49:13: +49:15 + scope 20 { + debug b1 => _40; // in scope 20 at $DIR/reference_prop.rs:+49:13: +49:15 + let _41: usize; // in scope 20 at $DIR/reference_prop.rs:+50:13: +50:14 + scope 21 { + debug c => _41; // in scope 21 at $DIR/reference_prop.rs:+50:13: +50:14 + let _42: &mut usize; // in scope 21 at $DIR/reference_prop.rs:+51:13: +51:15 + scope 22 { + debug b2 => _42; // in scope 22 at $DIR/reference_prop.rs:+51:13: +51:15 + let _43: usize; // in scope 22 at $DIR/reference_prop.rs:+52:13: +52:15 + scope 23 { + debug c2 => _43; // in scope 23 at $DIR/reference_prop.rs:+52:13: +52:15 + let _44: &mut usize; // in scope 23 at $DIR/reference_prop.rs:+53:13: +53:15 + scope 24 { + debug b3 => _44; // in scope 24 at $DIR/reference_prop.rs:+53:13: +53:15 + } + } + } + } + } + } + scope 25 { +- debug a => _48; // in scope 25 at $DIR/reference_prop.rs:+61:13: +61:14 ++ debug a => _1; // in scope 25 at $DIR/reference_prop.rs:+61:13: +61:14 + let _49: T; // in scope 25 at $DIR/reference_prop.rs:+62:13: +62:14 + scope 26 { + debug b => _49; // in scope 26 at $DIR/reference_prop.rs:+62:13: +62:14 + } + } + scope 27 { + debug a => _53; // in scope 27 at $DIR/reference_prop.rs:+68:13: +68:14 + let _56: T; // in scope 27 at $DIR/reference_prop.rs:+70:13: +70:14 + scope 28 { + debug b => _56; // in scope 28 at $DIR/reference_prop.rs:+70:13: +70:14 + } + } + scope 29 { + debug a => _60; // in scope 29 at $DIR/reference_prop.rs:+76:13: +76:18 + let _61: &mut usize; // in scope 29 at $DIR/reference_prop.rs:+77:13: +77:14 + scope 30 { +- debug b => _61; // in scope 30 at $DIR/reference_prop.rs:+77:13: +77:14 ++ debug b => &_60; // in scope 30 at $DIR/reference_prop.rs:+77:13: +77:14 + let _62: &&mut usize; // in scope 30 at $DIR/reference_prop.rs:+78:13: +78:14 + scope 31 { +- debug d => _62; // in scope 31 at $DIR/reference_prop.rs:+78:13: +78:14 ++ debug d => &&_60; // in scope 31 at $DIR/reference_prop.rs:+78:13: +78:14 + let _63: usize; // in scope 31 at $DIR/reference_prop.rs:+79:13: +79:14 + scope 32 { + debug c => _63; // in scope 32 at $DIR/reference_prop.rs:+79:13: +79:14 + } + } + } + } + scope 33 { + debug a => _66; // in scope 33 at $DIR/reference_prop.rs:+85:13: +85:18 + let mut _67: &mut usize; // in scope 33 at $DIR/reference_prop.rs:+86:13: +86:18 + scope 34 { +- debug b => _67; // in scope 34 at $DIR/reference_prop.rs:+86:13: +86:18 ++ debug b => &_66; // in scope 34 at $DIR/reference_prop.rs:+86:13: +86:18 + let _68: &mut &mut usize; // in scope 34 at $DIR/reference_prop.rs:+87:13: +87:14 + scope 35 { +- debug d => _68; // in scope 35 at $DIR/reference_prop.rs:+87:13: +87:14 ++ debug d => &&_66; // in scope 35 at $DIR/reference_prop.rs:+87:13: +87:14 + let _69: usize; // in scope 35 at $DIR/reference_prop.rs:+88:13: +88:14 + scope 36 { + debug c => _69; // in scope 36 at $DIR/reference_prop.rs:+88:13: +88:14 + } + } + } + } + + bb0: { +- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6 + StorageLive(_4); // scope 0 at $DIR/reference_prop.rs:+3:13: +3:18 + _4 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+3:21: +3:28 +- StorageLive(_5); // scope 1 at $DIR/reference_prop.rs:+4:13: +4:14 +- _5 = &mut _4; // scope 1 at $DIR/reference_prop.rs:+4:17: +4:23 + StorageLive(_6); // scope 2 at $DIR/reference_prop.rs:+5:13: +5:14 +- _6 = (*_5); // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19 ++ _6 = _4; // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19 + StorageLive(_7); // scope 3 at $DIR/reference_prop.rs:+6:9: +6:19 + StorageLive(_8); // scope 3 at $DIR/reference_prop.rs:+6:16: +6:18 + _8 = (); // scope 3 at $DIR/reference_prop.rs:+6:16: +6:18 + _7 = opaque::<()>(move _8) -> bb1; // scope 3 at $DIR/reference_prop.rs:+6:9: +6:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:109:9: 109:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb1: { + StorageDead(_8); // scope 3 at $DIR/reference_prop.rs:+6:18: +6:19 + StorageDead(_7); // scope 3 at $DIR/reference_prop.rs:+6:19: +6:20 +- _3 = const (); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6 + StorageDead(_6); // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6 +- StorageDead(_5); // scope 1 at $DIR/reference_prop.rs:+7:5: +7:6 + StorageDead(_4); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6 +- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6 +- StorageLive(_9); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6 + StorageLive(_10); // scope 0 at $DIR/reference_prop.rs:+11:13: +11:18 + _10 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+11:21: +11:28 + StorageLive(_11); // scope 4 at $DIR/reference_prop.rs:+12:13: +12:19 + _11 = const 7_usize; // scope 4 at $DIR/reference_prop.rs:+12:22: +12:29 + StorageLive(_12); // scope 5 at $DIR/reference_prop.rs:+13:13: +13:18 + _12 = &mut _10; // scope 5 at $DIR/reference_prop.rs:+13:21: +13:27 + StorageLive(_13); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:20 +- StorageLive(_14); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:20 +- _14 = &mut _11; // scope 6 at $DIR/reference_prop.rs:+14:13: +14:20 +- _13 = &mut (*_14); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:20 ++ _13 = &mut _11; // scope 6 at $DIR/reference_prop.rs:+14:13: +14:20 + _12 = move _13; // scope 6 at $DIR/reference_prop.rs:+14:9: +14:20 + StorageDead(_13); // scope 6 at $DIR/reference_prop.rs:+14:19: +14:20 +- StorageDead(_14); // scope 6 at $DIR/reference_prop.rs:+14:20: +14:21 + StorageLive(_15); // scope 6 at $DIR/reference_prop.rs:+16:13: +16:14 + _15 = (*_12); // scope 6 at $DIR/reference_prop.rs:+16:17: +16:19 + StorageLive(_16); // scope 7 at $DIR/reference_prop.rs:+17:9: +17:19 + StorageLive(_17); // scope 7 at $DIR/reference_prop.rs:+17:16: +17:18 + _17 = (); // scope 7 at $DIR/reference_prop.rs:+17:16: +17:18 + _16 = opaque::<()>(move _17) -> bb2; // scope 7 at $DIR/reference_prop.rs:+17:9: +17:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:120:9: 120:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb2: { + StorageDead(_17); // scope 7 at $DIR/reference_prop.rs:+17:18: +17:19 + StorageDead(_16); // scope 7 at $DIR/reference_prop.rs:+17:19: +17:20 +- _9 = const (); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6 + StorageDead(_15); // scope 6 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_12); // scope 5 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_11); // scope 4 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_10); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6 +- StorageDead(_9); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6 +- StorageLive(_18); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6 + StorageLive(_19); // scope 0 at $DIR/reference_prop.rs:+22:13: +22:18 + _19 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+22:21: +22:28 + StorageLive(_20); // scope 8 at $DIR/reference_prop.rs:+23:13: +23:14 + _20 = &mut _19; // scope 8 at $DIR/reference_prop.rs:+23:17: +23:23 + StorageLive(_21); // scope 9 at $DIR/reference_prop.rs:+24:13: +24:14 + _21 = &_20; // scope 9 at $DIR/reference_prop.rs:+24:17: +24:19 + StorageLive(_22); // scope 10 at $DIR/reference_prop.rs:+25:13: +25:14 + _22 = (*_20); // scope 10 at $DIR/reference_prop.rs:+25:17: +25:19 + StorageLive(_23); // scope 11 at $DIR/reference_prop.rs:+26:9: +26:18 + StorageLive(_24); // scope 11 at $DIR/reference_prop.rs:+26:16: +26:17 + _24 = _21; // scope 11 at $DIR/reference_prop.rs:+26:16: +26:17 + _23 = opaque::<&&mut usize>(move _24) -> bb3; // scope 11 at $DIR/reference_prop.rs:+26:9: +26:18 + // mir::Constant + // + span: $DIR/reference_prop.rs:129:9: 129:15 + // + literal: Const { ty: fn(&&mut usize) {opaque::<&&mut usize>}, val: Value() } + } + + bb3: { + StorageDead(_24); // scope 11 at $DIR/reference_prop.rs:+26:17: +26:18 + StorageDead(_23); // scope 11 at $DIR/reference_prop.rs:+26:18: +26:19 +- _18 = const (); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6 + StorageDead(_22); // scope 10 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_21); // scope 9 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_20); // scope 8 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_19); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6 +- StorageDead(_18); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6 +- StorageLive(_25); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6 + StorageLive(_26); // scope 0 at $DIR/reference_prop.rs:+31:13: +31:18 + _26 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+31:21: +31:28 + StorageLive(_27); // scope 12 at $DIR/reference_prop.rs:+32:13: +32:18 + _27 = &mut _26; // scope 12 at $DIR/reference_prop.rs:+32:21: +32:27 + StorageLive(_28); // scope 13 at $DIR/reference_prop.rs:+33:13: +33:14 + _28 = &raw mut _27; // scope 13 at $DIR/reference_prop.rs:+33:17: +33:27 + StorageLive(_29); // scope 14 at $DIR/reference_prop.rs:+34:13: +34:14 + _29 = (*_27); // scope 14 at $DIR/reference_prop.rs:+34:17: +34:19 + StorageLive(_30); // scope 15 at $DIR/reference_prop.rs:+35:9: +35:18 + StorageLive(_31); // scope 15 at $DIR/reference_prop.rs:+35:16: +35:17 + _31 = _28; // scope 15 at $DIR/reference_prop.rs:+35:16: +35:17 + _30 = opaque::<*mut &mut usize>(move _31) -> bb4; // scope 15 at $DIR/reference_prop.rs:+35:9: +35:18 + // mir::Constant + // + span: $DIR/reference_prop.rs:138:9: 138:15 + // + literal: Const { ty: fn(*mut &mut usize) {opaque::<*mut &mut usize>}, val: Value() } + } + + bb4: { + StorageDead(_31); // scope 15 at $DIR/reference_prop.rs:+35:17: +35:18 + StorageDead(_30); // scope 15 at $DIR/reference_prop.rs:+35:18: +35:19 +- _25 = const (); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6 + StorageDead(_29); // scope 14 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_28); // scope 13 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_27); // scope 12 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_26); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6 +- StorageDead(_25); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6 +- StorageLive(_32); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6 + StorageLive(_33); // scope 0 at $DIR/reference_prop.rs:+40:13: +40:18 + _33 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+40:21: +40:28 + StorageLive(_34); // scope 16 at $DIR/reference_prop.rs:+41:13: +41:14 + _34 = &mut _33; // scope 16 at $DIR/reference_prop.rs:+41:17: +41:23 + StorageLive(_35); // scope 17 at $DIR/reference_prop.rs:+42:13: +42:14 + _35 = (*_34); // scope 17 at $DIR/reference_prop.rs:+42:17: +42:19 + StorageLive(_36); // scope 18 at $DIR/reference_prop.rs:+43:9: +43:18 + StorageLive(_37); // scope 18 at $DIR/reference_prop.rs:+43:16: +43:17 + _37 = move _34; // scope 18 at $DIR/reference_prop.rs:+43:16: +43:17 + _36 = opaque::<&mut usize>(move _37) -> bb5; // scope 18 at $DIR/reference_prop.rs:+43:9: +43:18 + // mir::Constant + // + span: $DIR/reference_prop.rs:146:9: 146:15 + // + literal: Const { ty: fn(&mut usize) {opaque::<&mut usize>}, val: Value() } + } + + bb5: { + StorageDead(_37); // scope 18 at $DIR/reference_prop.rs:+43:17: +43:18 + StorageDead(_36); // scope 18 at $DIR/reference_prop.rs:+43:18: +43:19 +- _32 = const (); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6 + StorageDead(_35); // scope 17 at $DIR/reference_prop.rs:+44:5: +44:6 + StorageDead(_34); // scope 16 at $DIR/reference_prop.rs:+44:5: +44:6 + StorageDead(_33); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6 +- StorageDead(_32); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6 +- StorageLive(_38); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6 + StorageLive(_39); // scope 0 at $DIR/reference_prop.rs:+48:13: +48:18 + _39 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+48:21: +48:28 + StorageLive(_40); // scope 19 at $DIR/reference_prop.rs:+49:13: +49:15 + _40 = &mut _39; // scope 19 at $DIR/reference_prop.rs:+49:18: +49:24 + StorageLive(_41); // scope 20 at $DIR/reference_prop.rs:+50:13: +50:14 + _41 = (*_40); // scope 20 at $DIR/reference_prop.rs:+50:17: +50:20 + StorageLive(_42); // scope 21 at $DIR/reference_prop.rs:+51:13: +51:15 + _42 = move _40; // scope 21 at $DIR/reference_prop.rs:+51:18: +51:20 + StorageLive(_43); // scope 22 at $DIR/reference_prop.rs:+52:13: +52:15 + _43 = (*_42); // scope 22 at $DIR/reference_prop.rs:+52:18: +52:21 + StorageLive(_44); // scope 23 at $DIR/reference_prop.rs:+53:13: +53:15 + _44 = move _42; // scope 23 at $DIR/reference_prop.rs:+53:18: +53:20 + StorageLive(_45); // scope 24 at $DIR/reference_prop.rs:+56:9: +56:19 + StorageLive(_46); // scope 24 at $DIR/reference_prop.rs:+56:16: +56:18 + _46 = move _44; // scope 24 at $DIR/reference_prop.rs:+56:16: +56:18 + _45 = opaque::<&mut usize>(move _46) -> bb6; // scope 24 at $DIR/reference_prop.rs:+56:9: +56:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:159:9: 159:15 + // + literal: Const { ty: fn(&mut usize) {opaque::<&mut usize>}, val: Value() } + } + + bb6: { + StorageDead(_46); // scope 24 at $DIR/reference_prop.rs:+56:18: +56:19 + StorageDead(_45); // scope 24 at $DIR/reference_prop.rs:+56:19: +56:20 +- _38 = const (); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6 + StorageDead(_44); // scope 23 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_43); // scope 22 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_42); // scope 21 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_41); // scope 20 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_40); // scope 19 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_39); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6 +- StorageDead(_38); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6 +- StorageLive(_47); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6 +- StorageLive(_48); // scope 0 at $DIR/reference_prop.rs:+61:13: +61:14 +- _48 = &mut (*_1); // scope 0 at $DIR/reference_prop.rs:+61:17: +61:29 + StorageLive(_49); // scope 25 at $DIR/reference_prop.rs:+62:13: +62:14 +- _49 = (*_48); // scope 25 at $DIR/reference_prop.rs:+62:17: +62:19 ++ _49 = (*_1); // scope 25 at $DIR/reference_prop.rs:+62:17: +62:19 + StorageLive(_50); // scope 26 at $DIR/reference_prop.rs:+63:9: +63:19 + StorageLive(_51); // scope 26 at $DIR/reference_prop.rs:+63:16: +63:18 + _51 = (); // scope 26 at $DIR/reference_prop.rs:+63:16: +63:18 + _50 = opaque::<()>(move _51) -> bb7; // scope 26 at $DIR/reference_prop.rs:+63:9: +63:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:166:9: 166:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb7: { + StorageDead(_51); // scope 26 at $DIR/reference_prop.rs:+63:18: +63:19 + StorageDead(_50); // scope 26 at $DIR/reference_prop.rs:+63:19: +63:20 +- _47 = const (); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6 + StorageDead(_49); // scope 25 at $DIR/reference_prop.rs:+64:5: +64:6 +- StorageDead(_48); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6 +- StorageDead(_47); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6 +- StorageLive(_52); // scope 0 at $DIR/reference_prop.rs:+67:5: +72:6 + StorageLive(_53); // scope 0 at $DIR/reference_prop.rs:+68:13: +68:14 + _53 = &mut (*_2); // scope 0 at $DIR/reference_prop.rs:+68:17: +68:31 + StorageLive(_54); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:32 +- StorageLive(_55); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:32 +- _55 = &mut (*_1); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:32 +- _54 = &mut (*_55); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:32 ++ _54 = &mut (*_1); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:32 + _2 = move _54; // scope 27 at $DIR/reference_prop.rs:+69:9: +69:32 + StorageDead(_54); // scope 27 at $DIR/reference_prop.rs:+69:31: +69:32 +- StorageDead(_55); // scope 27 at $DIR/reference_prop.rs:+69:32: +69:33 + StorageLive(_56); // scope 27 at $DIR/reference_prop.rs:+70:13: +70:14 + _56 = (*_53); // scope 27 at $DIR/reference_prop.rs:+70:17: +70:19 + StorageLive(_57); // scope 28 at $DIR/reference_prop.rs:+71:9: +71:19 + StorageLive(_58); // scope 28 at $DIR/reference_prop.rs:+71:16: +71:18 + _58 = (); // scope 28 at $DIR/reference_prop.rs:+71:16: +71:18 + _57 = opaque::<()>(move _58) -> bb8; // scope 28 at $DIR/reference_prop.rs:+71:9: +71:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:174:9: 174:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb8: { + StorageDead(_58); // scope 28 at $DIR/reference_prop.rs:+71:18: +71:19 + StorageDead(_57); // scope 28 at $DIR/reference_prop.rs:+71:19: +71:20 +- _52 = const (); // scope 0 at $DIR/reference_prop.rs:+67:5: +72:6 + StorageDead(_56); // scope 27 at $DIR/reference_prop.rs:+72:5: +72:6 + StorageDead(_53); // scope 0 at $DIR/reference_prop.rs:+72:5: +72:6 +- StorageDead(_52); // scope 0 at $DIR/reference_prop.rs:+72:5: +72:6 +- StorageLive(_59); // scope 0 at $DIR/reference_prop.rs:+75:5: +81:6 + StorageLive(_60); // scope 0 at $DIR/reference_prop.rs:+76:13: +76:18 + _60 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+76:21: +76:28 +- StorageLive(_61); // scope 29 at $DIR/reference_prop.rs:+77:13: +77:14 +- _61 = &mut _60; // scope 29 at $DIR/reference_prop.rs:+77:17: +77:23 +- StorageLive(_62); // scope 30 at $DIR/reference_prop.rs:+78:13: +78:14 +- _62 = &_61; // scope 30 at $DIR/reference_prop.rs:+78:17: +78:19 + StorageLive(_63); // scope 31 at $DIR/reference_prop.rs:+79:13: +79:14 +- _63 = (*_61); // scope 31 at $DIR/reference_prop.rs:+79:17: +79:19 ++ _63 = _60; // scope 31 at $DIR/reference_prop.rs:+79:17: +79:19 + StorageLive(_64); // scope 32 at $DIR/reference_prop.rs:+80:9: +80:19 + StorageLive(_65); // scope 32 at $DIR/reference_prop.rs:+80:16: +80:18 + _65 = (); // scope 32 at $DIR/reference_prop.rs:+80:16: +80:18 + _64 = opaque::<()>(move _65) -> bb9; // scope 32 at $DIR/reference_prop.rs:+80:9: +80:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:183:9: 183:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb9: { + StorageDead(_65); // scope 32 at $DIR/reference_prop.rs:+80:18: +80:19 + StorageDead(_64); // scope 32 at $DIR/reference_prop.rs:+80:19: +80:20 +- _59 = const (); // scope 0 at $DIR/reference_prop.rs:+75:5: +81:6 + StorageDead(_63); // scope 31 at $DIR/reference_prop.rs:+81:5: +81:6 +- StorageDead(_62); // scope 30 at $DIR/reference_prop.rs:+81:5: +81:6 +- StorageDead(_61); // scope 29 at $DIR/reference_prop.rs:+81:5: +81:6 + StorageDead(_60); // scope 0 at $DIR/reference_prop.rs:+81:5: +81:6 +- StorageDead(_59); // scope 0 at $DIR/reference_prop.rs:+81:5: +81:6 + StorageLive(_66); // scope 0 at $DIR/reference_prop.rs:+85:13: +85:18 + _66 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+85:21: +85:28 +- StorageLive(_67); // scope 33 at $DIR/reference_prop.rs:+86:13: +86:18 +- _67 = &mut _66; // scope 33 at $DIR/reference_prop.rs:+86:21: +86:27 +- StorageLive(_68); // scope 34 at $DIR/reference_prop.rs:+87:13: +87:14 +- _68 = &mut _67; // scope 34 at $DIR/reference_prop.rs:+87:17: +87:23 + StorageLive(_69); // scope 35 at $DIR/reference_prop.rs:+88:13: +88:14 +- _69 = (*_67); // scope 35 at $DIR/reference_prop.rs:+88:17: +88:19 ++ _69 = _66; // scope 35 at $DIR/reference_prop.rs:+88:17: +88:19 + StorageLive(_70); // scope 36 at $DIR/reference_prop.rs:+89:9: +89:19 + StorageLive(_71); // scope 36 at $DIR/reference_prop.rs:+89:16: +89:18 + _71 = (); // scope 36 at $DIR/reference_prop.rs:+89:16: +89:18 + _70 = opaque::<()>(move _71) -> bb10; // scope 36 at $DIR/reference_prop.rs:+89:9: +89:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:192:9: 192:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb10: { + StorageDead(_71); // scope 36 at $DIR/reference_prop.rs:+89:18: +89:19 + StorageDead(_70); // scope 36 at $DIR/reference_prop.rs:+89:19: +89:20 + _0 = const (); // scope 0 at $DIR/reference_prop.rs:+84:5: +90:6 + StorageDead(_69); // scope 35 at $DIR/reference_prop.rs:+90:5: +90:6 +- StorageDead(_68); // scope 34 at $DIR/reference_prop.rs:+90:5: +90:6 +- StorageDead(_67); // scope 33 at $DIR/reference_prop.rs:+90:5: +90:6 + StorageDead(_66); // scope 0 at $DIR/reference_prop.rs:+90:5: +90:6 + return; // scope 0 at $DIR/reference_prop.rs:+91:2: +91:2 + } + } + diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff new file mode 100644 index 000000000..c93aa52be --- /dev/null +++ b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff @@ -0,0 +1,482 @@ +- // MIR for `reference_propagation_mut_ptr` before ReferencePropagation ++ // MIR for `reference_propagation_mut_ptr` after ReferencePropagation + + fn reference_propagation_mut_ptr(_1: *mut T, _2: *mut T) -> () { + debug single => _1; // in scope 0 at $DIR/reference_prop.rs:+0:43: +0:49 + debug multiple => _2; // in scope 0 at $DIR/reference_prop.rs:+0:59: +0:71 + let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:81: +0:81 + let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +7:6 + let _7: (); // in scope 0 at $DIR/reference_prop.rs:+6:9: +6:19 + let mut _8: (); // in scope 0 at $DIR/reference_prop.rs:+6:16: +6:18 + let _9: (); // in scope 0 at $DIR/reference_prop.rs:+10:5: +18:6 + let mut _13: *mut usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:24 + let _15: (); // in scope 0 at $DIR/reference_prop.rs:+17:9: +17:19 + let mut _16: (); // in scope 0 at $DIR/reference_prop.rs:+17:16: +17:18 + let _17: (); // in scope 0 at $DIR/reference_prop.rs:+21:5: +27:6 + let _22: (); // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:18 + let mut _23: &*mut usize; // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:17 + let _24: (); // in scope 0 at $DIR/reference_prop.rs:+30:5: +36:6 + let _29: (); // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:18 + let mut _30: *mut *mut usize; // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:17 + let _31: (); // in scope 0 at $DIR/reference_prop.rs:+39:5: +44:6 + let _35: (); // in scope 0 at $DIR/reference_prop.rs:+43:9: +43:18 + let mut _36: *mut usize; // in scope 0 at $DIR/reference_prop.rs:+43:16: +43:17 + let _37: (); // in scope 0 at $DIR/reference_prop.rs:+47:5: +57:6 + let _44: (); // in scope 0 at $DIR/reference_prop.rs:+56:9: +56:19 + let mut _45: *mut usize; // in scope 0 at $DIR/reference_prop.rs:+56:16: +56:18 + let _46: (); // in scope 0 at $DIR/reference_prop.rs:+60:5: +64:6 + let _49: (); // in scope 0 at $DIR/reference_prop.rs:+63:9: +63:19 + let mut _50: (); // in scope 0 at $DIR/reference_prop.rs:+63:16: +63:18 + let _51: (); // in scope 0 at $DIR/reference_prop.rs:+67:5: +72:6 + let mut _53: *mut T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:36 + let _55: (); // in scope 0 at $DIR/reference_prop.rs:+71:9: +71:19 + let mut _56: (); // in scope 0 at $DIR/reference_prop.rs:+71:16: +71:18 + let _57: (); // in scope 0 at $DIR/reference_prop.rs:+75:5: +81:6 + let _62: (); // in scope 0 at $DIR/reference_prop.rs:+80:9: +80:19 + let mut _63: (); // in scope 0 at $DIR/reference_prop.rs:+80:16: +80:18 + let _68: (); // in scope 0 at $DIR/reference_prop.rs:+89:9: +89:19 + let mut _69: (); // in scope 0 at $DIR/reference_prop.rs:+89:16: +89:18 + scope 1 { + let mut _4: usize; // in scope 1 at $DIR/reference_prop.rs:+3:13: +3:18 + scope 2 { + debug a => _4; // in scope 2 at $DIR/reference_prop.rs:+3:13: +3:18 + let _5: *mut usize; // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14 + scope 3 { +- debug b => _5; // in scope 3 at $DIR/reference_prop.rs:+4:13: +4:14 ++ debug b => &_4; // in scope 3 at $DIR/reference_prop.rs:+4:13: +4:14 + let _6: usize; // in scope 3 at $DIR/reference_prop.rs:+5:13: +5:14 + scope 4 { + debug c => _6; // in scope 4 at $DIR/reference_prop.rs:+5:13: +5:14 + } + } + } + } + scope 5 { + let mut _10: usize; // in scope 5 at $DIR/reference_prop.rs:+11:13: +11:18 + scope 6 { + debug a => _10; // in scope 6 at $DIR/reference_prop.rs:+11:13: +11:18 + let mut _11: usize; // in scope 6 at $DIR/reference_prop.rs:+12:13: +12:19 + scope 7 { + debug a2 => _11; // in scope 7 at $DIR/reference_prop.rs:+12:13: +12:19 + let mut _12: *mut usize; // in scope 7 at $DIR/reference_prop.rs:+13:13: +13:18 + scope 8 { + debug b => _12; // in scope 8 at $DIR/reference_prop.rs:+13:13: +13:18 + let _14: usize; // in scope 8 at $DIR/reference_prop.rs:+16:13: +16:14 + scope 9 { + debug c => _14; // in scope 9 at $DIR/reference_prop.rs:+16:13: +16:14 + } + } + } + } + } + scope 10 { + let mut _18: usize; // in scope 10 at $DIR/reference_prop.rs:+22:13: +22:18 + scope 11 { + debug a => _18; // in scope 11 at $DIR/reference_prop.rs:+22:13: +22:18 + let _19: *mut usize; // in scope 11 at $DIR/reference_prop.rs:+23:13: +23:14 + scope 12 { + debug b => _19; // in scope 12 at $DIR/reference_prop.rs:+23:13: +23:14 + let _20: &*mut usize; // in scope 12 at $DIR/reference_prop.rs:+24:13: +24:14 + scope 13 { + debug d => _20; // in scope 13 at $DIR/reference_prop.rs:+24:13: +24:14 + let _21: usize; // in scope 13 at $DIR/reference_prop.rs:+25:13: +25:14 + scope 14 { + debug c => _21; // in scope 14 at $DIR/reference_prop.rs:+25:13: +25:14 + } + } + } + } + } + scope 15 { + let mut _25: usize; // in scope 15 at $DIR/reference_prop.rs:+31:13: +31:18 + scope 16 { + debug a => _25; // in scope 16 at $DIR/reference_prop.rs:+31:13: +31:18 + let mut _26: *mut usize; // in scope 16 at $DIR/reference_prop.rs:+32:13: +32:18 + scope 17 { + debug b => _26; // in scope 17 at $DIR/reference_prop.rs:+32:13: +32:18 + let _27: *mut *mut usize; // in scope 17 at $DIR/reference_prop.rs:+33:13: +33:14 + scope 18 { + debug d => _27; // in scope 18 at $DIR/reference_prop.rs:+33:13: +33:14 + let _28: usize; // in scope 18 at $DIR/reference_prop.rs:+34:13: +34:14 + scope 19 { + debug c => _28; // in scope 19 at $DIR/reference_prop.rs:+34:13: +34:14 + } + } + } + } + } + scope 20 { + let mut _32: usize; // in scope 20 at $DIR/reference_prop.rs:+40:13: +40:18 + scope 21 { + debug a => _32; // in scope 21 at $DIR/reference_prop.rs:+40:13: +40:18 + let _33: *mut usize; // in scope 21 at $DIR/reference_prop.rs:+41:13: +41:14 + scope 22 { + debug b => _33; // in scope 22 at $DIR/reference_prop.rs:+41:13: +41:14 + let _34: usize; // in scope 22 at $DIR/reference_prop.rs:+42:13: +42:14 + scope 23 { + debug c => _34; // in scope 23 at $DIR/reference_prop.rs:+42:13: +42:14 + } + } + } + } + scope 24 { + let mut _38: usize; // in scope 24 at $DIR/reference_prop.rs:+48:13: +48:18 + scope 25 { + debug a => _38; // in scope 25 at $DIR/reference_prop.rs:+48:13: +48:18 + let _39: *mut usize; // in scope 25 at $DIR/reference_prop.rs:+49:13: +49:15 + scope 26 { + debug b1 => _39; // in scope 26 at $DIR/reference_prop.rs:+49:13: +49:15 + let _40: usize; // in scope 26 at $DIR/reference_prop.rs:+50:13: +50:14 + scope 27 { + debug c => _40; // in scope 27 at $DIR/reference_prop.rs:+50:13: +50:14 + let _41: *mut usize; // in scope 27 at $DIR/reference_prop.rs:+51:13: +51:15 + scope 28 { + debug b2 => _41; // in scope 28 at $DIR/reference_prop.rs:+51:13: +51:15 + let _42: usize; // in scope 28 at $DIR/reference_prop.rs:+52:13: +52:15 + scope 29 { + debug c2 => _42; // in scope 29 at $DIR/reference_prop.rs:+52:13: +52:15 + let _43: *mut usize; // in scope 29 at $DIR/reference_prop.rs:+53:13: +53:15 + scope 30 { + debug b3 => _43; // in scope 30 at $DIR/reference_prop.rs:+53:13: +53:15 + } + } + } + } + } + } + } + scope 31 { + let _47: *mut T; // in scope 31 at $DIR/reference_prop.rs:+61:13: +61:14 + scope 32 { +- debug a => _47; // in scope 32 at $DIR/reference_prop.rs:+61:13: +61:14 ++ debug a => _1; // in scope 32 at $DIR/reference_prop.rs:+61:13: +61:14 + let _48: T; // in scope 32 at $DIR/reference_prop.rs:+62:13: +62:14 + scope 33 { + debug b => _48; // in scope 33 at $DIR/reference_prop.rs:+62:13: +62:14 + } + } + } + scope 34 { + let _52: *mut T; // in scope 34 at $DIR/reference_prop.rs:+68:13: +68:14 + scope 35 { + debug a => _52; // in scope 35 at $DIR/reference_prop.rs:+68:13: +68:14 + let _54: T; // in scope 35 at $DIR/reference_prop.rs:+70:13: +70:14 + scope 36 { + debug b => _54; // in scope 36 at $DIR/reference_prop.rs:+70:13: +70:14 + } + } + } + scope 37 { + let mut _58: usize; // in scope 37 at $DIR/reference_prop.rs:+76:13: +76:18 + scope 38 { + debug a => _58; // in scope 38 at $DIR/reference_prop.rs:+76:13: +76:18 + let _59: *mut usize; // in scope 38 at $DIR/reference_prop.rs:+77:13: +77:14 + scope 39 { +- debug b => _59; // in scope 39 at $DIR/reference_prop.rs:+77:13: +77:14 ++ debug b => &_58; // in scope 39 at $DIR/reference_prop.rs:+77:13: +77:14 + let _60: &*mut usize; // in scope 39 at $DIR/reference_prop.rs:+78:13: +78:14 + scope 40 { +- debug d => _60; // in scope 40 at $DIR/reference_prop.rs:+78:13: +78:14 ++ debug d => &&_58; // in scope 40 at $DIR/reference_prop.rs:+78:13: +78:14 + let _61: usize; // in scope 40 at $DIR/reference_prop.rs:+79:13: +79:14 + scope 41 { + debug c => _61; // in scope 41 at $DIR/reference_prop.rs:+79:13: +79:14 + } + } + } + } + } + scope 42 { + let mut _64: usize; // in scope 42 at $DIR/reference_prop.rs:+85:13: +85:18 + scope 43 { + debug a => _64; // in scope 43 at $DIR/reference_prop.rs:+85:13: +85:18 + let mut _65: *mut usize; // in scope 43 at $DIR/reference_prop.rs:+86:13: +86:18 + scope 44 { +- debug b => _65; // in scope 44 at $DIR/reference_prop.rs:+86:13: +86:18 ++ debug b => &_64; // in scope 44 at $DIR/reference_prop.rs:+86:13: +86:18 + let _66: &mut *mut usize; // in scope 44 at $DIR/reference_prop.rs:+87:13: +87:14 + scope 45 { +- debug d => _66; // in scope 45 at $DIR/reference_prop.rs:+87:13: +87:14 ++ debug d => &&_64; // in scope 45 at $DIR/reference_prop.rs:+87:13: +87:14 + let _67: usize; // in scope 45 at $DIR/reference_prop.rs:+88:13: +88:14 + scope 46 { + debug c => _67; // in scope 46 at $DIR/reference_prop.rs:+88:13: +88:14 + } + } + } + } + } + + bb0: { +- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6 + StorageLive(_4); // scope 1 at $DIR/reference_prop.rs:+3:13: +3:18 + _4 = const 5_usize; // scope 1 at $DIR/reference_prop.rs:+3:21: +3:28 +- StorageLive(_5); // scope 2 at $DIR/reference_prop.rs:+4:13: +4:14 +- _5 = &raw mut _4; // scope 2 at $DIR/reference_prop.rs:+4:17: +4:27 + StorageLive(_6); // scope 3 at $DIR/reference_prop.rs:+5:13: +5:14 +- _6 = (*_5); // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19 ++ _6 = _4; // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19 + StorageLive(_7); // scope 4 at $DIR/reference_prop.rs:+6:9: +6:19 + StorageLive(_8); // scope 4 at $DIR/reference_prop.rs:+6:16: +6:18 + _8 = (); // scope 4 at $DIR/reference_prop.rs:+6:16: +6:18 + _7 = opaque::<()>(move _8) -> bb1; // scope 4 at $DIR/reference_prop.rs:+6:9: +6:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:304:9: 304:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb1: { + StorageDead(_8); // scope 4 at $DIR/reference_prop.rs:+6:18: +6:19 + StorageDead(_7); // scope 4 at $DIR/reference_prop.rs:+6:19: +6:20 +- _3 = const (); // scope 1 at $DIR/reference_prop.rs:+2:5: +7:6 + StorageDead(_6); // scope 3 at $DIR/reference_prop.rs:+7:5: +7:6 +- StorageDead(_5); // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6 + StorageDead(_4); // scope 1 at $DIR/reference_prop.rs:+7:5: +7:6 +- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6 +- StorageLive(_9); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6 + StorageLive(_10); // scope 5 at $DIR/reference_prop.rs:+11:13: +11:18 + _10 = const 5_usize; // scope 5 at $DIR/reference_prop.rs:+11:21: +11:28 + StorageLive(_11); // scope 6 at $DIR/reference_prop.rs:+12:13: +12:19 + _11 = const 7_usize; // scope 6 at $DIR/reference_prop.rs:+12:22: +12:29 + StorageLive(_12); // scope 7 at $DIR/reference_prop.rs:+13:13: +13:18 + _12 = &raw mut _10; // scope 7 at $DIR/reference_prop.rs:+13:21: +13:31 + StorageLive(_13); // scope 8 at $DIR/reference_prop.rs:+14:13: +14:24 + _13 = &raw mut _11; // scope 8 at $DIR/reference_prop.rs:+14:13: +14:24 + _12 = move _13; // scope 8 at $DIR/reference_prop.rs:+14:9: +14:24 + StorageDead(_13); // scope 8 at $DIR/reference_prop.rs:+14:23: +14:24 + StorageLive(_14); // scope 8 at $DIR/reference_prop.rs:+16:13: +16:14 + _14 = (*_12); // scope 8 at $DIR/reference_prop.rs:+16:17: +16:19 + StorageLive(_15); // scope 9 at $DIR/reference_prop.rs:+17:9: +17:19 + StorageLive(_16); // scope 9 at $DIR/reference_prop.rs:+17:16: +17:18 + _16 = (); // scope 9 at $DIR/reference_prop.rs:+17:16: +17:18 + _15 = opaque::<()>(move _16) -> bb2; // scope 9 at $DIR/reference_prop.rs:+17:9: +17:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:315:9: 315:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb2: { + StorageDead(_16); // scope 9 at $DIR/reference_prop.rs:+17:18: +17:19 + StorageDead(_15); // scope 9 at $DIR/reference_prop.rs:+17:19: +17:20 +- _9 = const (); // scope 5 at $DIR/reference_prop.rs:+10:5: +18:6 + StorageDead(_14); // scope 8 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_12); // scope 7 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_11); // scope 6 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_10); // scope 5 at $DIR/reference_prop.rs:+18:5: +18:6 +- StorageDead(_9); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6 +- StorageLive(_17); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6 + StorageLive(_18); // scope 10 at $DIR/reference_prop.rs:+22:13: +22:18 + _18 = const 5_usize; // scope 10 at $DIR/reference_prop.rs:+22:21: +22:28 + StorageLive(_19); // scope 11 at $DIR/reference_prop.rs:+23:13: +23:14 + _19 = &raw mut _18; // scope 11 at $DIR/reference_prop.rs:+23:17: +23:27 + StorageLive(_20); // scope 12 at $DIR/reference_prop.rs:+24:13: +24:14 + _20 = &_19; // scope 12 at $DIR/reference_prop.rs:+24:17: +24:19 + StorageLive(_21); // scope 13 at $DIR/reference_prop.rs:+25:13: +25:14 + _21 = (*_19); // scope 13 at $DIR/reference_prop.rs:+25:17: +25:19 + StorageLive(_22); // scope 14 at $DIR/reference_prop.rs:+26:9: +26:18 + StorageLive(_23); // scope 14 at $DIR/reference_prop.rs:+26:16: +26:17 + _23 = _20; // scope 14 at $DIR/reference_prop.rs:+26:16: +26:17 + _22 = opaque::<&*mut usize>(move _23) -> bb3; // scope 14 at $DIR/reference_prop.rs:+26:9: +26:18 + // mir::Constant + // + span: $DIR/reference_prop.rs:324:9: 324:15 + // + literal: Const { ty: fn(&*mut usize) {opaque::<&*mut usize>}, val: Value() } + } + + bb3: { + StorageDead(_23); // scope 14 at $DIR/reference_prop.rs:+26:17: +26:18 + StorageDead(_22); // scope 14 at $DIR/reference_prop.rs:+26:18: +26:19 +- _17 = const (); // scope 10 at $DIR/reference_prop.rs:+21:5: +27:6 + StorageDead(_21); // scope 13 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_20); // scope 12 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_19); // scope 11 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_18); // scope 10 at $DIR/reference_prop.rs:+27:5: +27:6 +- StorageDead(_17); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6 +- StorageLive(_24); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6 + StorageLive(_25); // scope 15 at $DIR/reference_prop.rs:+31:13: +31:18 + _25 = const 5_usize; // scope 15 at $DIR/reference_prop.rs:+31:21: +31:28 + StorageLive(_26); // scope 16 at $DIR/reference_prop.rs:+32:13: +32:18 + _26 = &raw mut _25; // scope 16 at $DIR/reference_prop.rs:+32:21: +32:31 + StorageLive(_27); // scope 17 at $DIR/reference_prop.rs:+33:13: +33:14 + _27 = &raw mut _26; // scope 17 at $DIR/reference_prop.rs:+33:17: +33:27 + StorageLive(_28); // scope 18 at $DIR/reference_prop.rs:+34:13: +34:14 + _28 = (*_26); // scope 18 at $DIR/reference_prop.rs:+34:17: +34:19 + StorageLive(_29); // scope 19 at $DIR/reference_prop.rs:+35:9: +35:18 + StorageLive(_30); // scope 19 at $DIR/reference_prop.rs:+35:16: +35:17 + _30 = _27; // scope 19 at $DIR/reference_prop.rs:+35:16: +35:17 + _29 = opaque::<*mut *mut usize>(move _30) -> bb4; // scope 19 at $DIR/reference_prop.rs:+35:9: +35:18 + // mir::Constant + // + span: $DIR/reference_prop.rs:333:9: 333:15 + // + literal: Const { ty: fn(*mut *mut usize) {opaque::<*mut *mut usize>}, val: Value() } + } + + bb4: { + StorageDead(_30); // scope 19 at $DIR/reference_prop.rs:+35:17: +35:18 + StorageDead(_29); // scope 19 at $DIR/reference_prop.rs:+35:18: +35:19 +- _24 = const (); // scope 15 at $DIR/reference_prop.rs:+30:5: +36:6 + StorageDead(_28); // scope 18 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_27); // scope 17 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_26); // scope 16 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_25); // scope 15 at $DIR/reference_prop.rs:+36:5: +36:6 +- StorageDead(_24); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6 +- StorageLive(_31); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6 + StorageLive(_32); // scope 20 at $DIR/reference_prop.rs:+40:13: +40:18 + _32 = const 7_usize; // scope 20 at $DIR/reference_prop.rs:+40:21: +40:28 + StorageLive(_33); // scope 21 at $DIR/reference_prop.rs:+41:13: +41:14 + _33 = &raw mut _32; // scope 21 at $DIR/reference_prop.rs:+41:17: +41:27 + StorageLive(_34); // scope 22 at $DIR/reference_prop.rs:+42:13: +42:14 + _34 = (*_33); // scope 22 at $DIR/reference_prop.rs:+42:17: +42:19 + StorageLive(_35); // scope 23 at $DIR/reference_prop.rs:+43:9: +43:18 + StorageLive(_36); // scope 23 at $DIR/reference_prop.rs:+43:16: +43:17 + _36 = _33; // scope 23 at $DIR/reference_prop.rs:+43:16: +43:17 + _35 = opaque::<*mut usize>(move _36) -> bb5; // scope 23 at $DIR/reference_prop.rs:+43:9: +43:18 + // mir::Constant + // + span: $DIR/reference_prop.rs:341:9: 341:15 + // + literal: Const { ty: fn(*mut usize) {opaque::<*mut usize>}, val: Value() } + } + + bb5: { + StorageDead(_36); // scope 23 at $DIR/reference_prop.rs:+43:17: +43:18 + StorageDead(_35); // scope 23 at $DIR/reference_prop.rs:+43:18: +43:19 +- _31 = const (); // scope 20 at $DIR/reference_prop.rs:+39:5: +44:6 + StorageDead(_34); // scope 22 at $DIR/reference_prop.rs:+44:5: +44:6 + StorageDead(_33); // scope 21 at $DIR/reference_prop.rs:+44:5: +44:6 + StorageDead(_32); // scope 20 at $DIR/reference_prop.rs:+44:5: +44:6 +- StorageDead(_31); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6 +- StorageLive(_37); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6 + StorageLive(_38); // scope 24 at $DIR/reference_prop.rs:+48:13: +48:18 + _38 = const 7_usize; // scope 24 at $DIR/reference_prop.rs:+48:21: +48:28 + StorageLive(_39); // scope 25 at $DIR/reference_prop.rs:+49:13: +49:15 + _39 = &raw mut _38; // scope 25 at $DIR/reference_prop.rs:+49:18: +49:28 + StorageLive(_40); // scope 26 at $DIR/reference_prop.rs:+50:13: +50:14 + _40 = (*_39); // scope 26 at $DIR/reference_prop.rs:+50:17: +50:20 + StorageLive(_41); // scope 27 at $DIR/reference_prop.rs:+51:13: +51:15 + _41 = _39; // scope 27 at $DIR/reference_prop.rs:+51:18: +51:20 + StorageLive(_42); // scope 28 at $DIR/reference_prop.rs:+52:13: +52:15 + _42 = (*_41); // scope 28 at $DIR/reference_prop.rs:+52:18: +52:21 + StorageLive(_43); // scope 29 at $DIR/reference_prop.rs:+53:13: +53:15 + _43 = _41; // scope 29 at $DIR/reference_prop.rs:+53:18: +53:20 + StorageLive(_44); // scope 30 at $DIR/reference_prop.rs:+56:9: +56:19 + StorageLive(_45); // scope 30 at $DIR/reference_prop.rs:+56:16: +56:18 + _45 = _43; // scope 30 at $DIR/reference_prop.rs:+56:16: +56:18 + _44 = opaque::<*mut usize>(move _45) -> bb6; // scope 30 at $DIR/reference_prop.rs:+56:9: +56:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:354:9: 354:15 + // + literal: Const { ty: fn(*mut usize) {opaque::<*mut usize>}, val: Value() } + } + + bb6: { + StorageDead(_45); // scope 30 at $DIR/reference_prop.rs:+56:18: +56:19 + StorageDead(_44); // scope 30 at $DIR/reference_prop.rs:+56:19: +56:20 +- _37 = const (); // scope 24 at $DIR/reference_prop.rs:+47:5: +57:6 + StorageDead(_43); // scope 29 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_42); // scope 28 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_41); // scope 27 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_40); // scope 26 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_39); // scope 25 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_38); // scope 24 at $DIR/reference_prop.rs:+57:5: +57:6 +- StorageDead(_37); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6 +- StorageLive(_46); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6 +- StorageLive(_47); // scope 31 at $DIR/reference_prop.rs:+61:13: +61:14 +- _47 = &raw mut (*_1); // scope 31 at $DIR/reference_prop.rs:+61:17: +61:33 + StorageLive(_48); // scope 32 at $DIR/reference_prop.rs:+62:13: +62:14 +- _48 = (*_47); // scope 32 at $DIR/reference_prop.rs:+62:17: +62:19 ++ _48 = (*_1); // scope 32 at $DIR/reference_prop.rs:+62:17: +62:19 + StorageLive(_49); // scope 33 at $DIR/reference_prop.rs:+63:9: +63:19 + StorageLive(_50); // scope 33 at $DIR/reference_prop.rs:+63:16: +63:18 + _50 = (); // scope 33 at $DIR/reference_prop.rs:+63:16: +63:18 + _49 = opaque::<()>(move _50) -> bb7; // scope 33 at $DIR/reference_prop.rs:+63:9: +63:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:361:9: 361:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb7: { + StorageDead(_50); // scope 33 at $DIR/reference_prop.rs:+63:18: +63:19 + StorageDead(_49); // scope 33 at $DIR/reference_prop.rs:+63:19: +63:20 +- _46 = const (); // scope 31 at $DIR/reference_prop.rs:+60:5: +64:6 + StorageDead(_48); // scope 32 at $DIR/reference_prop.rs:+64:5: +64:6 +- StorageDead(_47); // scope 31 at $DIR/reference_prop.rs:+64:5: +64:6 +- StorageDead(_46); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6 +- StorageLive(_51); // scope 0 at $DIR/reference_prop.rs:+67:5: +72:6 + StorageLive(_52); // scope 34 at $DIR/reference_prop.rs:+68:13: +68:14 + _52 = &raw mut (*_2); // scope 34 at $DIR/reference_prop.rs:+68:17: +68:35 + StorageLive(_53); // scope 35 at $DIR/reference_prop.rs:+69:20: +69:36 + _53 = &raw mut (*_1); // scope 35 at $DIR/reference_prop.rs:+69:20: +69:36 + _2 = move _53; // scope 35 at $DIR/reference_prop.rs:+69:9: +69:36 + StorageDead(_53); // scope 35 at $DIR/reference_prop.rs:+69:35: +69:36 + StorageLive(_54); // scope 35 at $DIR/reference_prop.rs:+70:13: +70:14 + _54 = (*_52); // scope 35 at $DIR/reference_prop.rs:+70:17: +70:19 + StorageLive(_55); // scope 36 at $DIR/reference_prop.rs:+71:9: +71:19 + StorageLive(_56); // scope 36 at $DIR/reference_prop.rs:+71:16: +71:18 + _56 = (); // scope 36 at $DIR/reference_prop.rs:+71:16: +71:18 + _55 = opaque::<()>(move _56) -> bb8; // scope 36 at $DIR/reference_prop.rs:+71:9: +71:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:369:9: 369:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb8: { + StorageDead(_56); // scope 36 at $DIR/reference_prop.rs:+71:18: +71:19 + StorageDead(_55); // scope 36 at $DIR/reference_prop.rs:+71:19: +71:20 +- _51 = const (); // scope 34 at $DIR/reference_prop.rs:+67:5: +72:6 + StorageDead(_54); // scope 35 at $DIR/reference_prop.rs:+72:5: +72:6 + StorageDead(_52); // scope 34 at $DIR/reference_prop.rs:+72:5: +72:6 +- StorageDead(_51); // scope 0 at $DIR/reference_prop.rs:+72:5: +72:6 +- StorageLive(_57); // scope 0 at $DIR/reference_prop.rs:+75:5: +81:6 + StorageLive(_58); // scope 37 at $DIR/reference_prop.rs:+76:13: +76:18 + _58 = const 5_usize; // scope 37 at $DIR/reference_prop.rs:+76:21: +76:28 +- StorageLive(_59); // scope 38 at $DIR/reference_prop.rs:+77:13: +77:14 +- _59 = &raw mut _58; // scope 38 at $DIR/reference_prop.rs:+77:17: +77:27 +- StorageLive(_60); // scope 39 at $DIR/reference_prop.rs:+78:13: +78:14 +- _60 = &_59; // scope 39 at $DIR/reference_prop.rs:+78:17: +78:19 + StorageLive(_61); // scope 40 at $DIR/reference_prop.rs:+79:13: +79:14 +- _61 = (*_59); // scope 40 at $DIR/reference_prop.rs:+79:17: +79:19 ++ _61 = _58; // scope 40 at $DIR/reference_prop.rs:+79:17: +79:19 + StorageLive(_62); // scope 41 at $DIR/reference_prop.rs:+80:9: +80:19 + StorageLive(_63); // scope 41 at $DIR/reference_prop.rs:+80:16: +80:18 + _63 = (); // scope 41 at $DIR/reference_prop.rs:+80:16: +80:18 + _62 = opaque::<()>(move _63) -> bb9; // scope 41 at $DIR/reference_prop.rs:+80:9: +80:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:378:9: 378:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb9: { + StorageDead(_63); // scope 41 at $DIR/reference_prop.rs:+80:18: +80:19 + StorageDead(_62); // scope 41 at $DIR/reference_prop.rs:+80:19: +80:20 +- _57 = const (); // scope 37 at $DIR/reference_prop.rs:+75:5: +81:6 + StorageDead(_61); // scope 40 at $DIR/reference_prop.rs:+81:5: +81:6 +- StorageDead(_60); // scope 39 at $DIR/reference_prop.rs:+81:5: +81:6 +- StorageDead(_59); // scope 38 at $DIR/reference_prop.rs:+81:5: +81:6 + StorageDead(_58); // scope 37 at $DIR/reference_prop.rs:+81:5: +81:6 +- StorageDead(_57); // scope 0 at $DIR/reference_prop.rs:+81:5: +81:6 + StorageLive(_64); // scope 42 at $DIR/reference_prop.rs:+85:13: +85:18 + _64 = const 5_usize; // scope 42 at $DIR/reference_prop.rs:+85:21: +85:28 +- StorageLive(_65); // scope 43 at $DIR/reference_prop.rs:+86:13: +86:18 +- _65 = &raw mut _64; // scope 43 at $DIR/reference_prop.rs:+86:21: +86:31 +- StorageLive(_66); // scope 44 at $DIR/reference_prop.rs:+87:13: +87:14 +- _66 = &mut _65; // scope 44 at $DIR/reference_prop.rs:+87:17: +87:23 + StorageLive(_67); // scope 45 at $DIR/reference_prop.rs:+88:13: +88:14 +- _67 = (*_65); // scope 45 at $DIR/reference_prop.rs:+88:17: +88:19 ++ _67 = _64; // scope 45 at $DIR/reference_prop.rs:+88:17: +88:19 + StorageLive(_68); // scope 46 at $DIR/reference_prop.rs:+89:9: +89:19 + StorageLive(_69); // scope 46 at $DIR/reference_prop.rs:+89:16: +89:18 + _69 = (); // scope 46 at $DIR/reference_prop.rs:+89:16: +89:18 + _68 = opaque::<()>(move _69) -> bb10; // scope 46 at $DIR/reference_prop.rs:+89:9: +89:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:387:9: 387:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb10: { + StorageDead(_69); // scope 46 at $DIR/reference_prop.rs:+89:18: +89:19 + StorageDead(_68); // scope 46 at $DIR/reference_prop.rs:+89:19: +89:20 + _0 = const (); // scope 42 at $DIR/reference_prop.rs:+84:5: +90:6 + StorageDead(_67); // scope 45 at $DIR/reference_prop.rs:+90:5: +90:6 +- StorageDead(_66); // scope 44 at $DIR/reference_prop.rs:+90:5: +90:6 +- StorageDead(_65); // scope 43 at $DIR/reference_prop.rs:+90:5: +90:6 + StorageDead(_64); // scope 42 at $DIR/reference_prop.rs:+90:5: +90:6 + return; // scope 0 at $DIR/reference_prop.rs:+91:2: +91:2 + } + } + diff --git a/tests/mir-opt/reference_prop.rs b/tests/mir-opt/reference_prop.rs new file mode 100644 index 000000000..4083b4547 --- /dev/null +++ b/tests/mir-opt/reference_prop.rs @@ -0,0 +1,592 @@ +// unit-test: ReferencePropagation +// needs-unwind + +#![feature(raw_ref_op)] +#![feature(core_intrinsics, custom_mir)] + +#[inline(never)] +fn opaque(_: impl Sized) {} + +fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { + // Propagation through a reference. + { + let a = 5_usize; + let b = &a; // This borrow is only used once. + let c = *b; // This should be optimized. + opaque(()); // We use opaque to separate cases into basic blocks in the MIR. + } + + // Propagation through a two references. + { + let a = 5_usize; + let a2 = 7_usize; + let mut b = &a; + b = &a2; + // `b` is assigned twice, so we cannot propagate it. + let c = *b; + opaque(()); + } + + // Propagation through a borrowed reference. + { + let a = 5_usize; + let b = &a; + let d = &b; + let c = *b; // `b` is immutably borrowed, we know its value, but do not propagate it + opaque(d); // prevent `d` from being removed. + } + + // Propagation through a borrowed reference. + { + let a = 5_usize; + let mut b = &a; + let d = &raw mut b; + let c = *b; // `b` is mutably borrowed, we cannot know its value. + opaque(d); // prevent `d` from being removed. + } + + // Propagation through an escaping borrow. + { + let a = 7_usize; + let b = &a; + let c = *b; + opaque(b); // `b` escapes here, but we can still replace immutable borrow + } + + // Propagation through a transitively escaping borrow. + { + let a = 7_usize; + let b1 = &a; + let c = *b1; + let b2 = b1; + let c2 = *b2; + let b3 = b2; + // `b3` escapes here, so we can only replace immutable borrow, + // for either `b`, `b2` or `b3`. + opaque(b3); + } + + // Propagation a reborrow of an argument. + { + let a = &*single; + let b = *a; // This should be optimized as `*single`. + opaque(()); + } + + // Propagation a reborrow of a mutated argument. + { + let a = &*multiple; + multiple = &*single; + let b = *a; // This should not be optimized. + opaque(()); + } + + // Fixed-point propagation through a borrowed reference. + { + let a = 5_usize; + let b = &a; + let d = &b; // first round promotes debuginfo for `d` + let c = *b; // second round propagates this dereference + opaque(()); + } + + // Fixed-point propagation through a borrowed reference. + { + let a = 5_usize; + let mut b = &a; + let d = &mut b; // first round promotes debuginfo for `d` + let c = *b; // second round propagates this dereference + opaque(()); + } +} + +fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a mut T) { + // Propagation through a reference. + { + let mut a = 5_usize; + let b = &mut a; // This borrow is only used once. + let c = *b; // This should be optimized. + opaque(()); + } + + // Propagation through a two references. + { + let mut a = 5_usize; + let mut a2 = 7_usize; + let mut b = &mut a; + b = &mut a2; + // `b` is assigned twice, so we cannot propagate it. + let c = *b; + opaque(()); + } + + // Propagation through a borrowed reference. + { + let mut a = 5_usize; + let b = &mut a; + let d = &b; + let c = *b; // `b` is immutably borrowed, we know its value, but cannot be removed. + opaque(d); // prevent `d` from being removed. + } + + // Propagation through a borrowed reference. + { + let mut a = 5_usize; + let mut b = &mut a; + let d = &raw mut b; + let c = *b; // `b` is mutably borrowed, we cannot know its value. + opaque(d); // prevent `d` from being removed. + } + + // Propagation through an escaping borrow. + { + let mut a = 7_usize; + let b = &mut a; + let c = *b; + opaque(b); // `b` escapes here, so we can only replace immutable borrow + } + + // Propagation through a transitively escaping borrow. + { + let mut a = 7_usize; + let b1 = &mut a; + let c = *b1; + let b2 = b1; + let c2 = *b2; + let b3 = b2; + // `b3` escapes here, so we can only replace immutable borrow, + // for either `b`, `b2` or `b3`. + opaque(b3); + } + + // Propagation a reborrow of an argument. + { + let a = &mut *single; + let b = *a; // This should be optimized as `*single`. + opaque(()); + } + + // Propagation a reborrow of a mutated argument. + { + let a = &mut *multiple; + multiple = &mut *single; + let b = *a; // This should not be optimized. + opaque(()); + } + + // Fixed-point propagation through a borrowed reference. + { + let mut a = 5_usize; + let b = &mut a; + let d = &b; // first round promotes debuginfo for `d` + let c = *b; // second round propagates this dereference + opaque(()); + } + + // Fixed-point propagation through a borrowed reference. + { + let mut a = 5_usize; + let mut b = &mut a; + let d = &mut b; // first round promotes debuginfo for `d` + let c = *b; // second round propagates this dereference + opaque(()); + } +} + +fn reference_propagation_const_ptr(single: *const T, mut multiple: *const T) { + // Propagation through a reference. + unsafe { + let a = 5_usize; + let b = &raw const a; // This borrow is only used once. + let c = *b; // This should be optimized. + opaque(()); + } + + // Propagation through a two references. + unsafe { + let a = 5_usize; + let a2 = 7_usize; + let mut b = &raw const a; + b = &raw const a2; + // `b` is assigned twice, so we cannot propagate it. + let c = *b; + opaque(()); + } + + // Propagation through a borrowed reference. + unsafe { + let a = 5_usize; + let b = &raw const a; + let d = &b; + let c = *b; // `b` is immutably borrowed, we know its value, but cannot be removed. + opaque(d); // prevent `d` from being removed. + } + + // Propagation through a borrowed reference. + unsafe { + let a = 5_usize; + let mut b = &raw const a; + let d = &raw mut b; + let c = *b; // `b` is mutably borrowed, we cannot know its value. + opaque(d); // prevent `d` from being removed. + } + + // Propagation through an escaping borrow. + unsafe { + let a = 7_usize; + let b = &raw const a; + let c = *b; + opaque(b); // `b` escapes here, so we can only replace immutable borrow + } + + // Propagation through a transitively escaping borrow. + unsafe { + let a = 7_usize; + let b1 = &raw const a; + let c = *b1; + let b2 = b1; + let c2 = *b2; + let b3 = b2; + // `b3` escapes here, so we can only replace immutable borrow, + // for either `b`, `b2` or `b3`. + opaque(b3); + } + + // Propagation a reborrow of an argument. + unsafe { + let a = &raw const *single; + let b = *a; // This should be optimized as `*single`. + opaque(()); + } + + // Propagation a reborrow of a mutated argument. + unsafe { + let a = &raw const *multiple; + multiple = &raw const *single; + let b = *a; // This should not be optimized. + opaque(()); + } + + // Propagation through a reborrow. + unsafe { + let a = 13_usize; + let b = &raw const a; + let c = &raw const *b; + let e = *c; + opaque(()); + } + + // Fixed-point propagation through a borrowed reference. + unsafe { + let a = 5_usize; + let b = &raw const a; + let d = &b; // first round promotes debuginfo for `d` + let c = *b; // second round propagates this dereference + opaque(()); + } + + // Fixed-point propagation through a borrowed reference. + unsafe { + let a = 5_usize; + let mut b = &raw const a; + let d = &mut b; // first round promotes debuginfo for `d` + let c = *b; // second round propagates this dereference + opaque(()); + } +} + +fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) { + // Propagation through a reference. + unsafe { + let mut a = 5_usize; + let b = &raw mut a; // This borrow is only used once. + let c = *b; // This should be optimized. + opaque(()); + } + + // Propagation through a two references. + unsafe { + let mut a = 5_usize; + let mut a2 = 7_usize; + let mut b = &raw mut a; + b = &raw mut a2; + // `b` is assigned twice, so we cannot propagate it. + let c = *b; + opaque(()); + } + + // Propagation through a borrowed reference. + unsafe { + let mut a = 5_usize; + let b = &raw mut a; + let d = &b; + let c = *b; // `b` is immutably borrowed, we know its value, but cannot be removed. + opaque(d); // prevent `d` from being removed. + } + + // Propagation through a borrowed reference. + unsafe { + let mut a = 5_usize; + let mut b = &raw mut a; + let d = &raw mut b; + let c = *b; // `b` is mutably borrowed, we cannot know its value. + opaque(d); // prevent `d` from being removed. + } + + // Propagation through an escaping borrow. + unsafe { + let mut a = 7_usize; + let b = &raw mut a; + let c = *b; + opaque(b); // `b` escapes here, so we can only replace immutable borrow + } + + // Propagation through a transitively escaping borrow. + unsafe { + let mut a = 7_usize; + let b1 = &raw mut a; + let c = *b1; + let b2 = b1; + let c2 = *b2; + let b3 = b2; + // `b3` escapes here, so we can only replace immutable borrow, + // for either `b`, `b2` or `b3`. + opaque(b3); + } + + // Propagation a reborrow of an argument. + unsafe { + let a = &raw mut *single; + let b = *a; // This should be optimized as `*single`. + opaque(()); + } + + // Propagation a reborrow of a mutated argument. + unsafe { + let a = &raw mut *multiple; + multiple = &raw mut *single; + let b = *a; // This should not be optimized. + opaque(()); + } + + // Fixed-point propagation through a borrowed reference. + unsafe { + let mut a = 5_usize; + let b = &raw mut a; + let d = &b; // first round promotes debuginfo for `d` + let c = *b; // second round propagates this dereference + opaque(()); + } + + // Fixed-point propagation through a borrowed reference. + unsafe { + let mut a = 5_usize; + let mut b = &raw mut a; + let d = &mut b; // first round promotes debuginfo for `d` + let c = *b; // second round propagates this dereference + opaque(()); + } +} + +#[custom_mir(dialect = "runtime", phase = "post-cleanup")] +fn read_through_raw(x: &mut usize) -> usize { + use std::intrinsics::mir::*; + + mir!( + let r1: &mut usize; + let r2: &mut usize; + let p1: *mut usize; + let p2: *mut usize; + + { + r1 = &mut *x; + r2 = &mut *r1; + p1 = &raw mut *r1; + p2 = &raw mut *r2; + + RET = *p1; + RET = *p2; + Return() + } + ) +} + +#[custom_mir(dialect = "runtime", phase = "post-cleanup")] +fn multiple_storage() { + use std::intrinsics::mir::*; + + mir!( + let x: i32; + { + StorageLive(x); + x = 5; + let z = &x; + StorageDead(x); + StorageLive(x); + // As there are multiple `StorageLive` statements for `x`, we cannot know if this `z`'s + // pointer address is the address of `x`, so do nothing. + let y = *z; + Call(RET, retblock, opaque(y)) + } + + retblock = { + Return() + } + ) +} + +#[custom_mir(dialect = "runtime", phase = "post-cleanup")] +fn dominate_storage() { + use std::intrinsics::mir::*; + + mir!( + let x: i32; + let r: &i32; + let c: i32; + let d: bool; + { Goto(bb0) } + bb0 = { + x = 5; + r = &x; + Goto(bb1) + } + bb1 = { + let c = *r; + Call(RET, bb2, opaque(c)) + } + bb2 = { + StorageDead(x); + StorageLive(x); + let d = true; + match d { false => bb2, _ => bb0 } + } + ) +} + +#[custom_mir(dialect = "runtime", phase = "post-cleanup")] +fn maybe_dead(m: bool) { + use std::intrinsics::mir::*; + + mir!( + let x: i32; + let y: i32; + { + StorageLive(x); + StorageLive(y); + x = 5; + y = 5; + let a = &x; + let b = &mut y; + // As we don't replace `b` in `bb2`, we cannot replace it here either. + *b = 7; + // But this can still be replaced. + let u = *a; + match m { true => bb1, _ => bb2 } + } + bb1 = { + StorageDead(x); + StorageDead(y); + Call(RET, bb2, opaque(u)) + } + bb2 = { + // As `x` may be `StorageDead`, `a` may be dangling, so we do nothing. + let z = *a; + Call(RET, bb3, opaque(z)) + } + bb3 = { + // As `y` may be `StorageDead`, `b` may be dangling, so we do nothing. + // This implies that we also do not substitute `b` in `bb0`. + let t = *b; + Call(RET, retblock, opaque(t)) + } + retblock = { + Return() + } + ) +} + +fn mut_raw_then_mut_shr() -> (i32, i32) { + let mut x = 2; + let xref = &mut x; + let xraw = &mut *xref as *mut _; + let xshr = &*xref; + // Verify that we completely replace with `x` in both cases. + let a = *xshr; + unsafe { *xraw = 4; } + (a, x) +} + +fn unique_with_copies() { + let y = { + let mut a = 0; + let x = &raw mut a; + // `*y` is not replacable below, so we must not replace `*x`. + unsafe { opaque(*x) }; + x + }; + // But rewriting as `*x` is ok. + unsafe { opaque(*y) }; +} + +fn debuginfo() { + struct T(u8); + + let ref_mut_u8 = &mut 5_u8; + let field = &T(0).0; + + // Verify that we don't emit `&*` in debuginfo. + let reborrow = &*ref_mut_u8; + + match Some(0) { + None => {} + Some(ref variant_field) => {} + } + + // `constant_index_from_end` and `subslice` should not be promoted, as their value depends + // on the slice length. + if let [_, ref constant_index, subslice @ .., ref constant_index_from_end] = &[6; 10][..] { + } + + let multiple_borrow = &&&mut T(6).0; +} + +fn many_debuginfo() { + let a = 0; + + // Verify that we do not ICE on deeply nested borrows. + let many_borrow = + &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& + &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& + &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& + &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& + &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&a; +} + +fn main() { + let mut x = 5_usize; + let mut y = 7_usize; + reference_propagation(&x, &y); + reference_propagation_mut(&mut x, &mut y); + reference_propagation_const_ptr(&raw const x, &raw const y); + reference_propagation_mut_ptr(&raw mut x, &raw mut y); + read_through_raw(&mut x); + multiple_storage(); + dominate_storage(); + maybe_dead(true); + mut_raw_then_mut_shr(); + unique_with_copies(); + debuginfo(); + many_debuginfo(); +} + +// EMIT_MIR reference_prop.reference_propagation.ReferencePropagation.diff +// EMIT_MIR reference_prop.reference_propagation_mut.ReferencePropagation.diff +// EMIT_MIR reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff +// EMIT_MIR reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff +// EMIT_MIR reference_prop.read_through_raw.ReferencePropagation.diff +// EMIT_MIR reference_prop.multiple_storage.ReferencePropagation.diff +// EMIT_MIR reference_prop.dominate_storage.ReferencePropagation.diff +// EMIT_MIR reference_prop.maybe_dead.ReferencePropagation.diff +// EMIT_MIR reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff +// EMIT_MIR reference_prop.unique_with_copies.ReferencePropagation.diff +// EMIT_MIR reference_prop.debuginfo.ReferencePropagation.diff diff --git a/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff b/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff new file mode 100644 index 000000000..b754aff47 --- /dev/null +++ b/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff @@ -0,0 +1,67 @@ +- // MIR for `unique_with_copies` before ReferencePropagation ++ // MIR for `unique_with_copies` after ReferencePropagation + + fn unique_with_copies() -> () { + let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:25: +0:25 + let _1: *mut i32; // in scope 0 at $DIR/reference_prop.rs:+1:9: +1:10 + let mut _2: i32; // in scope 0 at $DIR/reference_prop.rs:+2:13: +2:18 + let _4: (); // in scope 0 at $DIR/reference_prop.rs:+5:18: +5:28 + let mut _5: i32; // in scope 0 at $DIR/reference_prop.rs:+5:25: +5:27 + let _6: (); // in scope 0 at $DIR/reference_prop.rs:+9:14: +9:24 + let mut _7: i32; // in scope 0 at $DIR/reference_prop.rs:+9:21: +9:23 + scope 1 { +- debug y => _1; // in scope 1 at $DIR/reference_prop.rs:+1:9: +1:10 ++ debug y => _3; // in scope 1 at $DIR/reference_prop.rs:+1:9: +1:10 + scope 5 { + } + } + scope 2 { + debug a => _2; // in scope 2 at $DIR/reference_prop.rs:+2:13: +2:18 + let _3: *mut i32; // in scope 2 at $DIR/reference_prop.rs:+3:13: +3:14 + scope 3 { + debug x => _3; // in scope 3 at $DIR/reference_prop.rs:+3:13: +3:14 + scope 4 { + } + } + } + + bb0: { +- StorageLive(_1); // scope 0 at $DIR/reference_prop.rs:+1:9: +1:10 + StorageLive(_2); // scope 0 at $DIR/reference_prop.rs:+2:13: +2:18 + _2 = const 0_i32; // scope 0 at $DIR/reference_prop.rs:+2:21: +2:22 +- StorageLive(_3); // scope 2 at $DIR/reference_prop.rs:+3:13: +3:14 + _3 = &raw mut _2; // scope 2 at $DIR/reference_prop.rs:+3:17: +3:27 + StorageLive(_4); // scope 3 at $DIR/reference_prop.rs:+5:9: +5:30 + StorageLive(_5); // scope 4 at $DIR/reference_prop.rs:+5:25: +5:27 + _5 = (*_3); // scope 4 at $DIR/reference_prop.rs:+5:25: +5:27 + _4 = opaque::(move _5) -> bb1; // scope 4 at $DIR/reference_prop.rs:+5:18: +5:28 + // mir::Constant + // + span: $DIR/reference_prop.rs:524:18: 524:24 + // + literal: Const { ty: fn(i32) {opaque::}, val: Value() } + } + + bb1: { + StorageDead(_5); // scope 4 at $DIR/reference_prop.rs:+5:27: +5:28 + StorageDead(_4); // scope 3 at $DIR/reference_prop.rs:+5:30: +5:31 +- _1 = _3; // scope 3 at $DIR/reference_prop.rs:+6:9: +6:10 +- StorageDead(_3); // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6 + StorageDead(_2); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6 + StorageLive(_6); // scope 1 at $DIR/reference_prop.rs:+9:5: +9:26 + StorageLive(_7); // scope 5 at $DIR/reference_prop.rs:+9:21: +9:23 +- _7 = (*_1); // scope 5 at $DIR/reference_prop.rs:+9:21: +9:23 ++ _7 = (*_3); // scope 5 at $DIR/reference_prop.rs:+9:21: +9:23 + _6 = opaque::(move _7) -> bb2; // scope 5 at $DIR/reference_prop.rs:+9:14: +9:24 + // mir::Constant + // + span: $DIR/reference_prop.rs:528:14: 528:20 + // + literal: Const { ty: fn(i32) {opaque::}, val: Value() } + } + + bb2: { + StorageDead(_7); // scope 5 at $DIR/reference_prop.rs:+9:23: +9:24 + StorageDead(_6); // scope 1 at $DIR/reference_prop.rs:+9:26: +9:27 + _0 = const (); // scope 0 at $DIR/reference_prop.rs:+0:25: +10:2 +- StorageDead(_1); // scope 0 at $DIR/reference_prop.rs:+10:1: +10:2 + return; // scope 0 at $DIR/reference_prop.rs:+10:2: +10:2 + } + } + diff --git a/tests/mir-opt/simple_option_map_e2e.ezmap.PreCodegen.after.mir b/tests/mir-opt/simple_option_map_e2e.ezmap.PreCodegen.after.mir deleted file mode 100644 index cae89fb17..000000000 --- a/tests/mir-opt/simple_option_map_e2e.ezmap.PreCodegen.after.mir +++ /dev/null @@ -1,42 +0,0 @@ -// MIR for `ezmap` after PreCodegen - -fn ezmap(_1: Option) -> Option { - debug x => _1; // in scope 0 at $DIR/simple_option_map_e2e.rs:+0:14: +0:15 - let mut _0: std::option::Option; // return place in scope 0 at $DIR/simple_option_map_e2e.rs:+0:33: +0:44 - scope 1 (inlined map::) { // at $DIR/simple_option_map_e2e.rs:14:5: 14:22 - debug slf => _1; // in scope 1 at $DIR/simple_option_map_e2e.rs:2:17: 2:20 - debug f => const ZeroSized: [closure@$DIR/simple_option_map_e2e.rs:14:12: 14:15]; // in scope 1 at $DIR/simple_option_map_e2e.rs:2:33: 2:34 - let mut _2: isize; // in scope 1 at $DIR/simple_option_map_e2e.rs:7:9: 7:16 - let _3: i32; // in scope 1 at $DIR/simple_option_map_e2e.rs:7:14: 7:15 - let mut _4: i32; // in scope 1 at $DIR/simple_option_map_e2e.rs:7:25: 7:29 - scope 2 { - debug x => _3; // in scope 2 at $DIR/simple_option_map_e2e.rs:7:14: 7:15 - scope 3 (inlined ezmap::{closure#0}) { // at $DIR/simple_option_map_e2e.rs:7:25: 7:29 - debug n => _3; // in scope 3 at $DIR/simple_option_map_e2e.rs:+1:13: +1:14 - } - } - } - - bb0: { - _2 = discriminant(_1); // scope 1 at $DIR/simple_option_map_e2e.rs:6:11: 6:14 - switchInt(move _2) -> [0: bb1, 1: bb3, otherwise: bb2]; // scope 1 at $DIR/simple_option_map_e2e.rs:6:5: 6:14 - } - - bb1: { - _0 = Option::::None; // scope 1 at $DIR/simple_option_map_e2e.rs:8:17: 8:21 - return; // scope 1 at $DIR/simple_option_map_e2e.rs:8:17: 8:21 - } - - bb2: { - unreachable; // scope 1 at $DIR/simple_option_map_e2e.rs:6:11: 6:14 - } - - bb3: { - _3 = ((_1 as Some).0: i32); // scope 1 at $DIR/simple_option_map_e2e.rs:7:14: 7:15 - StorageLive(_4); // scope 2 at $DIR/simple_option_map_e2e.rs:7:25: 7:29 - _4 = Add(_3, const 1_i32); // scope 3 at $DIR/simple_option_map_e2e.rs:+1:16: +1:21 - _0 = Option::::Some(move _4); // scope 2 at $DIR/simple_option_map_e2e.rs:7:20: 7:30 - StorageDead(_4); // scope 2 at $DIR/simple_option_map_e2e.rs:7:29: 7:30 - return; // scope 1 at $DIR/simple_option_map_e2e.rs:10:1: 10:2 - } -} diff --git a/tests/mir-opt/simple_option_map_e2e.rs b/tests/mir-opt/simple_option_map_e2e.rs deleted file mode 100644 index 2acd2a227..000000000 --- a/tests/mir-opt/simple_option_map_e2e.rs +++ /dev/null @@ -1,19 +0,0 @@ -#[inline(always)] -fn map(slf: Option, f: F) -> Option -where - F: FnOnce(T) -> U, -{ - match slf { - Some(x) => Some(f(x)), - None => None, - } -} - -// EMIT_MIR simple_option_map_e2e.ezmap.PreCodegen.after.mir -pub fn ezmap(x: Option) -> Option { - map(x, |n| n + 1) -} - -fn main() { - assert_eq!(None, ezmap(None)); -} diff --git a/tests/mir-opt/simplify_arm.rs b/tests/mir-opt/simplify_arm.rs index c247872e2..4c471ce04 100644 --- a/tests/mir-opt/simplify_arm.rs +++ b/tests/mir-opt/simplify_arm.rs @@ -6,8 +6,7 @@ // EMIT_MIR simplify_arm.id_try.SimplifyArmIdentity.diff // EMIT_MIR simplify_arm.id_try.SimplifyBranchSame.diff -// This pass is broken since deaggregation changed -// ignore-test +// ignore-test This pass is broken since deaggregation changed fn id(o: Option) -> Option { match o { diff --git a/tests/mir-opt/simplify_arm_identity.rs b/tests/mir-opt/simplify_arm_identity.rs index cf6ff57aa..e122cd50e 100644 --- a/tests/mir-opt/simplify_arm_identity.rs +++ b/tests/mir-opt/simplify_arm_identity.rs @@ -4,8 +4,7 @@ // compile-flags: -Zmir-opt-level=3 // EMIT_MIR_FOR_EACH_BIT_WIDTH -// This pass is broken since deaggregation changed -// ignore-test +// ignore-test This pass is broken since deaggregation changed enum Src { Foo(u8), diff --git a/tests/mir-opt/slice_filter.rs b/tests/mir-opt/slice_filter.rs index 97c18af31..be32f40f1 100644 --- a/tests/mir-opt/slice_filter.rs +++ b/tests/mir-opt/slice_filter.rs @@ -12,7 +12,9 @@ pub fn variant_b(input: &[(usize, usize, usize, usize)]) -> usize { input.iter().filter(|&&(a, b, c, d)| a <= c && d <= b || c <= a && b <= d).count() } +// EMIT_MIR slice_filter.variant_a-{closure#0}.ReferencePropagation.diff // EMIT_MIR slice_filter.variant_a-{closure#0}.CopyProp.diff // EMIT_MIR slice_filter.variant_a-{closure#0}.DestinationPropagation.diff // EMIT_MIR slice_filter.variant_b-{closure#0}.CopyProp.diff +// EMIT_MIR slice_filter.variant_b-{closure#0}.ReferencePropagation.diff // EMIT_MIR slice_filter.variant_b-{closure#0}.DestinationPropagation.diff diff --git a/tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff b/tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff index 3bb0358ff..60e5056c7 100644 --- a/tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff +++ b/tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff @@ -101,16 +101,16 @@ } bb0: { -- StorageLive(_3); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 + StorageLive(_3); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 _25 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 _3 = &((*_25).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 -- StorageLive(_4); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 + StorageLive(_4); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 _26 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 _4 = &((*_26).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 -- StorageLive(_5); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 + StorageLive(_5); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 _27 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 _5 = &((*_27).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 -- StorageLive(_6); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 + StorageLive(_6); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 _28 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 _6 = &((*_28).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 @@ -184,10 +184,10 @@ bb3: { StorageDead(_16); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 -- StorageDead(_6); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 -- StorageDead(_5); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 -- StorageDead(_4); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 -- StorageDead(_3); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_6); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_5); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_4); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_3); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 return; // scope 0 at $DIR/slice_filter.rs:+0:76: +0:76 } diff --git a/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff b/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff index 294c3272f..afdcf5781 100644 --- a/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff +++ b/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff @@ -3,118 +3,79 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:8:25: 8:39], _2: &&(usize, usize, usize, usize)) -> bool { let mut _0: bool; // return place in scope 0 at $DIR/slice_filter.rs:+0:40: +0:40 - let _3: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 - let _4: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 - let _5: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 - let _6: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 - let mut _7: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:56 - let mut _8: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:46 - let mut _9: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:41 - let mut _10: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46 - let _11: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46 - let mut _12: bool; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:56 - let mut _13: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:51 - let mut _14: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56 - let _15: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56 - let mut _16: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:76 - let mut _17: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:66 - let mut _18: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:61 - let mut _19: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66 - let _20: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66 - let mut _21: bool; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:76 - let mut _22: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:71 - let mut _23: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 - let _24: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 - let mut _25: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 - let mut _26: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 - let mut _27: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 - let mut _28: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 + let mut _3: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:56 + let mut _4: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:46 + let mut _5: bool; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:56 + let mut _6: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:76 + let mut _7: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:66 + let mut _8: bool; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:76 + let mut _9: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 + let mut _10: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 + let mut _11: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 + let mut _12: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 scope 1 { - debug a => _3; // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28 - debug b => _4; // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31 - debug c => _5; // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34 - debug d => _6; // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37 + debug a => &((*_9).0: usize); // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28 + debug b => &((*_10).1: usize); // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31 + debug c => &((*_11).2: usize); // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34 + debug d => &((*_12).3: usize); // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37 scope 2 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:40: 8:46 - debug self => _9; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL - debug other => _10; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _29: &usize; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _30: &usize; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug self => &&((*_9).0: usize); // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => &&((*_11).2: usize); // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL scope 3 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL - debug self => _29; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - debug other => _30; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _31: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _32: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug self => &((*_9).0: usize); // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => &((*_11).2: usize); // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _13: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _14: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL } } scope 4 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:60: 8:66 - debug self => _18; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL - debug other => _19; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _33: &usize; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _34: &usize; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug self => &&((*_11).2: usize); // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => &&((*_9).0: usize); // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL scope 5 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL - debug self => _33; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - debug other => _34; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _35: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _36: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug self => &((*_11).2: usize); // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => &((*_9).0: usize); // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _15: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _16: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL } } scope 6 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:50: 8:56 - debug self => _13; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL - debug other => _14; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _37: &usize; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _38: &usize; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug self => &&((*_12).3: usize); // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => &&((*_10).1: usize); // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL scope 7 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL - debug self => _37; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - debug other => _38; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _39: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _40: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug self => &((*_12).3: usize); // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => &((*_10).1: usize); // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _17: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _18: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL } } scope 8 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:70: 8:76 - debug self => _22; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL - debug other => _23; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _41: &usize; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _42: &usize; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug self => &&((*_10).1: usize); // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => &&((*_12).3: usize); // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL scope 9 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL - debug self => _41; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - debug other => _42; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _43: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _44: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug self => &((*_10).1: usize); // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => &((*_12).3: usize); // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _19: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _20: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL } } } bb0: { - _25 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 - _3 = &((*_25).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 - _26 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 - _4 = &((*_26).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 - _27 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 - _5 = &((*_27).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 - _28 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 - _6 = &((*_28).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 -- StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 + _9 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 + _10 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 + _11 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 + _12 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 +- StorageLive(_3); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 + nop; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 - StorageLive(_8); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:46 - StorageLive(_9); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41 - _9 = &_3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41 - StorageLive(_10); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 - StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 - _11 = _5; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 - _10 = &_11; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 - _29 = deref_copy (*_9); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL - _30 = deref_copy (*_10); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_31); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - _31 = (*_29); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_32); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - _32 = (*_30); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - _8 = Le(move _31, move _32); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_32); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_31); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 - StorageDead(_10); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 - StorageDead(_9); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 - switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 + StorageLive(_4); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:46 + StorageLive(_13); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + _13 = ((*_9).0: usize); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_14); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + _14 = ((*_11).2: usize); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + _4 = Le(move _13, move _14); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_14); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_13); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + switchInt(move _4) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 } bb1: { @@ -123,113 +84,80 @@ } bb2: { -- StorageLive(_16); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 +- StorageLive(_6); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + nop; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 - StorageLive(_17); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:66 - StorageLive(_18); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61 - _18 = &_5; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61 - StorageLive(_19); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 - StorageLive(_20); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 - _20 = _3; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 - _19 = &_20; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 - _33 = deref_copy (*_18); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL - _34 = deref_copy (*_19); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_35); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - _35 = (*_33); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_36); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - _36 = (*_34); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - _17 = Le(move _35, move _36); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_36); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_35); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_20); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 - StorageDead(_19); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 - StorageDead(_18); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 - switchInt(move _17) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:66 + StorageLive(_15); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + _15 = ((*_11).2: usize); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_16); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + _16 = ((*_9).0: usize); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + _7 = Le(move _15, move _16); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_16); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_15); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + switchInt(move _7) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 } bb3: { -- StorageDead(_16); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 -- StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 +- StorageDead(_6); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 +- StorageDead(_3); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + nop; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + nop; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 return; // scope 0 at $DIR/slice_filter.rs:+0:76: +0:76 } bb4: { -- StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 +- StorageDead(_5); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + nop; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + StorageDead(_4); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 goto -> bb2; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 } bb5: { -- StorageLive(_12); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56 +- StorageLive(_5); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56 + nop; // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56 - StorageLive(_13); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51 - _13 = &_6; // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51 - StorageLive(_14); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - StorageLive(_15); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - _15 = _4; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - _14 = &_15; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - _37 = deref_copy (*_13); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL - _38 = deref_copy (*_14); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_39); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - _39 = (*_37); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_40); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - _40 = (*_38); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - _12 = Le(move _39, move _40); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_40); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_39); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_15); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - StorageDead(_14); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - StorageDead(_13); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 -- _7 = move _12; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 -- StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + StorageLive(_17); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + _17 = ((*_12).3: usize); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_18); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + _18 = ((*_10).1: usize); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + _5 = Le(move _17, move _18); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_18); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_17); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL +- _3 = move _5; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 +- StorageDead(_5); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + nop; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 + nop; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 -- switchInt(move _7) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 -+ switchInt(move _12) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 + StorageDead(_4); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 +- switchInt(move _3) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 ++ switchInt(move _5) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 } bb6: { -- _16 = const false; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 +- _6 = const false; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + _0 = const false; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 } bb7: { -- StorageLive(_21); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76 +- StorageLive(_8); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76 + nop; // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76 - StorageLive(_22); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71 - _22 = &_4; // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71 - StorageLive(_23); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - StorageLive(_24); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - _24 = _6; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - _23 = &_24; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - _41 = deref_copy (*_22); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL - _42 = deref_copy (*_23); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_43); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - _43 = (*_41); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_44); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - _44 = (*_42); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _21 = Le(move _43, move _44); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ _0 = Le(move _43, move _44); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_44); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_43); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_24); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - StorageDead(_23); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - StorageDead(_22); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 -- _16 = move _21; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + StorageLive(_19); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + _19 = ((*_10).1: usize); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_20); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + _20 = ((*_12).3: usize); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL +- _8 = Le(move _19, move _20); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ _0 = Le(move _19, move _20); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_20); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_19); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL +- _6 = move _8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + nop; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 } bb8: { -- StorageDead(_21); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 +- StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + nop; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - StorageDead(_17); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 -- _0 = move _16; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 + StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 +- _0 = move _6; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 + nop; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 } diff --git a/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff b/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff new file mode 100644 index 000000000..2534eeef4 --- /dev/null +++ b/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff @@ -0,0 +1,267 @@ +- // MIR for `variant_a::{closure#0}` before ReferencePropagation ++ // MIR for `variant_a::{closure#0}` after ReferencePropagation + + fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:8:25: 8:39], _2: &&(usize, usize, usize, usize)) -> bool { + let mut _0: bool; // return place in scope 0 at $DIR/slice_filter.rs:+0:40: +0:40 + let _3: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 + let _4: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 + let _5: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 + let _6: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 + let mut _7: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:56 + let mut _8: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:46 + let mut _9: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:41 + let mut _10: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46 + let _11: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46 + let mut _12: bool; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:56 + let mut _13: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:51 + let mut _14: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56 + let _15: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56 + let mut _16: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:76 + let mut _17: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:66 + let mut _18: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:61 + let mut _19: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66 + let _20: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66 + let mut _21: bool; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:76 + let mut _22: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:71 + let mut _23: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 + let _24: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 + let mut _25: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 + let mut _26: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 + let mut _27: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 + let mut _28: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 + let mut _31: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _32: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _37: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _38: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _43: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _44: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _49: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _50: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL + scope 1 { +- debug a => _3; // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28 +- debug b => _4; // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31 +- debug c => _5; // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34 +- debug d => _6; // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37 ++ debug a => &((*_25).0: usize); // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28 ++ debug b => &((*_26).1: usize); // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31 ++ debug c => &((*_27).2: usize); // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34 ++ debug d => &((*_28).3: usize); // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37 + scope 2 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:40: 8:46 +- debug self => _9; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL +- debug other => _10; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ debug self => &&((*_25).0: usize); // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ debug other => &&((*_27).2: usize); // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _29: &usize; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _30: &usize; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL + scope 3 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL +- debug self => _29; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL +- debug other => _30; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ debug self => &((*_25).0: usize); // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ debug other => &((*_27).2: usize); // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _33: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _34: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + } + } + scope 4 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:60: 8:66 +- debug self => _18; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL +- debug other => _19; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ debug self => &&((*_27).2: usize); // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ debug other => &&((*_25).0: usize); // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _35: &usize; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _36: &usize; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL + scope 5 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL +- debug self => _35; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL +- debug other => _36; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ debug self => &((*_27).2: usize); // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ debug other => &((*_25).0: usize); // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _39: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _40: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + } + } + scope 6 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:50: 8:56 +- debug self => _13; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL +- debug other => _14; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ debug self => &&((*_28).3: usize); // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ debug other => &&((*_26).1: usize); // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _41: &usize; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _42: &usize; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + scope 7 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL +- debug self => _41; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL +- debug other => _42; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ debug self => &((*_28).3: usize); // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ debug other => &((*_26).1: usize); // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _45: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _46: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + } + } + scope 8 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:70: 8:76 +- debug self => _22; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL +- debug other => _23; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ debug self => &&((*_26).1: usize); // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ debug other => &&((*_28).3: usize); // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _47: &usize; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _48: &usize; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + scope 9 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL +- debug self => _47; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL +- debug other => _48; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ debug self => &((*_26).1: usize); // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ debug other => &((*_28).3: usize); // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _51: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _52: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + } + } + } + + bb0: { +- StorageLive(_3); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 + _25 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 +- _3 = &((*_25).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 +- StorageLive(_4); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 + _26 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 +- _4 = &((*_26).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 +- StorageLive(_5); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 + _27 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 +- _5 = &((*_27).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 +- StorageLive(_6); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 + _28 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 +- _6 = &((*_28).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 + StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 + StorageLive(_8); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:46 +- StorageLive(_9); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41 +- _9 = &_3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41 +- StorageLive(_10); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 +- StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 +- _11 = _5; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 +- _10 = &_11; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 +- _29 = deref_copy (*_9); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL +- _30 = deref_copy (*_10); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_33); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL +- _33 = (*_29); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ _33 = ((*_25).0: usize); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_34); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL +- _34 = (*_30); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ _34 = ((*_27).2: usize); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + _8 = Le(move _33, move _34); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_34); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_33); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL +- StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 +- StorageDead(_10); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 +- StorageDead(_9); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 + switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 + } + + bb1: { + _0 = const true; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 + goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 + } + + bb2: { + StorageLive(_16); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + StorageLive(_17); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:66 +- StorageLive(_18); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61 +- _18 = &_5; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61 +- StorageLive(_19); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 +- StorageLive(_20); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 +- _20 = _3; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 +- _19 = &_20; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 +- _35 = deref_copy (*_18); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL +- _36 = deref_copy (*_19); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_39); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL +- _39 = (*_35); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ _39 = ((*_27).2: usize); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_40); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL +- _40 = (*_36); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ _40 = ((*_25).0: usize); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + _17 = Le(move _39, move _40); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_40); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_39); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL +- StorageDead(_20); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 +- StorageDead(_19); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 +- StorageDead(_18); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 + switchInt(move _17) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + } + + bb3: { + StorageDead(_16); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 +- StorageDead(_6); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 +- StorageDead(_5); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 +- StorageDead(_4); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 +- StorageDead(_3); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 + return; // scope 0 at $DIR/slice_filter.rs:+0:76: +0:76 + } + + bb4: { + _7 = const false; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 + StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + goto -> bb2; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 + } + + bb5: { + StorageLive(_12); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56 +- StorageLive(_13); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51 +- _13 = &_6; // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51 +- StorageLive(_14); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 +- StorageLive(_15); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 +- _15 = _4; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 +- _14 = &_15; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 +- _41 = deref_copy (*_13); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL +- _42 = deref_copy (*_14); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_45); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL +- _45 = (*_41); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ _45 = ((*_28).3: usize); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_46); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL +- _46 = (*_42); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ _46 = ((*_26).1: usize); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + _12 = Le(move _45, move _46); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_46); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_45); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL +- StorageDead(_15); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 +- StorageDead(_14); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 +- StorageDead(_13); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + _7 = move _12; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 + StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + switchInt(move _7) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 + } + + bb6: { + _16 = const false; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + } + + bb7: { + StorageLive(_21); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76 +- StorageLive(_22); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71 +- _22 = &_4; // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71 +- StorageLive(_23); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 +- StorageLive(_24); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 +- _24 = _6; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 +- _23 = &_24; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 +- _47 = deref_copy (*_22); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL +- _48 = deref_copy (*_23); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_51); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL +- _51 = (*_47); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ _51 = ((*_26).1: usize); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_52); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL +- _52 = (*_48); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ _52 = ((*_28).3: usize); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + _21 = Le(move _51, move _52); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_52); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_51); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL +- StorageDead(_24); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 +- StorageDead(_23); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 +- StorageDead(_22); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + _16 = move _21; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + } + + bb8: { + StorageDead(_21); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_17); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + _0 = move _16; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 + goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 + } + } + diff --git a/tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff b/tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff new file mode 100644 index 000000000..d1241c6b0 --- /dev/null +++ b/tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff @@ -0,0 +1,103 @@ +- // MIR for `variant_b::{closure#0}` before ReferencePropagation ++ // MIR for `variant_b::{closure#0}` after ReferencePropagation + + fn variant_b::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:12:25: 12:41], _2: &&(usize, usize, usize, usize)) -> bool { + let mut _0: bool; // return place in scope 0 at $DIR/slice_filter.rs:+0:42: +0:42 + let _3: usize; // in scope 0 at $DIR/slice_filter.rs:+0:29: +0:30 + let _4: usize; // in scope 0 at $DIR/slice_filter.rs:+0:32: +0:33 + let _5: usize; // in scope 0 at $DIR/slice_filter.rs:+0:35: +0:36 + let _6: usize; // in scope 0 at $DIR/slice_filter.rs:+0:38: +0:39 + let mut _7: bool; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:58 + let mut _8: bool; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:48 + let mut _9: usize; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:43 + let mut _10: usize; // in scope 0 at $DIR/slice_filter.rs:+0:47: +0:48 + let mut _11: bool; // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:58 + let mut _12: usize; // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:53 + let mut _13: usize; // in scope 0 at $DIR/slice_filter.rs:+0:57: +0:58 + let mut _14: bool; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:78 + let mut _15: bool; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:68 + let mut _16: usize; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:63 + let mut _17: usize; // in scope 0 at $DIR/slice_filter.rs:+0:67: +0:68 + let mut _18: bool; // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:78 + let mut _19: usize; // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:73 + let mut _20: usize; // in scope 0 at $DIR/slice_filter.rs:+0:77: +0:78 + let mut _21: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 + let mut _22: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 + let mut _23: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 + let mut _24: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 + scope 1 { + debug a => _3; // in scope 1 at $DIR/slice_filter.rs:+0:29: +0:30 + debug b => _4; // in scope 1 at $DIR/slice_filter.rs:+0:32: +0:33 + debug c => _5; // in scope 1 at $DIR/slice_filter.rs:+0:35: +0:36 + debug d => _6; // in scope 1 at $DIR/slice_filter.rs:+0:38: +0:39 + } + + bb0: { + _21 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30 + _3 = ((*_21).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30 + _22 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33 + _4 = ((*_22).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33 + _23 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36 + _5 = ((*_23).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36 + _24 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39 + _6 = ((*_24).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39 + StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 + StorageLive(_8); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48 + _8 = Le(_3, _5); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48 + switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 + } + + bb1: { + _0 = const true; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 + goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 + } + + bb2: { + StorageLive(_14); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 + StorageLive(_15); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68 + _15 = Le(_5, _3); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68 + switchInt(move _15) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 + } + + bb3: { + StorageDead(_14); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 + StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 + return; // scope 0 at $DIR/slice_filter.rs:+0:78: +0:78 + } + + bb4: { + _7 = const false; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 + StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 + StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 + goto -> bb2; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 + } + + bb5: { + StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58 + _11 = Le(_6, _4); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58 + _7 = move _11; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 + StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 + StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 + switchInt(move _7) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 + } + + bb6: { + _14 = const false; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 + goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 + } + + bb7: { + StorageLive(_18); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78 + _18 = Le(_4, _6); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78 + _14 = move _18; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 + goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 + } + + bb8: { + StorageDead(_18); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 + StorageDead(_15); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 + _0 = move _14; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 + goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 + } + } + diff --git a/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff index 579587a43..9bda5f575 100644 --- a/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff @@ -15,14 +15,14 @@ let mut _13: &[&str; 3]; // in scope 0 at $DIR/lifetimes.rs:+10:19: +10:28 let _14: &[&str; 3]; // in scope 0 at $DIR/lifetimes.rs:+10:19: +10:28 let _15: [&str; 3]; // in scope 0 at $DIR/lifetimes.rs:+10:19: +10:28 - let mut _16: &[core::fmt::ArgumentV1<'_>]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _17: &[core::fmt::ArgumentV1<'_>; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _18: &[core::fmt::ArgumentV1<'_>; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _19: [core::fmt::ArgumentV1<'_>; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _20: core::fmt::ArgumentV1<'_>; // in scope 0 at $DIR/lifetimes.rs:+10:20: +10:23 + let mut _16: &[core::fmt::rt::Argument<'_>]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _17: &[core::fmt::rt::Argument<'_>; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let _18: &[core::fmt::rt::Argument<'_>; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let _19: [core::fmt::rt::Argument<'_>; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL + let mut _20: core::fmt::rt::Argument<'_>; // in scope 0 at $DIR/lifetimes.rs:+10:20: +10:23 let mut _21: &std::boxed::Box; // in scope 0 at $DIR/lifetimes.rs:+10:20: +10:23 let _22: &std::boxed::Box; // in scope 0 at $DIR/lifetimes.rs:+10:20: +10:23 - let mut _23: core::fmt::ArgumentV1<'_>; // in scope 0 at $DIR/lifetimes.rs:+10:24: +10:27 + let mut _23: core::fmt::rt::Argument<'_>; // in scope 0 at $DIR/lifetimes.rs:+10:24: +10:27 let mut _24: &u32; // in scope 0 at $DIR/lifetimes.rs:+10:24: +10:27 let _25: &u32; // in scope 0 at $DIR/lifetimes.rs:+10:24: +10:27 let mut _27: bool; // in scope 0 at $DIR/lifetimes.rs:+12:1: +12:2 @@ -113,11 +113,11 @@ StorageLive(_22); // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23 _22 = &_8; // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23 _21 = &(*_22); // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23 - _20 = core::fmt::ArgumentV1::<'_>::new_display::>(move _21) -> [return: bb3, unwind unreachable]; // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23 + _20 = core::fmt::rt::Argument::<'_>::new_display::>(move _21) -> [return: bb3, unwind unreachable]; // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23 // mir::Constant // + span: $DIR/lifetimes.rs:27:20: 27:23 // + user_ty: UserType(4) - // + literal: Const { ty: for<'b> fn(&'b Box) -> core::fmt::ArgumentV1<'b> {core::fmt::ArgumentV1::<'_>::new_display::>}, val: Value() } + // + literal: Const { ty: for<'b> fn(&'b Box) -> core::fmt::rt::Argument<'b> {core::fmt::rt::Argument::<'_>::new_display::>}, val: Value() } } bb3: { @@ -127,11 +127,11 @@ StorageLive(_25); // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27 _25 = &_6; // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27 _24 = &(*_25); // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27 - _23 = core::fmt::ArgumentV1::<'_>::new_display::(move _24) -> [return: bb4, unwind unreachable]; // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27 + _23 = core::fmt::rt::Argument::<'_>::new_display::(move _24) -> [return: bb4, unwind unreachable]; // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27 // mir::Constant // + span: $DIR/lifetimes.rs:27:24: 27:27 // + user_ty: UserType(5) - // + literal: Const { ty: for<'b> fn(&'b u32) -> core::fmt::ArgumentV1<'b> {core::fmt::ArgumentV1::<'_>::new_display::}, val: Value() } + // + literal: Const { ty: for<'b> fn(&'b u32) -> core::fmt::rt::Argument<'b> {core::fmt::rt::Argument::<'_>::new_display::}, val: Value() } } bb4: { @@ -141,13 +141,13 @@ StorageDead(_20); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL _18 = &_19; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL _17 = &(*_18); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _16 = move _17 as &[core::fmt::ArgumentV1<'_>] (Pointer(Unsize)); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL + _16 = move _17 as &[core::fmt::rt::Argument<'_>] (Pointer(Unsize)); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL StorageDead(_17); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL _11 = Arguments::<'_>::new_v1(move _12, move _16) -> [return: bb5, unwind unreachable]; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL // mir::Constant // + span: $SRC_DIR/std/src/macros.rs:LL:COL // + user_ty: UserType(3) - // + literal: Const { ty: fn(&[&'static str], &[core::fmt::ArgumentV1<'_>]) -> Arguments<'_> {Arguments::<'_>::new_v1}, val: Value() } + // + literal: Const { ty: fn(&[&'static str], &[core::fmt::rt::Argument<'_>]) -> Arguments<'_> {Arguments::<'_>::new_v1}, val: Value() } } bb5: { diff --git a/tests/mir-opt/storage_ranges.main.nll.0.mir b/tests/mir-opt/storage_ranges.main.nll.0.mir index 8e10e70f1..5bb1a7bf0 100644 --- a/tests/mir-opt/storage_ranges.main.nll.0.mir +++ b/tests/mir-opt/storage_ranges.main.nll.0.mir @@ -1,21 +1,21 @@ // MIR for `main` 0 nll | Free Region Mapping -| '_#0r | Global | ['_#0r, '_#1r] -| '_#1r | Local | ['_#1r] +| '?0 | Global | ['?0, '?1] +| '?1 | Local | ['?1] | | Inferred Region Values -| '_#0r | U0 | {bb0[0..=22], '_#0r, '_#1r} -| '_#1r | U0 | {bb0[0..=22], '_#1r} -| '_#2r | U0 | {bb0[10..=11]} -| '_#3r | U0 | {bb0[11]} +| '?0 | U0 | {bb0[0..=22], '?0, '?1} +| '?1 | U0 | {bb0[0..=22], '?1} +| '?2 | U0 | {bb0[10..=11]} +| '?3 | U0 | {bb0[11]} | | Inference Constraints -| '_#0r live at {bb0[0..=22]} -| '_#1r live at {bb0[0..=22]} -| '_#2r live at {bb0[10]} -| '_#3r live at {bb0[11]} -| '_#2r: '_#3r due to Assignment at Single(bb0[10]) ($DIR/storage_ranges.rs:6:17: 6:25 (#0) +| '?0 live at {bb0[0..=22]} +| '?1 live at {bb0[0..=22]} +| '?2 live at {bb0[10]} +| '?3 live at {bb0[11]} +| '?2: '?3 due to Assignment at Single(bb0[10]) ($DIR/storage_ranges.rs:6:17: 6:25 (#0) | fn main() -> () { let mut _0: (); // return place in scope 0 at $DIR/storage_ranges.rs:+0:11: +0:11 diff --git a/tests/mir-opt/try_identity_e2e.new.PreCodegen.after.mir b/tests/mir-opt/try_identity_e2e.new.PreCodegen.after.mir deleted file mode 100644 index 935dbb28b..000000000 --- a/tests/mir-opt/try_identity_e2e.new.PreCodegen.after.mir +++ /dev/null @@ -1,66 +0,0 @@ -// MIR for `new` after PreCodegen - -fn new(_1: Result) -> Result { - debug x => _1; // in scope 0 at $DIR/try_identity_e2e.rs:+0:14: +0:15 - let mut _0: std::result::Result; // return place in scope 0 at $DIR/try_identity_e2e.rs:+0:34: +0:46 - let mut _2: std::ops::ControlFlow; // in scope 0 at $DIR/try_identity_e2e.rs:+2:15: +7:10 - let mut _3: isize; // in scope 0 at $DIR/try_identity_e2e.rs:+4:17: +4:22 - let _4: T; // in scope 0 at $DIR/try_identity_e2e.rs:+4:20: +4:21 - let _5: E; // in scope 0 at $DIR/try_identity_e2e.rs:+5:21: +5:22 - let mut _6: isize; // in scope 0 at $DIR/try_identity_e2e.rs:+8:13: +8:37 - let _7: T; // in scope 0 at $DIR/try_identity_e2e.rs:+8:35: +8:36 - let _8: E; // in scope 0 at $DIR/try_identity_e2e.rs:+9:32: +9:33 - scope 1 { - debug v => _4; // in scope 1 at $DIR/try_identity_e2e.rs:+4:20: +4:21 - } - scope 2 { - debug e => _5; // in scope 2 at $DIR/try_identity_e2e.rs:+5:21: +5:22 - } - scope 3 { - debug v => _7; // in scope 3 at $DIR/try_identity_e2e.rs:+8:35: +8:36 - } - scope 4 { - debug e => _8; // in scope 4 at $DIR/try_identity_e2e.rs:+9:32: +9:33 - } - - bb0: { - StorageLive(_2); // scope 0 at $DIR/try_identity_e2e.rs:+2:15: +7:10 - _3 = discriminant(_1); // scope 0 at $DIR/try_identity_e2e.rs:+3:19: +3:20 - switchInt(move _3) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 0 at $DIR/try_identity_e2e.rs:+3:13: +3:20 - } - - bb1: { - _5 = move ((_1 as Err).0: E); // scope 0 at $DIR/try_identity_e2e.rs:+5:21: +5:22 - _2 = ControlFlow::::Break(move _5); // scope 2 at $DIR/try_identity_e2e.rs:+5:27: +5:48 - goto -> bb4; // scope 0 at $DIR/try_identity_e2e.rs:+5:47: +5:48 - } - - bb2: { - unreachable; // scope 0 at $DIR/try_identity_e2e.rs:+3:19: +3:20 - } - - bb3: { - _4 = move ((_1 as Ok).0: T); // scope 0 at $DIR/try_identity_e2e.rs:+4:20: +4:21 - _2 = ControlFlow::::Continue(move _4); // scope 1 at $DIR/try_identity_e2e.rs:+4:26: +4:50 - goto -> bb4; // scope 0 at $DIR/try_identity_e2e.rs:+4:49: +4:50 - } - - bb4: { - _6 = discriminant(_2); // scope 0 at $DIR/try_identity_e2e.rs:+2:15: +7:10 - switchInt(move _6) -> [0: bb6, 1: bb5, otherwise: bb2]; // scope 0 at $DIR/try_identity_e2e.rs:+2:9: +7:10 - } - - bb5: { - _8 = move ((_2 as Break).0: E); // scope 0 at $DIR/try_identity_e2e.rs:+9:32: +9:33 - _0 = Result::::Err(move _8); // scope 4 at $DIR/try_identity_e2e.rs:+9:45: +9:51 - StorageDead(_2); // scope 0 at $DIR/try_identity_e2e.rs:+12:1: +12:2 - return; // scope 0 at $DIR/try_identity_e2e.rs:+12:1: +12:2 - } - - bb6: { - _7 = move ((_2 as Continue).0: T); // scope 0 at $DIR/try_identity_e2e.rs:+8:35: +8:36 - _0 = Result::::Ok(move _7); // scope 0 at $DIR/try_identity_e2e.rs:+1:5: +11:6 - StorageDead(_2); // scope 0 at $DIR/try_identity_e2e.rs:+12:1: +12:2 - return; // scope 0 at $DIR/try_identity_e2e.rs:+12:1: +12:2 - } -} diff --git a/tests/mir-opt/try_identity_e2e.old.PreCodegen.after.mir b/tests/mir-opt/try_identity_e2e.old.PreCodegen.after.mir deleted file mode 100644 index d88ae5ac9..000000000 --- a/tests/mir-opt/try_identity_e2e.old.PreCodegen.after.mir +++ /dev/null @@ -1,36 +0,0 @@ -// MIR for `old` after PreCodegen - -fn old(_1: Result) -> Result { - debug x => _1; // in scope 0 at $DIR/try_identity_e2e.rs:+0:14: +0:15 - let mut _0: std::result::Result; // return place in scope 0 at $DIR/try_identity_e2e.rs:+0:34: +0:46 - let mut _2: isize; // in scope 0 at $DIR/try_identity_e2e.rs:+3:13: +3:18 - let _3: T; // in scope 0 at $DIR/try_identity_e2e.rs:+3:16: +3:17 - let _4: E; // in scope 0 at $DIR/try_identity_e2e.rs:+4:17: +4:18 - scope 1 { - debug v => _3; // in scope 1 at $DIR/try_identity_e2e.rs:+3:16: +3:17 - } - scope 2 { - debug e => _4; // in scope 2 at $DIR/try_identity_e2e.rs:+4:17: +4:18 - } - - bb0: { - _2 = discriminant(_1); // scope 0 at $DIR/try_identity_e2e.rs:+2:15: +2:16 - switchInt(move _2) -> [0: bb3, 1: bb1, otherwise: bb2]; // scope 0 at $DIR/try_identity_e2e.rs:+2:9: +2:16 - } - - bb1: { - _4 = move ((_1 as Err).0: E); // scope 0 at $DIR/try_identity_e2e.rs:+4:17: +4:18 - _0 = Result::::Err(move _4); // scope 2 at $DIR/try_identity_e2e.rs:+4:30: +4:36 - return; // scope 0 at $DIR/try_identity_e2e.rs:+7:1: +7:2 - } - - bb2: { - unreachable; // scope 0 at $DIR/try_identity_e2e.rs:+2:15: +2:16 - } - - bb3: { - _3 = move ((_1 as Ok).0: T); // scope 0 at $DIR/try_identity_e2e.rs:+3:16: +3:17 - _0 = Result::::Ok(move _3); // scope 0 at $DIR/try_identity_e2e.rs:+1:5: +6:6 - return; // scope 0 at $DIR/try_identity_e2e.rs:+7:1: +7:2 - } -} diff --git a/tests/mir-opt/try_identity_e2e.rs b/tests/mir-opt/try_identity_e2e.rs deleted file mode 100644 index 00cb80f50..000000000 --- a/tests/mir-opt/try_identity_e2e.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Track the status of MIR optimizations simplifying `Ok(res?)` for both the old and new desugarings -// of that syntax. - -use std::ops::ControlFlow; - -// EMIT_MIR try_identity_e2e.new.PreCodegen.after.mir -fn new(x: Result) -> Result { - Ok( - match { - match x { - Ok(v) => ControlFlow::Continue(v), - Err(e) => ControlFlow::Break(e), - } - } { - ControlFlow::Continue(v) => v, - ControlFlow::Break(e) => return Err(e), - } - ) -} - -// EMIT_MIR try_identity_e2e.old.PreCodegen.after.mir -fn old(x: Result) -> Result { - Ok( - match x { - Ok(v) => v, - Err(e) => return Err(e), - } - ) -} - -fn main() { - let _ = new::<(), ()>(Ok(())); - let _ = old::<(), ()>(Ok(())); -} diff --git a/tests/mir-opt/uninhabited_enum.process_void.SimplifyLocals-final.after.mir b/tests/mir-opt/uninhabited_enum.process_void.SimplifyLocals-final.after.mir index 2af864998..4b2a16b50 100644 --- a/tests/mir-opt/uninhabited_enum.process_void.SimplifyLocals-final.after.mir +++ b/tests/mir-opt/uninhabited_enum.process_void.SimplifyLocals-final.after.mir @@ -3,16 +3,13 @@ fn process_void(_1: *const Void) -> () { debug input => _1; // in scope 0 at $DIR/uninhabited_enum.rs:+0:21: +0:26 let mut _0: (); // return place in scope 0 at $DIR/uninhabited_enum.rs:+0:41: +0:41 - let _2: &Void; // in scope 0 at $DIR/uninhabited_enum.rs:+1:8: +1:14 scope 1 { - debug _input => _2; // in scope 1 at $DIR/uninhabited_enum.rs:+1:8: +1:14 + debug _input => _1; // in scope 1 at $DIR/uninhabited_enum.rs:+1:8: +1:14 } scope 2 { } bb0: { - StorageLive(_2); // scope 0 at $DIR/uninhabited_enum.rs:+1:8: +1:14 - StorageDead(_2); // scope 0 at $DIR/uninhabited_enum.rs:+4:1: +4:2 return; // scope 0 at $DIR/uninhabited_enum.rs:+4:2: +4:2 } } diff --git a/tests/mir-opt/while_let_loops.change_loop_body.ConstProp.diff b/tests/mir-opt/while_let_loops.change_loop_body.ConstProp.diff deleted file mode 100644 index a4f2d8c84..000000000 --- a/tests/mir-opt/while_let_loops.change_loop_body.ConstProp.diff +++ /dev/null @@ -1,45 +0,0 @@ -- // MIR for `change_loop_body` before ConstProp -+ // MIR for `change_loop_body` after ConstProp - - fn change_loop_body() -> () { - let mut _0: (); // return place in scope 0 at $DIR/while_let_loops.rs:+0:27: +0:27 - let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:+1:9: +1:15 - let mut _2: std::option::Option; // in scope 0 at $DIR/while_let_loops.rs:+2:28: +2:32 - let mut _3: isize; // in scope 0 at $DIR/while_let_loops.rs:+2:15: +2:25 - scope 1 { - debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:+1:9: +1:15 - scope 2 { - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:+1:9: +1:15 - _1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:+1:18: +1:19 - StorageLive(_2); // scope 2 at $DIR/while_let_loops.rs:+2:28: +2:32 - _2 = Option::::None; // scope 2 at $DIR/while_let_loops.rs:+2:28: +2:32 -- _3 = discriminant(_2); // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25 -- switchInt(move _3) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25 -+ _3 = const 0_isize; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25 -+ switchInt(const 0_isize) -> [1: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25 - } - - bb1: { - switchInt(((_2 as Some).0: u32)) -> [0: bb2, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25 - } - - bb2: { - _1 = const 1_i32; // scope 2 at $DIR/while_let_loops.rs:+3:9: +3:15 - goto -> bb4; // scope 2 at $DIR/while_let_loops.rs:+4:9: +4:14 - } - - bb3: { - goto -> bb4; // scope 1 at no-location - } - - bb4: { - StorageDead(_2); // scope 1 at $DIR/while_let_loops.rs:+5:5: +5:6 - StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:+6:1: +6:2 - return; // scope 0 at $DIR/while_let_loops.rs:+6:2: +6:2 - } - } - diff --git a/tests/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.mir b/tests/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.mir deleted file mode 100644 index 15b0aece8..000000000 --- a/tests/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.mir +++ /dev/null @@ -1,17 +0,0 @@ -// MIR for `change_loop_body` after PreCodegen - -fn change_loop_body() -> () { - let mut _0: (); // return place in scope 0 at $DIR/while_let_loops.rs:+0:27: +0:27 - let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:+1:9: +1:15 - scope 1 { - debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:+1:9: +1:15 - scope 2 { - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:+1:9: +1:15 - StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:+6:1: +6:2 - return; // scope 0 at $DIR/while_let_loops.rs:+6:2: +6:2 - } -} diff --git a/tests/mir-opt/while_let_loops.rs b/tests/mir-opt/while_let_loops.rs deleted file mode 100644 index fc56cd698..000000000 --- a/tests/mir-opt/while_let_loops.rs +++ /dev/null @@ -1,14 +0,0 @@ -// EMIT_MIR while_let_loops.change_loop_body.ConstProp.diff -// EMIT_MIR while_let_loops.change_loop_body.PreCodegen.after.mir - -pub fn change_loop_body() { - let mut _x = 0; - while let Some(0u32) = None { - _x = 1; - break; - } -} - -fn main() { - change_loop_body(); -} diff --git a/tests/pretty/offset_of.rs b/tests/pretty/offset_of.rs new file mode 100644 index 000000000..e17834328 --- /dev/null +++ b/tests/pretty/offset_of.rs @@ -0,0 +1,4 @@ +// pp-exact +#![feature(offset_of)] + +fn main() { std::mem::offset_of!(std :: ops :: Range < usize >, end); } diff --git a/tests/pretty/tests-are-sorted.pp b/tests/pretty/tests-are-sorted.pp index 58f746f2e..7d7f68213 100644 --- a/tests/pretty/tests-are-sorted.pp +++ b/tests/pretty/tests-are-sorted.pp @@ -79,6 +79,7 @@ pub const a_test: test::TestDescAndFn = }; fn a_test() {} #[rustc_main] +#[no_coverage] pub fn main() -> () { extern crate test; test::test_main_static(&[&a_test, &m_test, &z_test]) diff --git a/tests/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs b/tests/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs index 8dac53c2a..7db100a08 100644 --- a/tests/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs +++ b/tests/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs @@ -67,7 +67,7 @@ impl CodegenBackend for TheBackend { let crate_name = codegen_results.crate_info.local_crate_name; for &crate_type in sess.opts.crate_types.iter() { if crate_type != CrateType::Rlib { - sess.fatal(&format!("Crate type is {:?}", crate_type)); + sess.fatal(format!("Crate type is {:?}", crate_type)); } let output_name = out_filename(sess, crate_type, &outputs, crate_name); let mut out_file = ::std::fs::File::create(output_name).unwrap(); diff --git a/tests/run-make-fulldeps/obtain-borrowck/driver.rs b/tests/run-make-fulldeps/obtain-borrowck/driver.rs index 9cd504f00..b59a65a71 100644 --- a/tests/run-make-fulldeps/obtain-borrowck/driver.rs +++ b/tests/run-make-fulldeps/obtain-borrowck/driver.rs @@ -18,15 +18,15 @@ extern crate rustc_interface; extern crate rustc_middle; extern crate rustc_session; -use rustc_borrowck::consumers::BodyWithBorrowckFacts; +use rustc_borrowck::consumers::{self, BodyWithBorrowckFacts, ConsumerOptions}; use rustc_driver::Compilation; -use rustc_hir::def_id::LocalDefId; use rustc_hir::def::DefKind; +use rustc_hir::def_id::LocalDefId; use rustc_interface::interface::Compiler; use rustc_interface::{Config, Queries}; -use rustc_middle::ty::query::query_values::mir_borrowck; -use rustc_middle::ty::query::{ExternProviders, Providers}; -use rustc_middle::ty::{self, TyCtxt}; +use rustc_middle::query::queries::mir_borrowck::ProvidedValue; +use rustc_middle::query::{ExternProviders, Providers}; +use rustc_middle::ty::TyCtxt; use rustc_session::Session; use std::cell::RefCell; use std::collections::HashMap; @@ -102,7 +102,7 @@ impl rustc_driver::Callbacks for CompilerCalls { println!("Bodies retrieved for:"); for (def_id, body) in bodies { println!("{}", def_id); - assert!(body.input_facts.cfg_edge.len() > 0); + assert!(body.input_facts.unwrap().cfg_edge.len() > 0); } }); @@ -126,11 +126,9 @@ thread_local! { RefCell::new(HashMap::new()); } -fn mir_borrowck<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> mir_borrowck<'tcx> { - let body_with_facts = rustc_borrowck::consumers::get_body_with_borrowck_facts( - tcx, - ty::WithOptConstParam::unknown(def_id), - ); +fn mir_borrowck<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> ProvidedValue<'tcx> { + let opts = ConsumerOptions::PoloniusInputFacts; + let body_with_facts = consumers::get_body_with_borrowck_facts(tcx, def_id, opts); // SAFETY: The reader casts the 'static lifetime to 'tcx before using it. let body_with_facts: BodyWithBorrowckFacts<'static> = unsafe { std::mem::transmute(body_with_facts) }; diff --git a/tests/run-make/CURRENT_RUSTC_VERSION/Makefile b/tests/run-make/CURRENT_RUSTC_VERSION/Makefile new file mode 100644 index 000000000..7940dae20 --- /dev/null +++ b/tests/run-make/CURRENT_RUSTC_VERSION/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +all: + $(RUSTC) --emit=metadata --crate-type lib stable.rs + $(RUSTC) --emit=metadata --extern stable=$(TMPDIR)/libstable.rmeta main.rs 2>&1 >/dev/null \ + | $(CGREP) -e "stable since $$(cat $(S)/src/version)(-[a-zA-Z]+)?" diff --git a/tests/run-make/CURRENT_RUSTC_VERSION/main.rs b/tests/run-make/CURRENT_RUSTC_VERSION/main.rs new file mode 100644 index 000000000..466aaa82b --- /dev/null +++ b/tests/run-make/CURRENT_RUSTC_VERSION/main.rs @@ -0,0 +1,4 @@ +#![feature(foo)] +extern crate stable; + +fn main() {} diff --git a/tests/run-make/CURRENT_RUSTC_VERSION/stable.rs b/tests/run-make/CURRENT_RUSTC_VERSION/stable.rs new file mode 100644 index 000000000..2fd09aded --- /dev/null +++ b/tests/run-make/CURRENT_RUSTC_VERSION/stable.rs @@ -0,0 +1,5 @@ +#![feature(staged_api)] +#![stable(since = "1.0.0", feature = "rust1")] + +#[stable(since = "CURRENT_RUSTC_VERSION", feature = "foo")] +pub fn foo() {} diff --git a/tests/run-make/allocator-shim-circular-deps/Makefile b/tests/run-make/allocator-shim-circular-deps/Makefile new file mode 100644 index 000000000..4624b8468 --- /dev/null +++ b/tests/run-make/allocator-shim-circular-deps/Makefile @@ -0,0 +1,7 @@ +# ignore-cross-compile +include ../tools.mk + +all: + rm -rf $(TMPDIR) && mkdir $(TMPDIR) + $(RUSTC) my_lib.rs + $(RUSTC) main.rs --test --extern my_lib=$(TMPDIR)/libmy_lib.rlib diff --git a/tests/run-make/allocator-shim-circular-deps/main.rs b/tests/run-make/allocator-shim-circular-deps/main.rs new file mode 100644 index 000000000..e317c6571 --- /dev/null +++ b/tests/run-make/allocator-shim-circular-deps/main.rs @@ -0,0 +1,5 @@ +#![crate_type = "bin"] + +fn main() { + my_lib::do_something(); +} diff --git a/tests/run-make/allocator-shim-circular-deps/my_lib.rs b/tests/run-make/allocator-shim-circular-deps/my_lib.rs new file mode 100644 index 000000000..095b10361 --- /dev/null +++ b/tests/run-make/allocator-shim-circular-deps/my_lib.rs @@ -0,0 +1,10 @@ +#![crate_type = "lib"] + +use std::alloc::System; + +#[global_allocator] +static ALLOCATOR: System = System; + +pub fn do_something() { + format!("allocating a string!"); +} diff --git a/tests/run-make/branch-protection-check-IBT/Makefile b/tests/run-make/branch-protection-check-IBT/Makefile new file mode 100644 index 000000000..cabe951e1 --- /dev/null +++ b/tests/run-make/branch-protection-check-IBT/Makefile @@ -0,0 +1,15 @@ +# Check for GNU Property Note + +include ../tools.mk + +# How to run this +# python3 x.py test --target x86_64-unknown-linux-gnu tests/run-make/branch-protection-check-IBT/ + +# only-x86_64 + +all: +ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86_64) + $(RUSTC) --target x86_64-unknown-linux-gnu -Z cf-protection=branch -L$(TMPDIR) -C link-args='-nostartfiles' -C save-temps ./main.rs -o $(TMPDIR)/rsmain + readelf -nW $(TMPDIR)/rsmain | $(CGREP) -e ".note.gnu.property" +endif + diff --git a/tests/run-make/branch-protection-check-IBT/main.rs b/tests/run-make/branch-protection-check-IBT/main.rs new file mode 100644 index 000000000..ad379d6ea --- /dev/null +++ b/tests/run-make/branch-protection-check-IBT/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("hello world"); +} diff --git a/tests/run-make/c-unwind-abi-catch-lib-panic/Makefile b/tests/run-make/c-unwind-abi-catch-lib-panic/Makefile index 9c41a5a71..b8e0e9483 100644 --- a/tests/run-make/c-unwind-abi-catch-lib-panic/Makefile +++ b/tests/run-make/c-unwind-abi-catch-lib-panic/Makefile @@ -1,4 +1,5 @@ # ignore-cross-compile +# needs-unwind include ../tools.mk all: archive diff --git a/tests/run-make/c-unwind-abi-catch-lib-panic/main.rs b/tests/run-make/c-unwind-abi-catch-lib-panic/main.rs index 78a71219c..42d3efa82 100644 --- a/tests/run-make/c-unwind-abi-catch-lib-panic/main.rs +++ b/tests/run-make/c-unwind-abi-catch-lib-panic/main.rs @@ -2,7 +2,6 @@ //! //! This test triggers a panic in a Rust library that our foreign function invokes. This shows //! that we can unwind through the C code in that library, and catch the underlying panic. -#![feature(c_unwind)] use std::panic::{catch_unwind, AssertUnwindSafe}; diff --git a/tests/run-make/c-unwind-abi-catch-lib-panic/panic.rs b/tests/run-make/c-unwind-abi-catch-lib-panic/panic.rs index a99a04d5c..9e7bc3e53 100644 --- a/tests/run-make/c-unwind-abi-catch-lib-panic/panic.rs +++ b/tests/run-make/c-unwind-abi-catch-lib-panic/panic.rs @@ -1,5 +1,4 @@ #![crate_type = "staticlib"] -#![feature(c_unwind)] /// This function will panic if `x` is greater than 10. /// diff --git a/tests/run-make/c-unwind-abi-catch-panic/Makefile b/tests/run-make/c-unwind-abi-catch-panic/Makefile index 4398ac2ee..1760ddb30 100644 --- a/tests/run-make/c-unwind-abi-catch-panic/Makefile +++ b/tests/run-make/c-unwind-abi-catch-panic/Makefile @@ -1,4 +1,5 @@ # ignore-cross-compile +# needs-unwind include ../tools.mk all: $(call NATIVE_STATICLIB,add) diff --git a/tests/run-make/c-unwind-abi-catch-panic/main.rs b/tests/run-make/c-unwind-abi-catch-panic/main.rs index 15d38d721..1903be956 100644 --- a/tests/run-make/c-unwind-abi-catch-panic/main.rs +++ b/tests/run-make/c-unwind-abi-catch-panic/main.rs @@ -1,7 +1,6 @@ //! A test for calling `C-unwind` functions across foreign function boundaries. //! //! This test triggers a panic when calling a foreign function that calls *back* into Rust. -#![feature(c_unwind)] use std::panic::{catch_unwind, AssertUnwindSafe}; diff --git a/tests/run-make/const-prop-lint/Makefile b/tests/run-make/const-prop-lint/Makefile new file mode 100644 index 000000000..f29f282f7 --- /dev/null +++ b/tests/run-make/const-prop-lint/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +# Test that emitting an error because of arithmetic +# overflow lint does not leave .o files around +# because of interrupted codegen. + +all: + $(RUSTC) input.rs; test $$? -eq 1 + ls *.o; test $$? -ne 0 diff --git a/tests/run-make/const-prop-lint/input.rs b/tests/run-make/const-prop-lint/input.rs new file mode 100644 index 000000000..ccbdfb8d5 --- /dev/null +++ b/tests/run-make/const-prop-lint/input.rs @@ -0,0 +1,5 @@ +#![deny(arithmetic_overflow)] + +fn main() { + let x = 255u8 + 1; +} diff --git a/tests/run-make/const_fn_mir/Makefile b/tests/run-make/const_fn_mir/Makefile index b2c268f04..6d72c1227 100644 --- a/tests/run-make/const_fn_mir/Makefile +++ b/tests/run-make/const_fn_mir/Makefile @@ -1,3 +1,4 @@ +# needs-unwind -Cpanic=abort gives different MIR output include ../tools.mk all: diff --git a/tests/run-make/core-no-oom-handling/Makefile b/tests/run-make/core-no-oom-handling/Makefile new file mode 100644 index 000000000..28c5261ff --- /dev/null +++ b/tests/run-make/core-no-oom-handling/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +FAKEROOT=$(TMPDIR)/fakeroot + +all: + $(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/core/src/lib.rs --sysroot=$(FAKEROOT) --cfg no_global_oom_handling diff --git a/tests/run-make/coverage-llvmir/filecheck.testprog.txt b/tests/run-make/coverage-llvmir/filecheck.testprog.txt index c943261d7..b3a8808df 100644 --- a/tests/run-make/coverage-llvmir/filecheck.testprog.txt +++ b/tests/run-make/coverage-llvmir/filecheck.testprog.txt @@ -36,7 +36,7 @@ CHECK-SAME: section "llvm.metadata" CHECK: [[DEFINE_INTERNAL]] { {{.*}} } @_R{{[a-zA-Z0-9_]+}}testprog14will_be_called() unnamed_addr #{{[0-9]+}} { CHECK-NEXT: start: CHECK-NOT: [[DEFINE_INTERNAL]] -CHECK: %pgocount = load i64, {{i64\*|ptr}} +CHECK: atomicrmw add ptr CHECK-SAME: @__profc__R{{[a-zA-Z0-9_]+}}testprog14will_be_called, CHECK: declare void @llvm.instrprof.increment({{i8\*|ptr}}, i64, i32, i32) #[[LLVM_INSTRPROF_INCREMENT_ATTR:[0-9]+]] diff --git a/tests/run-make/coverage-reports/Makefile b/tests/run-make/coverage-reports/Makefile index d06cd9c6a..0ae409c41 100644 --- a/tests/run-make/coverage-reports/Makefile +++ b/tests/run-make/coverage-reports/Makefile @@ -138,6 +138,7 @@ endif ) \ 2> "$(TMPDIR)"/show_coverage_stderr.$@.txt \ | "$(PYTHON)" $(BASEDIR)/normalize_paths.py \ + | "$(PYTHON)" $(BASEDIR)/sort_subviews.py \ > "$(TMPDIR)"/actual_show_coverage.$@.txt || \ ( status=$$? ; \ >&2 cat "$(TMPDIR)"/show_coverage_stderr.$@.txt ; \ @@ -158,23 +159,15 @@ ifdef RUSTC_BLESS_TEST else # Compare the show coverage output (`--bless` refreshes `typical` files). # - # FIXME(richkadel): None of the Rust test source samples have the - # `// ignore-llvm-cov-show-diffs` anymore. This directive exists to work around a limitation - # with `llvm-cov show`. When reporting coverage for multiple instantiations of a generic function, - # with different type substitutions, `llvm-cov show` prints these in a non-deterministic order, - # breaking the `diff` comparison. + # `llvm-cov show` normally prints instantiation groups in an unpredictable + # order, but we have used `sort_subviews.py` to sort them, so we can still + # check the output directly with `diff`. # - # A partial workaround is implemented below, with `diff --ignore-matching-lines=RE` - # to ignore each line prefixing each generic instantiation coverage code region. - # - # This workaround only works if the coverage counts are identical across all reported - # instantiations. If there is no way to ensure this, you may need to apply the - # `// ignore-llvm-cov-show-diffs` directive, and check for differences using the - # `.json` files to validate that results have not changed. (Until then, the JSON - # files are redundant, so there is no need to generate `expected_*.json` files or - # compare actual JSON results.) - - $(DIFF) --ignore-matching-lines='^ | .*::<.*>.*:$$' --ignore-matching-lines='^ | <.*>::.*:$$' \ + # Some of the test cases are currently not working (since #110393) and have + # been marked with `// ignore-llvm-cov-show-diffs` so that they don't fail + # the build. + + $(DIFF) \ expected_show_coverage.$@.txt "$(TMPDIR)"/actual_show_coverage.$@.txt || \ ( grep -q '^\/\/ ignore-llvm-cov-show-diffs' $(SOURCEDIR)/$@.rs && \ >&2 echo 'diff failed, but suppressed with `// ignore-llvm-cov-show-diffs` in $(SOURCEDIR)/$@.rs' \ diff --git a/tests/run-make/coverage-reports/expected_show_coverage.async.txt b/tests/run-make/coverage-reports/expected_show_coverage.async.txt index 87ccb6c43..93c1535b0 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.async.txt +++ b/tests/run-make/coverage-reports/expected_show_coverage.async.txt @@ -41,9 +41,9 @@ 41| 1| // executed asynchronously. 42| 1| match x { 43| 1| y if c(x).await == y + 1 => { d().await; } - ^0 ^0 ^0 ^0 + ^0 ^0 ^0 ^0 44| 1| y if f().await == y + 1 => (), - ^0 ^0 ^0 + ^0 ^0 ^0 45| 1| _ => (), 46| | } 47| 1|} diff --git a/tests/run-make/coverage-reports/expected_show_coverage.generics.txt b/tests/run-make/coverage-reports/expected_show_coverage.generics.txt index 48983ba43..7eb33a29a 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.generics.txt +++ b/tests/run-make/coverage-reports/expected_show_coverage.generics.txt @@ -11,15 +11,15 @@ 11| 3| self.strength = new_strength; 12| 3| } ------------------ - | >::set_strength: - | 10| 1| fn set_strength(&mut self, new_strength: T) { - | 11| 1| self.strength = new_strength; - | 12| 1| } - ------------------ | >::set_strength: | 10| 2| fn set_strength(&mut self, new_strength: T) { | 11| 2| self.strength = new_strength; | 12| 2| } + ------------------ + | >::set_strength: + | 10| 1| fn set_strength(&mut self, new_strength: T) { + | 11| 1| self.strength = new_strength; + | 12| 1| } ------------------ 13| |} 14| | diff --git a/tests/run-make/coverage-reports/expected_show_coverage.sort_groups.txt b/tests/run-make/coverage-reports/expected_show_coverage.sort_groups.txt new file mode 100644 index 000000000..81468cb35 --- /dev/null +++ b/tests/run-make/coverage-reports/expected_show_coverage.sort_groups.txt @@ -0,0 +1,49 @@ + 1| |// compile-flags: --edition=2021 + 2| | + 3| |// Demonstrate that `sort_subviews.py` can sort instantiation groups into a + 4| |// predictable order, while preserving their heterogeneous contents. + 5| | + 6| 1|fn main() { + 7| 1| let cond = std::env::args().len() > 1; + 8| 1| generic_fn::<()>(cond); + 9| 1| generic_fn::<&'static str>(!cond); + 10| 1| if false { + 11| 0| generic_fn::(cond); + 12| 1| } + 13| 1| generic_fn::(cond); + 14| 1| other_fn(); + 15| 1|} + 16| | + 17| 3|fn generic_fn(cond: bool) { + 18| 3| if cond { + 19| 1| println!("{}", std::any::type_name::()); + 20| 2| } + 21| 3|} + ------------------ + | Unexecuted instantiation: sort_groups::generic_fn:: + ------------------ + | sort_groups::generic_fn::<&str>: + | 17| 1|fn generic_fn(cond: bool) { + | 18| 1| if cond { + | 19| 1| println!("{}", std::any::type_name::()); + | 20| 1| } + | ^0 + | 21| 1|} + ------------------ + | sort_groups::generic_fn::<()>: + | 17| 1|fn generic_fn(cond: bool) { + | 18| 1| if cond { + | 19| 0| println!("{}", std::any::type_name::()); + | 20| 1| } + | 21| 1|} + ------------------ + | sort_groups::generic_fn::: + | 17| 1|fn generic_fn(cond: bool) { + | 18| 1| if cond { + | 19| 0| println!("{}", std::any::type_name::()); + | 20| 1| } + | 21| 1|} + ------------------ + 22| | + 23| 1|fn other_fn() {} + diff --git a/tests/run-make/coverage-reports/expected_show_coverage.test_harness.txt b/tests/run-make/coverage-reports/expected_show_coverage.test_harness.txt new file mode 100644 index 000000000..93bd1cfcb --- /dev/null +++ b/tests/run-make/coverage-reports/expected_show_coverage.test_harness.txt @@ -0,0 +1,11 @@ + 1| |// Verify that the entry point injected by the test harness doesn't cause + 2| |// weird artifacts in the coverage report (e.g. issue #10749). + 3| | + 4| |// compile-flags: --test + 5| | + 6| |#[allow(dead_code)] + 7| 0|fn unused() {} + 8| | + 9| 1|#[test] + 10| 1|fn my_test() {} + diff --git a/tests/run-make/coverage-reports/expected_show_coverage.uses_crate.txt b/tests/run-make/coverage-reports/expected_show_coverage.uses_crate.txt index 65eb1008d..412f4a93b 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.uses_crate.txt +++ b/tests/run-make/coverage-reports/expected_show_coverage.uses_crate.txt @@ -19,29 +19,29 @@ 18| 2| println!("used_only_from_bin_crate_generic_function with {:?}", arg); 19| 2|} ------------------ - | used_crate::used_only_from_bin_crate_generic_function::<&str>: + | Unexecuted instantiation: used_crate::used_only_from_bin_crate_generic_function::<_> + ------------------ + | used_crate::used_only_from_bin_crate_generic_function::<&alloc::vec::Vec>: | 17| 1|pub fn used_only_from_bin_crate_generic_function(arg: T) { | 18| 1| println!("used_only_from_bin_crate_generic_function with {:?}", arg); | 19| 1|} ------------------ - | used_crate::used_only_from_bin_crate_generic_function::<&alloc::vec::Vec>: + | used_crate::used_only_from_bin_crate_generic_function::<&str>: | 17| 1|pub fn used_only_from_bin_crate_generic_function(arg: T) { | 18| 1| println!("used_only_from_bin_crate_generic_function with {:?}", arg); | 19| 1|} - ------------------ - | Unexecuted instantiation: used_crate::used_only_from_bin_crate_generic_function::<_> ------------------ 20| |// Expect for above function: `Unexecuted instantiation` (see below) 21| 2|pub fn used_only_from_this_lib_crate_generic_function(arg: T) { 22| 2| println!("used_only_from_this_lib_crate_generic_function with {:?}", arg); 23| 2|} ------------------ - | used_crate::used_only_from_this_lib_crate_generic_function::>: + | used_crate::used_only_from_this_lib_crate_generic_function::<&str>: | 21| 1|pub fn used_only_from_this_lib_crate_generic_function(arg: T) { | 22| 1| println!("used_only_from_this_lib_crate_generic_function with {:?}", arg); | 23| 1|} ------------------ - | used_crate::used_only_from_this_lib_crate_generic_function::<&str>: + | used_crate::used_only_from_this_lib_crate_generic_function::>: | 21| 1|pub fn used_only_from_this_lib_crate_generic_function(arg: T) { | 22| 1| println!("used_only_from_this_lib_crate_generic_function with {:?}", arg); | 23| 1|} @@ -51,12 +51,12 @@ 26| 2| println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); 27| 2|} ------------------ - | used_crate::used_from_bin_crate_and_lib_crate_generic_function::>: + | used_crate::used_from_bin_crate_and_lib_crate_generic_function::<&str>: | 25| 1|pub fn used_from_bin_crate_and_lib_crate_generic_function(arg: T) { | 26| 1| println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); | 27| 1|} ------------------ - | used_crate::used_from_bin_crate_and_lib_crate_generic_function::<&str>: + | used_crate::used_from_bin_crate_and_lib_crate_generic_function::>: | 25| 1|pub fn used_from_bin_crate_and_lib_crate_generic_function(arg: T) { | 26| 1| println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); | 27| 1|} diff --git a/tests/run-make/coverage-reports/expected_show_coverage.uses_inline_crate.txt b/tests/run-make/coverage-reports/expected_show_coverage.uses_inline_crate.txt index 748343885..66ca9e80a 100644 --- a/tests/run-make/coverage-reports/expected_show_coverage.uses_inline_crate.txt +++ b/tests/run-make/coverage-reports/expected_show_coverage.uses_inline_crate.txt @@ -42,6 +42,8 @@ 40| 2| println!("used_only_from_bin_crate_generic_function with {:?}", arg); 41| 2|} ------------------ + | Unexecuted instantiation: used_inline_crate::used_only_from_bin_crate_generic_function::<_> + ------------------ | used_inline_crate::used_only_from_bin_crate_generic_function::<&alloc::vec::Vec>: | 39| 1|pub fn used_only_from_bin_crate_generic_function(arg: T) { | 40| 1| println!("used_only_from_bin_crate_generic_function with {:?}", arg); @@ -51,8 +53,6 @@ | 39| 1|pub fn used_only_from_bin_crate_generic_function(arg: T) { | 40| 1| println!("used_only_from_bin_crate_generic_function with {:?}", arg); | 41| 1|} - ------------------ - | Unexecuted instantiation: used_inline_crate::used_only_from_bin_crate_generic_function::<_> ------------------ 42| |// Expect for above function: `Unexecuted instantiation` (see notes in `used_crate.rs`) 43| | @@ -77,15 +77,15 @@ 51| 3| println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); 52| 3|} ------------------ - | used_inline_crate::used_from_bin_crate_and_lib_crate_generic_function::>: - | 50| 1|pub fn used_from_bin_crate_and_lib_crate_generic_function(arg: T) { - | 51| 1| println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); - | 52| 1|} - ------------------ | used_inline_crate::used_from_bin_crate_and_lib_crate_generic_function::<&str>: | 50| 2|pub fn used_from_bin_crate_and_lib_crate_generic_function(arg: T) { | 51| 2| println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); | 52| 2|} + ------------------ + | used_inline_crate::used_from_bin_crate_and_lib_crate_generic_function::>: + | 50| 1|pub fn used_from_bin_crate_and_lib_crate_generic_function(arg: T) { + | 51| 1| println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); + | 52| 1|} ------------------ 53| | 54| |#[inline(always)] diff --git a/tests/run-make/coverage-reports/sort_subviews.py b/tests/run-make/coverage-reports/sort_subviews.py new file mode 100644 index 000000000..10cfc51d4 --- /dev/null +++ b/tests/run-make/coverage-reports/sort_subviews.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 + +# `llvm-cov show` prints grouped subviews (e.g. for generic functions) in an +# unstable order, which is inconvenient when checking output snapshots with +# `diff`. To work around that, this script detects consecutive subviews in its +# piped input, and sorts them while preserving their contents. + +from __future__ import print_function + +import sys + + +def main(): + subviews = [] + + def flush_subviews(): + if not subviews: + return + + # The last "subview" should be just a boundary line on its own, so + # temporarily remove it before sorting the accumulated subviews. + terminator = subviews.pop() + subviews.sort() + subviews.append(terminator) + + for view in subviews: + for line in view: + print(line, end="") + + subviews.clear() + + for line in sys.stdin: + if line.startswith(" ------------------"): + # This is a subview boundary line, so start a new subview. + subviews.append([line]) + elif line.startswith(" |"): + # Add this line to the current subview. + subviews[-1].append(line) + else: + # This line is not part of a subview, so sort and print any + # accumulated subviews, and then print the line as-is. + flush_subviews() + print(line, end="") + + flush_subviews() + assert not subviews + + +if __name__ == "__main__": + main() diff --git a/tests/run-make/coverage/sort_groups.rs b/tests/run-make/coverage/sort_groups.rs new file mode 100644 index 000000000..f89f9f3ec --- /dev/null +++ b/tests/run-make/coverage/sort_groups.rs @@ -0,0 +1,23 @@ +// compile-flags: --edition=2021 + +// Demonstrate that `sort_subviews.py` can sort instantiation groups into a +// predictable order, while preserving their heterogeneous contents. + +fn main() { + let cond = std::env::args().len() > 1; + generic_fn::<()>(cond); + generic_fn::<&'static str>(!cond); + if false { + generic_fn::(cond); + } + generic_fn::(cond); + other_fn(); +} + +fn generic_fn(cond: bool) { + if cond { + println!("{}", std::any::type_name::()); + } +} + +fn other_fn() {} diff --git a/tests/run-make/coverage/test_harness.rs b/tests/run-make/coverage/test_harness.rs new file mode 100644 index 000000000..12a755734 --- /dev/null +++ b/tests/run-make/coverage/test_harness.rs @@ -0,0 +1,10 @@ +// Verify that the entry point injected by the test harness doesn't cause +// weird artifacts in the coverage report (e.g. issue #10749). + +// compile-flags: --test + +#[allow(dead_code)] +fn unused() {} + +#[test] +fn my_test() {} diff --git a/tests/run-make/coverage/uses_crate.rs b/tests/run-make/coverage/uses_crate.rs index 20cb05fe5..1ee8037a1 100644 --- a/tests/run-make/coverage/uses_crate.rs +++ b/tests/run-make/coverage/uses_crate.rs @@ -1,3 +1,6 @@ +// FIXME #110395 +// ignore-llvm-cov-show-diffs + #![allow(unused_assignments, unused_variables)] // compile-flags: -C opt-level=3 # validates coverage now works with optimizations extern crate used_crate; diff --git a/tests/run-make/coverage/uses_inline_crate.rs b/tests/run-make/coverage/uses_inline_crate.rs index a7fe8532b..f7aff3c3f 100644 --- a/tests/run-make/coverage/uses_inline_crate.rs +++ b/tests/run-make/coverage/uses_inline_crate.rs @@ -1,3 +1,6 @@ +// FIXME #110395 +// ignore-llvm-cov-show-diffs + #![allow(unused_assignments, unused_variables)] // compile-flags: -C opt-level=3 # validates coverage now works with optimizations diff --git a/tests/run-make/debug-assertions/Makefile b/tests/run-make/debug-assertions/Makefile index e83337c59..4501459e9 100644 --- a/tests/run-make/debug-assertions/Makefile +++ b/tests/run-make/debug-assertions/Makefile @@ -1,4 +1,5 @@ # ignore-cross-compile +# needs-unwind include ../tools.mk all: diff --git a/tests/run-make/debugger-visualizer-dep-info/Makefile b/tests/run-make/debugger-visualizer-dep-info/Makefile new file mode 100644 index 000000000..0877998a7 --- /dev/null +++ b/tests/run-make/debugger-visualizer-dep-info/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +# This test makes sure that files referenced via #[debugger_visualizer] are +# included in `--emit dep-info` output. + +all: + $(RUSTC) --emit dep-info main.rs + $(CGREP) "foo.py" < $(TMPDIR)/main.d + $(CGREP) "my_visualizers/bar.natvis" < $(TMPDIR)/main.d diff --git a/tests/run-make/debugger-visualizer-dep-info/foo.py b/tests/run-make/debugger-visualizer-dep-info/foo.py new file mode 100644 index 000000000..1bb8bf6d7 --- /dev/null +++ b/tests/run-make/debugger-visualizer-dep-info/foo.py @@ -0,0 +1 @@ +# empty diff --git a/tests/run-make/debugger-visualizer-dep-info/main.rs b/tests/run-make/debugger-visualizer-dep-info/main.rs new file mode 100644 index 000000000..3aede2215 --- /dev/null +++ b/tests/run-make/debugger-visualizer-dep-info/main.rs @@ -0,0 +1,12 @@ +#![debugger_visualizer(gdb_script_file = "foo.py")] + +fn main() { + const _UNUSED: u32 = { + mod inner { + #![debugger_visualizer(natvis_file = "my_visualizers/bar.natvis")] + pub const XYZ: u32 = 123; + } + + inner::XYZ + 1 + }; +} diff --git a/tests/run-make/debugger-visualizer-dep-info/my_visualizers/bar.natvis b/tests/run-make/debugger-visualizer-dep-info/my_visualizers/bar.natvis new file mode 100644 index 000000000..c341a4039 --- /dev/null +++ b/tests/run-make/debugger-visualizer-dep-info/my_visualizers/bar.natvis @@ -0,0 +1 @@ + diff --git a/tests/run-make/forced-unwind-terminate-pof/Makefile b/tests/run-make/forced-unwind-terminate-pof/Makefile new file mode 100644 index 000000000..871621520 --- /dev/null +++ b/tests/run-make/forced-unwind-terminate-pof/Makefile @@ -0,0 +1,9 @@ +# ignore-cross-compile +# only-linux +include ../tools.mk + +all: foo + $(call RUN,foo) | $(CGREP) -v "cannot unwind" + +foo: foo.rs + $(RUSTC) $< diff --git a/tests/run-make/forced-unwind-terminate-pof/foo.rs b/tests/run-make/forced-unwind-terminate-pof/foo.rs new file mode 100644 index 000000000..0a5128731 --- /dev/null +++ b/tests/run-make/forced-unwind-terminate-pof/foo.rs @@ -0,0 +1,17 @@ +// Tests that forced unwind through POF Rust frames wouldn't trigger our terminating guards. + +#![feature(c_unwind)] +#![no_main] + +extern "C-unwind" { + fn pthread_exit(v: *mut core::ffi::c_void) -> !; +} + +unsafe extern "C" fn call_pthread_exit() { + pthread_exit(core::ptr::null_mut()); +} + +#[no_mangle] +unsafe extern "C-unwind" fn main(_argc: core::ffi::c_int, _argv: *mut *mut core::ffi::c_char) { + call_pthread_exit(); +} diff --git a/tests/run-make/foreign-double-unwind/Makefile b/tests/run-make/foreign-double-unwind/Makefile index f20fe3ce6..b5e52808d 100644 --- a/tests/run-make/foreign-double-unwind/Makefile +++ b/tests/run-make/foreign-double-unwind/Makefile @@ -1,4 +1,5 @@ # ignore-cross-compile +# needs-unwind include ../tools.mk all: foo diff --git a/tests/run-make/foreign-double-unwind/foo.rs b/tests/run-make/foreign-double-unwind/foo.rs index cae8aa940..c085480b4 100644 --- a/tests/run-make/foreign-double-unwind/foo.rs +++ b/tests/run-make/foreign-double-unwind/foo.rs @@ -1,8 +1,6 @@ // Tests that C++ double unwinding through Rust code will be properly guarded // against instead of exhibiting undefined behaviour. -#![feature(c_unwind)] - extern "C-unwind" { fn throw_cxx_exception(); fn cxx_catch_callback(cb: extern "C-unwind" fn()); diff --git a/tests/run-make/foreign-exceptions/Makefile b/tests/run-make/foreign-exceptions/Makefile index a8e20ffb1..56c41b274 100644 --- a/tests/run-make/foreign-exceptions/Makefile +++ b/tests/run-make/foreign-exceptions/Makefile @@ -1,4 +1,5 @@ # ignore-cross-compile +# needs-unwind include ../tools.mk all: foo diff --git a/tests/run-make/foreign-exceptions/foo.rs b/tests/run-make/foreign-exceptions/foo.rs index dd3b7c76f..ccf858d85 100644 --- a/tests/run-make/foreign-exceptions/foo.rs +++ b/tests/run-make/foreign-exceptions/foo.rs @@ -2,8 +2,6 @@ // are caught by catch_unwind. Also tests that Rust panics can unwind through // C++ code. -#![feature(c_unwind)] - use std::panic::{catch_unwind, AssertUnwindSafe}; struct DropCheck<'a>(&'a mut bool); diff --git a/tests/run-make/foreign-rust-exceptions/Makefile b/tests/run-make/foreign-rust-exceptions/Makefile index 0d007bf1c..59cee2842 100644 --- a/tests/run-make/foreign-rust-exceptions/Makefile +++ b/tests/run-make/foreign-rust-exceptions/Makefile @@ -1,5 +1,6 @@ # ignore-cross-compile # ignore-i686-pc-windows-gnu +# needs-unwind # This test doesn't work on 32-bit MinGW as cdylib has its own copy of unwinder # so cross-DLL unwinding does not work. diff --git a/tests/run-make/foreign-rust-exceptions/bar.rs b/tests/run-make/foreign-rust-exceptions/bar.rs index 5f9efe323..1d865b429 100644 --- a/tests/run-make/foreign-rust-exceptions/bar.rs +++ b/tests/run-make/foreign-rust-exceptions/bar.rs @@ -1,5 +1,4 @@ #![crate_type = "cdylib"] -#![feature(c_unwind)] #[no_mangle] extern "C-unwind" fn panic() { diff --git a/tests/run-make/foreign-rust-exceptions/foo.rs b/tests/run-make/foreign-rust-exceptions/foo.rs index 266987c5b..38942c55b 100644 --- a/tests/run-make/foreign-rust-exceptions/foo.rs +++ b/tests/run-make/foreign-rust-exceptions/foo.rs @@ -1,5 +1,3 @@ -#![feature(c_unwind)] - #[cfg_attr(not(windows), link(name = "bar"))] #[cfg_attr(windows, link(name = "bar.dll"))] extern "C-unwind" { diff --git a/tests/run-make/inaccessible-temp-dir/Makefile b/tests/run-make/inaccessible-temp-dir/Makefile new file mode 100644 index 000000000..abdba4eb8 --- /dev/null +++ b/tests/run-make/inaccessible-temp-dir/Makefile @@ -0,0 +1,32 @@ +# only-linux +# ignore-arm - linker error on `armhf-gnu` + +include ../tools.mk + +# Issue #66530: We would ICE if someone compiled with `-o /dev/null`, +# because we would try to generate auxiliary files in `/dev/` (which +# at least the OS X file system rejects). +# +# An attempt to `-Ztemps-dir` into a directory we cannot write into should +# indeed be an error; but not an ICE. +# +# However, some folks run tests as root, which can write `/dev/` and end +# up clobbering `/dev/null`. Instead we'll use an inaccessible path, which +# also used to ICE, but even root can't magically write there. +# +# Note that `-Ztemps-dir` uses `create_dir_all` so it is not sufficient to +# use a directory with non-existing parent like `/does-not-exist/output`. + +all: + # Create an inaccessible directory + mkdir $(TMPDIR)/inaccessible + chmod 000 $(TMPDIR)/inaccessible + + # Run rustc with `-Ztemps-dir` set to a directory + # *inside* the inaccessible one, so that it can't create it + $(RUSTC) program.rs -Ztemps-dir=$(TMPDIR)/inaccessible/tmp 2>&1 \ + | $(CGREP) 'failed to find or create the directory specified by `--temps-dir`' + + # Make the inaccessible directory accessible, + # so that compiletest can delete the temp dir + chmod +rw $(TMPDIR)/inaccessible diff --git a/tests/run-make/inaccessible-temp-dir/program.rs b/tests/run-make/inaccessible-temp-dir/program.rs new file mode 100644 index 000000000..f328e4d9d --- /dev/null +++ b/tests/run-make/inaccessible-temp-dir/program.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/incremental-debugger-visualizer/Makefile b/tests/run-make/incremental-debugger-visualizer/Makefile new file mode 100644 index 000000000..8cfe41597 --- /dev/null +++ b/tests/run-make/incremental-debugger-visualizer/Makefile @@ -0,0 +1,49 @@ +include ../tools.mk + +# This test makes sure that changes to files referenced via #[debugger_visualizer] +# are picked up when compiling incrementally. + +# We have to copy the source to $(TMPDIR) because Github CI mounts the source +# directory as readonly. We need to apply modifications to some of the source +# file. +SRC_DIR := $(TMPDIR)/src +INCR_CACHE_DIR := $(TMPDIR)/incremental + +all: + rm -rf $(TMPDIR)/* + mkdir $(SRC_DIR) + cp ./foo.rs $(SRC_DIR) + echo "GDB script v1" > $(SRC_DIR)/foo.py + echo "Natvis v1" > $(SRC_DIR)/foo.natvis + $(RUSTC) $(SRC_DIR)/foo.rs \ + --crate-type=rlib \ + --emit metadata \ + -C incremental=$(INCR_CACHE_DIR) \ + -Z incremental-verify-ich + $(CGREP) "GDB script v1" < $(TMPDIR)/libfoo.rmeta + $(CGREP) "Natvis v1" < $(TMPDIR)/libfoo.rmeta + + # Change only the GDB script and check that the change has been picked up + echo "GDB script v2" > $(SRC_DIR)/foo.py + $(RUSTC) $(SRC_DIR)/foo.rs \ + --crate-type=rlib \ + --emit metadata \ + -C incremental=$(INCR_CACHE_DIR) \ + -Z incremental-verify-ich + + $(CGREP) "GDB script v2" < $(TMPDIR)/libfoo.rmeta + $(CGREP) -v "GDB script v1" < $(TMPDIR)/libfoo.rmeta + $(CGREP) "Natvis v1" < $(TMPDIR)/libfoo.rmeta + + # Now change the Natvis version and check that the change has been picked up + echo "Natvis v2" > $(SRC_DIR)/foo.natvis + $(RUSTC) $(SRC_DIR)/foo.rs \ + --crate-type=rlib \ + --emit metadata \ + -C incremental=$(INCR_CACHE_DIR) \ + -Z incremental-verify-ich + + $(CGREP) "GDB script v2" < $(TMPDIR)/libfoo.rmeta + $(CGREP) -v "GDB script v1" < $(TMPDIR)/libfoo.rmeta + $(CGREP) "Natvis v2" < $(TMPDIR)/libfoo.rmeta + $(CGREP) -v "Natvis v1" < $(TMPDIR)/libfoo.rmeta diff --git a/tests/run-make/incremental-debugger-visualizer/foo.rs b/tests/run-make/incremental-debugger-visualizer/foo.rs new file mode 100644 index 000000000..8daa36a12 --- /dev/null +++ b/tests/run-make/incremental-debugger-visualizer/foo.rs @@ -0,0 +1,6 @@ +#![debugger_visualizer(natvis_file = "./foo.natvis")] +#![debugger_visualizer(gdb_script_file = "./foo.py")] + +pub struct Foo { + pub x: u32, +} diff --git a/tests/run-make/issue-107094/Makefile b/tests/run-make/issue-107094/Makefile new file mode 100644 index 000000000..d614e3e10 --- /dev/null +++ b/tests/run-make/issue-107094/Makefile @@ -0,0 +1,7 @@ +# needs-git-hash + +include ../tools.mk + +all: + $(BARE_RUSTC) --version --verbose | $(CGREP) -i -e "commit-hash: [0-9a-f]{40}" "commit-date: [0-9]{4}-[0-9]{2}-[0-9]{2}" + $(BARE_RUSTDOC) --version --verbose | $(CGREP) -i -e "commit-hash: [0-9a-f]{40}" "commit-date: [0-9]{4}-[0-9]{2}-[0-9]{2}" diff --git a/tests/run-make/issue-83045/Makefile b/tests/run-make/issue-83045/Makefile index 7053da00f..b76e184b6 100644 --- a/tests/run-make/issue-83045/Makefile +++ b/tests/run-make/issue-83045/Makefile @@ -29,5 +29,5 @@ all: --crate-type=rlib \ --edition=2018 \ c.rs 2>&1 | tee $(TMPDIR)/output.txt || exit 0 - $(CGREP) E0519 < $(TMPDIR)/output.txt + $(CGREP) E0463 < $(TMPDIR)/output.txt $(CGREP) -v "internal compiler error" < $(TMPDIR)/output.txt diff --git a/tests/run-make/libtest-json/Makefile b/tests/run-make/libtest-json/Makefile index 417637cf0..c8bc7b5dd 100644 --- a/tests/run-make/libtest-json/Makefile +++ b/tests/run-make/libtest-json/Makefile @@ -1,4 +1,5 @@ # ignore-cross-compile +# needs-unwind include ../tools.mk # Test expected libtest's JSON output diff --git a/tests/run-make/libtest-junit/Makefile b/tests/run-make/libtest-junit/Makefile new file mode 100644 index 000000000..d97cafccf --- /dev/null +++ b/tests/run-make/libtest-junit/Makefile @@ -0,0 +1,19 @@ +# ignore-cross-compile +include ../tools.mk + +# Test expected libtest's junit output + +OUTPUT_FILE_DEFAULT := $(TMPDIR)/libtest-junit-output-default.xml +OUTPUT_FILE_STDOUT_SUCCESS := $(TMPDIR)/libtest-junit-output-stdout-success.xml + +all: f.rs validate_junit.py output-default.xml output-stdout-success.xml + $(RUSTC) --test f.rs + RUST_BACKTRACE=0 $(call RUN,f) -Z unstable-options --test-threads=1 --format=junit > $(OUTPUT_FILE_DEFAULT) || true + RUST_BACKTRACE=0 $(call RUN,f) -Z unstable-options --test-threads=1 --format=junit --show-output > $(OUTPUT_FILE_STDOUT_SUCCESS) || true + + cat $(OUTPUT_FILE_DEFAULT) | "$(PYTHON)" validate_junit.py + cat $(OUTPUT_FILE_STDOUT_SUCCESS) | "$(PYTHON)" validate_junit.py + + # Normalize the actual output and compare to expected output file + cat $(OUTPUT_FILE_DEFAULT) | sed 's/time="[0-9.]*"/time="$$TIME"/g' | diff output-default.xml - + cat $(OUTPUT_FILE_STDOUT_SUCCESS) | sed 's/time="[0-9.]*"/time="$$TIME"/g' | diff output-stdout-success.xml - diff --git a/tests/run-make/libtest-junit/f.rs b/tests/run-make/libtest-junit/f.rs new file mode 100644 index 000000000..d360d7731 --- /dev/null +++ b/tests/run-make/libtest-junit/f.rs @@ -0,0 +1,23 @@ +#[test] +fn a() { + println!("print from successful test"); + // Should pass +} + +#[test] +fn b() { + println!("print from failing test"); + assert!(false); +} + +#[test] +#[should_panic] +fn c() { + assert!(false); +} + +#[test] +#[ignore = "msg"] +fn d() { + assert!(false); +} diff --git a/tests/run-make/libtest-junit/output-default.xml b/tests/run-make/libtest-junit/output-default.xml new file mode 100644 index 000000000..d59e07b8a --- /dev/null +++ b/tests/run-make/libtest-junit/output-default.xml @@ -0,0 +1 @@ + diff --git a/tests/run-make/libtest-junit/output-stdout-success.xml b/tests/run-make/libtest-junit/output-stdout-success.xml new file mode 100644 index 000000000..0c300611e --- /dev/null +++ b/tests/run-make/libtest-junit/output-stdout-success.xml @@ -0,0 +1 @@ + diff --git a/tests/run-make/libtest-junit/validate_junit.py b/tests/run-make/libtest-junit/validate_junit.py new file mode 100755 index 000000000..47a8e70cc --- /dev/null +++ b/tests/run-make/libtest-junit/validate_junit.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +import sys +import xml.etree.ElementTree as ET + +# Try to decode line in order to ensure it is a valid XML document +for line in sys.stdin: + try: + ET.fromstring(line) + except ET.ParseError as pe: + print("Invalid xml: %r" % line) + raise diff --git a/tests/run-make/no-alloc-shim/Makefile b/tests/run-make/no-alloc-shim/Makefile new file mode 100644 index 000000000..568e3f9ba --- /dev/null +++ b/tests/run-make/no-alloc-shim/Makefile @@ -0,0 +1,24 @@ +include ../tools.mk + +# ignore-cross-compile +# ignore-msvc FIXME(bjorn3) can't figure out how to link with the MSVC toolchain + +TARGET_LIBDIR = $$($(RUSTC) --print target-libdir) + +all: + $(RUSTC) foo.rs --crate-type bin --emit obj -Cpanic=abort +ifdef IS_MSVC + $(CC) $(CFLAGS) $(TMPDIR)/foo.o $(call OUT_EXE,foo) /link $(TARGET_LIBDIR)/liballoc-*.rlib $(TARGET_LIBDIR)/libcore-*.rlib $(TARGET_LIBDIR)/libcompiler_builtins-*.rlib + $(call OUT_EXE,foo) +else + $(CC) $(CFLAGS) $(TMPDIR)/foo.o $(TARGET_LIBDIR)/liballoc-*.rlib $(TARGET_LIBDIR)/libcore-*.rlib $(TARGET_LIBDIR)/libcompiler_builtins-*.rlib -o $(call RUN_BINFILE,foo) + $(call RUN_BINFILE,foo) +endif + + # Check that linking without __rust_no_alloc_shim_is_unstable defined fails + $(RUSTC) foo.rs --crate-type bin --emit obj -Cpanic=abort --cfg check_feature_gate +ifdef IS_MSVC + $(CC) $(CFLAGS) $(TMPDIR)/foo.o $(call OUT_EXE,foo) /link $(TARGET_LIBDIR)/liballoc-*.rlib $(TARGET_LIBDIR)/libcore-*.rlib $(TARGET_LIBDIR)/libcompiler_builtins-*.rlib || exit 0 && exit 1 +else + $(CC) $(CFLAGS) $(TMPDIR)/foo.o $(TARGET_LIBDIR)/liballoc-*.rlib $(TARGET_LIBDIR)/libcore-*.rlib $(TARGET_LIBDIR)/libcompiler_builtins-*.rlib -o $(call RUN_BINFILE,foo) || exit 0 && exit 1 +endif diff --git a/tests/run-make/no-alloc-shim/foo.rs b/tests/run-make/no-alloc-shim/foo.rs new file mode 100644 index 000000000..a3daec3db --- /dev/null +++ b/tests/run-make/no-alloc-shim/foo.rs @@ -0,0 +1,44 @@ +#![feature(default_alloc_error_handler)] +#![no_std] +#![no_main] + +extern crate alloc; + +use alloc::alloc::{GlobalAlloc, Layout}; + +#[panic_handler] +fn panic_handler(_: &core::panic::PanicInfo) -> ! { + loop {} +} + +#[no_mangle] +extern "C" fn rust_eh_personality() { + loop {} +} + +#[global_allocator] +static ALLOC: Alloc = Alloc; + +struct Alloc; + +unsafe impl GlobalAlloc for Alloc { + unsafe fn alloc(&self, _: Layout) -> *mut u8 { + core::ptr::null_mut() + } + unsafe fn dealloc(&self, _: *mut u8, _: Layout) { + todo!() + } +} + +#[cfg(not(check_feature_gate))] +#[no_mangle] +static __rust_no_alloc_shim_is_unstable: u8 = 0; + +#[no_mangle] +extern "C" fn main(_argc: usize, _argv: *const *const i8) -> i32 { + unsafe { + assert_eq!(alloc::alloc::alloc(Layout::new::<()>()), core::ptr::null_mut()); + } + + 0 +} diff --git a/tests/run-make/pointer-auth-link-with-c/Makefile b/tests/run-make/pointer-auth-link-with-c/Makefile index 7acea0380..dffbd3035 100644 --- a/tests/run-make/pointer-auth-link-with-c/Makefile +++ b/tests/run-make/pointer-auth-link-with-c/Makefile @@ -5,10 +5,10 @@ include ../tools.mk all: $(COMPILE_OBJ) $(TMPDIR)/test.o test.c $(AR) rcs $(TMPDIR)/libtest.a $(TMPDIR)/test.o - $(RUSTC) -Z branch-protection=bti,pac-ret,leaf test.rs + $(RUSTC) --target $(TARGET) -Z branch-protection=bti,pac-ret,leaf test.rs $(call RUN,test) $(COMPILE_OBJ) $(TMPDIR)/test.o test.c -mbranch-protection=bti+pac-ret+leaf $(AR) rcs $(TMPDIR)/libtest.a $(TMPDIR)/test.o - $(RUSTC) -Z branch-protection=bti,pac-ret,leaf test.rs + $(RUSTC) --target $(TARGET) -Z branch-protection=bti,pac-ret,leaf test.rs $(call RUN,test) diff --git a/tests/run-make/print-native-static-libs/Makefile b/tests/run-make/print-native-static-libs/Makefile new file mode 100644 index 000000000..98e72d769 --- /dev/null +++ b/tests/run-make/print-native-static-libs/Makefile @@ -0,0 +1,15 @@ +include ../tools.mk + +# ignore-cross-compile +# ignore-wasm + +all: + $(RUSTC) --crate-type rlib -lbar_cli bar.rs + $(RUSTC) foo.rs -lfoo_cli --crate-type staticlib --print native-static-libs 2>&1 \ + | grep 'note: native-static-libs: ' \ + | sed 's/note: native-static-libs: \(.*\)/\1/' > $(TMPDIR)/libs.txt + + cat $(TMPDIR)/libs.txt | grep -F "glib-2.0" # in bar.rs + cat $(TMPDIR)/libs.txt | grep -F "systemd" # in foo.rs + cat $(TMPDIR)/libs.txt | grep -F "bar_cli" + cat $(TMPDIR)/libs.txt | grep -F "foo_cli" diff --git a/tests/run-make/print-native-static-libs/bar.rs b/tests/run-make/print-native-static-libs/bar.rs new file mode 100644 index 000000000..a563bbc2a --- /dev/null +++ b/tests/run-make/print-native-static-libs/bar.rs @@ -0,0 +1,13 @@ +#[no_mangle] +pub extern "C" fn my_bar_add(left: i32, right: i32) -> i32 { + // Obviously makes no sense but... + unsafe { + g_free(std::ptr::null_mut()); + } + left + right +} + +#[link(name = "glib-2.0")] +extern "C" { + fn g_free(p: *mut ()); +} diff --git a/tests/run-make/print-native-static-libs/foo.rs b/tests/run-make/print-native-static-libs/foo.rs new file mode 100644 index 000000000..6acaee20e --- /dev/null +++ b/tests/run-make/print-native-static-libs/foo.rs @@ -0,0 +1,15 @@ +extern crate bar; + +#[no_mangle] +pub extern "C" fn my_foo_add(left: i32, right: i32) -> i32 { + // Obviously makes no sense but... + unsafe { + init(std::ptr::null_mut()); + } + bar::my_bar_add(left, right) +} + +#[link(name = "systemd")] +extern "C" { + fn init(p: *mut ()); +} diff --git a/tests/run-make/raw-dylib-alt-calling-convention/lib.rs b/tests/run-make/raw-dylib-alt-calling-convention/lib.rs index 22f222c12..dcb5fee9e 100644 --- a/tests/run-make/raw-dylib-alt-calling-convention/lib.rs +++ b/tests/run-make/raw-dylib-alt-calling-convention/lib.rs @@ -1,5 +1,4 @@ #![feature(abi_vectorcall)] -#![cfg_attr(target_arch = "x86", feature(raw_dylib))] #[repr(C)] #[derive(Clone)] diff --git a/tests/run-make/raw-dylib-c/lib.rs b/tests/run-make/raw-dylib-c/lib.rs index 5fb120403..f17125f30 100644 --- a/tests/run-make/raw-dylib-c/lib.rs +++ b/tests/run-make/raw-dylib-c/lib.rs @@ -1,5 +1,3 @@ -#![feature(raw_dylib)] - #[link(name = "extern_1.dll", kind = "raw-dylib", modifiers = "+verbatim")] extern { fn extern_fn_1(); diff --git a/tests/run-make/raw-dylib-cross-compilation/lib.rs b/tests/run-make/raw-dylib-cross-compilation/lib.rs index 51bf2ec6b..3338ac0a0 100644 --- a/tests/run-make/raw-dylib-cross-compilation/lib.rs +++ b/tests/run-make/raw-dylib-cross-compilation/lib.rs @@ -1,4 +1,3 @@ -#![feature(raw_dylib)] #![feature(no_core, lang_items)] #![no_std] #![no_core] diff --git a/tests/run-make/raw-dylib-custom-dlltool/Makefile b/tests/run-make/raw-dylib-custom-dlltool/Makefile new file mode 100644 index 000000000..f5d5360a3 --- /dev/null +++ b/tests/run-make/raw-dylib-custom-dlltool/Makefile @@ -0,0 +1,11 @@ +# Test using -Cdlltool to change where raw-dylib looks for the dlltool binary. + +# only-windows +# only-gnu +# needs-dlltool + +include ../tools.mk + +all: + $(RUSTC) --crate-type lib --crate-name raw_dylib_test lib.rs -Cdlltool=$(CURDIR)/script.cmd + $(DIFF) output.txt "$(TMPDIR)"/output.txt diff --git a/tests/run-make/raw-dylib-custom-dlltool/lib.rs b/tests/run-make/raw-dylib-custom-dlltool/lib.rs new file mode 100644 index 000000000..2f3f497a0 --- /dev/null +++ b/tests/run-make/raw-dylib-custom-dlltool/lib.rs @@ -0,0 +1,10 @@ +#[link(name = "extern_1", kind = "raw-dylib")] +extern { + fn extern_fn_1(); +} + +pub fn library_function() { + unsafe { + extern_fn_1(); + } +} diff --git a/tests/run-make/raw-dylib-custom-dlltool/output.txt b/tests/run-make/raw-dylib-custom-dlltool/output.txt new file mode 100644 index 000000000..6dd9466d2 --- /dev/null +++ b/tests/run-make/raw-dylib-custom-dlltool/output.txt @@ -0,0 +1 @@ +Called dlltool via script.cmd diff --git a/tests/run-make/raw-dylib-custom-dlltool/script.cmd b/tests/run-make/raw-dylib-custom-dlltool/script.cmd new file mode 100644 index 000000000..95f85c61c --- /dev/null +++ b/tests/run-make/raw-dylib-custom-dlltool/script.cmd @@ -0,0 +1,2 @@ +echo Called dlltool via script.cmd> %TMPDIR%\output.txt +dlltool.exe %* diff --git a/tests/run-make/raw-dylib-import-name-type/driver.rs b/tests/run-make/raw-dylib-import-name-type/driver.rs index 9a3cd9ebe..6c1c212f1 100644 --- a/tests/run-make/raw-dylib-import-name-type/driver.rs +++ b/tests/run-make/raw-dylib-import-name-type/driver.rs @@ -1,4 +1,3 @@ -#![feature(raw_dylib)] #![feature(abi_vectorcall)] #[link(name = "extern", kind = "raw-dylib", import_name_type = "undecorated")] diff --git a/tests/run-make/raw-dylib-inline-cross-dylib/driver.rs b/tests/run-make/raw-dylib-inline-cross-dylib/driver.rs index f72ded7d9..0c3125be6 100644 --- a/tests/run-make/raw-dylib-inline-cross-dylib/driver.rs +++ b/tests/run-make/raw-dylib-inline-cross-dylib/driver.rs @@ -1,5 +1,3 @@ -#![feature(raw_dylib)] - extern crate raw_dylib_test; extern crate raw_dylib_test_wrapper; diff --git a/tests/run-make/raw-dylib-inline-cross-dylib/lib.rs b/tests/run-make/raw-dylib-inline-cross-dylib/lib.rs index 00c2c1c42..4877cb80a 100644 --- a/tests/run-make/raw-dylib-inline-cross-dylib/lib.rs +++ b/tests/run-make/raw-dylib-inline-cross-dylib/lib.rs @@ -1,5 +1,3 @@ -#![feature(raw_dylib)] - #[link(name = "extern_1", kind = "raw-dylib")] extern { fn extern_fn_1(); diff --git a/tests/run-make/raw-dylib-link-ordinal/lib.rs b/tests/run-make/raw-dylib-link-ordinal/lib.rs index bb25ac64c..1bbb45bbc 100644 --- a/tests/run-make/raw-dylib-link-ordinal/lib.rs +++ b/tests/run-make/raw-dylib-link-ordinal/lib.rs @@ -1,5 +1,3 @@ -#![cfg_attr(target_arch = "x86", feature(raw_dylib))] - #[link(name = "exporter", kind = "raw-dylib")] extern { #[link_ordinal(13)] diff --git a/tests/run-make/raw-dylib-stdcall-ordinal/lib.rs b/tests/run-make/raw-dylib-stdcall-ordinal/lib.rs index b7921396a..74c5c7f82 100644 --- a/tests/run-make/raw-dylib-stdcall-ordinal/lib.rs +++ b/tests/run-make/raw-dylib-stdcall-ordinal/lib.rs @@ -1,5 +1,3 @@ -#![cfg_attr(target_arch = "x86", feature(raw_dylib))] - #[link(name = "exporter", kind = "raw-dylib")] extern "stdcall" { #[link_ordinal(15)] diff --git a/tests/run-make/short-ice/Makefile b/tests/run-make/short-ice/Makefile new file mode 100644 index 000000000..4f33d5902 --- /dev/null +++ b/tests/run-make/short-ice/Makefile @@ -0,0 +1,9 @@ +include ../tools.mk + +# ignore-windows + +export RUSTC := $(RUSTC_ORIGINAL) +export TMPDIR := $(TMPDIR) + +all: + bash check.sh diff --git a/tests/run-make/short-ice/check.sh b/tests/run-make/short-ice/check.sh new file mode 100644 index 000000000..96cd8fe86 --- /dev/null +++ b/tests/run-make/short-ice/check.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +RUST_BACKTRACE=1 $RUSTC src/lib.rs -Z treat-err-as-bug=1 1>$TMPDIR/rust-test-1.log 2>&1 +RUST_BACKTRACE=full $RUSTC src/lib.rs -Z treat-err-as-bug=1 1>$TMPDIR/rust-test-2.log 2>&1 + +short=$(cat $TMPDIR/rust-test-1.log | wc -l) +full=$(cat $TMPDIR/rust-test-2.log | wc -l) +rustc_query_count=$(cat $TMPDIR/rust-test-1.log | grep rustc_query_ | wc -l) +rustc_query_count_full=$(cat $TMPDIR/rust-test-2.log | grep rustc_query_ | wc -l) + +begin_count=$(cat $TMPDIR/rust-test-2.log | grep __rust_begin_short_backtrace | wc -l) +end_count=$(cat $TMPDIR/rust-test-2.log | grep __rust_end_short_backtrace | wc -l) + +cat $TMPDIR/rust-test-1.log +echo "=====================" +cat $TMPDIR/rust-test-2.log +echo "=====================" + +echo "short backtrace: $short" +echo "full backtrace: $full" +echo "begin_count: $begin_count" +echo "end_count : $end_count" +echo "rustc_query_count: $rustc_query_count" +echo "rustc_query_count_full: $rustc_query_count_full" + +## backtraces to vary a bit depending on platform and configuration options, +## here we make sure that the short backtrace of rustc_query is shorter than the full, +## and marks are in pairs. +if [ $short -lt $full ] && + [ $begin_count -eq $end_count ] && + [ $(($rustc_query_count + 10)) -lt $rustc_query_count_full ] && + [ $rustc_query_count_full -gt 10 ]; then + exit 0 +else + exit 1 +fi diff --git a/tests/run-make/short-ice/src/lib.rs b/tests/run-make/short-ice/src/lib.rs new file mode 100644 index 000000000..b23b7f830 --- /dev/null +++ b/tests/run-make/short-ice/src/lib.rs @@ -0,0 +1,7 @@ +fn func(s: &str) { + println!("{}", s); +} + +fn main() { + func(1); +} diff --git a/tests/run-make/static-unwinding/Makefile b/tests/run-make/static-unwinding/Makefile index dec94fb16..4b093f936 100644 --- a/tests/run-make/static-unwinding/Makefile +++ b/tests/run-make/static-unwinding/Makefile @@ -1,4 +1,5 @@ # ignore-cross-compile +# needs-unwind include ../tools.mk all: diff --git a/tests/run-make/staticlib-dylib-linkage/Makefile b/tests/run-make/staticlib-dylib-linkage/Makefile new file mode 100644 index 000000000..a1e86a7ce --- /dev/null +++ b/tests/run-make/staticlib-dylib-linkage/Makefile @@ -0,0 +1,21 @@ +include ../tools.mk + +# ignore-cross-compile +# ignore-msvc FIXME(bjorn3) can't figure out how to link with the MSVC toolchain +# ignore-wasm wasm doesn't support dynamic libraries + +all: + $(RUSTC) -C prefer-dynamic bar.rs + $(RUSTC) foo.rs --crate-type staticlib --print native-static-libs \ + -Z staticlib-allow-rdylib-deps 2>&1 | grep 'note: native-static-libs: ' \ + | sed 's/note: native-static-libs: \(.*\)/\1/' > $(TMPDIR)/libs.txt + cat $(TMPDIR)/libs.txt + +ifdef IS_MSVC + $(CC) $(CFLAGS) /c foo.c /Fo:$(TMPDIR)/foo.o + $(RUSTC_LINKER) $(TMPDIR)/foo.o $(TMPDIR)/foo.lib $$(cat $(TMPDIR)/libs.txt) $(call OUT_EXE,foo) +else + $(CC) $(CFLAGS) foo.c -L $(TMPDIR) -lfoo $$(cat $(TMPDIR)/libs.txt) -o $(call RUN_BINFILE,foo) +endif + + $(call RUN,foo) diff --git a/tests/run-make/staticlib-dylib-linkage/bar.rs b/tests/run-make/staticlib-dylib-linkage/bar.rs new file mode 100644 index 000000000..b3a7539ab --- /dev/null +++ b/tests/run-make/staticlib-dylib-linkage/bar.rs @@ -0,0 +1,5 @@ +#![crate_type = "dylib"] + +pub fn bar() { + println!("hello!"); +} diff --git a/tests/run-make/staticlib-dylib-linkage/foo.c b/tests/run-make/staticlib-dylib-linkage/foo.c new file mode 100644 index 000000000..154f9682e --- /dev/null +++ b/tests/run-make/staticlib-dylib-linkage/foo.c @@ -0,0 +1,10 @@ +#include + +extern void foo(); +extern unsigned bar(unsigned a, unsigned b); + +int main() { + foo(); + assert(bar(1, 2) == 3); + return 0; +} diff --git a/tests/run-make/staticlib-dylib-linkage/foo.rs b/tests/run-make/staticlib-dylib-linkage/foo.rs new file mode 100644 index 000000000..af439391c --- /dev/null +++ b/tests/run-make/staticlib-dylib-linkage/foo.rs @@ -0,0 +1,13 @@ +#![crate_type = "staticlib"] + +extern crate bar; + +#[no_mangle] +pub extern "C" fn foo() { + bar::bar(); +} + +#[no_mangle] +pub extern "C" fn bar(a: u32, b: u32) -> u32 { + a + b +} diff --git a/tests/run-make/test-benches/Makefile b/tests/run-make/test-benches/Makefile index 0253a5263..11aed2e4c 100644 --- a/tests/run-make/test-benches/Makefile +++ b/tests/run-make/test-benches/Makefile @@ -1,6 +1,7 @@ include ../tools.mk # ignore-cross-compile +# needs-unwind #[bench] and -Zpanic-abort-tests can't be combined all: # Smoke-test that `#[bench]` isn't entirely broken. diff --git a/tests/run-make/translation/Makefile b/tests/run-make/translation/Makefile index 0acf64e5d..07e0547cf 100644 --- a/tests/run-make/translation/Makefile +++ b/tests/run-make/translation/Makefile @@ -46,6 +46,8 @@ sysroot: test.rs working.ftl rm -f $(FAKEROOT)/lib/rustlib/src mkdir $(FAKEROOT)/lib/rustlib/src ln -s $(SYSROOT)/lib/rustlib/src/* $(FAKEROOT)/lib/rustlib/src + # When download-rustc is enabled, `$(SYSROOT)` will have a share directory. Delete the link to it. + rm -f $(FAKEROOT)/share mkdir -p $(FAKEROOT)/share/locale/zh-CN/ ln -s $(CURDIR)/working.ftl $(FAKEROOT)/share/locale/zh-CN/basic-translation.ftl $(RUSTC) $< --sysroot $(FAKEROOT) -Ztranslate-lang=zh-CN 2>&1 | $(CGREP) "this is a test message" diff --git a/tests/run-make/valid-print-requests/valid-print-requests.stderr b/tests/run-make/valid-print-requests/valid-print-requests.stderr index bea6ce067..4f57550c2 100644 --- a/tests/run-make/valid-print-requests/valid-print-requests.stderr +++ b/tests/run-make/valid-print-requests/valid-print-requests.stderr @@ -1,2 +1,2 @@ -error: unknown print request `uwu`. Valid print requests are: `crate-name`, `file-names`, `sysroot`, `target-libdir`, `cfg`, `calling-conventions`, `target-list`, `target-cpus`, `target-features`, `relocation-models`, `code-models`, `tls-models`, `native-static-libs`, `stack-protector-strategies`, `target-spec-json`, `all-target-specs-json`, `link-args`, `split-debuginfo` +error: unknown print request `uwu`. Valid print requests are: `crate-name`, `file-names`, `sysroot`, `target-libdir`, `cfg`, `calling-conventions`, `target-list`, `target-cpus`, `target-features`, `relocation-models`, `code-models`, `tls-models`, `native-static-libs`, `stack-protector-strategies`, `target-spec-json`, `all-target-specs-json`, `link-args`, `split-debuginfo`, `deployment-target` diff --git a/tests/rustdoc-gui/anchors.goml b/tests/rustdoc-gui/anchors.goml index 0904aa90e..e9b772969 100644 --- a/tests/rustdoc-gui/anchors.goml +++ b/tests/rustdoc-gui/anchors.goml @@ -75,35 +75,35 @@ call-function: ( "check-colors", { "theme": "ayu", - "main_color": "rgb(197, 197, 197)", - "title_color": "rgb(255, 255, 255)", - "main_heading_color": "rgb(255, 255, 255)", - "main_heading_type_color": "rgb(255, 160, 165)", - "src_link_color": "rgb(57, 175, 215)", - "sidebar_link_color": "rgb(83, 177, 219)", + "main_color": "#c5c5c5", + "title_color": "#fff", + "main_heading_color": "#fff", + "main_heading_type_color": "#ffa0a5", + "src_link_color": "#39afd7", + "sidebar_link_color": "#53b1db", }, ) call-function: ( "check-colors", { "theme": "dark", - "main_color": "rgb(221, 221, 221)", - "title_color": "rgb(221, 221, 221)", - "main_heading_color": "rgb(221, 221, 221)", - "main_heading_type_color": "rgb(45, 191, 184)", - "src_link_color": "rgb(210, 153, 29)", - "sidebar_link_color": "rgb(253, 191, 53)", + "main_color": "#ddd", + "title_color": "#ddd", + "main_heading_color": "#ddd", + "main_heading_type_color": "#2dbfb8", + "src_link_color": "#d2991d", + "sidebar_link_color": "#fdbf35", }, ) call-function: ( "check-colors", { "theme": "light", - "main_color": "rgb(0, 0, 0)", - "title_color": "rgb(0, 0, 0)", - "main_heading_color": "rgb(0, 0, 0)", - "main_heading_type_color": "rgb(173, 55, 138)", - "src_link_color": "rgb(56, 115, 173)", - "sidebar_link_color": "rgb(53, 109, 164)", + "main_color": "black", + "title_color": "black", + "main_heading_color": "black", + "main_heading_type_color": "#ad378a", + "src_link_color": "#3873ad", + "sidebar_link_color": "#356da4", }, ) diff --git a/tests/rustdoc-gui/check-stab-in-docblock.goml b/tests/rustdoc-gui/check-stab-in-docblock.goml index 2f6263621..f25c88690 100644 --- a/tests/rustdoc-gui/check-stab-in-docblock.goml +++ b/tests/rustdoc-gui/check-stab-in-docblock.goml @@ -7,20 +7,26 @@ set-window-size: (786, 600) // Confirms that there 3 paragraphs. assert-count: (".top-doc .docblock p", 3) // Checking that there is no scrollable content. -store-property: (clientHeight, ".top-doc .docblock p:nth-of-type(1)", "clientHeight") -store-property: (clientWidth, ".top-doc .docblock p:nth-of-type(1)", "clientWidth") +store-property: (".top-doc .docblock p:nth-of-type(1)", { + "clientHeight": clientHeight, + "clientWidth": clientWidth, +}) assert-property: ( ".top-doc .docblock p:nth-of-type(1)", {"scrollHeight": |clientHeight|, "scrollWidth": |clientWidth|}, ) -store-property: (clientHeight, ".top-doc .docblock p:nth-of-type(2)", "clientHeight") -store-property: (clientWidth, ".top-doc .docblock p:nth-of-type(2)", "clientWidth") +store-property: (".top-doc .docblock p:nth-of-type(2)", { + "clientHeight": clientHeight, + "clientWidth": clientWidth, +}) assert-property: ( ".top-doc .docblock p:nth-of-type(2)", {"scrollHeight": |clientHeight|, "scrollWidth": |clientWidth|}, ) -store-property: (clientHeight, ".top-doc .docblock p:nth-of-type(3)", "clientHeight") -store-property: (clientWidth, ".top-doc .docblock p:nth-of-type(3)", "clientWidth") +store-property: (".top-doc .docblock p:nth-of-type(3)", { + "clientHeight": clientHeight, + "clientWidth": clientWidth, +}) assert-property: ( ".top-doc .docblock p:nth-of-type(3)", {"scrollHeight": |clientHeight|, "scrollWidth": |clientWidth|}, diff --git a/tests/rustdoc-gui/codeblock-sub.goml b/tests/rustdoc-gui/codeblock-sub.goml index 03575cc6a..a4b055876 100644 --- a/tests/rustdoc-gui/codeblock-sub.goml +++ b/tests/rustdoc-gui/codeblock-sub.goml @@ -1,5 +1,5 @@ // Test that code blocks nested within do not have a line height of 0. go-to: "file://" + |DOC_PATH| + "/test_docs/codeblock_sub/index.html" -store-property: (codeblock_sub_1, "#codeblock-sub-1", "offsetHeight") +store-property: ("#codeblock-sub-1", {"offsetHeight": codeblock_sub_1}) assert-property-false: ("#codeblock-sub-3", { "offsetHeight": |codeblock_sub_1| }) diff --git a/tests/rustdoc-gui/codeblock-tooltip.goml b/tests/rustdoc-gui/codeblock-tooltip.goml index 2ed0579d3..e1c81ed79 100644 --- a/tests/rustdoc-gui/codeblock-tooltip.goml +++ b/tests/rustdoc-gui/codeblock-tooltip.goml @@ -109,19 +109,19 @@ define-function: ( call-function: ("check-colors", { "theme": "ayu", - "background": "rgb(15, 20, 25)", - "color": "rgb(197, 197, 197)", - "border": "rgb(92, 103, 115)", + "background": "#0f1419", + "color": "#c5c5c5", + "border": "#5c6773", }) call-function: ("check-colors", { "theme": "dark", - "background": "rgb(53, 53, 53)", - "color": "rgb(221, 221, 221)", - "border": "rgb(224, 224, 224)", + "background": "#353535", + "color": "#ddd", + "border": "#e0e0e0", }) call-function: ("check-colors", { "theme": "light", - "background": "rgb(255, 255, 255)", - "color": "rgb(0, 0, 0)", - "border": "rgb(224, 224, 224)", + "background": "white", + "color": "black", + "border": "#e0e0e0", }) diff --git a/tests/rustdoc-gui/docblock-details.goml b/tests/rustdoc-gui/docblock-details.goml index 58ff17619..8e6d2ba82 100644 --- a/tests/rustdoc-gui/docblock-details.goml +++ b/tests/rustdoc-gui/docblock-details.goml @@ -9,7 +9,7 @@ reload: assert-text: (".top-doc .docblock > h3", "Hello") assert-css: ( ".top-doc .docblock > h3", - {"border-bottom": "1px solid rgb(210, 210, 210)"}, + {"border-bottom": "1px solid #d2d2d2"}, ) // We now check that the `` doesn't have a bottom border and has the correct display. assert-css: ( diff --git a/tests/rustdoc-gui/highlight-colors.goml b/tests/rustdoc-gui/highlight-colors.goml index 4f5e1c110..d162674fa 100644 --- a/tests/rustdoc-gui/highlight-colors.goml +++ b/tests/rustdoc-gui/highlight-colors.goml @@ -43,52 +43,52 @@ define-function: ( call-function: ("check-colors", { "theme": "ayu", - "kw": "rgb(255, 119, 51)", - "kw2": "rgb(255, 119, 51)", - "prelude_ty": "rgb(105, 242, 223)", - "prelude_val": "rgb(255, 119, 51)", - "lifetime": "rgb(255, 119, 51)", - "number": "rgb(184, 204, 82)", - "string": "rgb(184, 204, 82)", - "bool_val": "rgb(255, 119, 51)", - "self": "rgb(54, 163, 217)", - "attr": "rgb(230, 225, 207)", - "macro": "rgb(163, 122, 204)", - "question_mark": "rgb(255, 144, 17)", - "comment": "rgb(120, 135, 151)", - "doc_comment": "rgb(161, 172, 136)", + "kw": "#ff7733", + "kw2": "#ff7733", + "prelude_ty": "#69f2df", + "prelude_val": "#ff7733", + "lifetime": "#ff7733", + "number": "#b8cc52", + "string": "#b8cc52", + "bool_val": "#ff7733", + "self": "#36a3d9", + "attr": "#e6e1cf", + "macro": "#a37acc", + "question_mark": "#ff9011", + "comment": "#788797", + "doc_comment": "#a1ac88", }) call-function: ("check-colors", { "theme": "dark", - "kw": "rgb(171, 138, 193)", - "kw2": "rgb(118, 154, 203)", - "prelude_ty": "rgb(118, 154, 203)", - "prelude_val": "rgb(238, 104, 104)", - "lifetime": "rgb(217, 127, 38)", - "number": "rgb(131, 163, 0)", - "string": "rgb(131, 163, 0)", - "bool_val": "rgb(238, 104, 104)", - "self": "rgb(238, 104, 104)", - "attr": "rgb(238, 104, 104)", - "macro": "rgb(62, 153, 159)", - "question_mark": "rgb(255, 144, 17)", - "comment": "rgb(141, 141, 139)", - "doc_comment": "rgb(140, 163, 117)", + "kw": "#ab8ac1", + "kw2": "#769acb", + "prelude_ty": "#769acb", + "prelude_val": "#ee6868", + "lifetime": "#d97f26", + "number": "#83a300", + "string": "#83a300", + "bool_val": "#ee6868", + "self": "#ee6868", + "attr": "#ee6868", + "macro": "#3e999f", + "question_mark": "#ff9011", + "comment": "#8d8d8b", + "doc_comment": "#8ca375", }) call-function: ("check-colors", { "theme": "light", - "kw": "rgb(137, 89, 168)", - "kw2": "rgb(66, 113, 174)", - "prelude_ty": "rgb(66, 113, 174)", - "prelude_val": "rgb(200, 40, 41)", - "lifetime": "rgb(183, 101, 20)", - "number": "rgb(113, 140, 0)", - "string": "rgb(113, 140, 0)", - "bool_val": "rgb(200, 40, 41)", - "self": "rgb(200, 40, 41)", - "attr": "rgb(200, 40, 41)", - "macro": "rgb(62, 153, 159)", - "question_mark": "rgb(255, 144, 17)", - "comment": "rgb(142, 144, 140)", - "doc_comment": "rgb(77, 77, 76)", + "kw": "#8959a8", + "kw2": "#4271ae", + "prelude_ty": "#4271ae", + "prelude_val": "#c82829", + "lifetime": "#b76514", + "number": "#718c00", + "string": "#718c00", + "bool_val": "#c82829", + "self": "#c82829", + "attr": "#c82829", + "macro": "#3e999f", + "question_mark": "#ff9011", + "comment": "#8e908c", + "doc_comment": "#4d4d4c", }) diff --git a/tests/rustdoc-gui/item-info.goml b/tests/rustdoc-gui/item-info.goml index 60fd7c4e1..030ff8f8a 100644 --- a/tests/rustdoc-gui/item-info.goml +++ b/tests/rustdoc-gui/item-info.goml @@ -4,8 +4,8 @@ go-to: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html" // We set a fixed size so there is no chance of "random" resize. set-window-size: (1100, 800) // We check that ".item-info" is bigger than its content. -assert-css: (".item-info", {"width": "840px"}) -assert-css: (".item-info .stab", {"width": "289px"}) +assert-size: (".item-info", {"width": 840}) +assert-size: (".item-info .stab", {"width": 289}) assert-position: (".item-info .stab", {"x": 245}) // Now we ensure that they're not rendered on the same line. diff --git a/tests/rustdoc-gui/jump-to-def-background.goml b/tests/rustdoc-gui/jump-to-def-background.goml index 3a7d48284..6adc36b0e 100644 --- a/tests/rustdoc-gui/jump-to-def-background.goml +++ b/tests/rustdoc-gui/jump-to-def-background.goml @@ -17,6 +17,6 @@ define-function: ( }, ) -call-function: ("check-background-color", ("ayu", "rgb(51, 51, 51)")) -call-function: ("check-background-color", ("dark", "rgb(51, 51, 51)")) -call-function: ("check-background-color", ("light", "rgb(238, 238, 238)")) +call-function: ("check-background-color", ("ayu", "#333")) +call-function: ("check-background-color", ("dark", "#333")) +call-function: ("check-background-color", ("light", "#eee")) diff --git a/tests/rustdoc-gui/notable-trait.goml b/tests/rustdoc-gui/notable-trait.goml index f65da5774..ecb57c274 100644 --- a/tests/rustdoc-gui/notable-trait.goml +++ b/tests/rustdoc-gui/notable-trait.goml @@ -225,12 +225,12 @@ assert: "#method\.create_an_iterator_from_read .tooltip:focus" // Now we check that the focus isn't given back to the wrong item when opening // another popover. -store-window-property: (scroll, "scrollY") +store-window-property: {"scrollY": scroll} click: "#method\.create_an_iterator_from_read .fn" // We ensure that the scroll position changed. assert-window-property-false: {"scrollY": |scroll|} // Store the new position. -store-window-property: (scroll, "scrollY") +store-window-property: {"scrollY": scroll} click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']" wait-for: "//*[@class='tooltip popover']" click: "#settings-menu a" @@ -239,12 +239,12 @@ click: ".search-input" assert-window-property-false: {"scrollY": |scroll|} // Same but with Escape handling. -store-window-property: (scroll, "scrollY") +store-window-property: {"scrollY": scroll} click: "#method\.create_an_iterator_from_read .fn" // We ensure that the scroll position changed. assert-window-property-false: {"scrollY": |scroll|} // Store the new position. -store-window-property: (scroll, "scrollY") +store-window-property: {"scrollY": scroll} click: "//*[@id='method.create_an_iterator_from_read']//*[@class='tooltip']" wait-for: "//*[@class='tooltip popover']" click: "#settings-menu a" diff --git a/tests/rustdoc-gui/scrape-examples-button-focus.goml b/tests/rustdoc-gui/scrape-examples-button-focus.goml index 77061ea2a..af4293dfc 100644 --- a/tests/rustdoc-gui/scrape-examples-button-focus.goml +++ b/tests/rustdoc-gui/scrape-examples-button-focus.goml @@ -3,7 +3,7 @@ go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html" // The next/prev buttons vertically scroll the code viewport between examples -store-property: (initialScrollTop, ".scraped-example-list > .scraped-example pre", "scrollTop") +store-property: (".scraped-example-list > .scraped-example pre", {"scrollTop": initialScrollTop}) focus: ".scraped-example-list > .scraped-example .next" press-key: "Enter" assert-property-false: (".scraped-example-list > .scraped-example pre", { @@ -16,7 +16,7 @@ assert-property: (".scraped-example-list > .scraped-example pre", { }, NEAR) // The expand button increases the scrollHeight of the minimized code viewport -store-property: (smallOffsetHeight, ".scraped-example-list > .scraped-example pre", "offsetHeight") +store-property: (".scraped-example-list > .scraped-example pre", {"offsetHeight": smallOffsetHeight}) assert-property-false: (".scraped-example-list > .scraped-example pre", { "scrollHeight": |smallOffsetHeight| }, NEAR) @@ -25,7 +25,7 @@ press-key: "Enter" assert-property-false: (".scraped-example-list > .scraped-example pre", { "offsetHeight": |smallOffsetHeight| }, NEAR) -store-property: (fullOffsetHeight, ".scraped-example-list > .scraped-example pre", "offsetHeight") +store-property: (".scraped-example-list > .scraped-example pre", {"offsetHeight": fullOffsetHeight}) assert-property: (".scraped-example-list > .scraped-example pre", { "scrollHeight": |fullOffsetHeight| }, NEAR) diff --git a/tests/rustdoc-gui/scrape-examples-color.goml b/tests/rustdoc-gui/scrape-examples-color.goml index 8ddb06fcc..0052d18dc 100644 --- a/tests/rustdoc-gui/scrape-examples-color.goml +++ b/tests/rustdoc-gui/scrape-examples-color.goml @@ -33,30 +33,30 @@ define-function: ( call-function: ("check-colors", { "theme": "ayu", - "highlight": "rgb(91, 59, 1)", - "highlight_focus": "rgb(124, 75, 15)", - "help_border": "rgb(170, 170, 170)", - "help_color": "rgb(238, 238, 238)", - "help_hover_border": "rgb(255, 255, 255)", - "help_hover_color": "rgb(255, 255, 255)", + "highlight": "#5b3b01", + "highlight_focus": "#7c4b0f", + "help_border": "#aaa", + "help_color": "#eee", + "help_hover_border": "#fff", + "help_hover_color": "#fff", }) call-function: ("check-colors", { "theme": "dark", - "highlight": "rgb(91, 59, 1)", - "highlight_focus": "rgb(124, 75, 15)", - "help_border": "rgb(170, 170, 170)", - "help_color": "rgb(238, 238, 238)", - "help_hover_border": "rgb(255, 255, 255)", - "help_hover_color": "rgb(255, 255, 255)", + "highlight": "#5b3b01", + "highlight_focus": "#7c4b0f", + "help_border": "#aaa", + "help_color": "#eee", + "help_hover_border": "#fff", + "help_hover_color": "#fff", }) call-function: ("check-colors", { "theme": "light", - "highlight": "rgb(252, 255, 214)", - "highlight_focus": "rgb(246, 253, 176)", - "help_border": "rgb(85, 85, 85)", - "help_color": "rgb(51, 51, 51)", - "help_hover_border": "rgb(0, 0, 0)", - "help_hover_color": "rgb(0, 0, 0)", + "highlight": "#fcffd6", + "highlight_focus": "#f6fdb0", + "help_border": "#555", + "help_color": "#333", + "help_hover_border": "#000", + "help_hover_color": "#000", }) // Now testing the top and bottom background in case there is only one scraped examples. @@ -81,16 +81,16 @@ define-function: ( call-function: ("check-background", { "theme": "ayu", - "background_color_start": "rgb(15, 20, 25)", + "background_color_start": "rgba(15, 20, 25, 1)", "background_color_end": "rgba(15, 20, 25, 0)", }) call-function: ("check-background", { "theme": "dark", - "background_color_start": "rgb(53, 53, 53)", + "background_color_start": "rgba(53, 53, 53, 1)", "background_color_end": "rgba(53, 53, 53, 0)", }) call-function: ("check-background", { "theme": "light", - "background_color_start": "rgb(255, 255, 255)", + "background_color_start": "rgba(255, 255, 255, 1)", "background_color_end": "rgba(255, 255, 255, 0)", }) diff --git a/tests/rustdoc-gui/scrape-examples-layout.goml b/tests/rustdoc-gui/scrape-examples-layout.goml index 160056d6d..4fc1c1ac0 100644 --- a/tests/rustdoc-gui/scrape-examples-layout.goml +++ b/tests/rustdoc-gui/scrape-examples-layout.goml @@ -9,9 +9,8 @@ assert-property-false: ( // Check that examples with very long lines have the same width as ones that don't. store-property: ( - clientWidth, ".more-scraped-examples .scraped-example:nth-child(2) .code-wrapper .src-line-numbers", - "clientWidth" + {"clientWidth": clientWidth}, ) assert-property: ( @@ -40,8 +39,8 @@ assert-property: ( store-value: (offset_y, 4) // First with desktop -assert-position: (".scraped-example .code-wrapper", {"y": 253}) -assert-position: (".scraped-example .code-wrapper .prev", {"y": 253 + |offset_y|}) +assert-position: (".scraped-example .code-wrapper", {"y": 226}) +assert-position: (".scraped-example .code-wrapper .prev", {"y": 226 + |offset_y|}) // Then with mobile set-window-size: (600, 600) diff --git a/tests/rustdoc-gui/search-corrections.goml b/tests/rustdoc-gui/search-corrections.goml new file mode 100644 index 000000000..5d1b83b35 --- /dev/null +++ b/tests/rustdoc-gui/search-corrections.goml @@ -0,0 +1,56 @@ +// ignore-tidy-linelength + +// Checks that the search tab result tell the user about corrections +// First, try a search-by-name +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +// Intentionally wrong spelling of "NotableStructWithLongName" +write: (".search-input", "NotableStructWithLongNamr") +// To be SURE that the search will be run. +press-key: 'Enter' +// Waiting for the search results to appear... +wait-for: "#search-tabs" + +// Corrections aren't shown on the "In Names" tab. +assert: "#search-tabs button.selected:first-child" +assert-css: (".search-corrections", { + "display": "none" +}) + +// Corrections do get shown on the "In Parameters" tab. +click: "#search-tabs button:nth-child(2)" +assert: "#search-tabs button.selected:nth-child(2)" +assert-css: (".search-corrections", { + "display": "block" +}) +assert-text: ( + ".search-corrections", + "Type \"notablestructwithlongnamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead." +) + +// Corrections do get shown on the "In Return Type" tab. +click: "#search-tabs button:nth-child(3)" +assert: "#search-tabs button.selected:nth-child(3)" +assert-css: (".search-corrections", { + "display": "block" +}) +assert-text: ( + ".search-corrections", + "Type \"notablestructwithlongnamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead." +) + +// Now, explicit return values +go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" +// Intentionally wrong spelling of "NotableStructWithLongName" +write: (".search-input", "-> NotableStructWithLongNamr") +// To be SURE that the search will be run. +press-key: 'Enter' +// Waiting for the search results to appear... +wait-for: "#search-tabs" + +assert-css: (".search-corrections", { + "display": "block" +}) +assert-text: ( + ".search-corrections", + "Type \"notablestructwithlongnamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead." +) diff --git a/tests/rustdoc-gui/search-result-color.goml b/tests/rustdoc-gui/search-result-color.goml index da46a90df..90f7160b7 100644 --- a/tests/rustdoc-gui/search-result-color.goml +++ b/tests/rustdoc-gui/search-result-color.goml @@ -47,89 +47,89 @@ reload: wait-for: "#search-tabs" assert-css: ( "#search-tabs > button > .count", - {"color": "rgb(136, 136, 136)"}, + {"color": "#888"}, ALL, ) assert-css: ( "//*[@class='desc'][text()='Just a normal struct.']", - {"color": "rgb(197, 197, 197)"}, + {"color": "#c5c5c5"}, ) assert-css: ( "//*[@class='result-name']/*[text()='test_docs::']", - {"color": "rgb(0, 150, 207)"}, + {"color": "#0096cf"}, ) // Checking the color of the bottom border. assert-css: ( ".search-results > a", - {"border-bottom-color": "rgba(170, 170, 170, 0.2)"} + {"border-bottom-color": "#aaa3"} ) // Checking the color of "keyword" text. assert-css: ( "//*[@class='result-name']//*[text()='(keyword)']", - {"color": "rgb(120, 135, 151)"}, + {"color": "#788797"}, ) -store-value: (entry_color, "rgb(0, 150, 207)") // color of the search entry -store-value: (hover_entry_color, "rgb(255, 255, 255)") // color of the hovered/focused search entry -store-value: (background_color, "rgba(0, 0, 0, 0)") // background color -store-value: (hover_background_color, "rgb(60, 60, 60)") // hover background color +store-value: (entry_color, "#0096cf") // color of the search entry +store-value: (hover_entry_color, "#fff") // color of the hovered/focused search entry +store-value: (background_color, "transparent") // background color +store-value: (hover_background_color, "#3c3c3c") // hover background color call-function: ( "check-result-color", ( "keyword", // item kind - "rgb(57, 175, 215)", // color of item kind - "rgb(57, 175, 215)", // color of hovered/focused item kind + "#39afd7", // color of item kind + "#39afd7", // color of hovered/focused item kind ), ) call-function: ( "check-result-color", ( "struct", // item kind - "rgb(255, 160, 165)", // color of item kind - "rgb(255, 160, 165)", // color of hovered/focused item kind + "#ffa0a5", // color of item kind + "#ffa0a5", // color of hovered/focused item kind ), ) call-function: ( "check-result-color", ( "associatedtype", // item kind - "rgb(57, 175, 215)", // color of item kind - "rgb(57, 175, 215)", // color of hovered/focused item kind + "#39afd7", // color of item kind + "#39afd7", // color of hovered/focused item kind ), ) call-function: ( "check-result-color", ( "tymethod", // item kind - "rgb(253, 214, 135)", // color of item kind - "rgb(253, 214, 135)", // color of hovered/focused item kind + "#fdd687", // color of item kind + "#fdd687", // color of hovered/focused item kind ), ) call-function: ( "check-result-color", ( "method", // item kind - "rgb(253, 214, 135)", // color of item kind - "rgb(253, 214, 135)", // color of hovered/focused item kind + "#fdd687", // color of item kind + "#fdd687", // color of hovered/focused item kind ), ) call-function: ( "check-result-color", ( "structfield", // item kind - "rgb(0, 150, 207)", // color of item kind - "rgb(255, 255, 255)", // color of hovered/focused item kind + "#0096cf", // color of item kind + "#fff", // color of hovered/focused item kind ), ) call-function: ( "check-result-color", ( "macro", // item kind - "rgb(163, 122, 204)", // color of item kind - "rgb(163, 122, 204)", // color of hovered/focused item kind + "#a37acc", // color of item kind + "#a37acc", // color of hovered/focused item kind ), ) call-function: ( "check-result-color", ( "fn", // item kind - "rgb(253, 214, 135)", // color of item kind - "rgb(253, 214, 135)", // color of hovered/focused item kind + "#fdd687", // color of item kind + "#fdd687", // color of hovered/focused item kind ), ) @@ -138,7 +138,7 @@ move-cursor-to: ".search-input" focus: ".search-input" // To ensure the `` container isnt focus or hover. assert-css: ( "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a", - {"color": "rgb(0, 150, 207)", "background-color": "rgba(0, 0, 0, 0)"}, + {"color": "#0096cf", "background-color": "transparent"}, ALL, ) @@ -146,11 +146,11 @@ assert-css: ( move-cursor-to: "//*[@class='desc'][text()='Just a normal struct.']" assert-css: ( "//*[@class='result-name']/*[text()='test_docs::']", - {"color": "rgb(255, 255, 255)"}, + {"color": "#fff"}, ) assert-css: ( "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a", - {"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"}, + {"color": "#fff", "background-color": "rgb(60, 60, 60)"}, ) // Dark theme @@ -164,89 +164,89 @@ reload: wait-for: "#search-tabs" assert-css: ( "#search-tabs > button > .count", - {"color": "rgb(136, 136, 136)"}, + {"color": "#888"}, ALL, ) assert-css: ( "//*[@class='desc'][text()='Just a normal struct.']", - {"color": "rgb(221, 221, 221)"}, + {"color": "#ddd"}, ) assert-css: ( "//*[@class='result-name']/*[text()='test_docs::']", - {"color": "rgb(221, 221, 221)"}, + {"color": "#ddd"}, ) // Checking the color of the bottom border. assert-css: ( ".search-results > a", - {"border-bottom-color": "rgba(170, 170, 170, 0.2)"} + {"border-bottom-color": "#aaa3"} ) // Checking the color for "keyword" text. assert-css: ( "//*[@class='result-name']//*[text()='(keyword)']", - {"color": "rgb(221, 221, 221)"}, + {"color": "#ddd"}, ) -store-value: (entry_color, "rgb(221, 221, 221)") // color of the search entry -store-value: (hover_entry_color, "rgb(221, 221, 221)") // color of the hovered/focused search entry -store-value: (background_color, "rgba(0, 0, 0, 0)") // background color -store-value: (hover_background_color, "rgb(97, 97, 97)") // hover background color +store-value: (entry_color, "#ddd") // color of the search entry +store-value: (hover_entry_color, "#ddd") // color of the hovered/focused search entry +store-value: (background_color, "transparent") // background color +store-value: (hover_background_color, "#616161") // hover background color call-function: ( "check-result-color", ( "keyword", // item kind - "rgb(210, 153, 29)", // color of item kind - "rgb(210, 153, 29)", // color of hovered/focused item kind + "#d2991d", // color of item kind + "#d2991d", // color of hovered/focused item kind ), ) call-function: ( "check-result-color", ( "struct", // item kind - "rgb(45, 191, 184)", // color of item kind - "rgb(45, 191, 184)", // color of hovered/focused item kind + "#2dbfb8", // color of item kind + "#2dbfb8", // color of hovered/focused item kind ), ) call-function: ( "check-result-color", ( "associatedtype", // item kind - "rgb(210, 153, 29)", // color of item kind - "rgb(210, 153, 29)", // color of hovered/focused item kind + "#d2991d", // color of item kind + "#d2991d", // color of hovered/focused item kind ), ) call-function: ( "check-result-color", ( "tymethod", // item kind - "rgb(43, 171, 99)", // color of item kind - "rgb(43, 171, 99)", // color of hovered/focused item kind + "#2bab63", // color of item kind + "#2bab63", // color of hovered/focused item kind ), ) call-function: ( "check-result-color", ( "method", // item kind - "rgb(43, 171, 99)", // color of item kind - "rgb(43, 171, 99)", // color of hovered/focused item kind + "#2bab63", // color of item kind + "#2bab63", // color of hovered/focused item kind ), ) call-function: ( "check-result-color", ( "structfield", // item kind - "rgb(221, 221, 221)", // color of item kind - "rgb(221, 221, 221)", // color of hovered/focused item kind + "#ddd", // color of item kind + "#ddd", // color of hovered/focused item kind ), ) call-function: ( "check-result-color", ( "macro", // item kind - "rgb(9, 189, 0)", // color of item kind - "rgb(9, 189, 0)", // color of hovered/focused item kind + "#09bd00", // color of item kind + "#09bd00", // color of hovered/focused item kind ), ) call-function: ( "check-result-color", ( "fn", // item kind - "rgb(43, 171, 99)", // color of item kind - "rgb(43, 171, 99)", // color of hovered/focused item kind + "#2bab63", // color of item kind + "#2bab63", // color of hovered/focused item kind ), ) @@ -255,7 +255,7 @@ move-cursor-to: ".search-input" focus: ".search-input" // To ensure the `` container isnt focus or hover. assert-css: ( "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a", - {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"}, + {"color": "#ddd", "background-color": "transparent"}, ) // Light theme @@ -266,89 +266,89 @@ reload: wait-for: "#search-tabs" assert-css: ( "#search-tabs > button > .count", - {"color": "rgb(136, 136, 136)"}, + {"color": "#888"}, ALL, ) assert-css: ( "//*[@class='desc'][text()='Just a normal struct.']", - {"color": "rgb(0, 0, 0)"}, + {"color": "#000"}, ) assert-css: ( "//*[@class='result-name']/*[text()='test_docs::']", - {"color": "rgb(0, 0, 0)"}, + {"color": "#000"}, ) // Checking the color of the bottom border. assert-css: ( ".search-results > a", - {"border-bottom-color": "rgba(170, 170, 170, 0.2)"} + {"border-bottom-color": "#aaa3"} ) // Checking the color for "keyword" text. assert-css: ( "//*[@class='result-name']//*[text()='(keyword)']", - {"color": "rgb(0, 0, 0)"}, + {"color": "#000"}, ) -store-value: (entry_color, "rgb(0, 0, 0)") // color of the search entry -store-value: (hover_entry_color, "rgb(0, 0, 0)") // color of the hovered/focused search entry -store-value: (background_color, "rgba(0, 0, 0, 0)") // background color -store-value: (hover_background_color, "rgb(204, 204, 204)") // hover background color +store-value: (entry_color, "#000") // color of the search entry +store-value: (hover_entry_color, "#000") // color of the hovered/focused search entry +store-value: (background_color, "transparent") // background color +store-value: (hover_background_color, "#ccc") // hover background color call-function: ( "check-result-color", ( "keyword", // item kind - "rgb(56, 115, 173)", // color of item kind - "rgb(56, 115, 173)", // color of hovered/focused item kind + "#3873ad", // color of item kind + "#3873ad", // color of hovered/focused item kind ), ) call-function: ( "check-result-color", ( "struct", // item kind - "rgb(173, 55, 138)", // color of item kind - "rgb(173, 55, 138)", // color of hovered/focused item kind + "#ad378a", // color of item kind + "#ad378a", // color of hovered/focused item kind ), ) call-function: ( "check-result-color", ( "associatedtype", // item kind - "rgb(56, 115, 173)", // color of item kind - "rgb(56, 115, 173)", // color of hovered/focused item kind + "#3873ad", // color of item kind + "#3873ad", // color of hovered/focused item kind ), ) call-function: ( "check-result-color", ( "tymethod", // item kind - "rgb(173, 124, 55)", // color of item kind - "rgb(173, 124, 55)", // color of hovered/focused item kind + "#ad7c37", // color of item kind + "#ad7c37", // color of hovered/focused item kind ), ) call-function: ( "check-result-color", ( "method", // item kind - "rgb(173, 124, 55)", // color of item kind - "rgb(173, 124, 55)", // color of hovered/focused item kind + "#ad7c37", // color of item kind + "#ad7c37", // color of hovered/focused item kind ), ) call-function: ( "check-result-color", ( "structfield", // item kind - "rgb(0, 0, 0)", // color of item kind - "rgb(0, 0, 0)", // color of hovered/focused item kind + "#000", // color of item kind + "#000", // color of hovered/focused item kind ), ) call-function: ( "check-result-color", ( "macro", // item kind - "rgb(6, 128, 0)", // color of item kind - "rgb(6, 128, 0)", // color of hovered/focused item kind + "#068000", // color of item kind + "#068000", // color of hovered/focused item kind ), ) call-function: ( "check-result-color", ( "fn", // item kind - "rgb(173, 124, 55)", // color of item kind - "rgb(173, 124, 55)", // color of hovered/focused item kind + "#ad7c37", // color of item kind + "#ad7c37", // color of hovered/focused item kind ), ) @@ -357,7 +357,7 @@ move-cursor-to: ".search-input" focus: ".search-input" // To ensure the `` container isnt focus or hover. assert-css: ( "//*[@class='result-name']/*[text()='test_docs::']/ancestor::a", - {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"}, + {"color": "#000", "background-color": "transparent"}, ) // Check the alias. @@ -386,16 +386,16 @@ define-function: ( call-function: ("check-alias", { "theme": "ayu", - "alias": "rgb(197, 197, 197)", - "grey": "rgb(153, 153, 153)", + "alias": "#c5c5c5", + "grey": "#999", }) call-function: ("check-alias", { "theme": "dark", - "alias": "rgb(255, 255, 255)", - "grey": "rgb(204, 204, 204)", + "alias": "#fff", + "grey": "#ccc", }) call-function: ("check-alias", { "theme": "light", - "alias": "rgb(0, 0, 0)", - "grey": "rgb(153, 153, 153)", + "alias": "#000", + "grey": "#999", }) diff --git a/tests/rustdoc-gui/search-result-display.goml b/tests/rustdoc-gui/search-result-display.goml index 93c71f23f..ee5598e4b 100644 --- a/tests/rustdoc-gui/search-result-display.goml +++ b/tests/rustdoc-gui/search-result-display.goml @@ -32,8 +32,8 @@ set-text: ( ) // Then we compare again to confirm the height didn't change. -assert-css: ("#crate-search", {"width": "527px"}) -assert-css: (".search-results-title", {"height": "50px", "width": "640px"}) +assert-size: ("#crate-search", {"width": 527}) +assert-size: (".search-results-title", {"height": 50, "width": 640}) // And we check that the ` -/// -/// -//~^ ERROR unclosed HTML tag `unknown` -/// < ok -/// -/// -pub fn d() {} - -// Unclosed tags shouldn't warn if they are nested inside a -/// -pub fn e() {} - -// Closing tags need to have ">" at the end, otherwise it's not a closing tag! -///
-///
-/// -/// -/// -pub fn g() {} - -/// -pub fn h() {} - -/// $DIR/invalid-html-tags.rs:3:5 - | -LL | //!

💩

- | ^^^ - | -note: the lint level is defined here - --> $DIR/invalid-html-tags.rs:1:9 - | -LL | #![deny(rustdoc::invalid_html_tags)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: unclosed HTML tag `p` - --> $DIR/invalid-html-tags.rs:3:9 - | -LL | //!

💩

- | ^^^ - -error: unclosed HTML tag `unknown` - --> $DIR/invalid-html-tags.rs:11:5 - | -LL | /// - | ^^^^^^^^^ - -error: unclosed HTML tag `script` - --> $DIR/invalid-html-tags.rs:14:5 - | -LL | /// +/// +//~^ ERROR unclosed HTML tag `unknown` +/// < ok +/// +/// +pub fn d() {} + +// Unclosed tags shouldn't warn if they are nested inside a +/// +pub fn e() {} + +// Closing tags need to have ">" at the end, otherwise it's not a closing tag! +///

+///
+/// +/// +/// +pub fn g() {} + +/// +pub fn h() {} + +/// $DIR/invalid-html-tags.rs:3:5 + | +LL | //!

💩

+ | ^^^ + | +note: the lint level is defined here + --> $DIR/invalid-html-tags.rs:1:9 + | +LL | #![deny(rustdoc::invalid_html_tags)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: unclosed HTML tag `p` + --> $DIR/invalid-html-tags.rs:3:9 + | +LL | //!

💩

+ | ^^^ + +error: unclosed HTML tag `unknown` + --> $DIR/invalid-html-tags.rs:11:5 + | +LL | /// + | ^^^^^^^^^ + +error: unclosed HTML tag `script` + --> $DIR/invalid-html-tags.rs:14:5 + | +LL | ///